[dpkg] 14/27: dpkg-buildpackage: Run dpkg-source from the current directory

Mattia Rizzolo mattia at debian.org
Mon Oct 23 18:10:28 UTC 2017


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository dpkg.

commit c84fa61a459b9c6f9217c361485de6c0650b279f
Author: Guillem Jover <guillem at debian.org>
Date:   Thu Oct 19 00:52:32 2017 +0200

    dpkg-buildpackage: Run dpkg-source from the current directory
    
    It used to be the case that dpkg-source did not support running from
    the current directory. That got fixed in commit
    a7f16be86689ee46f4b2e445e5f08a63f447cdeb. Which means we can simplify
    the code.
---
 debian/changelog             |  2 ++
 scripts/dpkg-buildpackage.pl | 16 +++-------------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index a0620f4..4841bbf 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,8 @@ dpkg (1.19.1) UNRELEASED; urgency=medium
     builds in dpkg-buildpackage. Reported by Ximin Luo <infinity0 at debian.org>.
   * Pass the correct source stanza to the dpkg-buildpackage code parsing the
     Rules-Requires-Root field. This meant the field was being ignored.
+  * Run dpkg-source directly from the current working directory in
+    dpkg-buildpackage, instead of changing directory back and forth.
   * Documentation:
     - Update gettext minimal version in README.
   * Packaging:
diff --git a/scripts/dpkg-buildpackage.pl b/scripts/dpkg-buildpackage.pl
index df2e1bb..4bc25a2 100755
--- a/scripts/dpkg-buildpackage.pl
+++ b/scripts/dpkg-buildpackage.pl
@@ -23,7 +23,6 @@
 use strict;
 use warnings;
 
-use Cwd;
 use File::Temp qw(tempdir);
 use File::Basename;
 use File::Copy;
@@ -433,9 +432,6 @@ if (defined $parallel) {
 
 set_build_profiles(@build_profiles) if @build_profiles;
 
-my $cwd = cwd();
-my $dir = basename($cwd);
-
 my $changelog = changelog_parse();
 my $ctrl = Dpkg::Control::Info->new();
 
@@ -525,9 +521,7 @@ if (not -x 'debian/rules') {
 }
 
 if (scalar @call_target == 0) {
-    chdir('..') or syserr('chdir ..');
-    run_cmd('dpkg-source', @source_opts, '--before-build', $dir);
-    chdir($dir) or syserr("chdir $dir");
+    run_cmd('dpkg-source', @source_opts, '--before-build', '.');
 }
 
 if ($checkbuilddep) {
@@ -564,9 +558,7 @@ run_hook('source', build_has_any(BUILD_SOURCE));
 if (build_has_any(BUILD_SOURCE)) {
     warning(g_('building a source package without cleaning up as you asked; ' .
                'it might contain undesired files')) if $noclean;
-    chdir('..') or syserr('chdir ..');
-    run_cmd('dpkg-source', @source_opts, '-b', $dir);
-    chdir($dir) or syserr("chdir $dir");
+    run_cmd('dpkg-source', @source_opts, '-b', '.');
 }
 
 run_hook('build', build_has_any(BUILD_BINARY));
@@ -617,9 +609,7 @@ if ($cleansource) {
     run_rules_cond_root('clean');
 }
 
-chdir('..') or syserr('chdir ..');
-run_cmd('dpkg-source', @source_opts, '--after-build', $dir);
-chdir($dir) or syserr("chdir $dir");
+run_cmd('dpkg-source', @source_opts, '--after-build', '.');
 
 info(describe_build($changes->{'Files'}));
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list