[dpkg] 172/192: Dpkg::Source::Package: Call source format prerequisites method if present

Ximin Luo infinity0 at debian.org
Tue Oct 17 11:04:15 UTC 2017


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

infinity0 pushed a commit to branch pu/reproducible_builds
in repository dpkg.

commit d9ba911e0bb30f2f8e290b7b8a80f527616a3034
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Oct 7 03:41:55 2017 +0200

    Dpkg::Source::Package: Call source format prerequisites method if present
    
    We want to be able to check for prerequisites when loading the source
    format module. That function used to be called import, which is a
    misnomer here, and was not being invoked.
    
    Rename it to the more appropriate prerequisites() and call it if it's
    present from the module loading code.
    
    Addresses: #877688
---
 debian/changelog                      | 2 ++
 scripts/Dpkg/Source/Package.pm        | 1 +
 scripts/Dpkg/Source/Package/V3/Bzr.pm | 2 +-
 scripts/Dpkg/Source/Package/V3/Git.pm | 2 +-
 4 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index e481b07..fa7eac7 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -106,6 +106,8 @@ dpkg (1.19.0) UNRELEASED; urgency=medium
       Dpkg::Source::Package when building source packages.
     - Switch Dpkg::Source::Package::V3 modules to use find_command() instead
       of ad-hoc code.
+    - Call source format prerequisites Dpkg::Source::Package method if
+      present. Addresses: #877688
   * Documentation:
     - Document currently accepted syntax for changelogs in deb-changelog(5).
       Closes: #858579
diff --git a/scripts/Dpkg/Source/Package.pm b/scripts/Dpkg/Source/Package.pm
index da66cd2..f7851d2 100644
--- a/scripts/Dpkg/Source/Package.pm
+++ b/scripts/Dpkg/Source/Package.pm
@@ -311,6 +311,7 @@ sub upgrade_object_type {
             error(g_("source package format '%s' is not supported: %s"),
                   $format, $@);
         }
+        $module->prerequisites() if $module->can('prerequisites');
         bless $self, $module;
     } else {
         error(g_("invalid Format field '%s'"), $format);
diff --git a/scripts/Dpkg/Source/Package/V3/Bzr.pm b/scripts/Dpkg/Source/Package/V3/Bzr.pm
index 4df7959..f0752c0 100644
--- a/scripts/Dpkg/Source/Package/V3/Bzr.pm
+++ b/scripts/Dpkg/Source/Package/V3/Bzr.pm
@@ -43,7 +43,7 @@ use parent qw(Dpkg::Source::Package);
 
 our $CURRENT_MINOR_VERSION = '0';
 
-sub import {
+sub prerequisites {
     return 1 if find_command('bzr');
     error(g_('cannot unpack bzr-format source package because ' .
              'bzr is not in the PATH'));
diff --git a/scripts/Dpkg/Source/Package/V3/Git.pm b/scripts/Dpkg/Source/Package/V3/Git.pm
index 72a2499..a915807 100644
--- a/scripts/Dpkg/Source/Package/V3/Git.pm
+++ b/scripts/Dpkg/Source/Package/V3/Git.pm
@@ -46,7 +46,7 @@ delete $ENV{GIT_OBJECT_DIRECTORY};
 delete $ENV{GIT_ALTERNATE_OBJECT_DIRECTORIES};
 delete $ENV{GIT_WORK_TREE};
 
-sub import {
+sub prerequisites {
     return 1 if find_command('git');
     error(g_('cannot unpack git-format source package because ' .
              'git is not in the PATH'));

-- 
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