Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Unsupported Software
  • Search

Cleaning out stale distfiles

This forum covers all Gentoo-related software not officially supported by Gentoo. Ebuilds/software posted here might harm the health and stability of your system(s), and are not supported by Gentoo developers. Bugs/errors caused by ebuilds from overlays.gentoo.org are covered by this forum, too.
Post Reply
Advanced search
200 posts
  • Page 5 of 8
    • Jump to page:
  • Previous
  • 1
  • …
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • Next
Author
Message
eeknay
Guru
Guru
User avatar
Posts: 402
Joined: Mon Jul 07, 2003 8:31 pm
Location: EndOfTheRainbow

  • Quote

Post by eeknay » Sun Mar 21, 2004 9:42 pm

thanks for the help.
Linda: "The holiday season is time of celebration for most but it is also the time to remember the tragic suffering of the less fortunate."
Morbo: "Earthlings do not yet know the meaning of suffering."
Top
Larcen
Apprentice
Apprentice
Posts: 174
Joined: Sun Mar 21, 2004 11:51 pm

  • Quote

Post by Larcen » Sun Mar 21, 2004 11:55 pm

Hello, I was using distclean-0.1.py and I continuously got this error:

aux_get(): (1) Error in x11-misc/ttmkfdir-3.0.9-r1 ebuild.
Check for syntax error or corruption in the ebuild. (--debug)

many many times, then it removed a handfull of files.. Is this common and should be ignored, or what? Do I need to run the file from a specific directory?
Top
far
Guru
Guru
User avatar
Posts: 394
Joined: Mon Mar 10, 2003 12:30 am
Location: Stockholm, Sweden
Contact:
Contact far
Website

  • Quote

Post by far » Mon Mar 22, 2004 12:02 am

Larcen wrote:Hello, I was using distclean-0.1.py and I continuously got this error:

aux_get(): (1) Error in x11-misc/ttmkfdir-3.0.9-r1 ebuild.
Check for syntax error or corruption in the ebuild. (--debug)

many many times, then it removed a handfull of files.. Is this common and should be ignored, or what? Do I need to run the file from a specific directory?
Probably means what it says, that there is something wrong with that ebuild.
It shouldn't have any impact on what distclean does.
The portage module is annoying in that way. Some errors it reports directly to stderr, instead of throwing exceptions.

The error message will probably go away after an emerge sync.
The Porthole Portage Frontend
Top
Larcen
Apprentice
Apprentice
Posts: 174
Joined: Sun Mar 21, 2004 11:51 pm

  • Quote

Post by Larcen » Mon Mar 22, 2004 12:09 am

Wow, that was a fast reply. Thank you. So if after a few syncs, it doesn't go away, would it hurt to wipe out the directory and just start over?
Top
far
Guru
Guru
User avatar
Posts: 394
Joined: Mon Mar 10, 2003 12:30 am
Location: Stockholm, Sweden
Contact:
Contact far
Website

  • Quote

Post by far » Mon Mar 22, 2004 12:18 am

Larcen wrote:Wow, that was a fast reply. Thank you. So if after a few syncs, it doesn't go away, would it hurt to wipe out the directory and just start over?
Wipe out distfiles? Yes, that's probably harmless, if you don't mind maybe having to download stuff again.
Does this error cause distclean to abort?
The Porthole Portage Frontend
Top
Larcen
Apprentice
Apprentice
Posts: 174
Joined: Sun Mar 21, 2004 11:51 pm

  • Quote

Post by Larcen » Mon Mar 22, 2004 12:35 am

Mind downloading what I emerge? No I don't. Does it cause it to abort? No, it continues right along.
Top
juam
n00b
n00b
Posts: 3
Joined: Thu Jan 01, 2004 10:40 pm

  • Quote

Post by juam » Sat Apr 10, 2004 9:47 pm

Hi, i've implemented a program, that let you define policies about what you want to clean:
http://www.leak.com.ar/~juam/code/distcleaner/

For now there are two policies. One deletes all the source that aren't needed to rebuild the system, and another, deletes all the files smaller that 1024 KB (those can be downloaded relative in an small time, and are the most common).

New policy are welcome.
Top
Jowilly
Guru
Guru
Posts: 319
Joined: Sat Jun 22, 2002 8:36 pm

  • Quote

Post by Jowilly » Sat May 08, 2004 8:03 pm

juam wrote:Hi, i've implemented a program, that let you define policies about what you want to clean:
http://www.leak.com.ar/~juam/code/distcleaner/

For now there are two policies. One deletes all the source that aren't needed to rebuild the system, and another, deletes all the files smaller that 1024 KB (those can be downloaded relative in an small time, and are the most common).

New policy are welcome.
Excellent !

I've put it in /etc/conf.d/local.start
Top
kaidon
n00b
n00b
Posts: 72
Joined: Sat Nov 01, 2003 8:07 pm

  • Quote

Post by kaidon » Sat Jun 05, 2004 8:58 pm

@juam

wonderfull :D

you just gave me back 1.6 gigs

thanx for that
Top
devsk
Advocate
Advocate
User avatar
Posts: 3039
Joined: Fri Oct 24, 2003 1:16 am
Location: Bay Area, CA

  • Quote

Post by devsk » Tue Jul 06, 2004 11:10 pm

juam wrote:Hi, i've implemented a program, that let you define policies about what you want to clean:
http://www.leak.com.ar/~juam/code/distcleaner/

For now there are two policies. One deletes all the source that aren't needed to rebuild the system, and another, deletes all the files smaller that 1024 KB (those can be downloaded relative in an small time, and are the most common).

New policy are welcome.
[3732]>

Code: Select all

distcleaner --pretend --action=not_installed
Traceback (most recent call last):
  File "/opt/portage/bin/distcleaner", line 294, in ?
    main()
  File "/opt/portage/bin/distcleaner", line 289, in main
    d.perform()
  File "/opt/portage/bin/distcleaner", line 116, in perform
    self.select_files_to_delete(hash)
  File "/opt/portage/bin/distcleaner", line 192, in select_files_to_delete
    hash.pop(file,0)
AttributeError: 'dict' object has no attribute 'pop'
I don't know what happened there. gentoolkit-0.2.0_pre8 is installed
Top
carpman
Advocate
Advocate
Posts: 2202
Joined: Thu Jun 20, 2002 2:42 pm
Location: London - UK

  • Quote

Post by carpman » Tue Aug 17, 2004 11:27 am

Hello, been using this script to keep distfile dir clean but have now moved over to http-replicator for network distfile download cache.

What this means is that the local distfiles dir contents can be cleaned out after emerging is done but on the http-replicator server all distfiles are moved to http-replicator dir, i tried editing the script so it pointed to /var/cache/http-replicator but the script did not work, there was no errors but no output even though i know there was files that could have been deleted.


How can i get this script to work with http-replicator?

cheers
Work Station - 64bit
Gigabyte GA X48-DQ6 Core2duo E8400
8GB GSkill DDR2-1066
SATA Areca 1210 Raid
BFG OC2 8800 GTS 640mb
--------------------------------
Notebook
Samsung Q45 7100 4gb
Top
gindaani
n00b
n00b
Posts: 15
Joined: Mon Apr 28, 2003 10:09 pm

  • Quote

Post by gindaani » Fri Aug 27, 2004 8:32 pm

What about the files in /var/tmp/portage?

I have a directory in there for every ebuild that has ever been run. Some of the directories only contain one file, temp/successful.

Is it safe to wipe all of these out or do we need something to selectively delete them?

Thanks,

Dan
Top
wolf31o2
Retired Dev
Retired Dev
User avatar
Posts: 628
Joined: Fri Jan 31, 2003 11:24 am
Location: Mountain View, CA
Contact:
Contact wolf31o2
Website

  • Quote

