[Reproducible-commits] [dpkg] 07/30: Dpkg: Relax dependency restriction parsing to allow sloppy spaces

Mattia Rizzolo mattia at debian.org
Mon May 9 09:02:50 UTC 2016


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

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

commit a234261b4e7929bab7035d8223e2abd3801a3b9b
Author: Guillem Jover <guillem at debian.org>
Date:   Wed May 4 21:39:17 2016 +0200

    Dpkg: Relax dependency restriction parsing to allow sloppy spaces
    
    Allow sloppy spaces again around versions, architectures and profile
    restrictions, so that we do not fail on previously accepted dependencies.
    
    Regression introduced in commit bd17966babf8705e8f02c808f646dfa149828256.
    
    Closes: #823431
    Reported-by: Niko Tyni <ntyni at debian.org>
---
 debian/changelog              |  4 ++++
 scripts/Dpkg/BuildProfiles.pm |  4 ++--
 scripts/Dpkg/Deps.pm          |  2 +-
 scripts/t/Dpkg_Deps.t         | 14 +++++++++++++-
 4 files changed, 20 insertions(+), 4 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 1538b6a..e70cae6 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,6 +1,10 @@
 dpkg (1.18.7) UNRELEASED; urgency=medium
 
   [ Guillem Jover ]
+  * Perl modules:
+    - Relax dependency restrictions parsing to allow again sloppy spaces
+      around versions, architectures and profile restrictions.
+      Regression introduced in 1.18.5. Closes: #823431
   * Documentation:
     - Shorten example symbol names in dpkg-gensymbols to avoid a mandb
       warning due to unwrappable lines in translations.
diff --git a/scripts/Dpkg/BuildProfiles.pm b/scripts/Dpkg/BuildProfiles.pm
index 85d24fe..6314f1e 100644
--- a/scripts/Dpkg/BuildProfiles.pm
+++ b/scripts/Dpkg/BuildProfiles.pm
@@ -91,9 +91,9 @@ Parses a build profiles specification, into an array of array references.
 sub parse_build_profiles {
     my $string = shift;
 
-    $string =~ s/^\s*<(.*)>\s*$/$1/;
+    $string =~ s/^\s*<\s*(.*)\s*>\s*$/$1/;
 
-    return map { [ split /\s+/ ] } split />\s+</, $string;
+    return map { [ split /\s+/ ] } split /\s*>\s+<\s*/, $string;
 }
 
 =item evaluate_restriction_formula(\@formula, \@profiles)
diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm
index e698adc..d29ba6c 100644
--- a/scripts/Dpkg/Deps.pm
+++ b/scripts/Dpkg/Deps.pm
@@ -602,7 +602,7 @@ sub parse_string {
               (?:                           # start of optional part
                 \s* \(                      # open parenthesis for version part
                 \s* (<<|<=|=|>=|>>|[<>])    # relation part
-                \s* ([^\)]+)                # do not attempt to parse version
+                \s* ([^\)\s]+)              # do not attempt to parse version
                 \s* \)                      # closing parenthesis
               )?                            # end of optional part
               (?:                           # start of optional architecture
diff --git a/scripts/t/Dpkg_Deps.t b/scripts/t/Dpkg_Deps.t
index 326c719..c561b3d 100644
--- a/scripts/t/Dpkg_Deps.t
+++ b/scripts/t/Dpkg_Deps.t
@@ -16,7 +16,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 47;
+use Test::More tests => 50;
 
 use Dpkg::Arch qw(get_host_arch);
 use Dpkg::Version;
@@ -188,6 +188,18 @@ is($dep_empty1->output(), '', 'Empty dependency');
 my $dep_empty2 = deps_parse(' , , ', union => 1);
 is($dep_empty2->output(), '', "' , , ' is also an empty dependency");
 
+# Check sloppy but acceptable dependencies
+
+my $dep_sloppy_version = deps_parse('package (=   1.0  )');
+is($dep_sloppy_version->output(), 'package (= 1.0)', 'sloppy version restriction');
+
+my $dep_sloppy_arch = deps_parse('package [  alpha    ]');
+is($dep_sloppy_arch->output(), 'package [alpha]', 'sloppy arch restriction');
+
+my $dep_sloppy_profile = deps_parse('package <  !profile    >   <  other  >');
+is($dep_sloppy_profile->output(), 'package <!profile> <other>',
+   'sloppy profile restriction');
+
 $SIG{__WARN__} = sub {};
 
 my $dep_bad_version = deps_parse('package (= 1.0) (>= 2.0)');

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