#1000319 lintian should provide an error when Debian::Copyright fails

#1000319#5
Date:
2021-11-21 13:23:17 UTC
From:
To:
Hi Felix,

lintian should provide an error when Debian::Copyright fails and
debian/copyright declares to be compatible with
https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/

Example with salsa.debian.org/js-team/uglifyjs

Cheers,
Yadd

#1000319#10
Date:
2021-11-21 16:28:33 UTC
From:
To:
Hi Yadd,

Which failure did you have in mind, please? Lintian parses
machine-readable files—which is what uglifyjs ships [1]—in the nearby
check Debian::Copyright::Dep5. [2] Thanks!

Kind regards
Felix Lechner

[1] https://tracker.debian.org/media/packages/u/uglifyjs/copyright-2.8.29-8
[2] https://salsa.debian.org/lintian/lintian/-/blob/master/lib/Lintian/Check/Debian/Copyright/Dep5.pm

#1000319#15
Date:
2021-11-21 16:28:33 UTC
From:
To:
Hi Yadd,

Which failure did you have in mind, please? Lintian parses
machine-readable files—which is what uglifyjs ships [1]—in the nearby
check Debian::Copyright::Dep5. [2] Thanks!

Kind regards
Felix Lechner

[1] https://tracker.debian.org/media/packages/u/uglifyjs/copyright-2.8.29-8
[2] https://salsa.debian.org/lintian/lintian/-/blob/master/lib/Lintian/Check/Debian/Copyright/Dep5.pm

#1000319#20
Date:
2021-11-21 17:08:41 UTC
From:
To:
Le 21/11/2021 à 17:28, Felix Lechner a écrit :

I wrote some scripts which use Debian::Copyright to automatize some JS
things, but when Debian::Copyright is unable to read debian/copyright,
automatic tools fail.

Here is a simple test:

  my $c = Debian::Copyright->new();
  $c->read('debian/copyright');

#1000319#25
Date:
2021-11-21 17:35:02 UTC
From:
To:
Hi,

Sorry, I did not realize you were referring to functionality provided
by libdebian-copyright-perl.

If you are just extracting information—Lintian does the validation—you
may be better off using a better parser. I could upload mine to the
archive, if you would like to try it. [1] For starters, field names
are case-insensitive (a requirement of the Deb822 spec). There are
also many field extraction functions, such as '->trimmed_list' [2]
(with an optional separator). The way to check for the presence of a
field is with '->declares'. [3] Most significantly, there are no NULL
pointers. [4]

It would be a little bit of a philosophical stretch for Lintian to
alert users to problems with other parsers, rather than the document
itself.

Kind regards
Felix Lechner

[1] Plus two surrounding files,
https://salsa.debian.org/lintian/lintian/-/blob/master/lib/Lintian/Deb822/Section.pm
[2] https://salsa.debian.org/lintian/lintian/-/blob/master/lib/Lintian/Check/Team/PkgJs/Testsuite.pm#L55-56
[3] https://salsa.debian.org/lintian/lintian/-/blob/master/lib/Lintian/Check/Debian/Copyright/Dep5.pm#L404-408
[4] https://www.infoq.com/presentations/Null-References-The-Billion-Dollar-Mistake-Tony-Hoare/