Logical opposite of -B, will include only arch-indep
packages into the upload.

Signed-off-by: Frank Lichtenheld <[EMAIL PROTECTED]>
---
 ChangeLog                    |    8 ++++++++
 scripts/dpkg-buildpackage.pl |   20 ++++++++++++++------
 scripts/dpkg-genchanges.pl   |   25 +++++++++++++++++--------
 3 files changed, 39 insertions(+), 14 deletions(-)

I'm not entirely certain I see this as a must-have feature but I was
curious how much changes it would need to be implemented. So here is a
patch that does this.

diff --git a/ChangeLog b/ChangeLog
index b1eafab..b8e9bb7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2007-09-29  Frank Lichtenheld  <[EMAIL PROTECTED]>
 
+       * scripts/dpkg-buildpackage.pl: Add new
+       -A option (passed to dpkg-genchanges).
+       * scripts/dpkg-genchanges.pl: Add new -A
+       option that will include only arch-indep
+       packages into the upload.
+
+2007-09-29  Frank Lichtenheld  <[EMAIL PROTECTED]>
+
        * scripts/dpkg-buildpackage.pl: Call checkversion()
        on version extracted from changelog. Since other
        program we call later will do the same there is
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index f34a8c6..b036d19 100644
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -49,8 +49,9 @@ Options:
   -us            unsigned source.
   -uc            unsigned changes.
   -a<arch>       Debian architecture we build for (implies -d).
-  -b             binary-only, do not build source. } also passed to
-  -B             binary-only, no arch-indep files. } dpkg-genchanges
+  -b             binary-only, do not build source.   } also passed to
+  -B             binary-only, no arch-indep files.   } dpkg-genchanges
+  -A             binary-only, only arch-indep files. }
   -S             source only, no binary files.     }
   -t<system>     set GNU system type.           } passed to dpkg-architecture
   -v<version>    changes since version <version>.      }
