/usr/ports/distfiles maintenance

Vasil Dimov vd at datamax.bg
Fri May 27 06:13:39 PDT 2005


> 
> I would say, that the output of 
>     grep MD5 */*/distinfo | awk '{ print $2 }' | sed -e 's/[()]//g'
> 
> would give a nice list of files which are current. Then diffing it
> against the output of:
>     find distfiles -type f | sed -e 's/distfiles.//'
> 
> and deleting the ones which show up as "in the distfiles directory".
> 
> Of course there might be something in the ports tree for this.
> Oh, and it kind of sucks too that */*/distinfo gives an "argument
> list too long" :-)

Here is an implementation of your idea.

cd /usr/ports
list="`for subcat in \`grep SUBDIR Makefile |cut -f 2 -d=\` ; do grep ^MD5 $subcat/*/distinfo* 2>/dev/null ; done |cut -f 2 -d '(' |cut -f 1 -d ')'`"
for file in `find ./distfiles -type f |cut -b 13-` ; do if [ -z "`echo "$list" |grep $file`" ] ; then echo "outdated $file" ; fi ; done

But it's better not to invent the wheel and use sysutils/portupgrade's
portsclean. At least someone has tested it before us and there is no risk for
deleting something valuable by mistyping some weird commands :)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 155 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20050527/b73ad0a6/attachment.bin


More information about the freebsd-ports mailing list