r29484 - in /trunk/dh-make-perl: debian/changelog lib/DhMakePerl.pm

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Fri Jan 9 10:20:28 UTC 2009


Author: dmn
Date: Fri Jan  9 10:20:25 2009
New Revision: 29484

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=29484
Log:
check if package named as the created one or containing modules with the same name already exists. Thanks to Brian Cassidy for bringing up the problem and Gregor Herrmann and Don Armstrong for the suggestions about the implementation

Modified:
    trunk/dh-make-perl/debian/changelog
    trunk/dh-make-perl/lib/DhMakePerl.pm

Modified: trunk/dh-make-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/debian/changelog?rev=29484&op=diff
==============================================================================
--- trunk/dh-make-perl/debian/changelog (original)
+++ trunk/dh-make-perl/debian/changelog Fri Jan  9 10:20:25 2009
@@ -1,3 +1,12 @@
+dh-make-perl (0.52) UNRELEASED; urgency=low
+
+  * check if package named as the created one or containing modules with the
+    same name already exists. Thanks to Brian Cassidy for bringing up the
+    problem and Gregor Herrmann and Don Armstrong for the suggestions about
+    the implementation
+
+ -- Damyan Ivanov <dmn at debian.org>  Fri, 09 Jan 2009 11:38:50 +0200
+
 dh-make-perl (0.51) unstable; urgency=low
 
   [ gregor herrmann ]

Modified: trunk/dh-make-perl/lib/DhMakePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl.pm?rev=29484&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl.pm Fri Jan  9 10:20:25 2009
@@ -32,6 +32,7 @@
 
 =cut
 
+use AptPkg::Cache ();
 use AptPkg::Config ();
 use Config qw( %Config );
 use CPAN ();
@@ -284,6 +285,9 @@
         if $self->cfg->build or $self->cfg->install;
     $self->install_package($debiandir) if $self->cfg->install;
     print "--- Done\n" if $self->cfg->verbose;
+
+    $self->package_already_exists($apt_contents);
+
     return(0);
 }
 
@@ -1648,6 +1652,42 @@
     return $val;
 }
 
+sub package_already_exists {
+    my( $self, $apt_contents ) = @_;
+
+    my $apt_cache = AptPkg::Cache->new;
+    my $found = $apt_cache->packages->lookup($pkgname);
+
+    if ($found) {
+        warn "**********\n";
+        warn "WARNING: a package named\n";
+        warn "              '$pkgname'\n";
+        warn "         is already available in APT repositories\n";
+        warn "Maintainer: ", $found->{Maintainer}, "\n";
+        my $short_desc = (split( /\n/, $found->{LongDesc} ))[0];
+        warn "Description: $short_desc\n";
+    }
+    elsif ($apt_contents) {
+        my @possible_packages = $apt_contents->find_perl_module_package(
+            $perlname);
+
+        if ( $found = shift @possible_packages ) {
+            my $mod_name = $perlname =~ s/-/::/g;
+            warn "**********\n";
+            warn "NOTICE: the package '$found', available in APT repositories\n";
+            warn "        already contains a module named $perlname\n";
+
+            if ( @possible_packages > 1 ) {
+                shift @possible_packages;
+                warn "\n        Other packages that contain similarly named modules are:\n";
+                warn "          - $_\n" for @possible_packages;
+            }
+        }
+    }
+
+    return $found ? 1 : 0;
+}
+
 sub _warn_incomplete_copyright {
     my $self = shift;
 




More information about the Pkg-perl-cvs-commits mailing list