Gentoo Archives: gentoo-dev

From: "José Fonseca" <j_r_fonseca@××××××××.uk>
To: Marko Mikulicic <marko@××××.org>
Cc: gentoo-dev@g.o
Subject: Re: [gentoo-dev] Script to clean old files from /usr/portage/distfiles
Date: Tue, 12 Nov 2002 00:54:44
Message-Id: 20021112005419.GA27162@localhost.localdomain
In Reply to: Re: [gentoo-dev] Script to clean old files from /usr/portage/distfiles by Marko Mikulicic
1 On Tue, Nov 12, 2002 at 01:29:44AM +0100, Marko Mikulicic wrote:
2 > You read my mind!
3 > I was just thinking "i'd like to have a script that ...."
4 > and you come out with this. great.
5 > thanks. I should think more often :-)
6 >
7
8 I'm glad you liked it.
9
10 > It would be nice if this script would appear in gentoolkit...
11 >
12 > >
13 > >I've started with a shell script, then python, then I've read qpkg.sh,
14 > >ebuild.sh, portage.py and many others in the search of the easiest way
15 > >to do this. In the end everything boiled down to 2 lines - the rest is
16 > >just sintatic sugar!
17 > nice. I just love when sed transforms the command line in completely
18 > unreadable magic :-)
19 >
20 > How would be to make it a bit shorter and more configurable in one shot ?:
21 >
22 > -PORTDIR=/usr/portage
23 > -DISTDIR=$PORTDIR/distfiles
24 > +. /etc/make.globals;. /etc/make.conf
25 > (or: for i in /etc/make.{globals,conf} do . $i;done )
26
27 This is ok...
28
29 > -CACHEDIR=$PORTDIR/metadata/cache
30 > -PKGDBDIR=/var/db/pkg
31
32 ...but becare full with these - you should keep them because they're
33 really not defined on the above files and the getting the last one wrong
34 will lead to the deletion of all files in distfiles...!
35
36 The way the script work is first get the list of all sources related
37 with the installed files from portache cache, merge it with the list of
38 sources in distfiles, and delete those which are unique - i.e., only are
39 in distfiles. There are two caveats with this procedure:
40 - it will delete sources of packages in PORTAGE_OVERLAY, if you have
41 any, since they aren't cached.
42 - if the cache is busted (or can't be found), the most probable outcome
43 is that all files in distfiles get deleted... so a good idea is to
44 replace 'rm' by 'echo' to get an idea of what is gonna be deleted.
45
46 These two caveats could be overcomed by getting the sources directly
47 from the installed ebuilds, but that would be terribly slow compared
48 with this, due to the parsing of all ebuilds.
49
50 Regards,
51
52 José Fonseca
53 __________________________________________________
54 Do You Yahoo!?
55 Everything you'll ever need on one web page
56 from News and Sport to Email and Music Charts
57 http://uk.my.yahoo.com
58
59 --
60 gentoo-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-dev] Script to clean old files from /usr/portage/distfiles Marko Mikulicic <marko@××××.org>