summaryrefslogtreecommitdiff
path: root/scripts/Dpkg/Shlibs
diff options
context:
space:
mode:
authorModestas Vainius <modax@debian.org>2010-01-05 02:03:28 +0200
committerRaphaël Hertzog <hertzog@debian.org>2010-01-11 19:09:56 +0100
commit8ad712068d4b33339fc9e88c0e05f75c3c6bc72d (patch)
tree4c406fd336cd53df82a306fc1d387406fddd07da /scripts/Dpkg/Shlibs
parent90dff312c582f1a3ead410769a334b2271ecb72a (diff)
downloaddpkg-8ad712068d4b33339fc9e88c0e05f75c3c6bc72d.tar.gz
Dpkg::Shlibs::SymbolFile::merge_symbols(): factorize some code
Split off some code from SymbolFile::merge_symbols() to Symbol::mark_found_in_library() and Symbol::mark_not_found_in_library() methods. Methods do sanitizing of the Symbol object when the symbol is / isn't found in the library respectively. This simplifies readability of merge_symbols() and allows reusability of the code blocks (for the future). Signed-off-by: Modestas Vainius <modax@debian.org> Signed-off-by: Raphaël Hertzog <hertzog@debian.org>
Diffstat (limited to 'scripts/Dpkg/Shlibs')
-rw-r--r--scripts/Dpkg/Shlibs/Symbol.pm42
-rw-r--r--scripts/Dpkg/Shlibs/SymbolFile.pm32
2 files changed, 45 insertions, 29 deletions
diff --git a/scripts/Dpkg/Shlibs/Symbol.pm b/scripts/Dpkg/Shlibs/Symbol.pm
index fe836f16f..d1920e14f 100644
--- a/scripts/Dpkg/Shlibs/Symbol.pm
+++ b/scripts/Dpkg/Shlibs/Symbol.pm
@@ -21,6 +21,7 @@ use warnings;
use Dpkg::Gettext;
use Dpkg::Deps;
use Dpkg::ErrorHandling;
+use Dpkg::Version;
use Storable qw();
use Dpkg::Shlibs::Cppfilt;
@@ -394,4 +395,45 @@ sub get_symbolspec {
return $spec;
}
+# Sanitize the symbol when it is confirmed to be found in
+# the respective library.
+sub mark_found_in_library {
+ my ($self, $minver, $arch) = @_;
+
+ if ($self->{deprecated}) {
+ # Symbol reappeared somehow
+ $self->{deprecated} = 0;
+ $self->{minver} = $minver if (not $self->is_optional());
+ } else {
+ # We assume that the right dependency information is already
+ # there.
+ if (version_compare($minver, $self->{minver}) < 0) {
+ $self->{minver} = $minver;
+ }
+ }
+ if (not $self->arch_is_concerned($arch)) {
+ # Remove arch tag because it is incorrect.
+ $self->delete_tag('arch');
+ }
+}
+
+# Sanitize the symbol when it is confirmed to be NOT found in
+# the respective library.
+# Mark as deprecated those that are no more provided (only if the
+# minver is bigger than the version where the symbol was introduced)
+sub mark_not_found_in_library {
+ my ($self, $minver, $arch) = @_;
+
+ # Ignore symbols from foreign arch
+ return if not $self->arch_is_concerned($arch);
+
+ if ($self->{deprecated}) {
+ # Bump deprecated if the symbol is optional so that it
+ # keeps reappering in the diff while it's missing
+ $self->{deprecated} = $minver if $self->is_optional();
+ } elsif (version_compare($minver, $self->{minver}) > 0) {
+ $self->{deprecated} = $minver;
+ }
+}
+
1;
diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm b/scripts/Dpkg/Shlibs/SymbolFile.pm
index bc9b22a96..433e5d127 100644
--- a/scripts/Dpkg/Shlibs/SymbolFile.pm
+++ b/scripts/Dpkg/Shlibs/SymbolFile.pm
@@ -301,21 +301,7 @@ sub merge_symbols {
if (exists $obj->{syms}{$name}) {
# If the symbol is already listed in the file
$sym = $obj->{syms}{$name};
- if ($sym->{deprecated}) {
- # Symbol reappeared somehow
- $sym->{deprecated} = 0;
- $sym->{minver} = $minver if (not $sym->is_optional());
- } else {
- # We assume that the right dependency information is already
- # there.
- if (version_compare($minver, $sym->{minver}) < 0) {
- $sym->{minver} = $minver;
- }
- }
- if (not $sym->arch_is_concerned($self->{arch})) {
- # Remove arch tag because it is incorrect.
- $sym->delete_tag('arch');
- }
+ $sym->mark_found_in_library($minver, $self->{arch});
} else {
# The symbol is new and not present in the file
my $symobj = $dynsyms{$name};
@@ -329,23 +315,11 @@ sub merge_symbols {
}
}
- # Scan all symbols in the file and mark as deprecated those that are
- # no more provided (only if the minver is bigger than the version where
- # the symbol was introduced)
+ # Process all symbols which could not be found in the library.
foreach my $name (keys %{$self->{objects}{$soname}{syms}}) {
if (not exists $dynsyms{$name}) {
my $sym = $self->{objects}{$soname}{syms}{$name};
-
- # Ignore symbols from foreign arch
- next if not $sym->arch_is_concerned($self->{arch});
-
- if ($sym->{deprecated}) {
- # Bump deprecated if the symbol is optional so that it
- # keeps reappering in the diff while it's missing
- $sym->{deprecated} = $minver if $sym->is_optional();
- } elsif (version_compare($minver, $sym->{minver}) > 0) {
- $sym->{deprecated} = $minver;
- }
+ $sym->mark_not_found_in_library($minver, $self->{arch});
}
}
}