Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
clean_dist_cache
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
T-Dawg
n00b
n00b


Joined: 12 Nov 2006
Posts: 51

PostPosted: Sun Dec 07, 2008 2:16 am    Post subject: clean_dist_cache Reply with quote

Hey guys,
I have source package caching server using http-replicator and need a better solution than eclean for cleaning up old packages. The problem with eclean for me is that it removes packages based on what is installed on the system its on. For me that means a minimal x86 server proving caching for x86 and x86_64 GUI machines. As a result most all packages cached that I still wanted to keep for those machines would be deleted. My solution was to write a script that did just what I wanted for cleaning package cache on a http-replicator server: keep ALL stable packages for the architectures I need and delete the rest -regardless whether it is installed on the local machine. Additionally, I added finer grain tuning on what packages to keep by allowing to specify a number below or above the stable packages.
For example, if I wanted to keep all stable packages for amd64 and x86 and those 1 version below the current stable package as well as all those above it the command would be:
Code:
clean_dist_cache --below-stable=1 --above-stable=all --keywords="amd64 x86" --distdir=/var/cache/http-replicator/

which would give me details about what it proposes to remove and the total amount of space it would reclaim:
Code:

bertha bin # ./clean_dist_cache -b 1 -a all
/usr/portage/distfiles/openssh-5.0p1-gsskex-20080404.patch:           [0.7M]
/usr/portage/distfiles/man-1.6f.tar.gz:                               [0.3M]
/usr/portage/distfiles/splash.xpm.gz:                                 [0.3M]
/usr/portage/distfiles/grub-0.97.tar.gz:                              [1.0M]
/usr/portage/distfiles/binutils-2.18.tar.bz2:                         [14.3M]
/usr/portage/distfiles/linux-2.6.25.tar.bz2:                          [46.4M]
/usr/portage/distfiles/genpatches-2.6.25-11.base.tar.bz2:             [0.1M]
/usr/portage/distfiles/genpatches-2.6.25-11.extras.tar.bz2:           [0.4M]

Total Size: 63.5M

Remove files? [Y/n]n


I figured it could be useful to others in my situation using http-replicator so I've put it up in a pastebin:
http://gentoo.pastebin.ca/1278452
Back to top
View user's profile Send private message
SeaTiger
l33t
l33t


Joined: 22 Nov 2007
Posts: 603
Location: Toronto, Ontario, Canada

PostPosted: Sun Dec 07, 2008 10:54 am    Post subject: Reply with quote

OMG, thank youi so much!! I am in the process of searching for something like this and this is perfect!!!!!!!
Back to top
View user's profile Send private message
Dirus
n00b
n00b


Joined: 26 Sep 2004
Posts: 7

PostPosted: Tue Dec 23, 2008 9:37 pm    Post subject: Reply with quote

Hey this is great! Thanks.

The only thing missing is an option to delete files that are in the cache but aren't actual portage files. http_replicator sometimes pulls down files with funny names (question marks in them or other parameters) and I seem to have some for packages that are no longer in portage that it seems to miss. You can test this pretty easily by just "touch somemadeupfilename" in the cache dir.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum