From owner-freebsd-questions@FreeBSD.ORG Wed Nov 24 21:50:26 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 2F77716A4CE for ; Wed, 24 Nov 2004 21:50:26 +0000 (GMT) Received: from charm.daemonsecurity.com (FW-182-254.go.retevision.es [62.174.254.182]) by mx1.FreeBSD.org (Postfix) with ESMTP id 3B55243D48 for ; Wed, 24 Nov 2004 21:50:25 +0000 (GMT) (envelope-from norgaard@locolomo.org) Received: from [192.168.0.32] (charm.daemonsecurity.com [192.168.0.32]) by charm.daemonsecurity.com (Postfix) with ESMTP id 3A9BD171A9; Wed, 24 Nov 2004 22:50:15 +0100 (CET) Message-ID: <41A5020A.5020902@locolomo.org> Date: Wed, 24 Nov 2004 22:50:02 +0100 From: Erik Norgaard User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.7.2) Gecko/20041114 X-Accept-Language: en, en-us, da, it, es MIME-Version: 1.0 To: Damien Hull References: <1101328720.4244.6.camel@tower1.digitaloverload.local> <41A4F8C3.1090701@locolomo.org> <1101332442.4361.2.camel@tower1.digitaloverload.local> In-Reply-To: <1101332442.4361.2.camel@tower1.digitaloverload.local> Content-Type: multipart/mixed; boundary="------------040601050009070802090207" cc: freebsd-questions@freebsd.org Subject: Re: cvsup to 5.3? X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Nov 2004 21:50:26 -0000 This is a multi-part message in MIME format. --------------040601050009070802090207 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Damien Hull wrote: > Looks like I didn't do a "make clean" when I installed kde. I know have > 3.5G in /usr. > > Is there an easy way to find out which ports need to have "make clean" > done? > I have a script: cleans up ports with a "work" dir and removes distfiles that no port is refering to. Not perfect - it doesn't descend deeply into distfiles directories. Also, I'd like to add the posibility of removing old packages if you "make package". But, it works good enough :-) you can also "make NOCLEANDEPENDS=yes clean" in /usr/ports, but this won't remove old distfiles. If you do not use NOCLEANDEPENDS=yes, make clean will clean out dependencies for each port which will do multimple cleans on a lot of ports. Takes extra time. Cheers, Erik -- Ph: +34.666334818 web: www.locolomo.org S/MIME Certificate: http://www.locolomo.org/crt/2004071206.crt Subject ID: A9:76:7A:ED:06:95:2B:8D:48:97:CE:F2:3F:42:C8:F2:22:DE:4C:B9 Fingerprint: 4A:E8:63:38:46:F6:9A:5D:B4:DC:29:41:3F:62:D3:0A:73:25:67:C2 --------------040601050009070802090207 Content-Type: text/plain; name="ports-clean.pl" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="ports-clean.pl" #!/usr/bin/perl -w # # $Id$ # # This script cleans up the ports tree removing work-directories and # moving created packages to /var/pkg use strict; use warnings; # use File::Copy; # my $ports_dir = "/usr/ports"; # Ports directory to clean my $pkg_dir = ""; # Directory to store packages my %distfile; foreach my $group (glob("$ports_dir/*")) { next unless -d $group; # Can't descend into a file # skip ports special directories next if $group =~ /$ports_dir\/(distfiles|Mk|Templates|Tools)/; print "Descending into $group:\n"; foreach my $port (glob("$group/*")) { if (-d "$port/work") { # Clean up ports work directory. print " Cleaning up $port\n"; system("make -C $port NOCLEANDEPENDS=yes clean") and warn " Unable to cleanup $port: $!"; }; if (-f "$port/distinfo") { # Read distinfo to clean up distfiles dir open(DIST,"<","$port/distinfo") or warn " Failed reading $port/distinfo: $!\n" and next; while(my $line = ) { if ($line =~ /MD5 \((.*?)\)\s*=\s*(\w+)/) { $distfile{$1} = $2; } } close(DIST); }; if ($pkg_dir) { foreach my $pkg (glob("$port/*.tgz"), glob("$port/*.tbz")) { print " Moving package to $pkg_dir:\n"; # Do stuff } }; }; }; # We could recurse deep, but there are no sub-sub directories. print "Cleaning up distfiles directory: \n"; foreach my $file (glob("$ports_dir/distfiles/*")) { if (-d $file) { foreach my $subfile (glob("$file/*")) { -d $subfile and warn "Found deep directory: $subfile\n" and next; my ($base) = $subfile =~ /$ports_dir\/distfiles\/(.*)/; if (! defined $distfile{$base} ) { print "Removing old distfile: $base\n"; unlink $subfile; }; } } else { # Remove unknown source files my ($base) = $file =~ /$ports_dir\/distfiles\/(.*)/; if (! defined $distfile{$base} ) { print "Removing old distfile: $base\n"; unlink $file; }; }; }; --------------040601050009070802090207--