Преглед на файлове

dpkg-shlibdeps: use get_control_path()

Do not hardcode the location of shlibs/symbols files. They are under the
control of dpkg. By using dpkg-query --control-path we ensure that we
always use the correct location.

Sponsored-by: Linaro Limited
Raphaël Hertzog преди 15 години
родител
ревизия
305d8090ca
променени са 3 файла, в които са добавени 13 реда и са изтрити 8 реда
  1. 2 0
      debian/changelog
  2. 4 4
      man/dpkg-shlibdeps.1
  3. 7 4
      scripts/dpkg-shlibdeps.pl

+ 2 - 0
debian/changelog

@@ -58,6 +58,8 @@ dpkg (1.16.0) UNRELEASED; urgency=low
     instead of -O2 when building ppc64 packages on Ubuntu. Closes: #612472
     instead of -O2 when building ppc64 packages on Ubuntu. Closes: #612472
   * Add new function get_control_path() to Dpkg::Path, it wraps dpkg-query
   * Add new function get_control_path() to Dpkg::Path, it wraps dpkg-query
     --control-path.
     --control-path.
+  * Update dpkg-shlibdeps to be multiarch-ready:
+    - use get_control_path() to find symbols/shlibs files
 
 
   [ Jonathan Nieder ]
   [ Jonathan Nieder ]
   * Remove support for use of synchronous sync(2), due to its pernicious
   * Remove support for use of synchronous sync(2), due to its pernicious

+ 4 - 4
man/dpkg-shlibdeps.1

@@ -62,9 +62,9 @@ other binary packages.
 Per-system overriding shared library dependency information.
 Per-system overriding shared library dependency information.
 \fIarch\fR is the architecture of the current system (obtained by
 \fIarch\fR is the architecture of the current system (obtained by
 .BR "dpkg-architecture -qDEB_HOST_ARCH" ).
 .BR "dpkg-architecture -qDEB_HOST_ARCH" ).
-.IP \fIadmindir\fR/info/\fIpackage\fR.symbols
+.IP File returned by dpkg-query --control-path \fIpackage\fR symbols
 Package-provided shared library dependency information.
 Package-provided shared library dependency information.
-Unless overridden, \fIadmindir\fR is /var/lib/dpkg.
+Unless overridden by --admindir, those files are located in /var/lib/dpkg.
 .P 
 .P 
 While scanning the symbols used by all binaries,
 While scanning the symbols used by all binaries,
 .B dpkg\-shlibdeps
 .B dpkg\-shlibdeps
@@ -96,9 +96,9 @@ Shared library information generated by the current build process that also invo
 They are only used if the library is found in a package's build tree. The
 They are only used if the library is found in a package's build tree. The
 shlibs file in that build tree takes precedence over shlibs files from
 shlibs file in that build tree takes precedence over shlibs files from
 other binary packages.
 other binary packages.
-.IP \fIadmindir\fR/info/\fIpackage\fR.shlibs
+.IP File returned by dpkg-query --control-path \fIpackage\fR shlibs
 Package-provided shared library dependency information.
 Package-provided shared library dependency information.
-Unless overridden, \fIadmindir\fR is /var/lib/dpkg.
+Unless overridden by --admindir, those files are located in /var/lib/dpkg.
 .IP /etc/dpkg/shlibs.default
 .IP /etc/dpkg/shlibs.default
 Per-system default shared library dependency information.
 Per-system default shared library dependency information.
 .P
 .P

+ 7 - 4
scripts/dpkg-shlibdeps.pl

@@ -26,7 +26,7 @@ use Dpkg;
 use Dpkg::Gettext;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling;
 use Dpkg::ErrorHandling;
 use Dpkg::Path qw(relative_to_pkg_root guess_pkg_root_dir
 use Dpkg::Path qw(relative_to_pkg_root guess_pkg_root_dir
-		  check_files_are_the_same);
+		  check_files_are_the_same get_control_path);
 use Dpkg::Version;
 use Dpkg::Version;
 use Dpkg::Shlibs qw(find_library @librarypaths);
 use Dpkg::Shlibs qw(find_library @librarypaths);
 use Dpkg::Shlibs::Objdump;
 use Dpkg::Shlibs::Objdump;
@@ -91,6 +91,7 @@ foreach (@ARGV) {
 	$admindir = $1;
 	$admindir = $1;
 	-d $admindir ||
 	-d $admindir ||
 	    error(_g("administrative directory '%s' does not exist"), $admindir);
 	    error(_g("administrative directory '%s' does not exist"), $admindir);
+	$ENV{'DPKG_ADMINDIR'} = $admindir;
     } elsif (m/^-d(.*)$/) {
     } elsif (m/^-d(.*)$/) {
 	$dependencyfield = field_capitalize($1);
 	$dependencyfield = field_capitalize($1);
 	defined($depstrength{$dependencyfield}) ||
 	defined($depstrength{$dependencyfield}) ||
@@ -635,7 +636,8 @@ sub add_shlibs_dep {
 	# Fallback to other shlibs files but it shouldn't be necessary
 	# Fallback to other shlibs files but it shouldn't be necessary
 	push @shlibs, @pkg_shlibs;
 	push @shlibs, @pkg_shlibs;
     } else {
     } else {
-	push @shlibs, "$admindir/info/$pkg.shlibs";
+	my $control_file = get_control_path($pkg, "shlibs");
+	push @shlibs, $control_file if defined $control_file;
     }
     }
     push @shlibs, $shlibsdefault;
     push @shlibs, $shlibsdefault;
     print " Looking up shlibs dependency of $soname provided by '$pkg'\n" if $debug;
     print " Looking up shlibs dependency of $soname provided by '$pkg'\n" if $debug;
@@ -723,8 +725,9 @@ sub find_symbols_file {
 	push @files, @pkg_symbols;
 	push @files, @pkg_symbols;
     } else {
     } else {
 	push @files, "/etc/dpkg/symbols/$pkg.symbols.$host_arch",
 	push @files, "/etc/dpkg/symbols/$pkg.symbols.$host_arch",
-	    "/etc/dpkg/symbols/$pkg.symbols",
-	    "$admindir/info/$pkg.symbols";
+	    "/etc/dpkg/symbols/$pkg.symbols";
+	my $control_file = get_control_path($pkg, "symbols");
+	push @files, $control_file if defined $control_file;
     }
     }
 
 
     foreach my $file (@files) {
     foreach my $file (@files) {