]> git.donarmstrong.com Git - debhelper.git/commitdiff
Add a global --remaining-packages option.
authorModestas Vainius <modestas@vainius.eu>
Mon, 23 Mar 2009 00:23:17 +0000 (02:23 +0200)
committerJoey Hess <joey@gnu.kitenet.net>
Mon, 23 Mar 2009 18:59:13 +0000 (14:59 -0400)
Add a global --remaining-packages option which allows to skip the command on
the packages which it has already been run on (i.e. if the command helper is
already present in the package debhelper log).

Signed-off-by: Modestas Vainius <modestas@vainius.eu>
Debian/Debhelper/Dh_Getopt.pm
Debian/Debhelper/Dh_Lib.pm
debhelper.pod
dh

index ef94e9403684c31a9c45a5941f54292ac9c59a47..5585a54ceca1f8b6efcb595ac2c694762a10fcef 100644 (file)
@@ -91,6 +91,8 @@ sub getoptions {
                "N=s" => \&ExcludePackage,
                "no-package=s" => \&ExcludePackage,
        
+               "remaining-packages" => \$dh{EXCLUDE_LOGGED},
+       
                "dbg-package=s" => \&AddDebugPackage,
                
                "s" => \&AddPackage,
@@ -222,6 +224,10 @@ sub parseopts {
        my $package;
        my %packages_seen;
        foreach $package (@{$dh{DOPACKAGES}}) {
+               if (defined($dh{EXCLUDE_LOGGED}) &&
+                   grep { $_ eq basename($0) } load_log($package)) {
+                       $exclude_package{$package}=1;
+               }
                if (! $exclude_package{$package}) {
                        if (! exists $packages_seen{$package}) {
                                $packages_seen{$package}=1;
index d481128362708228433740ee4c314c2cb5c2c82f..23e81a60682c037c7f3cf673d937d77e98e0d777 100644 (file)
@@ -15,7 +15,7 @@ use vars qw(@ISA @EXPORT %dh);
            &filedoublearray &getpackages &basename &dirname &xargs %dh
            &compat &addsubstvar &delsubstvar &excludefile &package_arch
            &is_udeb &udeb_filename &debhelper_script_subst &escape_shell
-           &inhibit_log);
+           &inhibit_log &load_log);
 
 my $max_compat=7;
 
@@ -102,7 +102,22 @@ sub END {
        if ($? == 0 && $write_log) {
                write_log(basename($0), @{$dh{DOPACKAGES}});
        }
-}      
+}
+
+sub load_log {
+       my ($package, $db)=@_;
+       my $ext=pkgext($package);
+
+       my @log;
+       open(LOG, "<", "debian/${ext}debhelper.log") || return;
+       while (<LOG>) {
+               chomp;
+               push @log, $_;
+               $db->{$package}{$_}=1 if (defined $db);
+       }
+       close LOG;
+       return @log;
+}
 
 sub write_log {
        my $cmd=shift;
index 77ace5c31c89ca932a3a4c0c763b349d4df0bc60..dad286ee0f5e5b5f2587696c3a5717bc9c0a6760 100644 (file)
@@ -118,6 +118,14 @@ are not architecture independent.
 Do not act on the specified package even if an -a, -i, or -p option lists
 the package as one that should be acted on.
 
+=item B<--remaining-packages>
+
+Do not act on the packages which have already been acted on by this debhelper
+command earlier (i.e. if the command is present in the package debhelper log).
+For example, if you need to call the command with special options only for a
+couple of binary packages, pass this option to the last call of the command to
+process the rest of packages with default settings. 
+
 =item B<--ignore=>I<file>
 
 Ignore the specified file. This can be used if debian/ contains a debhelper
diff --git a/dh b/dh
index 8639ed074311b418b2d10b1cf04835491e2042c5..ab7ddb07884b54788a11f8b7197ec8e1c9949b3f 100755 (executable)
--- a/dh
+++ b/dh
@@ -376,7 +376,7 @@ while (@ARGV_orig) {
 my %logged;
 my %startpoint;
 foreach my $package (@packages) {
-       my @log=loadlog($package);
+       my @log=load_log($package, \%logged);
        if ($dh{AFTER}) {
                # Run commands in the sequence that come after the
                # specified command.
@@ -484,21 +484,6 @@ sub run {
        }
 }
 
-sub loadlog {
-       my $package=shift;
-       my $ext=pkgext($package);
-       
-       my @log;
-       open(LOG, "<", "debian/${ext}debhelper.log") || return;
-       while (<LOG>) {
-               chomp;
-               push @log, $_;
-               $logged{$package}{$_}=1;
-       }
-       close LOG;
-       return @log;
-}
-
 sub writelog {
        Debian::Debhelper::Dh_Lib::write_log(@_);
 }