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

ryan52-guest at users.alioth.debian.org ryan52-guest at users.alioth.debian.org
Wed Mar 25 02:29:06 UTC 2009


Author: ryan52-guest
Date: Wed Mar 25 02:28:59 2009
New Revision: 32328

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=32328
Log:
when refreshing, extract the debian/* copyright holders and years
from debian/changelog

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=32328&op=diff
==============================================================================
--- trunk/dh-make-perl/debian/changelog (original)
+++ trunk/dh-make-perl/debian/changelog Wed Mar 25 02:28:59 2009
@@ -17,8 +17,10 @@
   * if --pkg-perl, set the changelog to UNRELEASED by default
   * if --pkg-perl is given, and --dist is not, set dist = sid
   * add myself to uploaders
-
- -- Ryan Niebur <ryanryan52 at gmail.com>  Sat, 21 Mar 2009 00:48:42 -0700
+  * when refreshing, extract the debian/* copyright holders and years
+    from debian/changelog
+
+ -- Ryan Niebur <ryanryan52 at gmail.com>  Tue, 24 Mar 2009 19:28:25 -0700
 
 dh-make-perl (0.52) unstable; urgency=low
 

Modified: trunk/dh-make-perl/lib/DhMakePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl.pm?rev=32328&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl.pm Wed Mar 25 02:28:59 2009
@@ -41,6 +41,7 @@
 use Debian::AptContents ();
 use Debian::Dependencies ();
 use Debian::Dependency ();
+use Parse::DebianChangelog;
 use DhMakePerl::Config;
 use DhMakePerl::PodParser ();
 use Email::Date::Format qw(email_date);
@@ -1287,6 +1288,38 @@
     my $fh = $self->_file_w($file);
     $fh->print( $self->cfg->dh, "\n" );
     $fh->close;
+}
+
+sub copyright_from_changelog {
+  my ( $self, $firstmaint, $firstyear ) = @_;
+  my %maintainers = ();
+  @{$maintainers{$firstmaint}} = ($firstyear);
+  my $chglog = Parse::DebianChangelog->init( { infile => 'debian/changelog' } );
+  foreach($chglog->data()) {
+    my $person = $_->Maintainer;
+    my $date = $_->Date;
+    my @date_pieces = split(" ", $date);
+    my $year = $date_pieces[3];
+    if(defined($maintainers{$person})) {
+      push @{$maintainers{$person}}, $year;
+      @{$maintainers{$person}} = sort(@{$maintainers{$person}});
+    } else {
+      @{$maintainers{$person}} = ($year);
+    }
+  }
+  my @strings;
+  foreach my $maint_name (keys %maintainers) {
+    my $str = " ";
+    my %uniq = map { $_ => 0 } @{$maintainers{$maint_name}};
+    foreach(sort keys %uniq) {
+      $str .= $_;
+      $str .= ", ";
+    }
+    $str .= $maint_name;
+    push @strings, $str;
+  }
+  @strings = sort @strings;
+  return @strings;
 }
 
 sub create_copyright {
@@ -1471,7 +1504,14 @@
     # licensed as the superset of the module and Perl itself.
     $licenses{'Artistic'} = $licenses{'GPL-1+'} = 1;
     $year = (localtime)[5] + 1900;
-    push( @res, "", "Files: debian/*", "Copyright: $year, $maintainer" );
+    push( @res, "", "Files: debian/*" );
+    if($self->cfg->command eq 'refresh') {
+      my @from_changelog = $self->copyright_from_changelog($maintainer, $year);
+      $from_changelog[0] = "Copyright:" . $from_changelog[0];
+      push @res, @from_changelog;
+    } else {
+      push @res, "Copyright: $year, $maintainer";
+    }
     push @res, "License: " . join( ' | ', keys %licenses );
 
     map { $texts{$_} && push( @res, '', "License: $_", $texts{$_} ) }




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