r55014 - /trunk/dh-make-perl/lib/DhMakePerl/Command/Packaging.pm

dmn at users.alioth.debian.org dmn at users.alioth.debian.org
Mon Mar 29 15:22:46 UTC 2010


Author: dmn
Date: Mon Mar 29 15:22:37 2010
New Revision: 55014

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=55014
Log:
move POD-based copyright extraction to extract_basic_copyright

Modified:
    trunk/dh-make-perl/lib/DhMakePerl/Command/Packaging.pm

Modified: trunk/dh-make-perl/lib/DhMakePerl/Command/Packaging.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl/Command/Packaging.pm?rev=55014&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl/Command/Packaging.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl/Command/Packaging.pm Mon Mar 29 15:22:37 2010
@@ -465,7 +465,10 @@
 
     $self->set_package_name;
 
-    $self->extract_desc("$dir/$vfrom") if defined $vfrom;
+    if ( defined($vfrom) ) {
+        $self->extract_desc("$dir/$vfrom");
+        $self->extract_basic_copyright("$dir/$vfrom");
+    }
 }
 
 sub extract_desc {
@@ -479,7 +482,7 @@
     my ( $parser, $modulename );
     $parser = new DhMakePerl::PodParser;
     return unless -f $file;
-    $parser->set_names(qw(NAME DESCRIPTION DETAILS COPYRIGHT AUTHOR AUTHORS));
+    $parser->set_names(qw(NAME DESCRIPTION DETAILS));
     $parser->parse_from_file($file);
     if ( $desc ) {
 
@@ -531,26 +534,6 @@
         $bin->long_description(
             "$long_desc\n\nThis description was automagically extracted from the module by dh-make-perl.\n"
         );
-    }
-
-    $self->copyright( $parser->get('COPYRIGHT')
-            || $parser->get('LICENSE')
-            || $parser->get('COPYRIGHT & LICENSE') )
-        unless $self->copyright;
-    if ( !$self->author ) {
-        if ( ref $self->meta->{author} ) {
-
-            # Does the author information appear in META.yml?
-            $self->author( join( ', ', @{ $self->meta->{author} } ) );
-        }
-        else {
-
-            # Get it from the POD - and clean up
-            # trailing/preceding spaces!
-            my $a = $parser->get('AUTHOR') || $parser->get('AUTHORS');
-            $a =~ s/^\s*(\S.*\S)\s*$/$1/gs if $a;
-            $self->author($a);
-        }
     }
 
     $parser->cleanup;
@@ -572,15 +555,45 @@
 }
 
 sub extract_basic_copyright {
-    my ($self) = @_;
+    my ( $self, $file ) = @_;
 
     for my $f ( map( $self->main_file($_), qw(LICENSE LICENCE COPYING) ) ) {
         if ( -f $f ) {
             my $fh = $self->_file_r($f);
-            return join( '', $fh->getlines );
-        }
-    }
-    return;
+            $self->copyright( join( '', $fh->getlines ) );
+        }
+    }
+
+    if ( defined($file) ) {
+        my ( $parser, $modulename );
+        $parser = new DhMakePerl::PodParser;
+        return unless -f $file;
+        $parser->set_names(qw(COPYRIGHT AUTHOR AUTHORS));
+        $parser->parse_from_file($file);
+
+        $self->copyright( $parser->get('COPYRIGHT')
+                || $parser->get('LICENSE')
+                || $parser->get('COPYRIGHT & LICENSE') )
+            unless $self->copyright;
+
+        if ( !$self->author ) {
+            if ( ref $self->meta->{author} ) {
+
+                # Does the author information appear in META.yml?
+                $self->author( join( ', ', @{ $self->meta->{author} } ) );
+            }
+            else {
+
+                # Get it from the POD - and clean up
+                # trailing/preceding spaces!
+                my $a = $parser->get('AUTHOR') || $parser->get('AUTHORS');
+                $a =~ s/^\s*(\S.*\S)\s*$/$1/gs if $a;
+                $self->author($a);
+            }
+        }
+
+        $parser->cleanup;
+    }
 }
 
 sub extract_docs {




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