[Reproducible-commits] [dpkg] 89/105: dpkg-shlibdeps: Add new -I option to ignore package build directories

Niko Tyni ntyni at moszumanska.debian.org
Mon May 2 13:49:56 UTC 2016


This is an automated email from the git hooks/post-receive script.

ntyni pushed a commit to branch ntyni/reproducible_builds
in repository dpkg.

commit 5792b38b091945aaf13082c5749194417d4aaec3
Author: Guillem Jover <guillem at debian.org>
Date:   Sat Apr 16 12:19:17 2016 +0200

    dpkg-shlibdeps: Add new -I option to ignore package build directories
    
    This option can be used to completely ignore local package build trees,
    for example in cases where've got multiple compatible builds of the same
    shared library, which provide use the same SONAME, and we want all our
    local objects to use the same single library instead of whatever came
    first. Using -x in the above case does not work, because that just
    removes the dependency after processing, so we end up with missing
    dependencies.
    
    Closes: #821025
---
 debian/changelog          |  2 ++
 man/dpkg-shlibdeps.1      |  5 +++++
 scripts/dpkg-shlibdeps.pl | 31 +++++++++++++++++++++++--------
 3 files changed, 30 insertions(+), 8 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 89d14a7..3985ff3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -77,6 +77,8 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
   * Add support for a new --build option to define build type by a
     comma-separated list of components (“source”, “any”, “all”, “binary” or
     “full”) in dpkg-genchanges and dpkg-buildpackage.
+  * Add new -I option to dpkg-shlibdeps to ignore package build directories.
+    Closes: #821025
   * Portability:
     - Move DPKG_ADMINDIR environment variable name out from update-alternatives
       code, to make life easier for non-dpkg-based systems.
diff --git a/man/dpkg-shlibdeps.1 b/man/dpkg-shlibdeps.1
index fb59dad..77c47b7 100644
--- a/man/dpkg-shlibdeps.1
+++ b/man/dpkg-shlibdeps.1
@@ -232,6 +232,11 @@ and you want to ensure that you get the dependency from a given binary
 package. You can use this option multiple times: directories will be
 tried in the same order before directories of other binary packages.
 .TP
+.BI \-I package-build-dir
+Ignore \fIpackage-build-dir\fP when looking for shlibs, symbols, and shared
+library files (since dpkg 1.18.5).
+You can use this option multiple times.
+.TP
 .BI \-\-ignore\-missing\-info
 Do not fail if dependency information can't be found for a shared library
 (since dpkg 1.14.8).
diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl
index 8c83025..3204026 100755
--- a/scripts/dpkg-shlibdeps.pl
+++ b/scripts/dpkg-shlibdeps.pl
@@ -71,15 +71,10 @@ my $warnings = WARN_SYM_NOT_FOUND | WARN_DEP_AVOIDABLE;
 my $debug = 0;
 my @exclude = ();
 my @pkg_dir_to_search = ();
+my @pkg_dir_to_ignore = ();
 my $host_arch = get_host_arch();
 
 my (@pkg_shlibs, @pkg_symbols, @pkg_root_dirs);
-if (-d 'debian') {
-    push @pkg_symbols, glob 'debian/*/DEBIAN/symbols';
-    push @pkg_shlibs, glob 'debian/*/DEBIAN/shlibs';
-    my %uniq = map { guess_pkg_root_dir($_) => 1 } (@pkg_symbols, @pkg_shlibs);
-    push @pkg_root_dirs, keys %uniq;
-}
 
 my ($stdout, %exec);
 foreach (@ARGV) {
@@ -93,6 +88,8 @@ foreach (@ARGV) {
 	Dpkg::Shlibs::add_library_dir($1);
     } elsif (m/^-S(.*)$/) {
 	push @pkg_dir_to_search, $1;
+    } elsif (m/^-I(.*)$/) {
+	push @pkg_dir_to_ignore, $1;
     } elsif (m/^-O$/) {
 	$stdout = 1;
     } elsif (m/^-O(.+)$/) {
@@ -146,6 +143,18 @@ foreach (@ARGV) {
 }
 usageerr(g_('need at least one executable')) unless scalar keys %exec;
 
+sub ignore_pkgdir {
+    my $path = shift;
+    return any { $path =~ /^\Q$_\E/ } @pkg_dir_to_ignore;
+}
+
+if (-d 'debian') {
+    push @pkg_symbols, grep { !ignore_pkgdir($_) } glob 'debian/*/DEBIAN/symbols';
+    push @pkg_shlibs, grep { !ignore_pkgdir($_) } glob 'debian/*/DEBIAN/shlibs';
+    my %uniq = map { guess_pkg_root_dir($_) => 1 } (@pkg_symbols, @pkg_shlibs);
+    push @pkg_root_dirs, keys %uniq;
+}
+
 my $control = Dpkg::Control::Info->new();
 my $fields = $control->get_source();
 my $bd_value = deps_concat($fields->{'Build-Depends'}, $fields->{'Build-Depends-Arch'});
@@ -563,7 +572,9 @@ sub usage {
   -t<type>                 set package type (default is deb).
   -x<package>              exclude package from the generated dependencies.
   -S<package-build-dir>    search needed libraries in the given
-                           package build directory first.
+                             package build directory first.
+  -I<package-build-dir>    ignore needed libraries, shlibs and symbols files
+                             in the given build directory.
   -v                       enable verbose mode (can be used multiple times).
   --ignore-missing-info    don't fail if dependency information can't be found.
   --warnings=<value>       define set of active warnings (see manual page).
@@ -806,7 +817,10 @@ sub my_find_library {
     # - package build tree of the binary which is analyzed
     # - package build tree given on the command line (option -S)
     # - other package build trees that contain either a shlibs or a
-    # symbols file
+    #   symbols file
+    # But ignore:
+    # - package build tree given on the command line (option -I)
+
     my @builddirs;
     my $pkg_root = guess_pkg_root_dir($execfile);
     push @builddirs, $pkg_root if defined $pkg_root;
@@ -815,6 +829,7 @@ sub my_find_library {
     my %dir_checked;
     foreach my $builddir (@builddirs) {
 	next if defined($dir_checked{$builddir});
+	next if ignore_pkgdir($builddir);
 	$file = find_library($lib, \@RPATH, $format, $builddir);
 	return $file if defined($file);
 	$dir_checked{$builddir} = 1;

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git



More information about the Reproducible-commits mailing list