Update of /cvsroot/fink/scripts/buildfink
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19394

Modified Files:
        FinkLib.pm buildfink 
Added Files:
        cleanfink 
Log Message:
Add purgeNonEssential to FinkLib, new script cleanfink which just does that

Index: FinkLib.pm
===================================================================
RCS file: /cvsroot/fink/scripts/buildfink/FinkLib.pm,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- FinkLib.pm  11 May 2005 19:04:34 -0000      1.1
+++ FinkLib.pm  26 May 2005 18:14:33 -0000      1.2
@@ -44,4 +44,32 @@
        return $FinkConfig;
 }
 
+# Purge packages we may have previously built
+sub purgeNonEssential {
+       my @essentials = map { quotemeta($_) } 
Fink::Package->list_essential_packages();
+       my $re = "^(?:" . join("|", @essentials) . ")\$";
+
+       $Fink::Status::the_instance ||= Fink::Status->new();
+       $Fink::Status::the_instance->read();
+
+       my @packages = Fink::Package->list_packages();
+       my @purgelist;
+       foreach my $pkgname (@packages) {
+               next if $pkgname =~ /$re/i;
+               next if $pkgname =~ /^fink-buildlock/;
+               next if Fink::VirtPackage->query_package($pkgname);
+
+               my $obj;
+               eval {
+                       $obj = Fink::Package->package_by_name($pkgname);
+               };
+               next if $@ or !$obj;
+               next unless $obj->is_any_installed();
+
+               push @purgelist, $pkgname;
+       }
+
+       system("dpkg --purge " . join(" ", @purgelist) . " 2>&1 | grep -v 'not 
installed'") if @purgelist;
+}
+
 1;

--- NEW FILE: cleanfink ---
#!/usr/bin/perl

# Purge non-essential packages

#Copyright (c) 2005 Apple Computer, Inc.  All Rights Reserved.
#
#This program is free software; you can redistribute it and/or modify
#it under the terms of the GNU General Public License as published by
#the Free Software Foundation; either version 2 of the License, or
#(at your option) any later version.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without even the implied warranty of
#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#GNU General Public License for more details.
#
#You should have received a copy of the GNU General Public License
#along with this program; if not, write to the Free Software
#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

use strict;
use warnings;
use FindBin qw($Bin);
use lib "$Bin";
use FinkLib;

die "Usage: $0 finkdir" unless @ARGV == 1;
my $FinkDir = shift;

if($FinkDir and not -d $FinkDir) {
        die "The specified Fink directory does not exist.\n";
} elsif($FinkDir and not -x "$FinkDir/bin/fink") {
        die "The specified Fink directory does not appear to contain a Fink 
installation.\n";
}


FinkLib::initFink($FinkDir);
FinkLib::purgeNonEssential();

Index: buildfink
===================================================================
RCS file: /cvsroot/fink/scripts/buildfink/buildfink,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- buildfink   25 May 2005 23:56:50 -0000      1.6
+++ buildfink   26 May 2005 18:14:33 -0000      1.7
@@ -129,7 +129,7 @@
 
 restoreSystem();
 prepSystem();
-purgeNonBase();
+FinkLib::purgeNonEssential();
 
 # Rebuild the package database, just to be paranoid.
 scanPackages();
@@ -370,7 +370,7 @@
                next if $obj->{type} and $obj->{type} eq "dummy";
 
                doLog("Building package $pkg...");
-               purgeNonBase();
+               FinkLib::purgeNonEssential();
                my $srcdir = $Fink::Config::buildpath; # Suppress "used only 
once" warning
                $srcdir = "$Fink::Config::buildpath/" . $obj->get_fullname();
 
@@ -686,34 +686,6 @@
        return "";
 }
 
-# Purge packages we may have previously built
-sub purgeNonBase {
-       my @essentials = map { quotemeta($_) } 
Fink::Package->list_essential_packages();
-       my $re = "^(?:" . join("|", @essentials) . ")\$";
-
-       $Fink::Status::the_instance ||= Fink::Status->new();
-       $Fink::Status::the_instance->read();
-
-       my @packages = Fink::Package->list_packages();
-       my @purgelist;
-       foreach my $pkgname (@packages) {
-               next if $pkgname =~ /$re/i;
-               next if $pkgname =~ /^fink-buildlock/;
-               next if Fink::VirtPackage->query_package($pkgname);
-
-               my $obj;
-               eval {
-                       $obj = Fink::Package->package_by_name($pkgname);
-               };
-               next if $@ or !$obj;
-               next unless $obj->is_any_installed();
-
-               push @purgelist, $pkgname;
-       }
-
-       system("dpkg --purge " . join(" ", @purgelist) . " 2>&1 | grep -v 'not 
installed'") if @purgelist;
-}
-
 # Rescan the .info files and rebuild the package database
 sub scanPackages {
        Fink::Package->forget_packages(2, 0);



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005
_______________________________________________
Fink-commits mailing list
Fink-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/fink-commits

Reply via email to