On 2017-7-13 11:01 , db wrote:
On 11 Jul 2017, at 23:35, Joshua Root <j...@macports.org> wrote:
The attached script will find any Portfiles that are not referenced by any 
installed port, and are thus safe to delete. It uses the same check that is 
done during uninstall so I'm still not sure how they are getting left behind.

Thanks for the script. It removed almost all the unreferenced portfiles and I 
cleaned up some empty directories, but still left 15 for ports that are not 
installed (diff'ed /opt/local/var/macports/registry/portfiles/ and 
/opt/local/var/macports/software/).

MPREGPF=/opt/local/var/macports/registry/portfiles/

./find_unreferenced_portfiles.tcl | while read LINE ; do sudo rm -r 
$MPREGPF$LINE ; done

ls $MPREGPF | \
while read LINE ; \
do [[ $(ls $MPREGPF$LINE | wc -l | xargs) == 0 ]] \
&& sudo rm -r $MPREGPF$LINE ; done

Is it safe to delete the rest? I haven't manually checked the reg db yet.

I don't know. Theoretically if the script doesn't print something then a row in the ports table matched it.

Easy enough to do something like:

sqlite3 /opt/local/var/macports/registry/registry.db "select * from ports"

and grep for the hashes in question.

- Josh

Reply via email to