Explorar o código

Merge branch 'master' of git://git.debian.org/git/dpkg/dpkg into sourcev3

Joey Hess %!s(int64=18) %!d(string=hai) anos
pai
achega
d9b20d99c5

+ 174 - 35
ChangeLog

@@ -1,17 +1,140 @@
+2007-11-24  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/dpkg-gensymbols.pl: Add a new -I<file> option to force
+	the usage of a specific file as basis for the generated symbols
+	file.
+
+2007-11-24  Guillem Jover  <guillem@debian.org>
+
+	* configure.ac: Bump version to 1.14.12~.
+
+2007-11-24  Guillem Jover  <guillem@debian.org>
+
+	* configure.ac: Release 1.14.11.
+
+2007-11-24  Guillem Jover  <guillem@debian.org>
+
+	* scripts/Makefile.am (clean-local): Run chmod only if t.tmp exists.
+
+2007-11-24  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-scanpackages.pl (%vercache): Declare with 'my' instead
+	of 'our'.
+	* scripts/dpkg-shlibdeps.pl ($host_arch): Likewise.
+
+2007-11-24  Guillem Jover  <guillem@debian.org>
+
+	* scripts/Dpkg/Arch.pm (get_raw_host_arch): Do not shadow
+	$gcc_host_gnu_type with a local variable.
+
+2007-11-24  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-scanpackages.pl: Use parenthesis to force the
+	precedence when checking if the specified override file exists.
+
+2007-11-24  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-scanpackages.pl: Do not require controllib.pl anymore.
+
+2007-11-23  Aaron M. Ucko  <ucko@debian.org>
+
+	* scripts/dpkg-shlibdeps.pl: Optimize "dpkg -S" lookups by caching
+	results.
+
+2007-11-23  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/dpkg-shlibdeps.pl: Limit the number of warnings
+	displayed about symbols not found in libraries to 10 per binary.
+
+2007-11-23  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/dpkg-shlibdeps.pl: Look for libs in the package's build
+	tree even if that package doesn't contain an shlibs file. Then
+	don't complain about missing dependency information if the lib is in
+	the same package than the binary. Also ignore it if the library is
+	not versionned and can't have an shlibs file.
+	* scripts/Dpkg/Path.pm (guess_pkg_root_dir)
+	(check_files_are_the_same): New helper functions.
+
+2007-11-23  Guillem Jover  <guillem@debian.org>
+
+	* configure.ac: Bump version to 1.14.11~.
+
+2007-11-23  Guillem Jover  <guillem@debian.org>
+
+	* configure.ac: Release 1.14.10.
+
+2007-11-23  Guillem Jover  <guillem@debian.org>
+
+	* scripts/Dpkg/Arch.pm (get_build_arch): Rename to ...
+	(get_raw_build_arch): ... this.
+	(get_build_arch): New function.
+	(get_host_arch): Rename to ...
+	(get_raw_host_arch): ... this. Use get_raw_build_arch instead of
+	get_build_arch.
+	(get_host_arch): New function.
+	(@EXPORT_OK): Add get_raw_build_arch and get_raw_host_arch.
+	* scripts/dpkg-architecture.pl: Import get_raw_build_arch and
+	get_raw_host_arch instead of get_build_arch and get_host_arch.
+	Fix all callers.
+
+2007-11-23  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-architecture.pl (%env): Rename to ...
+	(%v): ... this.
+	($deb_build_arch, $deb_build_arch_os, $deb_build_arch_cpu)
+	($deb_build_gnu_cpu, deb_build_gnu_system, deb_build_gnu_type)
+	($deb_host_arch, $deb_host_arch_os, $deb_host_arch_cpu)
+	($deb_host_gnu_cpu, $deb_host_gnu_system, $deb_host_gnu_type): Use
+	the %v hash to store those variables using the values from @ordered
+	as keys.
+	($abi): New variable.
+
+2007-11-23  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-gensymbols.pl (@librarypaths): Remove duplicated
+	declaration.
+
+2007-11-23  Guillem Jover  <guillem@debian.org>
+
+	* scripts/Dpkg/Fields.pm (%fieldimps): Declare with 'my' instead
+	of 'our'.
+
+2007-11-22  Guillem Jover  <guillem@debian.org>
+
+	* scripts/dpkg-name.sh (getname): Get the package extension from the
+	Package-Type field, or fallback to deb if not present.
+
+2007-11-22  Raphael Hertzog  <hertzog@debian.org>
+
+	* scripts/dpkg-shlibdeps.pl: Add more debug messages. Accept empty
+	dependencies in shlibs files again. When symlinks to libraries are
+	not found by "dpkg -S", try the same on the realpath of the
+	library as fallback before deciding that it's a library being
+	built.
+	* scripts/Dpkg/Shlibs.pm: Always add paths from LD_LIBRARY_PATH
+	at the beginning of the list of path to search, even if they
+	are already listed (one might want to use LD_LIBRARY_PATH to
+	change the search order).
+	* scripts/dpkg-source.pl: Fix regex used to identify the extension
+	of the orig.tar.{gz,bz2,lzma} file.
+
 2007-11-21  Raphael Hertzog  <hertzog@debian.org>
 
-	* scripts/Dpkg/Shlibs/Objdump.pm: Fix the checks in is_executable() and
-	is_public_library().
+	* scripts/Dpkg/Shlibs/Objdump.pm (reset): Initialize HASH, GNU_HASH,
+	SONAME and flags.
+	(is_executable, is_public_library): Fix the checks.
 	* scripts/t/200_Dpkg_Shlibs.t: Add some more tests to make sure
 	the above functions behave as expected.
 	* scripts/t/400_Dpkg_Deps.t: Add some more tests to make sure that
 	empty dependency fields are correctly handled.
-	* scripts/Makefile.am: Include the new data files required by the
-	tests above.
-	* scrips/Dpkg/Fields.pm: New module containing 3 functions moved
-	out of controllib.pl (capit(), set_field_importance(),
-	sort_by_field_importance()).
-	* scripts/controllib.pl: Removed the 3 functions above.
+	* scripts/t/200_Dpkg_Shlibs/objdump.dbd-pg: New file.
+	* scripts/t/200_Dpkg_Shlibs/objdump.ls: Likewise.
+	* scripts/Makefile.am (EXTRA_DIST): Include
+	't/200_Dpkg_Shlibs/objdump.dbd-pg' and 't/200_Dpkg_Shlibs/objdump.ls'.
+	* scripts/controllib.pl (capit, set_field_importance)
+	(sort_by_field_importance): Move functions to ...
+	* scrips/Dpkg/Fields.pm: ... here. New file.
 	* scripts/dpkg-shlibdeps.pl: Use Dpkg::Fields for capit().
 	* scripts/dpkg-genchanges.pl: Use Dpkg::Fields for capit() and
 	set_field_importance().
