r57146 - in /trunk/dh-make-perl: Changes TODO debian/changelog lib/DhMakePerl/Command/make.pm
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Thu Apr 29 19:36:12 UTC 2010
Author: dmn
Date: Thu Apr 29 19:36:03 2010
New Revision: 57146
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=57146
Log:
make: try harder to discover already existing package
looking up distribution modules in APT contents and dpkg file lists.
(cf. #530675)
Modified:
trunk/dh-make-perl/Changes
trunk/dh-make-perl/TODO
trunk/dh-make-perl/debian/changelog
trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm
Modified: trunk/dh-make-perl/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/Changes?rev=57146&op=diff
==============================================================================
--- trunk/dh-make-perl/Changes (original)
+++ trunk/dh-make-perl/Changes Thu Apr 29 19:36:03 2010
@@ -22,3 +22,6 @@
Use its ability to compare and drop Debian::Version
Dependenc{y,ies}: reduce '--' to '-' in the NAME POD section
+
+ make: try harder to discover already existing package by looking up
+ distribution modules in APT contents and dpkg file lists.
Modified: trunk/dh-make-perl/TODO
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/TODO?rev=57146&op=diff
==============================================================================
--- trunk/dh-make-perl/TODO (original)
+++ trunk/dh-make-perl/TODO Thu Apr 29 19:36:03 2010
@@ -7,12 +7,6 @@
* versioned dependencies should add the epochs too (found in
libpoex-role-sessioninstantiation-perl, where META.yml and Build.PL
request 'POE 1.005' which should translate to "libpoe-perl (>= 2:1.0050)")
-* package_already_exists(): maybe search for the module and not the package name;
- otherwise existing packages are missed that have a different name (cf. #530675)
- This is true for distributions that don't match the contained module, like
- libintl-perl, which has Locale::* modules.
- The way to solve this is perhaps to extract "package Foo::Bar" from all *.pm
- files and look them in the apt file contents. Lots of work for little gain.
* --refresh: add --only <file> option: done, but "--only control" also
touches d/rules if quilt is used
* #536838: Incorrect assumptions about perl module version -> debian package
Modified: trunk/dh-make-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/debian/changelog?rev=57146&op=diff
==============================================================================
--- trunk/dh-make-perl/debian/changelog (original)
+++ trunk/dh-make-perl/debian/changelog Thu Apr 29 19:36:03 2010
@@ -16,6 +16,8 @@
-S). Closes: #478781
* Dependency: drop Debian::Version and use Dpkg::Version instances instead
+ add (build-)dependency on libdpkg-perl
+ * make: try harder to discover already existing package by looking up
+ distribution modules in APT contents and dpkg file lists. (cf. #530675)
[ Salvatore Bonaccorso ]
* fallback to a dummy short description if none can be extracted
Modified: trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm?rev=57146&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm Thu Apr 29 19:36:03 2010
@@ -186,7 +186,8 @@
$self->install_package if $self->cfg->install;
print "--- Done\n" if $self->cfg->verbose;
- $self->package_already_exists($apt_contents);
+ $self->package_already_exists($apt_contents)
+ or $self->modules_already_packaged($apt_contents);
if ( $self->cfg->recursive ) {
$already_done //= {};
@@ -479,6 +480,75 @@
return $found ? 1 : 0;
}
+sub modules_already_packaged {
+ my( $self, $apt_contents ) = @_;
+
+ my @modules;
+
+ File::Find::find(
+ sub {
+ if ( basename($File::Find::dir)
+ =~ /^(?:\.(?:git|svn|hg|)|CVS|eg|samples?|examples?)$/ )
+ {
+ $File::Find::prune = 1;
+ return;
+ }
+ if (/.+\.pm$/) {
+ open my $fh, '<', $File::Find::name
+ or die "open($File::Find::name): $!";
+
+ while ( defined( my $l = <$fh> ) ) {
+ if ( $l =~ /^\s*package\s+(\w[\w\d_:]+).*;/ ) {
+ push @modules, $1;
+ last;
+ }
+ }
+ }
+ },
+ $self->main_dir,
+ );
+
+ my $found;
+
+ sub show_notice($$) {
+ warn $_[0] unless $_[1];
+ $_[0] = 1;
+ }
+
+ my $notice = <<EOF;
+*** Notice ***
+Some of the modules in the newly created package are already present
+in other packages.
+
+EOF
+ my $notice_shown = 0;
+
+ for my $mod (@modules) {
+ if ($apt_contents) {
+ $found = $apt_contents->find_perl_module_package($mod);
+
+ if ($found) {
+ show_notice( $notice, $notice_shown );
+ warn " $mod is in '$found' (APT)\n";
+ }
+ }
+ if ( !$found ) {
+ require Debian::DpkgLists;
+ my @found = Debian::DpkgLists->scan_perl_mod($mod);
+
+ if (@found) {
+ show_notice( $notice, $notice_shown );
+ warn " $mod is in " . join( ', ', @found ), " (local .deb)\n";
+ $found = 1;
+ }
+ }
+ }
+
+ warn "\n" if $notice_shown;
+
+ return $found ? 1 : 0;
+}
+
=item warning I<string> ...
In verbose mode, prints supplied arguments on STDERR, prepended with C<W: > and
More information about the Pkg-perl-cvs-commits
mailing list