From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11500 invoked by uid 1002); 12 Nov 2002 00:54:44 -0000 Mailing-List: contact gentoo-dev-help@gentoo.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@gentoo.org Received: (qmail 11491 invoked from network); 12 Nov 2002 00:54:44 -0000 Date: Tue, 12 Nov 2002 00:54:19 +0000 From: =?iso-8859-15?Q?Jos=E9?= Fonseca To: Marko Mikulicic Cc: gentoo-dev@gentoo.org Message-ID: <20021112005419.GA27162@localhost.localdomain> References: <20021111203828.GA10784@localhost.localdomain> <3DD04B78.9010806@seul.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3DD04B78.9010806@seul.org> User-Agent: Mutt/1.4i Subject: Re: [gentoo-dev] Script to clean old files from /usr/portage/distfiles X-Archives-Salt: 346eaeb2-6293-47c9-a77c-d4cfb95eab3b X-Archives-Hash: 496341516d98bd50607baa35fe57dc90 On Tue, Nov 12, 2002 at 01:29:44AM +0100, Marko Mikulicic wrote: > You read my mind! > I was just thinking "i'd like to have a script that ...." > and you come out with this. great. > thanks. I should think more often :-) > I'm glad you liked it. > It would be nice if this script would appear in gentoolkit... > > > > >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! > nice. I just love when sed transforms the command line in completely > unreadable magic :-) > > How would be to make it a bit shorter and more configurable in one shot ?: > > -PORTDIR=/usr/portage > -DISTDIR=$PORTDIR/distfiles > +. /etc/make.globals;. /etc/make.conf > (or: for i in /etc/make.{globals,conf} do . $i;done ) This is ok... > -CACHEDIR=$PORTDIR/metadata/cache > -PKGDBDIR=/var/db/pkg ...but becare full with these - you should keep them because they're really not defined on the above files and the getting the last one wrong will lead to the deletion of all files in distfiles...! The way the script work is first get the list of all sources related with the installed files from portache cache, merge it with the list of sources in distfiles, and delete those which are unique - i.e., only are in distfiles. There are two caveats with this procedure: - it will delete sources of packages in PORTAGE_OVERLAY, if you have any, since they aren't cached. - if the cache is busted (or can't be found), the most probable outcome is that all files in distfiles get deleted... so a good idea is to replace 'rm' by 'echo' to get an idea of what is gonna be deleted. These two caveats could be overcomed by getting the sources directly from the installed ebuilds, but that would be terribly slow compared with this, due to the parsing of all ebuilds. Regards, José Fonseca __________________________________________________ Do You Yahoo!? Everything you'll ever need on one web page from News and Sport to Email and Music Charts http://uk.my.yahoo.com -- gentoo-dev@gentoo.org mailing list