[Reproducible-commits] [dpkg] 63/74: Dpkg::Deps::Simple: Check whether restrictions are implied
Mattia Rizzolo
mattia at debian.org
Sun Jul 3 22:22:58 UTC 2016
This is an automated email from the git hooks/post-receive script.
mattia pushed a commit to annotated tag 1.18.8
in repository dpkg.
commit 5d45b9a7607b3f5f7552cb50e73afcd723f94f15
Author: Ben Hutchings <ben at decadent.org.uk>
Date: Mon Jun 20 23:23:56 2016 +0200
Dpkg::Deps::Simple: Check whether restrictions are implied
We need to check whether the restrictions on self imply the
restrictions on "o", along with all the other tests.
[guillem at debian.org: minor style fixes. ]
Closes: #827633
Signed-off-by: Guillem Jover <guillem at debian.org>
---
debian/changelog | 2 ++
scripts/Dpkg/Deps.pm | 34 ++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/debian/changelog b/debian/changelog
index 84eb217..09c5a13 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -72,6 +72,8 @@ dpkg (1.18.8) UNRELEASED; urgency=medium
- Preserve order when prepending shared library paths in Dpkg::Shlibs.
This fixes the order of paths passed via dpkg-shlibdeps -l option.
Closes: #823805
+ - Check whether dependency restrictions are implied in Dpkg::Deps::Simple.
+ Thanks to Ben Hutchings <ben at decadent.org.uk>. Closes: #827633
* Test suite:
- Bump perlcritic ValuesAndExpressions::RequireNumberSeparators minimum
to 99999.
diff --git a/scripts/Dpkg/Deps.pm b/scripts/Dpkg/Deps.pm
index 088fd37..33d4411 100644
--- a/scripts/Dpkg/Deps.pm
+++ b/scripts/Dpkg/Deps.pm
@@ -759,6 +759,36 @@ sub _arch_qualifier_implies {
return 0;
}
+# _restrictions_imply($p, $q)
+#
+# Returns true if the restrictions $p and $q are compatible with the
+# implication $p -> $q, false otherwise.
+# NOTE: We don't try to be very clever here, so we may conservatively
+# return false when there is an implication.
+sub _restrictions_imply {
+ my ($p, $q) = @_;
+
+ if (not defined $p) {
+ return 1;
+ } elsif (not defined $q) {
+ return 0;
+ } else {
+ # Check whether set difference is empty.
+ my %restr;
+
+ for my $restrlist (@{$q}) {
+ my $reststr = join ' ', sort @{$restrlist};
+ $restr{$reststr} = 1;
+ }
+ for my $restrlist (@{$p}) {
+ my $reststr = join ' ', sort @{$restrlist};
+ delete $restr{$reststr};
+ }
+
+ return keys %restr == 0;
+ }
+}
+
# Returns true if the dependency in parameter can deduced from the current
# dependency. Returns false if it can be negated. Returns undef if nothing
# can be concluded.
@@ -776,6 +806,10 @@ sub implies {
return unless _arch_qualifier_implies($self->{archqual},
$o->{archqual});
+ # Our restrictions must imply the restrictions for o
+ return unless _restrictions_imply($self->{restrictions},
+ $o->{restrictions});
+
# If o has no version clause, then our dependency is stronger
return 1 if not defined $o->{relation};
# If o has a version clause, we must also have one, otherwise there
--
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