Post by wolf31o2 » Fri Aug 27, 2004 9:00 pm

You can delete them safely. They are simply temporary files created by portage during an emerge. The reason they're around, is they also provide valuable information to portage during each stage of the install of a package. It won't give you much room, but it will free up a good number of inodes.
Ex-Gentoo Developer
Catalyst/Genkernel Development Lead
http://wolf31o2.org
Top
asph
l33t
l33t
User avatar
Posts: 741
Joined: Mon Aug 25, 2003 8:52 am
Location: Barcelona, Spain

  • Quote

Post by asph » Sat Aug 28, 2004 6:07 pm

does this script (the one on the first post of this thread) also delete files not installed? for example, if i emerge -f xmms, but finally i don't install it, when i run the script will those files i downloaded get deleted? they should :)

also check this little curious 'bug' ;)

Code: Select all

Would delete: font-arial-iso-8859-1 in favour of font-arial-iso-8859-2
gentoo sex is updatedb; locate; talk; date; cd; strip; look; touch; finger; unzip; uptime; gawk; head; emerge --oneshot condom; mount; fsck; gasp; more; yes; yes; yes; more; umount; emerge -C condom; make clean; sleep
Top
Nightweaver
n00b
n00b
Posts: 40
Joined: Wed Jul 24, 2002 10:06 pm

  • Quote

Post by Nightweaver » Mon Sep 27, 2004 11:48 pm

juam wrote:Hi, i've implemented a program, that let you define policies about what you want to clean:
http://www.leak.com.ar/~juam/code/distcleaner/

For now there are two policies. One deletes all the source that aren't needed to rebuild the system, and another, deletes all the files smaller that 1024 KB (those can be downloaded relative in an small time, and are the most common).

