[SCM] Debian packaging of libsoftware-license-perl branch, master, updated. debian/0.103002-3-4-g50f72ae

Dominique Dumont dod at debian.org
Sat Oct 8 11:13:42 UTC 2011


The following commit has been merged in the master branch:
commit 35d35dca928c5d65b43a1255aad7d9799c1b673d
Author: Dominique Dumont <dod at debian.org>
Date:   Sat Oct 8 13:02:59 2011 +0200

    re-organised patches to make upstream life easier (take 2)

diff --git a/debian/patches/gpl-2-plus-class b/debian/patches/gpl-2-plus-class
index 3aa6f2f..bb65154 100644
--- a/debian/patches/gpl-2-plus-class
+++ b/debian/patches/gpl-2-plus-class
@@ -45,3 +45,13 @@ Description: new class
 +
 +On Debian systems, the complete text of version 2 of the GNU General
 +Public License can be found in '/usr/share/common-licenses/GPL-2'.
+--- a/lib/Software/License.pm
++++ b/lib/Software/License.pm
+@@ -15,6 +15,7 @@
+   'GPL-1'  => 'GPL_1',
+   'GPL-1+' => 'GPL_1_plus',
+   'GPL-2'  => 'GPL_2',
++  'GPL-2+' => 'GPL_2_plus',
+   'GPL-3'  => 'GPL_3',
+   'Artistic' => 'Artistic_1_0',
+   'Artistic-1' => 'Artistic_1_0',
diff --git a/debian/patches/gpl-3-plus-class b/debian/patches/gpl-3-plus-class
index e3e0748..4506a83 100644
--- a/debian/patches/gpl-3-plus-class
+++ b/debian/patches/gpl-3-plus-class
@@ -44,3 +44,13 @@ Description: new class for gpl3 plus summary
 +
 +On Debian systems, the complete text of version 3 of the GNU General
 +Public License can be found in '/usr/share/common-licenses/GPL-3'.
+--- a/lib/Software/License.pm
++++ b/lib/Software/License.pm
+@@ -16,6 +16,7 @@
+   'GPL-1+' => 'GPL_1_plus',
+   'GPL-2'  => 'GPL_2',
+   'GPL-3'  => 'GPL_3',
++  'GPL-3+' => 'GPL_3_plus',
+   'Artistic' => 'Artistic_1_0',
+   'Artistic-1' => 'Artistic_1_0',
+   'Artistic-2' => 'Artistic_2_0',
diff --git a/lib/Software/License.pm b/lib/Software/License.pm
index baece72..c64c83c 100644
--- a/lib/Software/License.pm
+++ b/lib/Software/License.pm
@@ -11,15 +11,51 @@ use Data::Section -setup => { header_re => qr/\A__([^_]+)__\Z/ };
 use Sub::Install ();
 use Text::Template ();
 
+my %short_name = (
+  'GPL-1'  => 'GPL_1',
+  'GPL-1+' => 'GPL_1_plus',
+  'GPL-2'  => 'GPL_2',
+  'GPL-2+' => 'GPL_2_plus',
+  'GPL-3'  => 'GPL_3',
+  'GPL-3+' => 'GPL_3_plus',
+  'Artistic' => 'Artistic_1_0',
+  'Artistic-1' => 'Artistic_1_0',
+  'Artistic-2' => 'Artistic_2_0',
+);
+
+# Software::License is a virtual class. On the other hand, it's a
+# natural entry point to create "real" license using short names.
+# Of the 2 solutions provided below, I don't know which one is the best
+# (or the worse).
 
 sub new {
   my ($class, $arg) = @_;
 
   Carp::croak "no copyright holder specified" unless $arg->{holder};
 
-  bless $arg => $class;
+  # This ugly hack avoids having 2 constructors.
+  if ($class eq __PACKAGE__ ) {
+    return new_from_short_name(@_) ;
+  }
+  else {
+    bless $arg => $class;
+  }
 }
 
+# here's a second constructor that will provide a real license
+sub new_from_short_name {
+  my ($class, $arg) = @_;
+
+  Carp::croak "no license short name specified" unless $arg->{short_name};
+  my $short = delete $arg->{short_name} ;
+  my $lic = $short_name{$short} ;
+  Carp::croak "Unknow license with short name $short" unless $lic;
+
+  my $lic_file = my $lic_class = __PACKAGE__.'::'.$lic ;
+  $lic_file =~ s!::!/!g ;
+  require "$lic_file.pm";
+  return $lic_class->new ($arg) ;
+}
 
 sub year   { defined $_[0]->{year} ? $_[0]->{year} : (localtime)[5]+1900 }
 sub holder { $_[0]->{holder}     }
@@ -27,6 +63,11 @@ sub holder { $_[0]->{holder}     }
 
 sub notice { shift->_fill_in('NOTICE') }
 
+sub summary {
+    my ($self,$distro) = @_;
+    $distro ||= 'debian' ;
+    $self->_fill_in(uc($distro).'-SUMMARY');
+}
 
 sub license { shift->_fill_in('LICENSE') }
 
@@ -112,6 +153,15 @@ arguments are:
   holder - the holder of the copyright; required
   year   - the year of copyright; defaults to current year
 
+=head2 new_from_short_name
+
+ my $license = Software::License -> new_from_short_name(
+   { short_name => 'GPL-1', %arg }
+ );
+
+This constructor will return the correct subclass depending on
+C<short_name> value.
+
 =head2 year
 
 =head2 holder
@@ -165,6 +215,13 @@ there is no known string to use.  If this method does not exist, and
 C<meta_name> returns open_source, restricted, unrestricted, or unknown, that
 value will be used.
 
+=head2 summary
+
+This method returns a summary of the license. This summary must contains
+refer to a file containing the whole license. On Debian system, the file
+containing the whole license will be in C</usr/share/common-licenses/>
+directory.
+
 =head1 LOOKING UP LICENSE CLASSES
 
 If you have an entry in a F<META.yml> or F<META.json> file, or similar
diff --git a/lib/Software/License/Apache_2_0.pm b/lib/Software/License/Apache_2_0.pm
index cf02c45..34682fd 100644
--- a/lib/Software/License/Apache_2_0.pm
+++ b/lib/Software/License/Apache_2_0.pm
@@ -40,6 +40,19 @@ the same terms as the Perl 5 programming language system itself.
 
 
 __DATA__
+__DEBIAN-SUMMARY__
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+    http://www.apache.org/licenses/LICENSE-2.0
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS"BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+
+On Debian systems, the complete text of the Apache License,
+Version 2.0 can be found in '/usr/share/common-licenses/Apache-2.0'.
 __LICENSE__
                                  Apache License
                            Version 2.0, January 2004
diff --git a/lib/Software/License/Artistic_1_0.pm b/lib/Software/License/Artistic_1_0.pm
index a6f85fd..0952a07 100644
--- a/lib/Software/License/Artistic_1_0.pm
+++ b/lib/Software/License/Artistic_1_0.pm
@@ -77,6 +77,12 @@ the same terms as the Perl 5 programming language system itself.
 
 
 __DATA__
+__DEBIAN-SUMMARY__
+This program is free software; you can redistribute it and/or modify
+it under the terms of the Artistic License, which comes with Perl.
+
+On Debian systems, the complete text of the Artistic License can be
+found in '/usr/share/common-licenses/Artistic'.
 __LICENSE__
 The Artistic License
 
diff --git a/lib/Software/License/GPL_1.pm b/lib/Software/License/GPL_1.pm
index 65926d6..021bb1d 100644
--- a/lib/Software/License/GPL_1.pm
+++ b/lib/Software/License/GPL_1.pm
@@ -40,6 +40,13 @@ the same terms as the Perl 5 programming language system itself.
 
 
 __DATA__
+__DEBIAN-SUMMARY__
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; version 1, February 1989
+
+On Debian systems, the complete text of version 1 of the GNU General
+Public License can be found in `/usr/share/common-licenses/GPL-1'.
 __LICENSE__
                     GNU GENERAL PUBLIC LICENSE
                      Version 1, February 1989
diff --git a/lib/Software/License/GPL_2.pm b/lib/Software/License/GPL_2.pm
index 17a304f..85f523d 100644
--- a/lib/Software/License/GPL_2.pm
+++ b/lib/Software/License/GPL_2.pm
@@ -40,6 +40,13 @@ the same terms as the Perl 5 programming language system itself.
 
 
 __DATA__
+__DEBIAN-SUMMARY__
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; version 2 dated June, 1991.
+
+On Debian systems, the complete text of version 2 of the GNU General
+Public License can be found in '/usr/share/common-licenses/GPL-2'.
 __LICENSE__
                     GNU GENERAL PUBLIC LICENSE
                        Version 2, June 1991
diff --git a/lib/Software/License/GPL_3.pm b/lib/Software/License/GPL_3.pm
index ac07801..4365b53 100644
--- a/lib/Software/License/GPL_3.pm
+++ b/lib/Software/License/GPL_3.pm
@@ -40,6 +40,13 @@ the same terms as the Perl 5 programming language system itself.
 
 
 __DATA__
+__DEBIAN-SUMMARY__
+This program is free software; you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation; version 3 dated June, 2007.
+
+On Debian systems, the complete text of version 3 of the GNU General
+Public License can be found in '/usr/share/common-licenses/GPL-3'.
 __LICENSE__
                     GNU GENERAL PUBLIC LICENSE
                        Version 3, 29 June 2007

-- 
Debian packaging of libsoftware-license-perl



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