Axel Beckert pushed to branch master at lintian / lintian


Commits:
2348bca3 by Axel Beckert at 2023-01-16T01:10:28+01:00
inconsistent-appstream-metadata-license: Versions with trailing ".0" 
are equivalent to versions without

Fixes false positives as the Debian Copyright Format 1.0 explicitly
states that versions with trailing dot-zeroes are considered to be
equivalent to versions without.

Closes: #1002053

Relevant documentation:
https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/#license-short-name

- - - - -
3721f292 by Axel Beckert at 2023-01-16T01:10:39+01:00
inconsistent-appstream-metadata-license: Normalize comparison (-or-later/+, 
-only suffix)

Further normalize comparison of Debian style and SPDX style license
identifiers to -or-later suffix vs + suffix, -only suffix vs no
suffix.

Still display the original variant in the tag.

Relevant documentation/policy:

https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/#license-short-name

(Also make new code perltidy.)

- - - - -
e48f1d48 by Axel Beckert at 2023-01-16T01:27:45+01:00
inconsistent-appstream-metadata-license description: Text improvements; direct 
ref to tag specification

Closes: #1014956

- - - - -
bf82908d by Christoph Biedl at 2023-01-16T01:40:03+01:00
Lintian::Index::FileTypes: Call "file" with "--raw" to 
unbreak test suite with file/libmagic ≥ 5.42

Closes: #1026920

- - - - -


3 changed files:

- lib/Lintian/Check/Debian/Copyright/Dep5.pm
- lib/Lintian/Index/FileTypes.pm
- tags/i/inconsistent-appstream-metadata-license.tag


Changes:

=====================================
lib/Lintian/Check/Debian/Copyright/Dep5.pm
=====================================
@@ -852,8 +852,30 @@ sub check_dep5_copyright {
             next
               unless $seen;
 
+            # Compare and also normalize the seen and wanted license
+            # identifier wrt. to redundant trailing dot-zeros,
+            # -or-later suffix vs + suffix, -only suffix vs no
+            # suffix. Still display the original variant in the tag.
+            my $seen_normalized = $seen;
+            $seen_normalized =~ s/-or-later$/+/i;
+            $seen_normalized =~ s/-only$//i;
+            my $seen_nozero = $seen_normalized;
+            $seen_nozero =~ s/\.0//g;
+
             my @wanted = @{$license_identifiers_by_file{$name}};
-            my @mismatched = grep { $_ ne $seen } @wanted;
+            my @mismatched = grep {
+                my $want = $_;
+                my $want_normalized = $want;
+                $want_normalized =~ s/-or-later$/+/i;
+                $want_normalized =~ s/-only$//i;
+                my $want_nozero = $want_normalized;
+                $want_nozero =~ s/\.0//g;
+
+                $want_normalized ne $seen_normalized
+                  and $want_nozero ne $seen_normalized
+                  and $want_normalized ne $seen_nozero
+                  and $want_nozero ne $seen_nozero;
+            } @wanted;
 
             $self->pointed_hint('inconsistent-appstream-metadata-license',
                 $copyright_file->pointer, $name, "($seen != $_)")


=====================================
lib/Lintian/Index/FileTypes.pm
=====================================
@@ -72,7 +72,7 @@ sub add_file_types {
     my @files = grep { $_->is_file } @{$self->sorted_list};
     my @names = map { $_->name } @files;
 
-    my @command = qw(file --no-pad --print0 --print0 --);
+    my @command = qw(file --raw --no-pad --print0 --print0 --);
 
     my %file_types;
 


=====================================
tags/i/inconsistent-appstream-metadata-license.tag
=====================================
@@ -2,7 +2,9 @@ Tag: inconsistent-appstream-metadata-license
 Severity: warning
 Check: debian/copyright/dep5
 Explanation: The specified AppStream metadata file specifies a
- <code>metadata&lowbar;license</code> field but this does not match the files 
in
+ <code>metadata&lowbar;license</code> field but this does not match
+ its entry (possibly via the <code>Files: *</code> stanza) in
  <code>debian/copyright</code>.
 See-Also: https://wiki.debian.org/AppStream/Guidelines,
- https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
+ https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/,
+ 
https://www.freedesktop.org/software/appstream/docs/chap-Metadata.html#tag-metadata_license



View it on GitLab: 
https://salsa.debian.org/lintian/lintian/-/compare/6bf8452625fb7ebbbad0af23a225557ac146dd99...bf82908d338b9125ed5ba737d50bdfd85f829bee

-- 
View it on GitLab: 
https://salsa.debian.org/lintian/lintian/-/compare/6bf8452625fb7ebbbad0af23a225557ac146dd99...bf82908d338b9125ed5ba737d50bdfd85f829bee
You're receiving this email because of your account on salsa.debian.org.


Reply via email to