New policy are welcome.
I just upgraded to a newer version of gentoolkit (_pre9), and the 0.0.1 script no longer works :-(

Any chance of what I hope would be a simple update? I run this script every time after I do an emerge -uD world, but now it reports every single file in /usr/portage/distfiles as being 'not installed'.

Thanks.
Top
houtworm
Guru
Guru
User avatar
Posts: 397
Joined: Sat Mar 08, 2003 10:11 pm
Location: Den Haag, Netherlands
Contact:
Contact houtworm
Website

  • Quote

Post by houtworm » Wed Oct 13, 2004 12:59 am

distcleaner worked just fine, but now it wants to delete ALL distfiles :-/
Perhaps the upgrade of portage (Portage 2.0.51_rc9) has something to do with it?
I use distcleaner v0.0.1 , perhaps there is a newer version?
niemand is onbekwamer, dan een timmerman zonder hamer

Kees
Top
calle2003
n00b
n00b
User avatar
Posts: 63
Joined: Thu Oct 21, 2004 7:44 pm

  • Quote

Post by calle2003 » Thu Oct 21, 2004 8:36 pm

Hi all,

I found this thread because I'm not happy about old distfiles hanging around and wanted to delete them. I'm a bit concerned finding problems with the script with version numbers and so on, I'd rather have it delete exactly those files in DISTDIR that do not belong to an installed package. I think the approach should be to read the distfiles using the usual portage functionality and then delete all the rest. Unfortunately I couldn't find any possibilty to output the results of an ebuild's SRC_URI to the command line. Is there any?

Because of this, I did a small patch on portage.py (2.0.51);

Code: Select all

--- src-2.0.51/portage.py       2004-10-21 21:52:26.753228088 +0200
+++ portage.py  2004-10-21 19:46:07.496450256 +0200
@@ -2210,6 +2210,7 @@
 
        validcommands = ["help","clean","prerm","postrm","preinst","postinst",
                        "config","setup","depend","fetch","digest",
+                       "distfiles",
                        "unpack","compile","test","install","rpm","qmerge","merge",
                        "package","unmerge", "manifest"]
 
@@ -2494,6 +2495,10 @@
        except:
                pass
 
+       if mydo=="distfiles":
+               print string.join(checkme,"\n")
+               return 0
+
        if not fetch(fetchme, mysettings, listonly=listonly, fetchonly=fetchonly):
                return 1
This adds a "distfiles" command to ebuild so that "ebuild <file> distfiles" prints all the distfiles of that package. It works with the usual portage syntax.

Second, I created a script to show and delete the obsolete files (distclean):

Code: Select all

#!/bin/bash
# distclean utility
# Christian Schaefer
# License: public domain
# Use this script on your own risc. The author does
# not guarantue that doesn't destroy your system
# or is useful at all.

TMP1=tmp.distfiles.installed
TMP2=tmp.distfiles.obsolete
TMP3=tmp.distfiles.installed.tmp
DISTDIR=`portageq envvar DISTDIR`

function print_obsolete() {
        $PAGER $TMP2;
}

function delete_obsolete() {
        cat $TMP2 | xargs -r -l rm;
        rm $TMP1 $TMP2;
}

function print_statistics() {
        cat $TMP2 | xargs -r du --human-readable --total | tail -n 1;
}

function build_lists() {
# create list of distfiles for installed packages
# (distfiles patch to portage.py needed)
if [ ! -e "$TMP1" ]; then
        rm $TMP2 >/dev/nul 2>&1;
        qpkg -I -v --nocolor |
                xargs -l printf "=%s\n" | 
                xargs -l equery which |
                xargs -i ebuild {} distfiles | 
                sort | uniq > "$TMP3" ;
        mv "$TMP3" "$TMP1";
fi;

# create list of distfiles present on disc
# but not belonging to installed packages
if [ ! -e "$TMP2" ]; then
        find $DISTDIR -type f -printf "%f\n" | 
                sort | uniq | 
                comm -1 -3 "$TMP1" - |
                xargs -r -l printf "$DISTDIR/%s\n" > $TMP2 ;
fi;
}

function print_usage() {
        echo Utility to clean up the distfiles directory of portage
        echo Files not belonging to installed packages are considered
        echo obsolete and deleted.
        echo
        echo Usage: $0 option
        echo
        echo Options:
        echo
        echo "-p --pretend    print a list of obsolete files"
        echo "-s --size       print size of obsolete files"
        echo "--delete        delete obsolete files"
}

case $1 in 
        ( -p | --pretend )
                build_lists;
                print_obsolete;
        ;;
        ( --delete )
                build_lists;
                delete_obsolete;
        ;;
        ( -s | --size )
                build_lists;
                print_statistics;
        ;;
        ( * )
                print_usage;
        ;;
esac
The script leaves two files in the current directory, if no delete is done:

tmp.distfiles.installed
tmp.distfiles.obsolete

They are reused on a second run (so you can delete after checking quite fast), but must be deleted manually when anything changes in the DISTDIR.

This is anything else but fast, in fact it takes several minutes to produce an output.

I would like to know your opinion on this approach. I have no knowledge of python and only very basic knowledge of shell scripts so I'm sure there are a lot of things that could be optimized. At least it works for me, an "emerge -ef world" after "distclean --delete" fetched nothing, but I've got 1.4 gigabytes of disk space back.

I do not recommend to use this script, it is just experimental!

Best regards,
Christian.
Top
abionescu
n00b
n00b
User avatar
Posts: 2
Joined: Thu Nov 11, 2004 3:58 pm

  • Quote

Post by abionescu » Thu Nov 11, 2004 4:33 pm

You can use the following script to delete source files not used in your system:
#!/bin/bash
echo "Building index file..."
rm index.file
echo "What software do you have installed?"
for installed in `find /var/db/pkg/ -name *.ebuild`
do
basename=`dirname $installed | xargs dirname | xargs basename`
filename=`dirname $installed | xargs basename`
for configs in `find "/usr/portage/"$basename -name "digest-"$filename -print`
do
echo "Adding..."$configs
cat $configs >> index.file 2>&1
done
done
echo "Comparing files..."
rm remove.file
for i in `ls /usr/portage/distfiles/*.*`
do
chksum_full=`md5sum $i`
chksum_new=${chksum_full:0:32}
no=`cat index.file | grep $chksum_new | wc -l`
if [[ $no == 0 ]]
then
echo "Remove"$'\t'$i
echo $i >> remove.file
else
echo "Keep"$'\t'$i
fi
done
echo "Cleaning up..."
rm index.file
which will create a list with files from /usr/portage/distfiles folder which has no reason to be there.

After you check the content of the file you can issue the command:
cat remove.file | xargs rm
With some tunning in "index" creation part you can remove only the obsolete files (not found into portage)
Top
languste
n00b
n00b
Posts: 1
Joined: Mon Dec 20, 2004 12:29 am

  • Quote

Post by languste » Mon Dec 20, 2004 1:05 am

use this script if you have problems with recent portage versions. it cleans your dist and package files.

Code: Select all

#!/bin/bash
#
# filename: genclean
#
# Removes deprecated distfiles and packages of a gentoo system
#
# Tested with:
#              - portage 2.0.51-r3
#              - gentoolkit 0.2.0
#
# Shoud work with later versions as well
#
# v1.0, languste, Mon Dec 20 00:33:48 GMT 2004

# source needed vars
#
source_vars() {
        eval export `emerge info | egrep 'PORTDIR|DISTDIR|PKGDIR'`
}

# clean distfiles
#
distfiles_clean() {
        DIST_FILES=`find "$DISTDIR" -maxdepth 1 -type f -printf "%f\n" | sort`
        DIGEST_FILES=`find "$PORTDIR" "$PORTDIR_OVERLAY"  -path '*/*/files/digest-*' | xargs awk '{print $3}' | sort -u`
        OLD_DIST_FILES=`comm -23 <(echo "$DIST_FILES") <(echo "$DIGEST_FILES")`

        remove_files "$DISTDIR" "$OLD_DIST_FILES"
}

# clean packages
#
packages_clean() {
        QPKG_FILES=`qpkg -I -v -nc | cut -d "/" -f2 | sort | sed -e 's/$/\.tbz2/g' -e 's,^,All/,g'`
        QPKG_LINKS=`qpkg -I -v -nc | sort | sed 's/$/\.tbz2/g'`

        PKG_FILES=`cd "$PKGDIR" && find ./All/* | cut -d "/" -f2- | sort`
        PKG_LINKS=`cd "$PKGDIR" && find .  -type l | cut -d "/" -f2- | sort`
        
        OLD_PKG_FILES=`comm -23 <(echo "$PKG_FILES") <(echo "$QPKG_FILES")`
        OLD_PKG_LINKS=`comm -23 <(echo "$PKG_LINKS") <(echo "$QPKG_LINKS")`

        remove_files "$PKGDIR" "$OLD_PKG_FILES $OLD_PKG_LINKS"
}

# remove files
#
remove_files() {
        DIR="$1"
        FILES="$2"

        if [ "x${FILES}" = "x" -o "x${FILES}" = "x " ]; then
                echo "no files to remove."
                exit
        fi

        echo -e "These files (and links) in "$DIR" will be removed:\n"
        echo "Size    Filename"
        echo "----    --------"

        cd "${DIR}"
        du -hc $FILES

        echo -en "\nRemove these files? (Type YES to continue): "
        read YES

        [ "x$YES" = "xYES" ] || exit

        echo "removing files..."
        rm `echo "$FILES"`
}

# main
#
if [ "$1" = "distfiles" ]; then
        source_vars
        distfiles_clean
elif [ "$1" = "packages" ]; then
        source_vars
        packages_clean
else
        echo -e "Usage: `basename $0` <distfiles|packages>\n"
        echo "This little script will remove unused \"distfiles\" or \"packages\"."
        echo "No files will be deleted whithout confirmation!"
        exit
fi
p.s. i'am a debian user playing with gentoo and i can't belive that there is no tool inside "gentoolkit" or wherever. handling this problem. in my 4 year old debian system there would be now terrabytes of old and deprecated stuff filling up my disk :?
Top
heikole
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 148
Joined: Mon Oct 04, 2004 5:56 pm
Location: Berlin, Germany

  • Quote

Post by heikole » Thu Dec 23, 2004 2:04 pm

houtworm wrote:distcleaner worked just fine, but now it wants to delete ALL distfiles :-/
Perhaps the upgrade of portage (Portage 2.0.51_rc9) has something to do with it?
I use distcleaner v0.0.1 , perhaps there is a newer version?
Same problem for me. It seems that portage 2.0.51 is a little bit broken. distcleaner expects the call

Code: Select all

src = pkg.get_env_var('SRC_URI')
to return some value in src, but there isn't anything in it. pkg.get_env_var is defined in class Package in
  • /usr/lib/gentoolkit/pym/gentoolkit/gentoolkit.py
and called in distcleaner itself. Does somebody have any ideas how to fix this?
Top
skander
n00b
n00b
Posts: 12
Joined: Thu Dec 30, 2004 4:17 pm
Contact:
Contact skander
Website

thanks robm!

  • Quote

Post by skander » Tue Jan 04, 2005 8:03 pm

Thanks for the great script!
Top
fistfullast33l
n00b
n00b
Posts: 28
Joined: Wed May 26, 2004 2:23 pm

Delete Everything?

  • Quote

Post by fistfullast33l » Fri Jan 21, 2005 5:54 am

Someone remind me why I can't just delete all the files in distfiles?

Is there a big problem with doing this? I don't mind using the bandwidth to download the files again at some point.
Top
vonhelmet
l33t
l33t
Posts: 770
Joined: Tue Apr 06, 2004 12:18 pm
Location: Somewhere in a school
Contact:
Contact vonhelmet
Website

Re: Delete Everything?

  • Quote

Post by vonhelmet » Fri Jan 21, 2005 9:46 am

fistfullast33l wrote:Someone remind me why I can't just delete all the files in distfiles?

Is there a big problem with doing this? I don't mind using the bandwidth to download the files again at some point.
Yes, but the gentoo mirrors might mind you using up all their bandwidth.

Don't be so egocentric as to assume it's only your bandwidth - it cuts both ways.
My blog
nvtuner software - enhance your AGP Geforce 6800 or 6200!
Top
fistfullast33l
n00b
n00b
Posts: 28
Joined: Wed May 26, 2004 2:23 pm

Re: Delete Everything?

  • Quote

Post by fistfullast33l » Fri Jan 21, 2005 1:41 pm

vonhelmet wrote: Don't be so egocentric as to assume it's only your bandwidth - it cuts both ways.
That's a little harsh if you ask me. I don't think I was being egocentric, just uninformed.
Top
skander
n00b
n00b
Posts: 12
Joined: Thu Dec 30, 2004 4:17 pm
Contact:
Contact skander
Website

Re: Delete Everything?

  • Quote

Post by skander » Fri Jan 21, 2005 1:46 pm

fistfullast33l wrote:
vonhelmet wrote: Don't be so egocentric as to assume it's only your bandwidth - it cuts both ways.
That's a little harsh if you ask me. I don't think I was being egocentric, just uninformed.
It may have been a little harsh, but what did you take the "Don't sync more than once a day" message on the gentoo mirrors to mean?
Top
Post Reply

200 posts
  • Page 5 of 8
    • Jump to page:
  • Previous
  • 1
  • …
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • Next

Return to “Unsupported Software”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic