Bladeren bron

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

Raphael Hertzog 19 jaren geleden
bovenliggende
commit
8af4fb0453
2 gewijzigde bestanden met toevoegingen van 9 en 25 verwijderingen
  1. 7 23
      scripts/Dpkg/Shlibs/SymbolFile.pm
  2. 2 2
      scripts/t/200_Dpkg_Shlibs.t

+ 7 - 23
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;

+ 2 - 2
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' );