[libconfig-model-dpkg-perl] 01/10: improve error message about missing license paragraph

dod at debian.org dod at debian.org
Mon Nov 13 17:29:40 UTC 2017


This is an automated email from the git hooks/post-receive script.

dod pushed a commit to branch master
in repository libconfig-model-dpkg-perl.

commit 2f6108004b83bb92027c3a634e2f3cc243bda19c
Author: Dominique Dumont <dod at debian.org>
Date:   Sat Nov 4 17:58:30 2017 +0100

    improve error message about missing license paragraph
---
 lib/Config/Model/models/Dpkg/Copyright/FileLicense.pl   | 7 +++++--
 lib/Config/Model/models/Dpkg/Copyright/GlobalLicense.pl | 6 +++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/lib/Config/Model/models/Dpkg/Copyright/FileLicense.pl b/lib/Config/Model/models/Dpkg/Copyright/FileLicense.pl
index 3dec2a6..a50e7c8 100644
--- a/lib/Config/Model/models/Dpkg/Copyright/FileLicense.pl
+++ b/lib/Config/Model/models/Dpkg/Copyright/FileLicense.pl
@@ -45,9 +45,12 @@ license: abbrev exception(?)
      if ($elt->defined($short_name) or $arg[0]->grab("- full_license")->fetch) {
         $ok &&= 1;
      }
-     else { 
+     else {
      	 $ok = 0 ;
-         ${$arg[1]} .= "license \'$short_name\' is not declared in main License section. Expected ".join(" ",$elt->fetch_all_indexes) ;
+         my @known_licenses = $elt->fetch_all_indexes;
+         my $expected = @known_licenses ? "Expected one of the current stand-alone License paragraphs: @known_licenses."
+             : "Did not find any stand-alone License paragraph.";
+         ${$arg[1]} .= "license \'$short_name\' is not declared in a stand-alone License paragraph. $expected" ;
      }
    } ',
         'help' => {
diff --git a/lib/Config/Model/models/Dpkg/Copyright/GlobalLicense.pl b/lib/Config/Model/models/Dpkg/Copyright/GlobalLicense.pl
index 37defad..7645f3a 100644
--- a/lib/Config/Model/models/Dpkg/Copyright/GlobalLicense.pl
+++ b/lib/Config/Model/models/Dpkg/Copyright/GlobalLicense.pl
@@ -26,7 +26,11 @@ license: /[^\\s,]+/i
      }
      else {
         $ok = 0 ;
-        ${$arg[1]} .= "license $abbrev is not declared in main License section. Expected ".join(" ",$elt->fetch_all_indexes) ;
+        my @known_licenses = $elt->fetch_all_indexes;
+        my $expected
+          = @known_licenses ? "Expected one of the current stand-alone License paragraphs: @known_licenses."
+                            : "Did not find any stand-alone License paragraph.";
+       ${$arg[1]} .= "license $abbrev is not declared in a stand-alone License paragraph. $expected";
      }
    } ',
         'help' => {

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libconfig-model-dpkg-perl.git



More information about the Pkg-perl-cvs-commits mailing list