The branch, dpkg-shlibdeps-buxy has been updated
       via  b776c00b2570b0083172ea8a91820c9b34752624 (commit)
      from  9f4c19234c7608b052e3d1dd5b0441b0727666b2 (commit)


- Shortlog ------------------------------------------------------------
b776c00 Add "-x<package>" option to dpkg-shlibdeps to exlude packages

Summary of changes:
 man/dpkg-shlibdeps.1      |    7 ++++++
 scripts/dpkg-shlibdeps.pl |   49 ++++++++++++++++++++++++++++----------------
 2 files changed, 38 insertions(+), 18 deletions(-)
-----------------------------------------------------------------------
Details of changes:

commit b776c00b2570b0083172ea8a91820c9b34752624
Author: Raphael Hertzog <[EMAIL PROTECTED]>
Date:   Mon Sep 24 11:19:25 2007 +0200

    Add "-x<package>" option to dpkg-shlibdeps to exlude packages
    
    dpkg-shlibdeps now supports "-x<package>" options that can be used to 
exclude
    packages from generated dependencies. This is particalularly useful to
    avoid self-dependencies when a package contains a binary and a library 
(without
    requiring an shlibs.local file to override the usual shlibs file). It might
    also be used to avoid other unwanted dependencies (use with care though).
    Closes: #41907, #109954

diff --git a/man/dpkg-shlibdeps.1 b/man/dpkg-shlibdeps.1
index 488dc17..0f93495 100644
--- a/man/dpkg-shlibdeps.1
+++ b/man/dpkg-shlibdeps.1
@@ -166,6 +166,13 @@ Enable verbose mode. Numerous messages are displayed to 
explain what
 .B dpkg\-shlibdeps
 does.
 .TP
+.BI \-x package
+Exclude the package from the generated dependencies. This is useful to
+avoid self-dependencies for packages which provide ELF binaries
+(executables or library plugins) using a library contained in the same
+package. This option can be used multiple times to exclude several
+packages.
+.TP
 .BI \-\-admindir= dir
 Change the location of the \fBdpkg\fR database. The default location is
 \fI/var/lib/dpkg\fP.
diff --git a/scripts/dpkg-shlibdeps.pl b/scripts/dpkg-shlibdeps.pl
index c73d70a..9fa31e0 100755
--- a/scripts/dpkg-shlibdeps.pl
+++ b/scripts/dpkg-shlibdeps.pl
@@ -31,6 +31,7 @@ my $dependencyfield= 'Depends';
 my $varlistfile= 'debian/substvars';
 my $varnameprefix= 'shlibs';
 my $debug= 0;
+my @exclude = ();
 
 my (@pkg_shlibs, @pkg_symbols);
 if (-d "debian") {
@@ -67,6 +68,8 @@ foreach (@ARGV) {
        $packagetype = $1;
     } elsif (m/-v$/) {
        $debug = 1;
+    } elsif (m/-x(.*)$/) {
+       push @exclude, $1;
     } elsif (m/^-/) {
        usageerr(sprintf(_g("unknown option \`%s'"), $_));
     } else {
@@ -207,6 +210,31 @@ if ($stdout) {
 
 # Write out the shlibs substvars
 my %depseen;
+
+sub filter_deps {
+    my ($dep, $field) = @_;
+    # Skip dependencies on excluded packages
+    foreach my $exc (@exclude) {
+       return 0 if $dep =~ /^\s*\Q$exc\E\b/;
+    }
+    # Don't include dependencies if they are already
+    # mentionned in a higher priority field
+    if (not defined($depseen{$dep})) {
+       $depseen{$dep} = $dependencies{$field}{$dep};
+       return 1;
+    } else {
+       # Since dependencies can be versionned, we have to
+       # verify if the dependency is stronger than the
+       # previously seen one
+       if (vercmp($depseen{$dep}, $dependencies{$field}{$dep}) > 0) {
+           return 0;
+       } else {
+           $depseen{$dep} = $dependencies{$field}{$dep};
+           return 1;
+       }
+    }
+}
+
 foreach my $field (reverse @depfields) {
     my $dep = "";
     if (exists $dependencies{$field} and scalar keys %{$dependencies{$field}}) 
{
@@ -220,24 +248,8 @@ foreach my $field (reverse @depfields) {
                }
                s/\s+/ /g;
                $_;
-           } grep {
-               # Don't include dependencies if they are already
-               # mentionned in a higher priority field
-               if (not defined($depseen{$_})) {
-                   $depseen{$_} = $dependencies{$field}{$_};
-                   1;
-               } else {
-                   # Since dependencies can be versionned, we have to
-                   # verify if the dependency is stronger than the
-                   # previously seen one
-                   if (vercmp($depseen{$_}, $dependencies{$field}{$_}) > 0) {
-                       0;
-                   } else {
-                       $depseen{$_} = $dependencies{$field}{$_};
-                       1;
-                   }
-               }
-           } keys %{$dependencies{$field}};
+           } grep { filter_deps($_, $field) }
+           keys %{$dependencies{$field}};
     }
     if ($dep) {
        print $fh "$varnameprefix:$field=$dep\n";
@@ -286,6 +298,7 @@ Options:
   -L<localshlibsfile>      shlibs override file, not debian/shlibs.local.
   -T<varlistfile>          update variables here, not debian/substvars.
   -t<type>                 set package type (default is deb).
+  -x<package>              exclude package from the generated dependencies.
   --admindir=<directory>   change the administrative directory.
   -h, --help               show this help message.
       --version            show the version.

-- 
dpkg's main repository


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to