public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-dev] Disk space && managing package binaries
       [not found]     <web-205338@rems02.cluster1.charter.net>
@ 2003-03-24 21:39 99% ` Andy Arbon
  0 siblings, 0 replies; 1+ results
From: Andy Arbon @ 2003-03-24 21:39 UTC (permalink / raw
  To: gentoo-user, gentoo-dev

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


^ permalink raw reply	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
     [not found]     <web-205338@rems02.cluster1.charter.net>
2003-03-24 21:39 99% ` [gentoo-dev] Disk space && managing package binaries Andy Arbon

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