File: backward-compat

package info (click to toggle)
libsoftware-license-perl 0.103014-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,080 kB
  • sloc: perl: 7,270; makefile: 2
file content (61 lines) | stat: -rw-r--r-- 1,820 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Description: ensure backward compatibility
 Patches done for 0.103004-2 were modified to follow upstream advices. This modification are not backward compatible. This patch provides this backward compatibility.
 .
 This patch should be dropped once the reverse deps are adapted to the new API.
--- a/lib/Software/License.pm
+++ b/lib/Software/License.pm
@@ -8,6 +8,8 @@
 use Text::Template ();
 use Carp;
 
+use Software::LicenseUtils;
+
 #pod =head1 SYNOPSIS
 #pod
 #pod   my $license = Software::License::Discordian->new({
@@ -31,6 +33,12 @@
 sub new {
   my ($class, $arg) = @_;
 
+  if ($arg->{short_name}) {
+	  Carp::carp "short_name parameter in Software::License->new is deprecated. Use ",
+		"Software::LicenseUtils::new_form_short_name" ;
+      return Software::LicenseUtils->new_from_short_name($arg) ;
+  }
+
   Carp::croak "no copyright holder specified" unless $arg->{holder};
 
   bless $arg => $class;
--- a/t/summary.t
+++ b/t/summary.t
@@ -2,7 +2,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 13;
+use Test::More tests => 19;
 
 # try LGP2 license
 
@@ -43,3 +43,21 @@
 like($license->fulltext, qr/library/i, 'license text');
 
 }
+
+# these tests emits a deprecation warning that will be removed
+# once Buster is out (See #828218 for details)
+# test backward compat form
+{
+my $license = Software::License->new({
+    short_name => 'LGPL-2+',
+    holder => 'X. Ample'
+});
+
+is($license->holder, 'X. Ample', '(c) holder');
+isa_ok($license,'Software::License::LGPL_2',"license class");
+like($license->summary, qr/common-licenses/i, 'common-licenses found');
+like($license->summary, qr/later version/i, 'later version clause found');
+like($license->name, qr/version 2/i, "license name");
+like($license->fulltext, qr/library/i, 'license text');
+}
+# end of Debian specific tests