@@ -157,7 +158,7 @@ while (@ARGV) {
     } elsif (/^-nc$/) {
        $noclean = 1;
        if ($sourceonly) {
-           usageerr(sprintf(_g("cannot combine %s and %s"), '-nc', '-S'));
+           usageerr(sprintf(_g("cannot combine %s and -S"), '-nc'));
        }
        unless ($binaryonly) {
            $binaryonly = '-b';
@@ -167,20 +168,27 @@ while (@ARGV) {
        @checkbuilddep_args = ();
        $binarytarget = 'binary';
        if ($sourceonly) {
-           usageerr(sprintf(_g("cannot combine %s and %s"), '-b', '-S'));
+           usageerr(sprintf(_g("cannot combine %s and -S"), '-b'));
        }
     } elsif (/^-B$/) {
        $binaryonly = '-B';
        @checkbuilddep_args = ('-B');
        $binarytarget = 'binary-arch';
        if ($sourceonly) {
-           usageerr(sprintf(_g("cannot combine %s and %s"), '-B', '-S'));
+           usageerr(sprintf(_g("cannot combine %s and -S"), '-B'));
+       }
+    } elsif (/^-A$/) {
+       $binaryonly = '-A';
+       @checkbuilddep_args = ();
+       $binarytarget = 'binary-indep';
+       if ($sourceonly) {
+           usageerr(sprintf(_g("cannot combine %s and -S"), '-A'));
        }
     } elsif (/^-S$/) {
        $sourceonly = '-S';
        $checkbuilddep = 0;
        if ($binaryonly) {
-           usageerr(sprintf(_g("cannot combine %s and %s"), $binaryonly, 
'-S'));
+           usageerr(sprintf(_g("cannot combine %s and -S"), $binaryonly));
        }
     } elsif (/^-v(.*)$/) {
        $since = $1;
diff --git a/scripts/dpkg-genchanges.pl b/scripts/dpkg-genchanges.pl
index d17700b..720266a 100755
--- a/scripts/dpkg-genchanges.pl
+++ b/scripts/dpkg-genchanges.pl
@@ -56,7 +56,7 @@ my $dsc;
 my $changesdescription;
 my $sourceonly;
 my $binaryonly;
-my $archspecific;
+my $archspecific = 0;
 my $forcemaint;
 my $forcechangedby;
 my $since;
@@ -82,6 +82,7 @@ sub usage {
 Options:
   -b                       binary-only build - no source files.
   -B                       arch-specific - no source or arch-indep files.
+  -A                       only arch-indep - no source or arch-specific files.
   -S                       source-only upload.
   -c<controlfile>          get control info from this file.
   -l<changelogfile>        get per-version info from this file.
@@ -109,15 +110,20 @@ Options:
 while (@ARGV) {
     $_=shift(@ARGV);
     if (m/^-b$/) {
-       $sourceonly && &usageerr(_g("cannot combine -b or -B and -S"));
+       $sourceonly && &usageerr(sprintf(_g("cannot combine %s and -S"), $_));
         $binaryonly= 1;
     } elsif (m/^-B$/) {
-       $sourceonly && &usageerr(_g("cannot combine -b or -B and -S"));
+       $sourceonly && &usageerr(sprintf(_g("cannot combine %s and -S"), $_));
        $archspecific=1;
        $binaryonly= 1;
        printf STDERR _g("%s: arch-specific upload - not including 
arch-independent packages")."\n", $progname;
+    } elsif (m/^-A$/) {
+       $sourceonly && &usageerr(sprintf(_g("cannot combine %s and -S"), $_));
+       $archspecific=-1;
+       $binaryonly= 1;
+       printf STDERR _g("%s: arch-indep upload - not including arch-specific 
packages")."\n", $progname;
     } elsif (m/^-S$/) {
-       $binaryonly && &usageerr(_g("cannot combine -b or -B and -S"));
+       $binaryonly && &usageerr(sprintf(_g("cannot combine %s and -S"), 
$binaryonly));
        $sourceonly= 1;
     } elsif (m/^-s([iad])$/) {
         $sourcestyle= $1;
@@ -219,8 +225,9 @@ for $_ (keys %fi) {
        my $host_arch = get_host_arch();
 
        if (!defined($p2f{$p}) && not $sourceonly) {
-           if ((debarch_eq('all', $a) && !$archspecific) ||
-               grep(debarch_is($host_arch, $_), split(/\s+/, $a))) {
+           if ((debarch_eq('all', $a) and $archspecific < 1) ||
+               (grep(debarch_is($host_arch, $_), split(/\s+/, $a))
+                     and $archspecific >= 0)) {
                warning(sprintf(_g("package %s in control file but not in files 
list"), $p));
                next;
            }
@@ -243,7 +250,8 @@ for $_ (keys %fi) {
                $f{$_}= $v;
            } elsif (m/^Architecture$/) {
                if (not $sourceonly) {
-                   if (grep(debarch_is($host_arch, $_), split(/\s+/, $v))) {
+                   if (grep(debarch_is($host_arch, $_), split(/\s+/, $v))
+                       and $archspecific >= 0) {
                        $v = $host_arch;
                    } elsif (!debarch_eq('all', $v)) {
                        $v= '';
@@ -393,7 +401,8 @@ $f{'Files'}= '';
 my %filedone;
 
 for my $f (@sourcefiles, @fileslistfiles) {
-    next if ($archspecific && debarch_eq('all', $p2arch{$f2p{$f}}));
+    next if ($archspecific > 0 and debarch_eq('all', $p2arch{$f2p{$f}}));
+    next if ($archspecific < 0 and not debarch_eq('all', $p2arch{$f2p{$f}}));
     next if $filedone{$f}++;
     my $uf = "$uploadfilesdir/$f";
     open(STDIN,"< $uf") || &syserr(sprintf(_g("cannot open upload file %s for 
reading"), $uf));

-- 
Frank Lichtenheld <[EMAIL PROTECTED]>
www: http://www.djpig.de/



-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to