diff options
author | Dominique Dumont <dod@debian.org> | 2021-06-12 18:34:29 +0200 |
---|---|---|
committer | Dominique Dumont <dod@debian.org> | 2021-06-12 18:42:58 +0200 |
commit | 1ebdf84d98478874df3574a33226a6ef717cb3d6 (patch) | |
tree | a33393f46e0a5e47073614b4870329fb3169f29c | |
parent | 9bd42cc2e004787c479d667451ed308c3edbad41 (diff) |
refactor (Dpkg::Copyright): cleanup regexp
-rw-r--r-- | lib/Config/Model/Dpkg/Copyright.pm | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/Config/Model/Dpkg/Copyright.pm b/lib/Config/Model/Dpkg/Copyright.pm index 303336a0..a5536729 100644 --- a/lib/Config/Model/Dpkg/Copyright.pm +++ b/lib/Config/Model/Dpkg/Copyright.pm @@ -117,7 +117,7 @@ sub update ($self, %args) { # skip when no info is found in original data my $d_key; - if ( $new_data->{Copyright} =~ /no-info-found|unknown/i + if ( $new_data->{Copyright} =~ /no-info-found|unknown/xi and $new_data->{License}{short_name} =~ /unknown/i) { $new_copyrights_by_id[0] //= $new_data; $d_key = 0; @@ -206,12 +206,12 @@ sub update ($self, %args) { my $using_old_data = 0; if ($old_data and $old_data->{Copyright} and $old_data->{License}{short_name}) { - if ($datum->{Copyright} =~ /unknown|no-info-found/i) { + if ($datum->{Copyright} =~ /unknown|no-info-found/xi) { $self->_say( "keeping copyright dir data for $p"); $datum->{Copyright} = $old_data->{Copyright}; $using_old_data = 1; } - if ($datum->{License}{short_name} =~ /unknown|no-info-found/i) { + if ($datum->{License}{short_name} =~ /unknown|no-info-found/xi) { $self->_say( "keeping license dir data for $p"); $datum->{License}{short_name} = $old_data->{License}{short_name}; $datum->{License}{full_license} = $old_data->{License}{full_license}; @@ -242,7 +242,7 @@ sub update ($self, %args) { # if full_license is not provided in datum, check global license(s) if (not $datum->{License}{full_license}) { my $ok = 0; - my @sub_licenses = split m![,\s]+(?:and/or|or|and)[,\s]+!,$l; + my @sub_licenses = split m![,\s]+ (?:and/or|or|and) [,\s]+!x,$l; my $lic_count = 0; my @empty_licenses = grep { my $text = $self->grab_value(steps => qq!License:"$_" text!, check =>'no') ; @@ -330,10 +330,10 @@ sub _apply_fix_scan_copyright_file ($self, $current_dir) { # read a debian/fix.scanned.copyright file to patch scanned data my $debian = $current_dir->child('debian'); # may be missing in test environment if ($debian->is_dir) { - my @fixes = $current_dir->child('debian')->children(qr/fix\.scanned\.copyright$/); + my @fixes = $current_dir->child('debian')->children(qr/fix\.scanned\.copyright$/x); $self->_say( "Note: loading @fixes fixes from copyright fix files") if @fixes; foreach my $fix ( @fixes) { - my @l = grep { /[^\s]/ } grep { ! m!^(#|//)! } $fix->lines_utf8; + my @l = grep { /[^\s]/ } grep { ! m!^(?:#|//)! } $fix->lines_utf8; eval { $self->load( steps => join(' ',@l) , caller_is_root => 1 ); 1; |