From: Raphael Hertzog Date: Mon, 19 Nov 2007 21:10:55 +0000 (+0100) Subject: Bug fix in Dpkg::Path::get_pkg_root_dir() and related changes in dpkg-shlibdeps X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7e9e9a72c90b7bf159a217d2009889f7f3984f98;p=dpkg Bug fix in Dpkg::Path::get_pkg_root_dir() and related changes in dpkg-shlibdeps * scripts/Dpkg/Path.pm: Fix behaviour of get_pkg_root_dir() when there's no DEBIAN subdirectory in none of the parent directories. * scripts/dpkg-shlibdeps.pl: Handle undef values returned by get_pkg_root_dir() and complain when it's likely to create a problem (when a RPATH contains $ORIGIN and when the value of this variable can't be determined because we don't know what is the root directory of the temporary tree). --- diff --git a/ChangeLog b/ChangeLog index a258fe82..1acb0919 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2007-11-19 Raphael Hertzog + + * scripts/Dpkg/Path.pm: Fix behaviour of get_pkg_root_dir() when + there's no DEBIAN subdirectory in none of the parent directories. + * scripts/dpkg-shlibdeps.pl: Handle undef values returned by + get_pkg_root_dir() and complain when it's likely to create a + problem (when a RPATH contains $ORIGIN and when the value of + this variable can't be determined because we don't know what + is the root directory of the temporary tree). + 2007-11-19 Guillem Jover * configure.ac: Bump version to 1.14.9~. diff --git a/debian/changelog b/debian/changelog index 1174a1d2..c07bcd45 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,9 @@ dpkg (1.14.9) UNRELEASED; urgency=low + [ Raphael Hertzog ] + * Fix bad behaviour of Dpkg::Path::get_pkg_root_dir() and adjust + dpkg-shlibdeps accordingly. + [ Updated man pages translations ] * German (Helge Kreutzmann). diff --git a/scripts/Dpkg/Path.pm b/scripts/Dpkg/Path.pm index 5422e0f7..32d57fc9 100644 --- a/scripts/Dpkg/Path.pm +++ b/scripts/Dpkg/Path.pm @@ -41,17 +41,19 @@ This function will scan upwards the hierarchy of directory to find out the directory which contains the "DEBIAN" sub-directory and it will return its path. This directory is the root directory of a package being built. +If no DEBIAN subdirectory is found, it will return undef. + =cut sub get_pkg_root_dir($) { my $file = shift; $file =~ s{/+$}{}; $file =~ s{/+[^/]+$}{} if not -d $file; - do { + while ($file) { return $file if -d "$file/DEBIAN"; last if $file !~ m{/}; $file =~ s{/+[^/]+$}{}; - } while ($file); + } return undef; } diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl index e152e0ff..1599aa6d 100755 --- a/scripts/dpkg-shlibdeps.pl +++ b/scripts/dpkg-shlibdeps.pl @@ -424,12 +424,24 @@ sub my_find_library { # Create real RPATH in case $ORIGIN is used # Note: ld.so also supports $PLATFORM and $LIB but they are # used in real case (yet) - my $origin = "/" . relative_to_pkg_root($execfile); - $origin =~ s{/+[^/]*$}{}; + my $libdir = relative_to_pkg_root($execfile); + my $origin; + if (defined $libdir) { + $origin = "/$libdir"; + $origin =~ s{/+[^/]*$}{}; + } my @RPATH = (); foreach my $path (@{$rpath}) { - $path =~ s/\$ORIGIN/$origin/g; - $path =~ s/\$\{ORIGIN\}/$origin/g; + if ($path =~ /\$ORIGIN|\$\{ORIGIN\}/) { + if (defined $origin) { + $path =~ s/\$ORIGIN/$origin/g; + $path =~ s/\$\{ORIGIN\}/$origin/g; + } else { + warning(_g("\$ORIGIN is used in RPATH of %s and the corresponding " . + "directory could not be identified due to lack of DEBIAN " . + "sub-directory in the root of package's build tree"), $execfile); + } + } push @RPATH, $path; }