Просмотр исходного кода

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).
Raphael Hertzog лет назад: 18
Родитель
Сommit
7e9e9a72c9
4 измененных файлов с 34 добавлено и 6 удалено
  1. 10 0
      ChangeLog
  2. 4 0
      debian/changelog
  3. 4 2
      scripts/Dpkg/Path.pm
  4. 16 4
      scripts/dpkg-shlibdeps.pl

+ 10 - 0
ChangeLog

@@ -1,3 +1,13 @@
+2007-11-19  Raphael Hertzog  <hertzog@debian.org>
+
+	* 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  <guillem@debian.org>
 
 	* configure.ac: Bump version to 1.14.9~.

+ 4 - 0
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).
 

+ 4 - 2
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;
 }
 

+ 16 - 4
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;
     }