+2008-01-27 Raphael Hertzog <hertzog@debian.org>
+
+ * scripts/Dpkg/Shlibs/SymbolFile.pm: Replace has_new_libs(),
+ has_lost_libs(), has_new_symbols() and has_lost_symbols() by
+ corresponding get_* functions.
+ * scripts/dpkg-gensymbsols.pl: Display list of new/lost libs. Also
+ display list of lost symbols when wildcards symbols have been
+ used.
+ * scripts/t/200_Dpkg_Shlibs.t: Adjust test suite to API change.
+
2008-01-25 Andreas PĂ„hlsson <andreas.pahlsson@xcerion.com>
* utils/start-stop-daemon.c (tsub): Remove function.
return undef;
}
-sub has_new_symbols {
+sub get_new_symbols {
my ($self, $ref) = @_;
+ my @res;
foreach my $soname (keys %{$self->{objects}}) {
my $mysyms = $self->{objects}{$soname}{syms};
next if not exists $ref->{objects}{$soname};
if ((not exists $refsyms->{$sym}) or
$refsyms->{$sym}{deprecated})
{
- return 1;
+ push @res, {
+ 'soname' => $soname,
+ 'name' => $sym,
+ %{$mysyms->{$sym}}
+ };
}
}
}
- return 0;
+ return @res;
}
-sub has_lost_symbols {
+sub get_lost_symbols {
my ($self, $ref) = @_;
- return $ref->has_new_symbols($self);
+ return $ref->get_new_symbols($self);
}
-sub has_new_libs {
+sub get_new_libs {
my ($self, $ref) = @_;
+ my @res;
foreach my $soname (keys %{$self->{objects}}) {
- return 1 if not exists $ref->{objects}{$soname};
+ push @res, $soname if not exists $ref->{objects}{$soname};
}
- return 0;
+ return @res;
}
-sub has_lost_libs {
+sub get_lost_libs {
my ($self, $ref) = @_;
- return $ref->has_new_libs($self);
+ return $ref->get_new_libs($self);
}
1;
use File::Temp;
use Digest::MD5;
# Compare
- if ($symfile->has_new_libs($ref_symfile)) {
- warning(_g("new libraries appeared in the symbols file."));
+ if (my @libs = $symfile->get_new_libs($ref_symfile)) {
+ warning(_g("new libraries appeared in the symbols file: %s"), "@libs");
$exitcode = 4 if ($compare >= 4);
}
- if ($symfile->has_lost_libs($ref_symfile)) {
- warning(_g("some libraries disappeared in the symbols file."));
+ if (my @libs = $symfile->get_lost_libs($ref_symfile)) {
+ warning(_g("some libraries disappeared in the symbols file: %s"), "@libs");
$exitcode = 3 if ($compare >= 3);
}
- if ($symfile->has_new_symbols($ref_symfile)) {
+ if ($symfile->get_new_symbols($ref_symfile)) {
unless ($symfile->used_wildcards()) {
# Wildcards are used to replace many additional symbols, so we
# have no idea if this is really true, so don't say it and
# don't check it
- warning(_g("some new symbols appeared in the symbols file."));
+ warning(_g("some new symbols appeared in the symbols file: %s"),
+ _g("see diff output below"));
$exitcode = 2 if ($compare >= 2);
}
}
- if ($symfile->has_lost_symbols($ref_symfile)) {
- warning(_g("some symbols disappeared in the symbols file."));
+ if (my @syms = $symfile->get_lost_symbols($ref_symfile)) {
+ my $list = _g("see diff output below");
+ if ($symfile->used_wildcards()) {
+ # If wildcards are used, we don't get a diff, so list
+ # explicitely symbols which are lost
+ $list = "\n";
+ my $cur_soname = "";
+ foreach my $sym (sort { $a->{soname} cmp $b->{soname} or
+ $a->{name} cmp $b->{name} } @syms) {
+ if ($cur_soname ne $sym->{soname}) {
+ $list .= $sym->{soname} . "\n";
+ $cur_soname = $sym->{soname};
+ }
+ $list .= " " . $sym->{name} . "\n";
+ }
+ }
+ warning(_g("some symbols disappeared in the symbols file: %s"), $list);
$exitcode = 1 if ($compare >= 1);
}
unless ($symfile->used_wildcards()) {
# Output diffs between symbols files if any
if ($md5_before->hexdigest() ne $md5_after->hexdigest()) {
if (defined($ref_symfile->{file})) {
- warning(_g("%s doesn't match completely %s\n"),
+ warning(_g("%s doesn't match completely %s"),
$output, $ref_symfile->{file});
} else {
- warning(_g("no debian/symbols file used as basis for generating %s\n"),
+ warning(_g("no debian/symbols file used as basis for generating %s"),
$output);
}
my ($a, $b) = ($before->filename, $after->filename);
$sym_file->merge_symbols($obj, "2.6-1");
-ok( $sym_file->has_new_symbols($sym_file_old), 'has new symbols' );
-ok( $sym_file_old->has_lost_symbols($sym_file), 'has lost symbols' );
+ok( $sym_file->get_new_symbols($sym_file_old), 'has new symbols' );
+ok( $sym_file_old->get_lost_symbols($sym_file), 'has lost symbols' );
is( $sym_file_old->lookup_symbol('__bss_start@Base', ['libc.so.6']),
undef, 'internal symbols are blacklisted');