From: Raphael Hertzog Date: Thu, 3 Apr 2008 22:19:38 +0000 (+0200) Subject: dpkg-shlibdeps: initialize dependencies differently X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c87dde454cc53182afa4f373cebcb5c79e721531;p=dpkg dpkg-shlibdeps: initialize dependencies differently * scripts/Dpkg/Shlibs/SymbolFile.pm (get_smallest_version): New function to retrieve the smallest "minver" of all symbols of a given library. * scripts/dpkg-shlibdeps.pl: Do not initialize dependencies of libraries with symbols files as unversioned, instead use the smallest minimal version returned by the function above. This is required because the library might not have always been available in the package and the unversioned dependency thus doesn't ensure his presence. * scripts/t/800_Dpkg_IPC.t: Remove temporary files used by the tests. --- diff --git a/ChangeLog b/ChangeLog index cfdd9204..ce757b50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2008-04-04 Raphael Hertzog + + * scripts/Dpkg/Shlibs/SymbolFile.pm (get_smallest_version): New + function to retrieve the smallest "minver" of all symbols of a + given library. + * scripts/dpkg-shlibdeps.pl: Do not initialize dependencies of + libraries with symbols files as unversioned, instead use the + smallest minimal version returned by the function above. This + is required because the library might not have always been + available in the package and the unversioned dependency thus + doesn't ensure his presence. + + * scripts/t/800_Dpkg_IPC.t: Remove temporary files used by the + tests. + 2008-04-02 Sven Joachim * lib/triglib.c (trk_unknown_interest_change): Fix typo. diff --git a/debian/changelog b/debian/changelog index b547f17f..b6f454c2 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,11 @@ dpkg (1.14.18) UNRELEASED; urgency=low * Ensure the Files field is last in *.dsc and *.changes. This is a work-around for some braindead dsc parsers (dupload and sbuild for instance, see #473518 and #470440). + * Initialize dependencies for libraries having symbols files with the + smallest minimal version listed in the symbols file instead of using + an unversioned dependency. It's the only way to ensure the library + presence if it wasn't available in all versions of the package that ever + existed. Closes: #474079 [ Updated dselect translations ] * German. (Sven Joachim). diff --git a/scripts/Dpkg/Shlibs/SymbolFile.pm b/scripts/Dpkg/Shlibs/SymbolFile.pm index 5aac6810..7e068c66 100644 --- a/scripts/Dpkg/Shlibs/SymbolFile.pm +++ b/scripts/Dpkg/Shlibs/SymbolFile.pm @@ -304,6 +304,20 @@ sub get_dependency { return $self->{objects}{$soname}{deps}[$dep_id]; } +sub get_smallest_version { + my ($self, $soname, $dep_id) = @_; + $dep_id = 0 unless defined($dep_id); + my $minver; + foreach my $sym (values %{$self->{objects}{$soname}{syms}}) { + next if $dep_id != $sym->{dep_id}; + $minver ||= $sym->{minver}; + if (vercmp($minver, $sym->{minver}) > 0) { + $minver = $sym->{minver}; + } + } + return $minver; +} + sub get_dependencies { my ($self, $soname) = @_; return @{$self->{objects}{$soname}{deps}}; diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index 11a72df3..82a9a016 100755 --- a/scripts/dpkg-shlibdeps.pl +++ b/scripts/dpkg-shlibdeps.pl @@ -201,11 +201,15 @@ foreach my $file (keys %exec) { } } if (defined($dpkg_symfile) && $symfile->has_object($soname)) { - # Initialize dependencies as an unversioned dependency + # Initialize dependencies with the smallest minimal version + # of all symbols (unversioned dependency is not ok as the + # library might not have always been available in the + # package and we really need it) my $dep = $symfile->get_dependency($soname); + my $minver = $symfile->get_smallest_version($soname) || ''; foreach my $subdep (split /\s*,\s*/, $dep) { if (not exists $dependencies{$cur_field}{$subdep}) { - $dependencies{$cur_field}{$subdep} = ''; + $dependencies{$cur_field}{$subdep} = $minver; } } } else { diff --git a/scripts/t/800_Dpkg_IPC.t b/scripts/t/800_Dpkg_IPC.t index 30d74db1..85435aea 100644 --- a/scripts/t/800_Dpkg_IPC.t +++ b/scripts/t/800_Dpkg_IPC.t @@ -17,7 +17,7 @@ my $string = "foo\nbar\n"; my $string2; open TMP, '>', $tmp_name; -print TMP $string;; +print TMP $string; close TMP; my $pid = fork_and_exec(exec => "cat", @@ -54,3 +54,6 @@ $string2 = ; close TMP; is($string2, $string, "{from,to}_file"); + +unlink($tmp_name); +unlink($tmp2_name);