Bug#951186: Please reconsider usage of perl-Array-IntSpan in licensecheck
Sandro Mani
manisandro at gmail.com
Mon Feb 24 09:12:50 GMT 2020
Hi Jonas
Since I need to update the package in Fedora (it is currently broken),
I've prepared the patch below to remove the dependency. Can you perhaps
confirm that it does not fundamentally break licensecheck in some way?
From my tests, it appears to work.
Thanks
Sandro
----
diff -rupN App-Licensecheck-v3.0.45/lib/App/Licensecheck.pm
App-Licensecheck-v3.0.45-new/lib/App/Licensecheck.pm
--- App-Licensecheck-v3.0.45/lib/App/Licensecheck.pm 2020-02-21
16:24:52.000000000 +0100
+++ App-Licensecheck-v3.0.45-new/lib/App/Licensecheck.pm 2020-02-23
17:29:05.277245643 +0100
@@ -12,7 +12,6 @@ use Path::Tiny;
use Try::Tiny;
use Fcntl qw(:seek);
use Encode;
-use Array::IntSpan;
use Regexp::Pattern::License 3.1.102;
use Regexp::Pattern 0.2.12 (
're',
@@ -601,7 +600,6 @@ sub parse_license
my @gpl = qw(gpl gpl_1 gpl_2 gpl_3);
my @lgpl = qw(lgpl lgpl_2 lgpl_2_1 lgpl_3);
- my $coverage = Array::IntSpan->new();
my %match;
my ( %grant, %license );
@@ -697,27 +695,16 @@ sub parse_license
);
my $license = pop @licenses;
next unless ($license);
- next
- if defined(
- $coverage->get_range( $pos, $pos_license{$pos}{$license} )
- ->get_element(0) );
$self->log->tracef(
'detected and flagged well-formed license fulltext: %s: %s
[%s]',
$license, $pos, $file
);
- $coverage->set_range( $pos, $pos_license{$pos}{$license},
$license );
$license{$license} = 1;
}
foreach my $trait (qw(license_label_trove license_label
licensed_under)) {
next unless ( $licensetext =~ /$RE{"TRAIT_$trait"}/ );
while ( $licensetext =~ /$RE{"TRAIT_GLOBAL_$trait"}/g ) {
- next
- if (
- defined(
- $coverage->get_range( $-[0], $+[0] )->get_element(0)
- )
- );
push @clues, Trait [ $trait, $-[0], $+[0] ];
}
}
@@ -766,11 +753,6 @@ sub parse_license
if ( $name
and $match{$name}{name}{$pos_name}
- and !defined(
- $coverage->get_range(
- $pos_name, $match{$name}{name}{$pos_name}
- )->get_element(0)
- )
and grep { $_ eq $name } @L_tidy
)
{
@@ -1187,11 +1169,7 @@ sub parse_license
next if ( $match{$id}{custom} );
next if ( $license{$id} );
if ( $RE{"GRANT_$id"} ) {
- if ($licensetext =~ $RE{"GRANT_$id"}
- and !defined(
- $coverage->get_range( $-[0], $+[0] )->get_element(0)
- )
- )
+ if ($licensetext =~ $RE{"GRANT_$id"})
{
$self->log->tracef(
'detected versioned grant/license: %s: [%s]',
@@ -1246,11 +1224,7 @@ sub parse_license
if ( $license{$id}
or $grant{$id}
- or ($licensetext =~ $RE{"GRANT_$id"}
- and !defined(
- $coverage->get_range( $-[0], $+[0] )->get_element(0)
- )
- )
+ or $licensetext =~ $RE{"GRANT_$id"}
)
{
$self->log->tracef(
More information about the pkg-perl-maintainers
mailing list