From 8af4fb045300584f7696302fa8d946adfa56651f Mon Sep 17 00:00:00 2001 From: Raphael Hertzog Date: Sun, 15 Jul 2007 10:55:09 +0000 Subject: [PATCH] * Define $foo->has_lost_symbols($ref) as $ref->has_new_symbols($foo). * Same for has_lost_libs. * Fixed improper usage of File::Temp object in a non-regression test. --- scripts/Dpkg/Shlibs/SymbolFile.pm | 30 +++++++----------------------- scripts/t/200_Dpkg_Shlibs.t | 4 ++-- 2 files changed, 9 insertions(+), 25 deletions(-) diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm b/scripts/Dpkg/Shlibs/SymbolFile.pm index 38c5fcf5..5930c8d3 100644 --- a/scripts/Dpkg/Shlibs/SymbolFile.pm +++ b/scripts/Dpkg/Shlibs/SymbolFile.pm @@ -201,25 +201,6 @@ sub lookup_symbol { return undef; } -sub has_lost_symbols { - my ($self, $ref) = @_; - foreach my $soname (keys %{$self->{objects}}) { - my $mysyms = $self->{objects}{$soname}{syms}; - next if not exists $ref->{objects}{$soname}; - my $refsyms = $ref->{objects}{$soname}{syms}; - foreach my $sym (grep { not $refsyms->{$_}{deprecated} } - keys %{$refsyms}) - { - if ((not exists $mysyms->{$sym}) or - $mysyms->{$sym}{deprecated}) - { - return 1; - } - } - } - return 0; -} - sub has_new_symbols { my ($self, $ref) = @_; foreach my $soname (keys %{$self->{objects}}) { @@ -239,6 +220,12 @@ sub has_new_symbols { return 0; } +sub has_lost_symbols { + my ($self, $ref) = @_; + return $ref->has_new_symbols($self); +} + + sub has_new_libs { my ($self, $ref) = @_; foreach my $soname (keys %{$self->{objects}}) { @@ -249,10 +236,7 @@ sub has_new_libs { sub has_lost_libs { my ($self, $ref) = @_; - foreach my $soname (keys %{$ref->{objects}}) { - return 1 if not exists $self->{objects}{$soname}; - } - return 0; + return $ref->has_new_libs($self); } 1; diff --git a/scripts/t/200_Dpkg_Shlibs.t b/scripts/t/200_Dpkg_Shlibs.t index 9db3a4ef..9d1d17d0 100644 --- a/scripts/t/200_Dpkg_Shlibs.t +++ b/scripts/t/200_Dpkg_Shlibs.t @@ -78,9 +78,9 @@ use File::Temp; my $save_file = new File::Temp; -$sym_file->save($save_file); +$sym_file->save($save_file->filename); -$sym_file_dup->load($save_file); +$sym_file_dup->load($save_file->filename); $sym_file_dup->{file} = "t/200_Dpkg_Shlibs/symbol_file.tmp"; is_deeply($sym_file_dup, $sym_file, 'save -> load' ); -- 2.39.5