dpkg-deb, dpkg-genbuildinfo and dpkg-genchanges already have flags for output directories in a directory other than `..`. Adding this `--no-changes` flag prevents `dpkg-buildpackage` from writing the .changes file to `..`.
With this option, the `-O` options from `dpkg-genchanges` and `dpkg-genbuildinfo` can take care of handling the output instead of `dpkg-buildpackage`. This change could be done by having `dpkg-genchanges` determine where to place the .changes file, but currently `dpkg-buildpackage` does so. That change however seems like it potentially breaks existing behavior. Adding a flag to `dpkg-buildpackage` to override this behavior seems preferable since it is new behavior instead of breaking old behavior. --- scripts/dpkg-buildpackage.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl index aacb83118..4755b5a5a 100755 --- a/scripts/dpkg-buildpackage.pl +++ b/scripts/dpkg-buildpackage.pl @@ -109,6 +109,7 @@ sub usage { -us, --unsigned-source unsigned source package. -ui, --unsigned-buildinfo unsigned .buildinfo file. -uc, --unsigned-changes unsigned .buildinfo and .changes file. + --no-changes do not create .changes file. --no-sign do not sign any file. --force-sign force signing the resulting files. --admindir=<directory> change the administrative directory. @@ -166,6 +167,7 @@ my $signreleased = 1; my $signsource = 1; my $signbuildinfo = 1; my $signchanges = 1; +my $skipchanges = 0; my $buildtarget = 'build'; my $binarytarget = 'binary'; my $host_arch = ''; @@ -271,6 +273,8 @@ while (@ARGV) { $signsource = 0; $signbuildinfo = 0; $signchanges = 0; + } elsif (/^--no-changes$/) { + $skipchanges = 1; } elsif (/^-us$/ or /^--unsigned-source$/) { $signsource = 0; } elsif (/^-ui$/ or /^--unsigned-buildinfo$/) { @@ -601,12 +605,14 @@ push @changes_opts, "-C$desc" if defined $desc; my $chg = "../$pva.changes"; my $changes = Dpkg::Control->new(type => CTRL_FILE_CHANGES); -printcmd("dpkg-genchanges @changes_opts >$chg"); +my $genchanges_cmd = "dpkg-genchanges @changes_opts"; +$genchanges_cmd .= " >$chg" unless $skipchanges; +printcmd($genchanges_cmd); open my $changes_fh, '-|', 'dpkg-genchanges', @changes_opts or subprocerr('dpkg-genchanges'); $changes->parse($changes_fh, g_('parse changes file')); -$changes->save($chg); +$changes->save($chg) unless $skipchanges; close $changes_fh or subprocerr(g_('dpkg-genchanges')); run_hook('postclean', $postclean); -- 2.25.1