@@ -117,18 +240,17 @@
 
 2007-10-18  Raphael Hertzog  <hertzog@debian.org>
 
-	* scripts/Dpkg/Deps.pm: new module to handle dependencies, to
-	evaluate them and check implications between them.
-	* scripts/t/400_Dpkg_Deps.t: non-regression tests for Dpkg::Deps.
-	* scripts/dpkg-checkbuilddeps.pl: adapted to use the new
+	* scripts/controllib.pl (parsedep, showdep): Remove unused functions.
+	(@pkg_dep_fields, @src_dep_fields): Move variables to ...
+	* scripts/Dpkg/Deps.pm: ... here. New file.
+	* scripts/t/400_Dpkg_Deps.t: New file.
+	* scripts/dpkg-checkbuilddeps.pl: Adapted to use the new
 	Dpkg::Deps module.
 	* scripts/dpkg-source.pl: Likewise.
 	* scripts/dpkg-scanpackages.pl: Likewise.
 	* scripts/dpkg-gencontrol.pl: Likewise. Also gains new features
 	such as automatic simplification of dependencies.
-	* scripts/controllib.pl: remove unused parsedep(), showdep(),
-	@pkg_dep_fields and @src_dep_fields.
-	* man/dpkg-gencontrol.1: document the new behaviour with
+	* man/dpkg-gencontrol.1: Document the new behaviour with
 	dependency fields.
 
 2007-10-18  Guillem Jover  <guillem@debian.org>
@@ -147,17 +269,17 @@
 
 2007-10-15  Raphael Hertzog  <hertzog@debian.org>
 
-	* scripts/Dpkg/Version.pm: fix compare_versions to handle properly
-	  the >= cases (it was improperly handled like >> due to a bad regexp).
-	* debian/rules: include cputable ostable triplettable in
+	* scripts/Dpkg/Version.pm: Fix compare_versions to handle properly
+	the >= cases (it was improperly handled like >> due to a bad regexp).
+	* debian/rules: Include cputable ostable triplettable in
 	build-tree so that they are available during make check (Dpkg.pm
 	exports ".." as $pkgdatadir during tests).
-	* scripts/dpkg-shlibdeps.pl: bugfix, avoid unwanted modification
-	of @pkg_shlibs by my_find_library.
+	* scripts/dpkg-shlibdeps.pl (my_find_library): Avoid unwanted
+	modification of @pkg_shlibs.
 
 2007-10-14  Raphael Hertzog  <hertzog@debian.org>
 
-	* scripts/Dpkg/Version.pm: mark compare_versions as exportable.
+	* scripts/Dpkg/Version.pm: Mark compare_versions as exportable.
 
 2007-10-13  Guillem Jover  <guillem@debian.org>
 
@@ -265,7 +387,7 @@
 	* scripts/dpkg-source.pl (usage): -W is the default
 	for quite some time already. Adapt the description of
 	-W and -E.
-	* scripts/dpkg-buildpackage.pl (usage): likewise.
+	* scripts/dpkg-buildpackage.pl (usage): Likewise.
 
 	* scripts/dpkg-buildpackage.pl: Add -z/-Z to
 	passthrough opts (will be passed to dpkg-source).
@@ -282,20 +404,37 @@
 2007-10-08  Raphael Hertzog  <hertzog@debian.org>
 	    Frank Lichtenheld  <djpig@debian.org>
 
-	* Merge dpkg-shlibdeps-buxy branch.
-
-	* scripts/dpkg-shlibdeps.pl: heavily reworked to support "symbols"
-	files. Lots of the code has been modularized in perl modules
-	Dpkg::Shlibs::*.
-
-	* scripts/dpkg-gensymbols.pl: new script used to generated symbols
-	files at package build time. It shall be used by packages of libraries.
+	Merge dpkg-shlibdeps-buxy branch.
 
-	* man/dpkg-{shlibdeps,gensymbols}.1: updated and created manual
-	pages documenting the changes above.
-
-	* scripts/t/*: Added some non-regression test on many parts of the
-	newly introduced perl modules.
+	* scripts/Dpkg/ErrorHandling.pm: New file.
+	* scripts/Dpkg/Gettext.pm: Likewise.
+	* scripts/Dpkg/Path.pm: Likewise.
+	* scripts/Dpkg/Shlibs.pm: Likewise.
+	* scripts/Dpkg/Shlibs/Objdump.pm: Likewise.
+	* scripts/Dpkh/Shlibs/SymbolFile.pm: Likewise.
+	* scripts/Dpkg/Version.pm: Likewise.
+
+	* scripts/dpkg-shlibdeps.pl: Add support for "symbols" files.
+	* man/dpkg-shlibdeps.1: Document "symbols" files support.
+
+	* scripts/dpkg-gensymbols.pl: New file.
+	* man/dpkg-gensymbols.1: Likewise.
+
+	* scripts/t/000_pod.t: New file.
+	* scripts/t/100_Dpkg_Version.t: Likewise.
+	* scripts/t/200_Dpkg_Shlibs.t: Likewise.
+	* scripts/t/200_Dpkg_Shlibs/ld.so.conf: Likewise.
+	* scripts/t/200_Dpkg_Shlibs/ld.so.conf_2: Likewise.
+	* scripts/t/200_Dpkg_Shlibs/ld.so.conf.d/inf_recurse.conf: Likewise.
+	* scripts/t/200_Dpkg_Shlibs/ld.so.conf.d/normal.conf: Likewise.
+	* scripts/t/200_Dpkg_Shlibs/ld.so.conf.d/recursive.conf: Likewise.
+	* scripts/t/200_Dpkg_Shlibs/objdump.glib-ia64: Likewise.
+	* scripts/t/200_Dpkg_Shlibs/objdump.libc6-2.3: Likewise.
+	* scripts/t/200_Dpkg_Shlibs/objdump.libc6-2.6: Likewise.
+	* scripts/t/200_Dpkg_Shlibs/symbols.fake-1: Likewise.
+	* scripts/t/200_Dpkg_Shlibs/symbols.fake-2: Likewise.
+	* scripts/t/200_Dpkg_Shlibs/symbols.include-1: Likewise.
+	* scripts/t/200_Dpkg_Shlibs/symbols.include-2: Likewise.
 
 2007-10-08  Guillem Jover  <guillem@debian.org>
 

+ 1 - 1
configure.ac

@@ -1,7 +1,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ(2.59)
-AC_INIT([dpkg], [1.14.10~], [debian-dpkg@lists.debian.org])
+AC_INIT([dpkg], [1.14.12~], [debian-dpkg@lists.debian.org])
 AC_CONFIG_SRCDIR([lib/dpkg.h])
 AC_CONFIG_MACRO_DIR([m4])
 AC_CONFIG_AUX_DIR([config])

+ 41 - 3
debian/changelog

@@ -1,10 +1,48 @@
-dpkg (1.14.10) UNRELEASED; urgency=low
+dpkg (1.14.12) UNRELEASED; urgency=low
+
+  *
+
+ -- Guillem Jover <guillem@debian.org>  Sat, 24 Nov 2007 07:38:13 +0200
+
+dpkg (1.14.11) unstable; urgency=low
+
+  [ Raphael Hertzog ]
+  * dpkg-shlibdeps now ignores the lack of dependency information in some
+    specific cases (instead of failing):
+    - when the library is in the same package than the binary analyzed
+    - when the library is not versionned and can't have a shlibs file
+  * dpkg-shlibdeps now only displays 10 warnings about symbols not found for
+    each binary and a count of skipped warnings. Closes: #452318
+  * dpkg-shlibdeps: optimize "dpkg -S" lookups by caching results, patch
+    from Aaron M. Ucko <ucko@debian.org>. Closes: #452577
+
+  [ Guillem Jover ]
+  * Fix dpkg-scanpackages to properly support an optional override file.
+    Closes: #452621
+
+ -- Guillem Jover <guillem@debian.org>  Sat, 24 Nov 2007 07:19:02 +0200
+
+dpkg (1.14.10) unstable; urgency=low
 
   [ Raphael Hertzog ]
   * dpkg-shlibdeps now correctly identify private libraries (avoid many
-    warnings with perl/python modules).
+    warnings with perl/python modules). Closes: #452338
   * Move capit() to a Dpkg::Fields module and use it in dpkg-shlibdeps.
     Closes: #452262
+  * Add more debug messages to dpkg-shlibdeps to ease collecting information
+    in case of problems.
+  * dpkg-shlibdeps now accepts again empty dependencies in shlibs files.
+  * dpkg-shlibdeps will try harder to identify packages providing a library
+    by looking up dpkg -S on the realpath of any symlink to a library.
+    Closes: #452339
+  * dpkg-source now correctly identifies the extension of the
+    orig.tar.{gz,bz2,lzma} file and won't unexpectedly create "Format: 2.0"
+    .dsc files.
+
+  [ Guillem Jover ]
+  * Add support for Package-Type in dpkg-name.
+  * Restore cross compilation support by honouring the environment host and
+    arch variables to override the default values on the dpkg-dev scripts.
 
   [ Updated man pages translations ]
   * Swedish (Peter Karlsson)
@@ -12,7 +50,7 @@ dpkg (1.14.10) UNRELEASED; urgency=low
   [ Added scripts translations ]
   * Swedish (Peter Karlsson)
 
- -- Guillem Jover <guillem@debian.org>  Tue, 20 Nov 2007 07:27:44 +0200
+ -- Guillem Jover <guillem@debian.org>  Fri, 23 Nov 2007 06:32:27 +0200
 
 dpkg (1.14.9) unstable; urgency=low
 

+ 8 - 0
man/ChangeLog

@@ -1,3 +1,11 @@
+2007-11-24  Raphael Hertzog  <hertzog@debian.org>
+
+	* dpkg-gensymbols.1: Document the new -I<file> option.
+
+2007-11-22  Guillem Jover  <guillem@debian.org>
+
+	* dpkg-name.1: Document that the Package-Type field is now supported.
+
 2007-11-02  Peter Karlsson  <peterk@debian.org>
 
 	* po/sv.po: Updated to 1344t.

+ 4 - 0
man/dpkg-gensymbols.1

@@ -117,6 +117,10 @@ libraries. You can use a regular expression in \fIlibrary-file\fR to match
 multiple libraries with a single argument (otherwise you need multiple
 \fB\-e\fR).
 .TP
+.BI \-I filename
+Use \fIfilename\fR as reference file to generate the symbols file
+that is integrated in the package itself.
+.TP
 .B \-O
 Print the generated symbols file to standard output, rather than being
 stored in the package build tree.

+ 6 - 5
man/dpkg-name.1

@@ -3,7 +3,7 @@
 .\"
 .\" This is free software; see the GNU General Public Licence version 2
 .\" or later for copying conditions.  There is NO warranty.
-.TH dpkg\-name 1 "2007-07-18" "Debian Project" "dpkg utilities"
+.TH dpkg\-name 1 "2007-11-22" "Debian Project" "dpkg utilities"
 .SH NAME
 dpkg\-name \- rename Debian packages to full package names
 .
@@ -20,10 +20,11 @@ This manual page documents the
 program which provides an easy way to rename
 .B Debian
 packages into their full package names. A full package name consists
-of \fI<package>_<version>_<architecture>.deb\fP as specified in the control
-file of the package. The \fI<version>\fP part of the filename consists of
-the upstream version information optionally followed by a hyphen and
-the revision information.
+of \fI<package>_<version>_<architecture>.<package_type>\fP as specified in
+the control file of the package. The \fI<version>\fP part of the filename
+consists of the upstream version information optionally followed by a
+hyphen and the revision information. The \fI<package_type>\fP part comes
+from that field if present or fallbacks to \fBdeb\fP.
 .
 .SH OPTIONS
 .TP

+ 16 - 5
scripts/Dpkg/Arch.pm

@@ -5,7 +5,8 @@ use warnings;
 
 use Exporter;
 our @ISA = qw(Exporter);
-our @EXPORT_OK = qw(get_build_arch get_host_arch get_gcc_host_gnu_type
+our @EXPORT_OK = qw(get_raw_build_arch get_raw_host_arch
+                    get_build_arch get_host_arch get_gcc_host_gnu_type
                     get_valid_arches debarch_eq debarch_is
                     debarch_to_gnutriplet gnutriplet_to_debarch
                     debtriplet_to_gnutriplet gnutriplet_to_debtriplet
@@ -27,7 +28,7 @@ my %debarch_to_debtriplet;
     my $host_arch;
     my $gcc_host_gnu_type;
 
-    sub get_build_arch()
+    sub get_raw_build_arch()
     {
 	return $build_arch if defined $build_arch;
 
@@ -39,6 +40,11 @@ my %debarch_to_debtriplet;
 	return $build_arch;
     }
 
+    sub get_build_arch()
+    {
+	return $ENV{DEB_BUILD_ARCH} || get_raw_build_arch();
+    }
+
     sub get_gcc_host_gnu_type()
     {
 	return $gcc_host_gnu_type if defined $gcc_host_gnu_type;
@@ -53,11 +59,11 @@ my %debarch_to_debtriplet;
 	return $gcc_host_gnu_type;
     }
 
-    sub get_host_arch()
+    sub get_raw_host_arch()
     {
 	return $host_arch if defined $host_arch;
 
-	my $gcc_host_gnu_type = get_gcc_host_gnu_type();
+	$gcc_host_gnu_type = get_gcc_host_gnu_type();
 
 	if ($gcc_host_gnu_type eq '') {
 	    warning(_g("Couldn't determine gcc system type, falling back to " .
@@ -77,11 +83,16 @@ my %debarch_to_debtriplet;
 
 	if (!defined($host_arch)) {
 	    # Switch to native compilation.
-	    $host_arch = get_build_arch();
+	    $host_arch = get_raw_build_arch();
 	}
 
 	return $host_arch;
     }
+
+    sub get_host_arch()
+    {
+	return $ENV{DEB_HOST_ARCH} || get_raw_host_arch();
+    }
 }
 
 sub get_valid_arches()

+ 1 - 1
scripts/Dpkg/Fields.pm

@@ -12,7 +12,7 @@ sub capit {
     return join '-', @pieces;
 }
 
-our %fieldimps;
+my %fieldimps;
 
 sub set_field_importance(@)
 {

+ 47 - 1
scripts/Dpkg/Path.pm

@@ -20,8 +20,10 @@ use strict;
 use warnings;
 
 use Exporter;
+use Cwd qw(realpath);
 our @ISA = qw(Exporter);
-our @EXPORT_OK = qw(get_pkg_root_dir relative_to_pkg_root);
+our @EXPORT_OK = qw(get_pkg_root_dir relative_to_pkg_root
+		    guess_pkg_root_dir check_files_are_the_same);
 
 =head1 NAME
 
@@ -73,6 +75,50 @@ sub relative_to_pkg_root($) {
     return undef;
 }
 
+=item guess_pkg_root_dir($file)
+
+This function tries to guess the root directory of the package build tree.
+It will first use get_pkg_root_dir(), but it will fallback to a more
+imprecise check: namely it will use the parent directory that is a
+sub-directory of the debian directory.
+
+It can still return undef if a file outside of the debian sub-directory is
+provided.
+
+=cut
+sub guess_pkg_root_dir($) {
+    my $file = shift;
+    my $root = get_pkg_root_dir($file);
+    return $root if defined $root;
+
+    $file =~ s{/+$}{};
+    $file =~ s{/+[^/]+$}{} if not -d $file;
+    my $parent = $file;
+    while ($file) {
+	$parent =~ s{/+[^/]+$}{};
+	last if not -d $parent;
+	return $file if check_files_are_the_same("debian", $parent);
+	$file = $parent;
+	last if $file !~ m{/};
+    }
+    return undef;
+}
+
+=item check_files_are_the_same($file1, $file2)
+
+This function verifies that both files are the same by checking that the device
+numbers and the inode numbers returned by lstat() are the same.
+
+=cut
+sub check_files_are_the_same($$) {
+    my ($file1, $file2) = @_;
+    return 0 if ((! -e $file1) || (! -e $file2));
+    my @stat1 = lstat($file1);
+    my @stat2 = lstat($file2);
+    my $result = ($stat1[0] == $stat2[0]) && ($stat1[1] == $stat2[1]);
+    return $result;
+}
+
 =back
 
 =head1 AUTHOR

+ 1 - 3
scripts/Dpkg/Shlibs.pm

@@ -35,9 +35,7 @@ our @librarypaths = (DEFAULT_LIBRARY_PATH);
 if ($ENV{LD_LIBRARY_PATH}) {
     foreach my $path (reverse split( /:/, $ENV{LD_LIBRARY_PATH} )) {
 	$path =~ s{/+$}{};
-	unless (scalar grep { $_ eq $path } @librarypaths) {
-	    unshift @librarypaths, $path;
-	}
+	unshift @librarypaths, $path;
     }
 }
 

+ 1 - 1
scripts/Makefile.am

@@ -143,7 +143,7 @@ TEST_FILES= $(srcdir)/t/*.t
 TEST_VERBOSE= 0
 
 clean-local:
-	chmod -R +w t.tmp
+	[ ! -d t.tmp ] || chmod -R +w t.tmp
 	rm -fr t.tmp
 
 check: $(TEST_FILES) $(wildcard $(srcdir)/t/200_Dpkg_Shlibs/ld.so.conf*)

+ 31 - 52
scripts/dpkg-architecture.pl

@@ -25,7 +25,7 @@ use warnings;
 use Dpkg;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling qw(warning syserr usageerr);
-use Dpkg::Arch qw(get_build_arch get_host_arch get_gcc_host_gnu_type
+use Dpkg::Arch qw(get_raw_build_arch get_raw_host_arch get_gcc_host_gnu_type
                   get_valid_arches debarch_eq debarch_is debarch_to_debtriplet
                   debarch_to_gnutriplet gnutriplet_to_debarch);
 
@@ -123,11 +123,18 @@ while (@ARGV) {
 
 # Set default values:
 
-my $deb_build_arch = get_build_arch();
-my $deb_build_gnu_type = debarch_to_gnutriplet($deb_build_arch);
+my %v;
 
-my $deb_host_arch = get_host_arch();
-my $deb_host_gnu_type = debarch_to_gnutriplet($deb_host_arch);
+my @ordered = qw(DEB_BUILD_ARCH DEB_BUILD_ARCH_OS DEB_BUILD_ARCH_CPU
+                 DEB_BUILD_GNU_CPU DEB_BUILD_GNU_SYSTEM DEB_BUILD_GNU_TYPE
+                 DEB_HOST_ARCH DEB_HOST_ARCH_OS DEB_HOST_ARCH_CPU
+                 DEB_HOST_GNU_CPU DEB_HOST_GNU_SYSTEM DEB_HOST_GNU_TYPE);
+
+$v{DEB_BUILD_ARCH} = get_raw_build_arch();
+$v{DEB_BUILD_GNU_TYPE} = debarch_to_gnutriplet($v{DEB_BUILD_ARCH});
+
+$v{DEB_HOST_ARCH} = get_raw_host_arch();
+$v{DEB_HOST_GNU_TYPE} = debarch_to_gnutriplet($v{DEB_HOST_ARCH});
 
 # Set user values:
 
@@ -156,77 +163,49 @@ if ($req_host_gnu_type ne '' && $req_host_arch ne '') {
         if $dfl_host_gnu_type ne $req_host_gnu_type;
 }
 
-$deb_host_arch = $req_host_arch if $req_host_arch ne '';
-$deb_host_gnu_type = $req_host_gnu_type if $req_host_gnu_type ne '';
+$v{DEB_HOST_ARCH} = $req_host_arch if $req_host_arch ne '';
+$v{DEB_HOST_GNU_TYPE} = $req_host_gnu_type if $req_host_gnu_type ne '';
 
 my $gcc = get_gcc_host_gnu_type();
 
 warning(_g("Specified GNU system type %s does not match gcc system type %s."),
-        $deb_host_gnu_type, $gcc)
+        $v{DEB_HOST_GNU_TYPE}, $gcc)
     if !($req_is_arch or $req_eq_arch) &&
-       ($gcc ne '') && ($gcc ne $deb_host_gnu_type);
+       ($gcc ne '') && ($gcc ne $v{DEB_HOST_GNU_TYPE});
 
 # Split the Debian and GNU names
-my ($deb_host_arch_abi, $deb_host_arch_os, $deb_host_arch_cpu) = debarch_to_debtriplet($deb_host_arch);
-my ($deb_build_arch_abi, $deb_build_arch_os, $deb_build_arch_cpu) = debarch_to_debtriplet($deb_build_arch);
-my ($deb_host_gnu_cpu, $deb_host_gnu_system) = split(/-/, $deb_host_gnu_type, 2);
-my ($deb_build_gnu_cpu, $deb_build_gnu_system) = split(/-/, $deb_build_gnu_type, 2);
-
-my %env = ();
-if (!$force) {
-    $deb_build_arch = $ENV{DEB_BUILD_ARCH} if (exists $ENV{DEB_BUILD_ARCH});
-    $deb_build_arch_os = $ENV{DEB_BUILD_ARCH_OS} if (exists $ENV{DEB_BUILD_ARCH_OS});
-    $deb_build_arch_cpu = $ENV{DEB_BUILD_ARCH_CPU} if (exists $ENV{DEB_BUILD_ARCH_CPU});
-    $deb_build_gnu_cpu = $ENV{DEB_BUILD_GNU_CPU} if (exists $ENV{DEB_BUILD_GNU_CPU});
-    $deb_build_gnu_system = $ENV{DEB_BUILD_GNU_SYSTEM} if (exists $ENV{DEB_BUILD_GNU_SYSTEM});
-    $deb_build_gnu_type = $ENV{DEB_BUILD_GNU_TYPE} if (exists $ENV{DEB_BUILD_GNU_TYPE});
-    $deb_host_arch = $ENV{DEB_HOST_ARCH} if (exists $ENV{DEB_HOST_ARCH});
-    $deb_host_arch_os = $ENV{DEB_HOST_ARCH_OS} if (exists $ENV{DEB_HOST_ARCH_OS});
-    $deb_host_arch_cpu = $ENV{DEB_HOST_ARCH_CPU} if (exists $ENV{DEB_HOST_ARCH_CPU});
-    $deb_host_gnu_cpu = $ENV{DEB_HOST_GNU_CPU} if (exists $ENV{DEB_HOST_GNU_CPU});
-    $deb_host_gnu_system = $ENV{DEB_HOST_GNU_SYSTEM} if (exists $ENV{DEB_HOST_GNU_SYSTEM});
-    $deb_host_gnu_type = $ENV{DEB_HOST_GNU_TYPE} if (exists $ENV{DEB_HOST_GNU_TYPE});
-}
+my $abi;
 
-my @ordered = qw(DEB_BUILD_ARCH DEB_BUILD_ARCH_OS DEB_BUILD_ARCH_CPU
-                 DEB_BUILD_GNU_CPU DEB_BUILD_GNU_SYSTEM DEB_BUILD_GNU_TYPE
-                 DEB_HOST_ARCH DEB_HOST_ARCH_OS DEB_HOST_ARCH_CPU
-                 DEB_HOST_GNU_CPU DEB_HOST_GNU_SYSTEM DEB_HOST_GNU_TYPE);
+($abi, $v{DEB_HOST_ARCH_OS}, $v{DEB_HOST_ARCH_CPU}) = debarch_to_debtriplet($v{DEB_HOST_ARCH});
+($abi, $v{DEB_BUILD_ARCH_OS}, $v{DEB_BUILD_ARCH_CPU}) = debarch_to_debtriplet($v{DEB_BUILD_ARCH});
+($v{DEB_HOST_GNU_CPU}, $v{DEB_HOST_GNU_SYSTEM}) = split(/-/, $v{DEB_HOST_GNU_TYPE}, 2);
+($v{DEB_BUILD_GNU_CPU}, $v{DEB_BUILD_GNU_SYSTEM}) = split(/-/, $v{DEB_BUILD_GNU_TYPE}, 2);
 
-$env{'DEB_BUILD_ARCH'}=$deb_build_arch;
-$env{'DEB_BUILD_ARCH_OS'}=$deb_build_arch_os;
-$env{'DEB_BUILD_ARCH_CPU'}=$deb_build_arch_cpu;
-$env{'DEB_BUILD_GNU_CPU'}=$deb_build_gnu_cpu;
-$env{'DEB_BUILD_GNU_SYSTEM'}=$deb_build_gnu_system;
-$env{'DEB_BUILD_GNU_TYPE'}=$deb_build_gnu_type;
-$env{'DEB_HOST_ARCH'}=$deb_host_arch;
-$env{'DEB_HOST_ARCH_OS'}=$deb_host_arch_os;
-$env{'DEB_HOST_ARCH_CPU'}=$deb_host_arch_cpu;
-$env{'DEB_HOST_GNU_CPU'}=$deb_host_gnu_cpu;
-$env{'DEB_HOST_GNU_SYSTEM'}=$deb_host_gnu_system;
-$env{'DEB_HOST_GNU_TYPE'}=$deb_host_gnu_type;
+for my $k (@ordered) {
+    $v{$k} = $ENV{$k} if (defined ($ENV{$k}) && !$force);
+}
 
 if ($action eq 'l') {
     foreach my $k (@ordered) {
-	print "$k=$env{$k}\n";
+	print "$k=$v{$k}\n";
     }
 } elsif ($action eq 's') {
     foreach my $k (@ordered) {
-	print "$k=$env{$k}; ";
+	print "$k=$v{$k}; ";
     }
     print "export ".join(" ",@ordered)."\n";
 } elsif ($action eq 'u') {
     print "unset ".join(" ",@ordered)."\n";
 } elsif ($action eq 'e') {
-    exit !debarch_eq($deb_host_arch, $req_eq_arch);
+    exit !debarch_eq($v{DEB_HOST_ARCH}, $req_eq_arch);
 } elsif ($action eq 'i') {
-    exit !debarch_is($deb_host_arch, $req_is_arch);
+    exit !debarch_is($v{DEB_HOST_ARCH}, $req_is_arch);
 } elsif ($action eq 'c') {
-    @ENV{keys %env} = values %env;
+    @ENV{keys %v} = values %v;
     exec @ARGV;
 } elsif ($action eq 'q') {
-    if (exists $env{$req_variable_to_print}) {
-        print "$env{$req_variable_to_print}\n";
+    if (exists $v{$req_variable_to_print}) {
+        print "$v{$req_variable_to_print}\n";
     } else {
         die sprintf(_g("%s is not a supported variable name"), $req_variable_to_print);
     }

+ 6 - 2
scripts/dpkg-gensymbols.pl

@@ -18,7 +18,6 @@ require 'controllib.pl';
 
 our (%f, %fi);
 our %p2i;
-our @librarypaths;
 
 my $controlfile = 'debian/control';
 my $changelogfile = 'debian/changelog';
@@ -28,6 +27,7 @@ my $sourceversion;
 my $stdout;
 my $oppackage;
 my $compare = 1; # Bail on missing symbols by default
+my $input;
 my $output;
 my $debug = 0;
 my $host_arch = get_host_arch();
@@ -61,6 +61,8 @@ Options:
 			   (level goes from 0 for no check, to 4
 			   for all checks). By default checks at
 			   level 1.
+  -I<file>                 force usage of <file> as reference symbols
+                           file instead of the default file.
   -O<file>                 write to <file>, not .../DEBIAN/symbols.
   -O                       write to stdout, not .../DEBIAN/symbols.
   -d                       display debug information during work.
@@ -94,6 +96,8 @@ while (@ARGV) {
 	$packagebuilddir =~ s{/+$}{};
     } elsif (m/^-O$/) {
 	$stdout= 1;
+    } elsif (m/^-I(.+)$/) {
+	$input = $1;
     } elsif (m/^-O(.+)$/) {
 	$output= $1;
     } elsif (m/^-(h|-help)$/) {
@@ -122,7 +126,7 @@ if (not defined($oppackage)) {
 my $symfile = Dpkg::Shlibs::SymbolFile->new();
 my $ref_symfile = Dpkg::Shlibs::SymbolFile->new();
 # Load source-provided symbol information
-foreach my $file ($output, "debian/$oppackage.symbols.$host_arch",
+foreach my $file ($input, $output, "debian/$oppackage.symbols.$host_arch",
     "debian/symbols.$host_arch", "debian/$oppackage.symbols",
     "debian/symbols")
 {

+ 8 - 3
scripts/dpkg-name.sh

@@ -34,7 +34,7 @@ usage () {
 	echo "Usage: ${prog} <file>...
 
 ${purpose}
-file.deb changes to <package>_<version>_<architecture>.deb
+file.deb changes to <package>_<version>_<architecture>.<package_type>
 according to the ``underscores convention''.
 
 Options:
@@ -80,11 +80,16 @@ getname () {
 			a=`dpkg --print-architecture`;
 			stderr "assuming architecture \`"$a"' for \`"$1"'";
 		fi
+		t=`dpkg-deb -f -- "$1" package-type`
+		if [ -z "$t" ];
+		then
+			t=deb
+		fi
 		if [ -z "$noarchitecture" ];
 		then
-			tname=$p\_$v\_$a.deb;
+			tname=$p\_$v\_$a.$t;
 		else
-			tname=$p\_$v.deb
+			tname=$p\_$v.$t
 		fi
 	
 		name=`echo $tname|sed -e 's/ //g'`

+ 3 - 5
scripts/dpkg-scanpackages.pl

@@ -9,8 +9,6 @@ use Dpkg;
 use Dpkg::Gettext;
 use Dpkg::Deps qw(@pkg_dep_fields);
 
-push(@INC,$dpkglibdir);
-require 'controllib.pl';
 textdomain("dpkg-dev");
 
 my (@samemaint, @changedmaint);
@@ -137,12 +135,12 @@ my ($binarydir, $override, $pathprefix) = @ARGV;
 
 -d $binarydir or die sprintf(_g("Binary dir %s not found"),
                              $binarydir)."\n";
-defined $override and -e $override or
-    die sprintf(_g("Override file %s not found"), $override)."\n";
+defined($override) and (-e $override or
+    die(sprintf(_g("Override file %s not found"), $override) . "\n"));
 
 $pathprefix = '' if not defined $pathprefix;
 
-our %vercache;
+my %vercache;
 sub vercmp {
      my ($a,$b)=@_;
      return $vercache{$a}{$b} if exists $vercache{$a}{$b};

+ 89 - 23
scripts/dpkg-shlibdeps.pl

@@ -5,10 +5,12 @@ use warnings;
 
 use English;
 use POSIX qw(:errno_h :signal_h);
+use Cwd qw(realpath);
 use Dpkg;
 use Dpkg::Gettext;
 use Dpkg::ErrorHandling qw(warning error failure syserr usageerr);
-use Dpkg::Path qw(relative_to_pkg_root);
+use Dpkg::Path qw(relative_to_pkg_root guess_pkg_root_dir
+		  check_files_are_the_same);
 use Dpkg::Version qw(vercmp);
 use Dpkg::Shlibs qw(find_library);
 use Dpkg::Shlibs::Objdump;
@@ -16,8 +18,6 @@ use Dpkg::Shlibs::SymbolFile;
 use Dpkg::Arch qw(get_host_arch);
 use Dpkg::Fields qw(capit);
 
-our $host_arch= get_host_arch();
-
 # By increasing importance
 my @depfields= qw(Suggests Recommends Depends Pre-Depends);
 my $i=0; my %depstrength = map { $_ => $i++ } @depfields;
@@ -34,6 +34,7 @@ my $varnameprefix= 'shlibs';
 my $ignore_missing_info= 0;
 my $debug= 0;
 my @exclude = ();
+my $host_arch = get_host_arch();
 
 my (@pkg_shlibs, @pkg_symbols);
 if (-d "debian") {
@@ -95,25 +96,39 @@ foreach my $file (keys %exec) {
 
     # Load symbols files for all needed libraries (identified by SONAME)
     my %libfiles;
+    my %altlibfiles;
     foreach my $soname (@sonames) {
 	my $lib = my_find_library($soname, $obj->{RPATH}, $obj->{format}, $file);
 	failure(_g("couldn't find library %s (note: only packages with " .
 	           "'shlibs' files are looked into)."), $soname)
 	    unless defined($lib);
-	$libfiles{$lib} = $soname if defined($lib);
+	$libfiles{$lib} = $soname;
+	if (-l $lib) {
+	    $altlibfiles{realpath($lib)} = $soname;
+	}
+	print "Library $soname found in $lib\n" if $debug;
     }
-    my $file2pkg = find_packages(keys %libfiles);
+    my $file2pkg = find_packages(keys %libfiles, keys %altlibfiles);
     my $symfile = Dpkg::Shlibs::SymbolFile->new();
     my $dumplibs_wo_symfile = Dpkg::Shlibs::Objdump->new();
     my @soname_wo_symfile;
     foreach my $lib (keys %libfiles) {
 	my $soname = $libfiles{$lib};
+	if (not exists $file2pkg->{$lib} and -l $lib) {
+	    # If the lib found is an unpackaged symlink, we try a fallback
+	    # on the realpath() first, maybe this one is part of a package
+	    my $reallib = realpath($lib);
+	    if (exists $file2pkg->{$reallib}) {
+		$file2pkg->{$lib} = $file2pkg->{$reallib};
+	    }
+	}
 	if (not exists $file2pkg->{$lib}) {
-	    # If the library is not available in an installed package,
+	    # If the library is really not available in an installed package,
 	    # it's because it's in the process of being built
 	    # Empty package name will lead to consideration of symbols
 	    # file from the package being built only
 	    $file2pkg->{$lib} = [""];
+	    print "No associated package found for $lib\n" if $debug;
 	}
 
 	# Load symbols/shlibs files from packages providing libraries
@@ -143,9 +158,23 @@ foreach my $file (keys %exec) {
 		my $libobj = $dumplibs_wo_symfile->get_object($id);
 		# Only try to generate a dependency for libraries with a SONAME
 		if ($libobj->is_public_library() and not add_shlibs_dep($soname, $pkg)) {
+		    # This failure is fairly new, try to be kind by
+		    # ignoring as many cases that can be safely ignored
+		    my $ignore = 0;
+		    # 1/ when the lib and the binary are in the same
+		    # package
+		    my $root_file = guess_pkg_root_dir($file);
+		    my $root_lib = guess_pkg_root_dir($lib);
+		    $ignore++ if defined $root_file and defined $root_lib
+			and check_files_are_the_same($root_file, $root_lib);
+		    # 2/ when the lib is not versioned and can't be
+		    # handled by shlibs
+		    $ignore++ unless scalar(split_soname($soname));
+		    # 3/ when we have been asked to do so
+		    $ignore++ if $ignore_missing_info;
 		    failure(_g("No dependency information found for %s " .
-		               "(used by %s)."), $soname, $file)
-		        unless $ignore_missing_info;
+		               "(used by %s)."), $lib, $file)
+		        unless $ignore;
 		}
 	    }
 	}
@@ -154,6 +183,8 @@ foreach my $file (keys %exec) {
     # Scan all undefined symbols of the binary and resolve to a
     # dependency
     my %used_sonames = map { $_ => 0 } @sonames;
+    my $nb_warnings = 0;
+    my $nb_skipped_warnings = 0;
     foreach my $sym ($obj->get_undefined_dynamic_symbols()) {
 	my $name = $sym->{name};
 	if ($sym->{version}) {
@@ -187,15 +218,23 @@ foreach my $file (keys %exec) {
 		    my $print_name = $name;
 		    # Drop the default suffix for readability
 		    $print_name =~ s/\@Base$//;
-		    warning(_g("symbol %s used by %s found in none of the " .
-		               "libraries."), $print_name, $file)
-		        unless $sym->{weak};
+		    unless ($sym->{weak}) {
+			if ($debug or $nb_warnings < 10) {
+			    warning(_g("symbol %s used by %s found in none of the " .
+				       "libraries."), $print_name, $file);
+			    $nb_warnings++;
+			} else {
+			    $nb_skipped_warnings++;
+			}
+		    }
 		}
 	    } else {
 		$used_sonames{$syminfo->{soname}}++;
 	    }
 	}
     }
+    warning(_g("%d other similar warnings have been skipped (use -v to see " .
+	    "them all)."), $nb_skipped_warnings) if $nb_skipped_warnings;
     # Warn about un-NEEDED libraries
     foreach my $soname (@sonames) {
 	unless ($used_sonames{$soname}) {
@@ -327,6 +366,7 @@ Dependency fields recognised are:
 
 sub add_shlibs_dep {
     my ($soname, $pkg) = @_;
+    print "Looking up shlibs dependency of $soname provided by '$pkg'\n" if $debug;
     foreach my $file ($shlibslocal, $shlibsoverride, @pkg_shlibs,
 			"$admindir/info/$pkg.shlibs",
 			$shlibsdefault)
@@ -334,24 +374,33 @@ sub add_shlibs_dep {
 	next if not -e $file;
 	my $dep = extract_from_shlibs($soname, $file);
 	if (defined($dep)) {
+	    print "Found $dep in $file\n" if $debug;
 	    foreach (split(/,\s*/, $dep)) {
 		$dependencies{$cur_field}{$_} = 1;
 	    }
 	    return 1;
 	}
     }
