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

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=8c0cd23e4b1aa04e661d8894df11f26dcbbb4b88

commit 8c0cd23e4b1aa04e661d8894df11f26dcbbb4b88
Author: Guillem Jover <[email protected]>
AuthorDate: Wed Jul 8 05:01:02 2020 +0200

    build: Detect GNU program variants for make, patch and tar in CPAN
    
    On systems where the defaults for these programs are not the GNU
    variants, we need to look for them and use them in preference. Search
    in the CPAN distribution build system, for the names prefixed with «g»
    which is the convention used on BSD systems for GNU variants, and use
    them to replace the variables in the Dpkg module.
---
 debian/changelog    |  3 +++
 scripts/Build.PL.in | 19 +++++++++++++++++++
 2 files changed, 22 insertions(+)

diff --git a/debian/changelog b/debian/changelog
index 17e149518..ec0c89281 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,9 @@ dpkg (1.20.5) UNRELEASED; urgency=medium
     apparently fixed the issue at hand because gcc started parsing it as
     the «[SUFFIX]:» case, completely disabling the PIE handling.
     Thanks to Thorsten Glaser <[email protected]>.
+  * Build system:
+    - Detect the GNU program variants for make, patch and tar in the CPAN
+      distribution to replace in the Dpkg module.
   * Test suite:
     - Only print the Dpkg::Path::check_directory_traversal() error on failure.
 
diff --git a/scripts/Build.PL.in b/scripts/Build.PL.in
index eb4449cd1..58430105c 100644
--- a/scripts/Build.PL.in
+++ b/scripts/Build.PL.in
@@ -17,11 +17,27 @@ if (-e 'Build.PL.in') {
 my $class = Module::Build->subclass(
     class => 'Module::Build::Dpkg',
     code => q{
+        require IPC::Cmd;
+
+        sub find_command {
+            my (@alts) = @_;
+
+            foreach my $cmd (@alts) {
+                my $pathname = IPC::Cmd::can_run($cmd);
+                return $pathname if defined $pathname;
+            }
+            die "error: cannot find any of @alts\n";
+        }
+
         sub subst {
             my ($self, $file) = @_;
             my $path = $self->install_path();
             my $version = $self->dist_version();
 
+            my $progmake = find_command(qw(gmake make));
+            my $progpatch = find_command(qw(gpatch patch));
+            my $progtar = find_command(qw(gtar tar));
+
             unlink "blib/$file"
                 or die "error: cannot remove blib/$file: $!\n";
             open my $fhin, '<', $file
@@ -30,6 +46,9 @@ my $class = Module::Build->subclass(
                 or die "error: cannot create blib/$file: $!\n";
             while (<$fhin>) {
                 s{our \$PROGVERSION = .*;}{our \$PROGVERSION = '$version';};
+                s{our \$PROGMAKE = .*;}{our \$PROGMAKE = '$progmake';};
+                s{our \$PROGPATCH = .*;}{our \$PROGPATCH = '$progpatch';};
+                s{our \$PROGTAR = .*;}{our \$PROGTAR = '$progtar';};
                 s{our \$CONFDIR = .*;}{our \$CONFDIR = '$path->{conf}';};
                 s{our \$DATADIR = .*;}{our \$DATADIR = '$path->{data}';};
                 s{our \$ADMINDIR = .*;}{our \$ADMINDIR = '$path->{admin}';};

-- 
Dpkg.Org's dpkg

Reply via email to