Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 188915

Summary: [portage] need default cron task for cleaning $PKGDIR and $DISTDIR
Product: Gentoo Linux Reporter: Jerome <jerome.bouat>
Component: New packagesAssignee: Gentoo Linux bug wranglers <bug-wranglers>
Status: RESOLVED WORKSFORME    
Severity: normal    
Priority: High    
Version: 2006.1   
Hardware: All   
OS: All   
Whiteboard:
Package list:
Runtime testing required: ---

Description Jerome 2007-08-14 21:41:18 UTC
I'm using Gentoo since 10 months
and I have already more than 20% of my disk space
used for old distfiles:
---
localhost ~ # du -sh /usr/portage/distfiles/
2.7G    /usr/portage/distfiles/
localhost ~ # 
---

Because of a lack of free space,
my disk is highly fragmented:
~6% even with ext3 ;)

Moreover, a lot of files are aged for more than 200 days:
---
localhost ~ # find /usr/portage/distfiles/ -type f -ctime +200 | wc --lines
58
localhost ~ #
---

Thus, I added the following cron task:
/etc/cron.daily/clean-distfiles
---
#! /bin/sh
rm -fv $(find /usr/portage/distfiles -type f -mtime +200)
---

The issue there is that I don't care of non versatile distfiles files. I saw that bug #10696 shows a script which remove only unused files.

I would appreciate a default behavior of the system which saves disk space whenever it is possible.

Reproducible: Always
Comment 1 Jakub Moc (RETIRED) gentoo-dev 2007-08-14 21:43:09 UTC

*** This bug has been marked as a duplicate of bug 33877 ***
Comment 2 Jerome 2007-08-19 11:24:23 UTC
I'm reopening the bug according to comment <a href="show_bug.cgi?id=33877#c52">comment 52</a> of <a href="show_bug.cgi?id=33877">bug 33877</a>.
Comment 3 Jerome 2007-08-19 12:29:34 UTC
For decreasing the additional load,
I split the cron task I'm currently using in 2 tasks.

/etc/cron.daily/clean-portage.daily
---
#! /bin/sh
source /etc/make.globals
source /etc/make.conf
for d in $PKGDIR $DISTDIR ; do
        if [ -x $d ]; then
                rm -fv $(find $d -type f -mtime +200)
        fi
done
---

/etc/cron.weekly/clean-portage.weekly
---
#! /bin/sh
eclean -dt 1w packages
eclean -dt 1w distfiles
---
Comment 4 Jerome 2007-08-19 12:31:19 UTC
Changing summary.
Comment 5 Jakub Moc (RETIRED) gentoo-dev 2007-08-19 12:47:48 UTC
So add it to your crontab and move on, or what's your trouble here? I for one don't want any such cronjob installed by default.
Comment 6 Jerome 2007-08-19 19:28:46 UTC
I don't understand why a default zombies files catcher
would disturb portage ?

It is only a safeguard in order to avoid to have
/usr/portage/distfiles growing up to more than 4 GB !
Comment 7 Jakub Moc (RETIRED) gentoo-dev 2007-08-19 19:34:18 UTC
(In reply to comment #6)
> It is only a safeguard in order to avoid to have
> /usr/portage/distfiles growing up to more than 4 GB !

Simply because it's none of portage business to decide *on behalf* of users how should that directory be managed. Imagine people on dial-up connection (no, not ADSL, plain old dialup) - you know how long does it take to download 4 gigs worth of tarballs for them, which they still might need?

`man eclean` already includes a cronjob example, go use it as is or adjust for your needs, you are the system administrator, not portage nor any 'default cronjob' script.
Comment 8 Jerome 2007-08-19 19:47:44 UTC
Sorry, but I don't think the portage will use distrib files aged for more than 9 months.