+    print "Found nothing\n" if $debug;
     return 0;
 }
 
+sub split_soname {
+    my $soname = shift;
+    if ($soname =~ /^(.*)\.so\.(.*)$/) {
+	return wantarray ? ($1, $2) : 1;
+    } elsif ($soname =~ /^(.*)-(\d.*)\.so$/) {
+	return wantarray ? ($1, $2) : 1;
+    } else {
+	return wantarray ? () : 0;
+    }
+}
+
 sub extract_from_shlibs {
     my ($soname, $shlibfile) = @_;
-    my ($libname, $libversion);
     # Split soname in name/version
-    if ($soname =~ /^(.*)\.so\.(.*)$/) {
-	$libname = $1; $libversion = $2;
-    } elsif ($soname =~ /^(.*)-(.*)\.so$/) {
-	$libname = $1; $libversion = $2;
-    } else {
+    my ($libname, $libversion) = split_soname($soname);
+    unless (defined $libname) {
 	warning(_g("Can't extract name and version from library name \`%s'"),
 	        $soname);
 	return;
@@ -364,11 +413,12 @@ sub extract_from_shlibs {
     while (<SHLIBS>) {
 	s/\s*\n$//;
 	next if m/^\#/;
-	if (!m/^\s*(?:(\S+):\s+)?(\S+)\s+(\S+)\s+(\S.*\S)\s*$/) {
+	if (!m/^\s*(?:(\S+):\s+)?(\S+)\s+(\S+)(?:\s+(\S.*\S))?\s*$/) {
 	    warning(_g("shared libs info file \`%s' line %d: bad line \`%s'"),
 	            $shlibfile, $., $_);
 	    next;
 	}
+	my $depread = defined($4) ? $4 : '';
 	if (($libname eq $2) && ($libversion eq $3)) {
 	    # Define dep and end here if the package type explicitely
 	    # matches. Otherwise if the packagetype is not specified, use
@@ -376,11 +426,11 @@ sub extract_from_shlibs {
 	    # line
 	    if (defined($1)) {
 		if ($1 eq $packagetype) {
-		    $dep = $4;
+		    $dep = $depread;
 		    last;
 		}
 	    } else {
-		$dep = $4 unless defined $dep;
+		$dep = $depread unless defined $dep;
 	    }
 	}
     }
@@ -447,10 +497,13 @@ sub my_find_library {
     }
 
     # Look into the packages we're currently building (but only those
-    # that provides shlibs file...)
+    # that provides shlibs file and the one that contains the binary being
+    # anlyzed...)
     # TODO: we should probably replace that by a cleaner way to look into
     # the various temporary build directories...
     my @copy = (@pkg_shlibs);
+    my $pkg_root = guess_pkg_root_dir($execfile);
+    unshift @copy, $pkg_root if defined $pkg_root;
     foreach my $builddir (map { s{/DEBIAN/shlibs$}{}; $_ } @copy) {
 	$file = find_library($lib, \@RPATH, $format, $builddir);
 	return $file if defined($file);
@@ -464,9 +517,22 @@ sub my_find_library {
     return undef;
 }
 
+my %cached_pkgmatch = ();
+
 sub find_packages {
-    my @files = (@_);
+    my @files;
     my $pkgmatch = {};
+
+    foreach (@_) {
+	if (exists $cached_pkgmatch{$_}) {
+	    $pkgmatch->{$_} = $cached_pkgmatch{$_};
+	} else {
+	    push @files, $_;
+	    $cached_pkgmatch{$_} = [""]; # placeholder to cache misses too.
+	}
+    }
+    return $pkgmatch unless scalar(@files);
+
     my $pid = open(DPKG, "-|");
     syserr(_g("cannot fork for dpkg --search")) unless defined($pid);
     if (!$pid) {
@@ -484,7 +550,7 @@ sub find_packages {
 	    print(STDERR " $_\n")
 		|| syserr(_g("write diversion info to stderr"));
 	} elsif (m/^([^:]+): (\S+)$/) {
-	    $pkgmatch->{$2} = [ split(/, /, $1) ];
+	    $cached_pkgmatch{$2} = $pkgmatch->{$2} = [ split(/, /, $1) ];
 	} else {
 	    warning(_g("unknown output from dpkg --search: '%s'"), $_);
 	}

+ 4 - 2
scripts/dpkg-source.pl

@@ -547,11 +547,13 @@ if ($opmode eq 'build') {
         $tardirbase= $origdirbase; $tardirname= $origdirname;
 
 	$tarname= $origtargz || "$basename.orig.tar.$comp_ext";
-	$tarname =~ /$basename.orig.tar.($comp_regex)/ ||
+	if ($tarname =~ /\Q$basename\E\.orig\.tar\.($comp_regex)/) {
+	    if (($1 ne 'gz') && ($f{'Format'} < 2)) { $f{'Format'} = '2.0' };
+	} else {
 	    warning(_g(".orig.tar name %s is not <package>_<upstreamversion>" .
 	               ".orig.tar (wanted %s)"),
 	            $tarname, "$basename.orig.tar.$comp_regex");
-	if (($1 ne 'gz') && ($f{'Format'} < 2)) { $f{'Format'} = '2.0' };
+	}
     } else {
 	$tardirbase= $dirbase; $tardirname= $dirname;
 	$tarname= "$basenamerev.tar.$comp_ext";