The following commit has been merged in the master branch:
commit 647dee469b94fac69cf98cc8bc36390df294137d
Author: Raphaël Hertzog <[email protected]>
Date:   Sun Feb 21 10:33:25 2010 +0100

    dpkg-buildpackage: support passing arbitrary options to 
dpkg-source/dpkg-genchanges

diff --git a/debian/changelog b/debian/changelog
index 374ae0a..dbe6724 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -43,6 +43,9 @@ dpkg (1.15.6) UNRELEASED; urgency=low
     from the file, those are package specific with debhelper). Closes: #557133
   * dpkg-gencontrol now indicates which package is concerned by the substvars
     warning that it displays. Closes: #566837
+  * dpkg-buildpackage now supports options --source-option=<opt> and
+    --changes-option=<opt> to forward arbitrary options to dpkg-source and
+    dpkg-genchanges respectively. Closes: #566230
 
   [ Guillem Jover ]
   * Handle argument parsing in dpkg-checkbuilddeps and dpkg-scanpackages
diff --git a/man/dpkg-buildpackage.1 b/man/dpkg-buildpackage.1
index cbd2468..feff8df 100644
--- a/man/dpkg-buildpackage.1
+++ b/man/dpkg-buildpackage.1
@@ -207,6 +207,12 @@ Do not sign the \fB.changes\fP file.
 .RS
 Passed unchanged to \fBdpkg\-source\fP. See its manual page.
 .RE
+.TP
+.BI \-\-source\-option= opt
+Pass option \fIopt\fP to \fBdpkg-source\fP.
+.TP
+.BI \-\-changes\-option= opt
+Pass option \fIopt\fP to \fBdpkg-genchanges\fP.
 .P
 .BI \-\-admindir= dir
 .br
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index 66363de..dfa2e74 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -88,6 +88,10 @@ Options:
   -ap            add pause before starting signature process.
   -i[<regex>]    ignore diffs of files matching regex.    } only passed
   -I[<pattern>]  filter out files when building tarballs. } to dpkg-source
+  --source-option=<opt>
+                pass option <opt> to dpkg-source
+  --changes-option=<opt>
+                pass option <opt> to dpkg-genchanges
   --admindir=<directory>
                  change the administrative directory.
   -h, --help     show this help message.
