public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] Script to clean old files from /usr/portage/distfiles
@ 2002-11-11 20:38 José Fonseca
  2002-11-11 23:42 ` Johannes Ballé
  2002-11-12  0:29 ` Marko Mikulicic
  0 siblings, 2 replies; 16+ messages in thread
From: José Fonseca @ 2002-11-11 20:38 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 707 bytes --]

I never do `rm -f /usr/portage/distfiles'. I find very useful having the
sources of the installed packages ihandy as it avoids downloading
everything over andagain when updating to new releases of the same
version, or when installing Gentoo on another system. But after some
time that directory gets too fat and is too boring to eliminate the
deprecated packages by hand so I've made a script to automate this. You
can see it attached.

I've started with a shell script, then python, then I've read qpkg.sh,
ebuild.sh, portage.py and many others in the search of the easiest way
to do this. In the end everything boiled down to 2 lines - the rest is
just sintatic sugar!

I hope you enjoy it.

José Fonseca

[-- Attachment #2: distfiles-clean --]
[-- Type: text/plain, Size: 575 bytes --]

#!/bin/sh
#
# distfiles-clean
#
# Cleans unused files from Portage distfiles directory.
#
# José Fonseca <j_r_fonseca@yahoo.co.uk>

PORTDIR=/usr/portage
DISTDIR=$PORTDIR/distfiles
CACHEDIR=$PORTDIR/metadata/cache
PKGDBDIR=/var/db/pkg

TMPFILE=`mktemp /tmp/$0.XXXXXX`

find $PKGDBDIR -name '*.ebuild' | sed -n -e "s:^$PKGDBDIR/\([^/]*\)/\([^/]*\)/\([^/]*\)\.ebuild$:$CACHEDIR/\1/\3:p" | xargs -l sed -e '4!d;s/[[:space:]]\+/\n/g' | sed -n -e 's:^.*/::p' | sort -u > $TMPFILE

ls -1 $DISTDIR | sort -m - $TMPFILE | uniq -u | sed -e "s:^:$DISTDIR/:" | xargs rm -f

rm $TMPFILE


[-- Attachment #3: Type: text/plain, Size: 37 bytes --]

--
gentoo-dev@gentoo.org mailing list

^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [gentoo-dev] Script to clean old files from /usr/portage/distfiles
@ 2003-03-25 18:55 DJ Cozatt
  2003-03-25 20:34 ` Chris Bainbridge
  0 siblings, 1 reply; 16+ messages in thread
From: DJ Cozatt @ 2003-03-25 18:55 UTC (permalink / raw
  To: gentoo-dev


I won't repost the thread but I liked this idea and wondered it if could
also be extended to remove old pkg's in PKGDIR set when usindg buildpkg
in /etc/make.conf Would yield a more general housecleaning app

bus_drivr

--
gentoo-dev@gentoo.org mailing list


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2003-03-27  4:50 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-11-11 20:38 [gentoo-dev] Script to clean old files from /usr/portage/distfiles José Fonseca
2002-11-11 23:42 ` Johannes Ballé
2002-11-12  1:13   ` José Fonseca
2002-11-12  2:01     ` Marko Mikulicic
     [not found]       ` <20021111212849.A23035@twobit.net>
2002-11-12 10:21         ` José Fonseca
2002-11-12 11:28           ` William Kenworthy
2002-11-12 12:28             ` José Fonseca
2002-11-12 15:37           ` Nils Ohlmeier
2002-11-12 17:56             ` José Fonseca
2002-11-12 23:12               ` Nils Ohlmeier
2002-11-12  0:29 ` Marko Mikulicic
2002-11-12  0:54   ` José Fonseca
2002-11-12  1:50     ` Marko Mikulicic
  -- strict thread matches above, loose matches on Subject: below --
2003-03-25 18:55 DJ Cozatt
2003-03-25 20:34 ` Chris Bainbridge
2003-03-27  4:53   ` DJ Cozatt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox