[libconfig-model-dpkg-perl] 06/11: improve error message about © Format url

dod at debian.org dod at debian.org
Mon Jul 11 18:23:21 UTC 2016


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 f0d6c850bc4cb17382c095e45057a227d38ee4f9
Author: Dominique Dumont <dod at debian.org>
Date:   Fri Jul 8 21:45:32 2016 +0200

    improve error message about © Format url
    
    Previous version was confusing as the warning was the same for a
    bad URL or a good URL with http protocol instead of https.
    
    The test is now split in 2:
    - check if the URL is good (http or https)
    - check if https is used
    
    This should provide a less confusing error message
    
    Tests require Config::Model 2.088 to get the 2 warnings above
    in a predictable order.
---
 lib/Config/Model/models/Dpkg/Copyright.pl   |  6 +++++-
 t/model_tests.d/dpkg-copyright-test-conf.pl | 18 ++++++++++--------
 2 files changed, 15 insertions(+), 9 deletions(-)

diff --git a/lib/Config/Model/models/Dpkg/Copyright.pl b/lib/Config/Model/models/Dpkg/Copyright.pl
index b2a75cc..e3cfdea 100644
--- a/lib/Config/Model/models/Dpkg/Copyright.pl
+++ b/lib/Config/Model/models/Dpkg/Copyright.pl
@@ -40,7 +40,11 @@ To upgrade your file from an old spec, run:
         'type' => 'leaf',
         'value_type' => 'uniline',
         'warn_unless_match' => {
-          '^https://www.debian.org/doc/packaging-manuals/copyright-format/1\\.0/?$' => {
+          '^https' => {
+            'fix' => '$_ = undef;',
+            'msg' => 'Format uses insecure http protocol instead of https'
+          },
+          '^https?://www.debian.org/doc/packaging-manuals/copyright-format/1\\.0/?$' => {
             'fix' => '$_ = undef;',
             'msg' => 'Format does not match the recommended URL for DEP-5'
           }
diff --git a/t/model_tests.d/dpkg-copyright-test-conf.pl b/t/model_tests.d/dpkg-copyright-test-conf.pl
index 5c1a309..0a672b9 100644
--- a/t/model_tests.d/dpkg-copyright-test-conf.pl
+++ b/t/model_tests.d/dpkg-copyright-test-conf.pl
@@ -95,8 +95,10 @@ $skip = ( $@ or not -r '/etc/debian_version') ? 1 : 0 ;
     },
     { # t7
         # example from CANDIDATE DEP-5 spec (nb 7)
-        load_warnings => [ (qr/Adding/) x 1 , qr/Format does not match/,
-                       qr/trailing slash/],
+        load_warnings => [
+            (qr/Adding/) x 1 , qr/insecure/, qr/Format does not match/,
+            qr/trailing slash/
+        ],
         load_check => 'skip',
         apply_fix => 1,
         check => { 
@@ -108,7 +110,7 @@ $skip = ( $@ or not -r '/etc/debian_version') ? 1 : 0 ;
     },
     {
         # test nb 8
-        load_warnings => [ qr/Format does not match/, qr/many versions/ ],
+        load_warnings => [ qr/insecure/, qr/Format does not match/, qr/many versions/ ],
         apply_fix => 1,
         check => { 
             Format => "https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/", 
@@ -116,7 +118,7 @@ $skip = ( $@ or not -r '/etc/debian_version') ? 1 : 0 ;
         },
     },
     {
-        load_warnings => [ qr/Format does not match/ ,qr/should not match/ ],
+        load_warnings => [  qr/insecure/, qr/Format does not match/ ,qr/should not match/ ],
         apply_fix => 1,
         load => 'Files~"*/share/web/static/[css|js|images]/yui/*"',
         check => {
@@ -139,7 +141,7 @@ $skip = ( $@ or not -r '/etc/debian_version') ? 1 : 0 ;
     },
 
     { # t11 Debian bug #610231
-        load_warnings => [ qr/Format does not match/ ],
+        load_warnings => [  qr/insecure/, qr/Format does not match/ ],
         apply_fix => 1,
         dump_errors =>  [ 
             qr/mandatory/ => 'Files:"*" Copyright="(c) foobar"',
@@ -156,12 +158,12 @@ $skip = ( $@ or not -r '/etc/debian_version') ? 1 : 0 ;
     },
 
     { # t13 Debian bug #624305
-        load_warnings => [ qr/Format does not match/ ],
+        load_warnings => [  qr/insecure/, qr/Format does not match/ ],
         apply_fix => 1,
     },
     { # t14 Debian bug #633847
         # need to change License model from Hash of leaves to hash of nodes 
-        load_warnings => [ qr/Format does not match/ ],
+        load_warnings => [  qr/insecure/, qr/Format does not match/ ],
         apply_fix => 1,
         check => { 
             'Comment' => "On Debian systems, copies of the GNU General Public License version 1
@@ -207,7 +209,7 @@ in ‘/usr/share/common-licenses/GPL-1’.",
     },
     {
         name => 'oar',
-        load_warnings => [ qr/Format does not match/, qr/use Expat/ ],
+        load_warnings => [  qr/insecure/, qr/use Expat/ ],
         no_warnings => 1,
         apply_fix => 1,
 

-- 
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