diff options
author | Sean Whitton <spwhitton@spwhitton.name> | 2016-04-03 20:10:54 -0700 |
---|---|---|
committer | Sean Whitton <spwhitton@spwhitton.name> | 2016-04-03 20:10:54 -0700 |
commit | 554ec94e0b4f5175d70cfe36a512dd3147bf5d5d (patch) | |
tree | 82a64688de0a4b15d8f22ee8e9cc39054e9e118e /lib/DhMakeELPA/Command | |
parent | 06ce13551cb16657c74e243172e86caf3837cfba (diff) |
detect GPL in existing loop through *.el files
Diffstat (limited to 'lib/DhMakeELPA/Command')
-rw-r--r-- | lib/DhMakeELPA/Command/Packaging.pm | 20 | ||||
-rw-r--r-- | lib/DhMakeELPA/Command/make.pm | 16 |
2 files changed, 15 insertions, 21 deletions
diff --git a/lib/DhMakeELPA/Command/Packaging.pm b/lib/DhMakeELPA/Command/Packaging.pm index a5d6788..f845feb 100644 --- a/lib/DhMakeELPA/Command/Packaging.pm +++ b/lib/DhMakeELPA/Command/Packaging.pm @@ -12,7 +12,7 @@ use DhMakeELPA::MELPA; use base 'DhMakePerl::Command::Packaging'; __PACKAGE__->mk_accessors( - qw( main_dir debian_dir bins control pkgname homepage elpa_version copyright ) + qw( main_dir debian_dir bins control pkgname homepage elpa_version copyright gpl_version ) ); use constant debstdversion => '3.9.7'; @@ -25,25 +25,23 @@ sub extract_basic { $self->pkgname(basename(cwd())); # TODO better? $self->elpa_version($self->extract_version()); - # Find the homepage and copyright by looking at the root .el file, - # if it exists, of the binary package with the shortest name, then - # the second shortest etc. This might leave $self->homepage - # undefined + # Find the homepage, license and copyright by looking at the root + # .el file, if it exists, of the binary package with the shortest + # name, then the second shortest etc. This might leave any of + # these three undefined foreach my $bin (sort {length($a) <=> length($b)} keys %{$self->bins}) { my $fh = $self->_file_r( $self->main_file("$bin.el") ); while (my $line = $fh->getline()) { if ($line =~ /^;; (X-)*URL: /) { chomp(my $homepage = $'); $self->homepage($homepage); - if (defined $self->copyright) { - last; - } } elsif ($line =~ /^;; Copyright /) { chomp(my $copyright = $'); $self->copyright($copyright); - if (defined $self->homepage) { - last; - } + } elsif ($line =~ /either version 2/) { + $self->gpl_version("2"); + } elsif ($line =~ /either version 3/) { + $self->gpl_version("3"); } } $fh->close; diff --git a/lib/DhMakeELPA/Command/make.pm b/lib/DhMakeELPA/Command/make.pm index 6110568..1ae709d 100644 --- a/lib/DhMakeELPA/Command/make.pm +++ b/lib/DhMakeELPA/Command/make.pm @@ -91,20 +91,16 @@ sub create_changelog { sub create_copyright { my $self = shift; my ( $gpl_version, @res ); + if ( defined $self->gpl_version ) { + $gpl_version = $self->gpl_version; + } else { + # give up + return; + } my $fh = $self->_file_w( $self->debian_file("copyright") ); my $year = (localtime)[5] + 1900; - $gpl_version = "2"; - # if ( fgrep /either version 3 of the License/ glob "*.el" ) { - # $gpl_version = "3"; - # } elsif ( fgrep /either version 2 of the License/ glob "*.el" ) { - # $gpl_version = "2"; - # } else { - # # give up - # return; - # } - push @res, 'Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/'; push @res, 'Upstream-Name: ' . $self->pkgname; push @res, 'Source: ' . $self->homepage; |