Bug#622852: dh-make-perl: Debian::AptContents misses some alternative packages

Manfred Stock manfred.stock+debian at gmail.com
Fri Apr 15 08:27:58 UTC 2011


Package: dh-make-perl
Version: 0.70-1
Severity: normal
Tags: patch

Debian::AptContents fails to find alternative packages if they install the
required module to different locations. One such example is Image::Magick which
is available from perlmagick and graphicsmagick-libmagick-dev-compat -
perlmagick installs Image/Magick.pm to /usr/lib, but
graphicsmagick-libmagick-dev-compat installs it to /usr/share. This case is not
correctly handled by the read_cache() method from Debian::AptContents, as it
overwrites an existing entry for eg. Image/Magick.pm in the apt_contents cache
if the 'same' file is found a second time, in another directory. The result is
that instead of a dependency to 'graphicsmagick-libmagick-dev-compat |
perlmagick', I only get 'graphicsmagick-libmagick-dev-compat'. The same issue
arises if different Contents files contain the same module, but in different
packages. The attached patch should provide a fix for this problem.


Regards,
Manfred

-- System Information:
Debian Release: 6.0.1
  APT prefers stable
  APT policy: (990, 'stable'), (500, 'stable-updates')
Architecture: amd64 (x86_64)

Kernel: Linux 2.6.26-2-amd64 (SMP w/2 CPU cores)
Locale: LANG=de_CH.utf8, LC_CTYPE=de_CH.utf8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages dh-make-perl depends on:
ii  debhelper                     8.0.0      helper programs for debian/rules
ii  dpkg-dev                      1.15.8.10  Debian package development tools
ii  fakeroot                      1.14.4-1   Gives a fake root environment
ii  libapt-pkg-perl               0.1.24+b1  Perl interface to libapt-pkg
ii  libarray-unique-perl          0.08-1     Tie-able array that allows only un
ii  libclass-accessor-perl        0.34-1     Perl module that automatically gen
ii  libdpkg-perl                  1.15.8.10  Dpkg perl modules
ii  libemail-date-format-perl     1.002-1    Module to generate RFC-2822-valid 
ii  liblist-moreutils-perl        0.25~02-1  Perl module with additional list f
ii  libmodule-depends-perl        0.14-3     identify the dependencies of a dis
ii  libparse-debcontrol-perl      2.005-2    Easy OO parsing of Debian control-
ii  libparse-debianchangelog-perl 1.1.1-2.1  parse Debian changelogs and output
ii  libtie-ixhash-perl            1.21-2     ordered associative arrays for Per
ii  libwww-mechanize-perl         1.64-1     module to automate interaction wit
ii  libyaml-perl                  0.71-1     YAML Ain't Markup Language
ii  make                          3.81-8     An utility for Directing compilati
ii  perl                          5.10.1-17  Larry Wall's Practical Extraction 
ii  perl-modules [libmodule-corel 5.10.1-17  Core Perl modules

Versions of packages dh-make-perl recommends:
ii  apt-file                      2.4.0      search for files within Debian pac

dh-make-perl suggests no packages.

-- no debconf information
-------------- next part --------------
>From 9fb611f272e03dc1af3d217428d565b0454cb6ca Mon Sep 17 00:00:00 2001
From: Manfred Stock <manfred.stock+debian at gmail.com>
Date: Thu, 14 Apr 2011 18:28:04 +0200
Subject: [PATCH] Prevent missed alternative dependencies from contents

The perlmagick and graphicsmagick-libmagick-dev-compat packages both contain
Image::Magick, but perlmagick installs it to /usr/lib while
graphicsmagick-libmagick-dev-compat installs it to /usr/share. Unfortunately,
the read_cache method from Debian::AptContents overwrote the Image/Magick.pm
entry from perlmagick with the one from graphicsmagick-libmagick-dev-compat,
which resulted in the missing alternative dependency to perlmagick. Other
alternative package combinations might be affected in a similar way.
---
 lib/Debian/AptContents.pm                     |    6 ++++--
 t/AptContents.t                               |   13 ++++++++++++-
 t/contents/test_debian_dists_testing_Contents |    3 +++
 3 files changed, 19 insertions(+), 3 deletions(-)

diff --git a/lib/Debian/AptContents.pm b/lib/Debian/AptContents.pm
index 360aff8..5616712 100644
--- a/lib/Debian/AptContents.pm
+++ b/lib/Debian/AptContents.pm
@@ -319,7 +319,9 @@ sub read_cache {
                         | perl/(?:\d[\d.]+)/   # or perl/5.10/
                         )
                     }{}x;
-                    $cache->{apt_contents}{$file} = $packages;
+                    $cache->{apt_contents}{$file} = exists $cache->{apt_contents}{$file}
+                        ? $cache->{apt_contents}{$file}.','.$packages
+                        : $packages;
 
                     # $packages is a comma-separated list of
                     # section/package items. We'll parse it when a file
@@ -396,7 +398,7 @@ sub find_file_packages {
                                                # otherwise it won't strip enough off Ubuntu's
                                                # usr/share/perl5/Config/Any.pm  universe/perl/libconfig-any-perl
 
-    return @packages;
+    return uniq @packages;
 }
 
 =item find_perl_module_package( $module, $version )
diff --git a/t/AptContents.t b/t/AptContents.t
index 1f52600..3a35ce0 100755
--- a/t/AptContents.t
+++ b/t/AptContents.t
@@ -3,7 +3,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 23;
+use Test::More tests => 25;
 
 BEGIN {
     use_ok 'Debian::AptContents';
@@ -128,4 +128,15 @@ is( $apt_contents->find_perl_module_package('GD') . '',
     'Alternative dependency for module found in multiple packages'
 );
 
+is_deeply(
+    [ $apt_contents->find_file_packages('Image/Magick.pm') ],
+    [ 'perlmagick', 'graphicsmagick-libmagick-dev-compat' ],
+    "Image/Magick.pm in perlmagick and graphicsmagick-libmagick-dev-compat, but different paths"
+);
+
+is( $apt_contents->find_perl_module_package('Image::Magick') . '',
+    'graphicsmagick-libmagick-dev-compat | perlmagick',
+    'Alternative dependency for Image::Magick module found in multiple packages'
+);
+
 ok( unlink "$Bin/Contents.cache", 'Contents.cache unlnked' );
diff --git a/t/contents/test_debian_dists_testing_Contents b/t/contents/test_debian_dists_testing_Contents
index ee318f6..8f9082e 100644
--- a/t/contents/test_debian_dists_testing_Contents
+++ b/t/contents/test_debian_dists_testing_Contents
@@ -1148,3 +1148,6 @@ usr/share/request-tracker3.6/lib/RT/URI/base.pm		    misc/request-tracker3.6
 usr/share/request-tracker3.6/lib/RT/URI/fsck_com_rt.pm	    misc/request-tracker3.6
 usr/share/request-tracker3.6/lib/RT/URI/fsck_com_rtfm.pm    misc/rt3.6-rtfm
 usr/share/request-tracker3.6/lib/RT/URI/t.pm		    misc/request-tracker3.6
+usr/lib/perl5/Image/Magick.pm							perl/perlmagick
+usr/share/perl5/GD/SecurityImage/Magick.pm				perl/libgd-securityimage-perl
+usr/share/perl5/Image/Magick.pm							graphics/graphicsmagick-libmagick-dev-compat
-- 
1.7.2.5



More information about the pkg-perl-maintainers mailing list