@@ -107,18 +111,16 @@ if ( ( ($ENV{GNUPGHOME} && -e $ENV{GNUPGHOME})
 }
 
 my ($admindir, $signkey, $forcesigninterface, $usepause, $noclean,
-    $sourcestyle, $cleansource,
-    $binaryonly, $sourceonly, $since, $maint,
+    $cleansource, $binaryonly, $sourceonly, $since, $maint,
     $changedby, $desc, $parallel);
-my (@checkbuilddep_args, @passopts, @tarignore);
 my $checkbuilddep = 1;
 my $signsource = 1;
 my $signchanges = 1;
-my $diffignore = '';
 my $binarytarget = 'binary';
 my $targetarch = my $targetgnusystem = '';
 my $call_target = '';
 my $call_target_as_root = 0;
+my (@checkbuilddep_opts, @changes_opts, @source_opts);
 
 while (@ARGV) {
     $_ = shift @ARGV;
@@ -133,6 +135,10 @@ while (@ARGV) {
         $admindir = shift @ARGV;
     } elsif (/^--admindir=(.*)$/) {
        $admindir = $1;
+    } elsif (/^--source-option=(.*)$/) {
+       push @source_opts, $1;
+    } elsif (/^--changes-option=(.*)$/) {
+       push @changes_opts, $1;
     } elsif (/^-j(\d*)$/) {
        $parallel = $1 || '';
     } elsif (/^-r(.*)$/) {
@@ -155,15 +161,9 @@ while (@ARGV) {
        $targetarch = $1;
        $checkbuilddep = 0;
     } elsif (/^-s[iad]$/) {
-       $sourcestyle = $_;
-    } elsif (/^-s[nsAkurKUR]$/) {
-       push @passopts, $_; # passed to dpkg-source
-    } elsif (/^-[zZ]/) {
-       push @passopts, $_; # passed to dpkg-source
-    } elsif (/^-i.*$/) {
-       $diffignore = $_;
-    } elsif (/^-I.*$/) {
-       push @tarignore, $_;
+       push @changes_opts, $_;
+    } elsif (/^-(?:s[insAkurKUR]|[zZ].*|i.*|I.*)$/) {
+       push @source_opts, $_; # passed to dpkg-source
     } elsif (/^-tc$/) {
        $cleansource = 1;
     } elsif (/^-t(.*)$/) {
@@ -178,19 +178,23 @@ while (@ARGV) {
        $noclean = 1;
     } elsif (/^-b$/) {
        $binaryonly = '-b';
-       @checkbuilddep_args = ();
+       push @changes_opts, '-b';
+       @checkbuilddep_opts = ();
        $binarytarget = 'binary';
     } elsif (/^-B$/) {
        $binaryonly = '-B';
-       @checkbuilddep_args = ('-B');
+       push @changes_opts, '-B';
+       @checkbuilddep_opts = ('-B');
        $binarytarget = 'binary-arch';
     } elsif (/^-A$/) {
        $binaryonly = '-A';
-       @checkbuilddep_args = ();
+       push @changes_opts, '-A';
+       @checkbuilddep_opts = ();
        $binarytarget = 'binary-indep';
     } elsif (/^-S$/) {
        $sourceonly = '-S';
-       @checkbuilddep_args = ('-B');
+       push @changes_opts, '-S';
+       @checkbuilddep_opts = ('-B');
     } elsif (/^-v(.*)$/) {
        $since = $1;
     } elsif (/^-m(.*)$/) {
@@ -349,10 +353,10 @@ if (not -x "debian/rules") {
 
 if ($checkbuilddep) {
     if ($admindir) {
-       push @checkbuilddep_args, "--admindir=$admindir";
+       push @checkbuilddep_opts, "--admindir=$admindir";
     }
 
-    system('dpkg-checkbuilddeps', @checkbuilddep_args);
+    system('dpkg-checkbuilddeps', @checkbuilddep_opts);
     if (not WIFEXITED($?)) {
         subprocerr('dpkg-checkbuilddeps');
     } elsif (WEXITSTATUS($?)) {
@@ -387,10 +391,7 @@ unless ($binaryonly) {
                "without cleaning up first, it might contain undesired " .
                "files.")) if $noclean;
     chdir('..') or syserr('chdir ..');
-    my @opts = @passopts;
-    if ($diffignore) { push @opts, $diffignore }
-    push @opts, @tarignore;
-    withecho('dpkg-source', @opts, '-b', $dir);
+    withecho('dpkg-source', @source_opts, '-b', $dir);
     chdir($dir) or syserr("chdir $dir");
 }
 unless ($sourceonly) {
@@ -411,20 +412,14 @@ unless ($binaryonly) {
     }
 }
 
-my @change_opts;
-
-if ($binaryonly) { push @change_opts, $binaryonly }
-if ($sourceonly) { push @change_opts, $sourceonly }
-if ($sourcestyle) { push @change_opts, $sourcestyle }
-
-if (defined($maint)) { push @change_opts, "-m$maint" }
-if (defined($changedby)) { push @change_opts, "-e$changedby" }
-if (defined($since)) { push @change_opts, "-v$since" }
-if (defined($desc)) { push @change_opts, "-C$desc" }
+if (defined($maint)) { push @changes_opts, "-m$maint" }
+if (defined($changedby)) { push @changes_opts, "-e$changedby" }
+if (defined($since)) { push @changes_opts, "-v$since" }
+if (defined($desc)) { push @changes_opts, "-C$desc" }
 
 my $chg = "../$pva.changes";
-print STDERR " dpkg-genchanges @change_opts >$chg\n";
-open CHANGES, '-|', 'dpkg-genchanges', @change_opts
+print STDERR " dpkg-genchanges @changes_opts >$chg\n";
+open CHANGES, '-|', 'dpkg-genchanges', @changes_opts
     or subprocerr('dpkg-genchanges');
 
 open OUT, '>', $chg or syserr(_g('write changes file'));

-- 
dpkg's main repository


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

Reply via email to