The following commit has been merged in the master branch:
commit 4a9c97d4d75e045ca3c1dbc5f3b4ce0ea0605cf0
Author: Modestas Vainius <[email protected]>
Date: Fri Jan 29 19:29:17 2010 +0200
Dpkg::Shlibs::Symbol::equals(): improve, make more general.
Now the function accepts named options and allows to optionally skip
comparision of versioning info (minver/dep_id) and tags. However,
by default, it compares all non-internal symbol properties.
diff --git a/scripts/Dpkg/Shlibs/Symbol.pm b/scripts/Dpkg/Shlibs/Symbol.pm
index 2fc3346..4450c43 100644
--- a/scripts/Dpkg/Shlibs/Symbol.pm
+++ b/scripts/Dpkg/Shlibs/Symbol.pm
@@ -253,23 +253,32 @@ sub get_tag_value {
return $self->{tags}{$tag};
}
-# Checks if the symbol is equal to another one (by name and tag set)
+# Checks if the symbol is equal to another one (by name and optionally,
+# tag sets, versioning info (minver and depid))
sub equals {
- my ($self, $other) = @_;
+ my ($self, $other, %opts) = @_;
- # Compare names and tag sets
return 0 if $self->{symbol} ne $other->{symbol};
- return 0 if scalar(@{$self->{tagorder}}) != scalar(@{$other->{tagorder}});
-
- for (my $i = 0; $i < scalar(@{$self->{tagorder}}); $i++) {
- my $tag = $self->{tagorder}->[$i];
- return 0 if $tag ne $other->{tagorder}->[$i];
- if (defined $self->{tags}{$tag} && defined $other->{tags}{$tag}) {
- return 0 if $self->{tags}{$tag} ne defined $other->{tags}{$tag};
- } elsif (defined $self->{tags}{$tag} || defined $other->{tags}{$tag}) {
- return 0;
+
+ if (!exists $opts{versioning} || $opts{versioning}) {
+ return 0 if $self->{minver} ne $other->{minver};
+ return 0 if $self->{dep_id} ne $other->{dep_id};
+ }
+
+ if (!exists $opts{tags} || $opts{tags}) {
+ return 0 if scalar(@{$self->{tagorder}}) !=
scalar(@{$other->{tagorder}});
+
+ for (my $i = 0; $i < scalar(@{$self->{tagorder}}); $i++) {
+ my $tag = $self->{tagorder}->[$i];
+ return 0 if $tag ne $other->{tagorder}->[$i];
+ if (defined $self->{tags}{$tag} && defined $other->{tags}{$tag}) {
+ return 0 if $self->{tags}{$tag} ne defined $other->{tags}{$tag};
+ } elsif (defined $self->{tags}{$tag} || defined
$other->{tags}{$tag}) {
+ return 0;
+ }
}
}
+
return 1;
}
diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm
b/scripts/Dpkg/Shlibs/SymbolFile.pm
index 436e78d..be19db4 100644
--- a/scripts/Dpkg/Shlibs/SymbolFile.pm
+++ b/scripts/Dpkg/Shlibs/SymbolFile.pm
@@ -504,7 +504,7 @@ sub lookup_pattern {
} elsif ($refpat->get_pattern_type() eq "generic") {
for my $p (@{$object->{patterns}{generic}}) {
if (($inc_deprecated || !$p->{deprecated}) &&
- $p->equals($refpat))
+ $p->equals($refpat, versioning => 0))
{
$pat = $p;
last;
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]