From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28506 invoked by uid 1002); 24 Mar 2003 21:39:42 -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 14263 invoked from network); 24 Mar 2003 21:39:41 -0000 Message-ID: <3E7F7B1A.2050108@andrewarbon.co.uk> Date: Mon, 24 Mar 2003 21:39:38 +0000 From: Andy Arbon User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.3) Gecko/20030319 X-Accept-Language: en, en-us MIME-Version: 1.0 To: gentoo-user@gentoo.org, gentoo-dev References: In-Reply-To: X-Enigmail-Version: 0.73.1.0 X-Enigmail-Supports: pgp-inline, pgp-mime Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Subject: [gentoo-dev] Disk space && managing package binaries X-Archives-Salt: 93b9135b-2423-4b9d-aedd-e04fe5d72857 X-Archives-Hash: 07e80c00ae861b7ead812487e46f3539 Hello, Related to my recent question on gentoo-user regarding freeing up disk space, I've just written a short bash script that helps tidying up the binary packages that portage builds (see below). All it does it take each file in the distfiles and packages directories and use qpkg to see if the package that built/came from it is currently installed. If it isn't then it's removed. There are obviously shortcomings with this, but as a rough tool it works. One problem is that if you have a package like rsync-1.2.3 and rsync-1.2.3-r1 then rsync-1.2.3 won't get removed until the system gets upgraded to rsync-1.2.4, as (AFAIK) there's no way to specify end-of-string in a query to qpkg (am I wrong about this?) At the moment it moves packages into a subdirectory ready to be removed but doesn't actually remove them. Any comments on this? Cheers, Andy #!/bin/bash # Clean out of date packages and distfiles out PPATH="/usr/portage/packages/All" DPATH="/usr/portage/distfiles" FILELIST=`find $PPATH| sed -e \ 's/.*\/\(.*\)\.\(tar.bz2$\|zip\|tar.gz$\|tbz2\|bz2\|gz\)$/\1/g' -e '1d'` if [[ -z "$PPATH/../old" ]]; then mkdir "$PPATH/../old" fi for file in $FILELIST; do echo -n "Testing $file " if [[ ! `qpkg -I $file` ]]; then mv $PPATH/$file* $PPATH/../old/ echo "... removing"; else echo fi done # Now we do the distfiles FILELIST=`find $DPATH| sed -e \ 's/.*\/\(.*\)\.\(tar.bz2$\|zip\|tar.gz$\|tbz2\|bz2\|gz\|exe\|wsz\|tgz\|patch\|bin\|tar.Z\)$/\1/g' -e '1d'` if [[ -z "$DPATH/../old" ]]; then mkdir "$DPATH/../old" fi for file in $FILELIST; do echo -n "Testing $file " if [[ ! `qpkg -I $file` ]]; then mv $DPATH/$file* $DPATH/../old/ echo "... removing"; else echo fi done -- gentoo-dev@gentoo.org mailing list