[libconfig-model-dpkg-perl] 03/03: no default value for Testsuite, only set by fix

dod at debian.org dod at debian.org
Sat Sep 3 16:20:10 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 9e901cd9aba15561adaffb0e439d88a757700fb8
Author: Dominique Dumont <dod at debian.org>
Date:   Sat Sep 3 18:17:15 2016 +0200

    no default value for Testsuite, only set by fix
    
    Perl pkg team requests that:
    - cme leave Testsuite alone with 'cme modify'
    - update Testsuite to the correct value with 'cme fix'
---
 lib/Config/Model/models/Dpkg/Control/Source.pl | 39 ++++++++++++--------------
 t/dpkg.t                                       | 28 ++++++++++++------
 t/model_tests.d/dpkg-control-test-conf.pl      |  1 +
 3 files changed, 38 insertions(+), 30 deletions(-)

diff --git a/lib/Config/Model/models/Dpkg/Control/Source.pl b/lib/Config/Model/models/Dpkg/Control/Source.pl
index 3d37bf0..ef52432 100644
--- a/lib/Config/Model/models/Dpkg/Control/Source.pl
+++ b/lib/Config/Model/models/Dpkg/Control/Source.pl
@@ -105,26 +105,10 @@ area/section if the package is in the contrib or non-free archive areas.
         'status' => 'deprecated',
         'summary' => 'name of the non regression test suite',
         'type' => 'leaf',
-        'value_type' => 'uniline',
-        'warn_unless_match' => {
-          '^autopkgtest(-pkg-(perl|ruby))?$' => {
-            'fix' => '$_ = undef; # restore default value',
-            'msg' => 'Unknown value'
-          }
-        }
+        'value_type' => 'uniline'
       },
       'Testsuite',
       {
-        'compute' => {
-          'allow_override' => '1',
-          'formula' => 'my ($str) = ($team =~ /pkg-(perl|ruby)/);
-$str ? \'autopkgtest-pkg-\'.$str : undef;
-',
-          'use_eval' => '1',
-          'variables' => {
-            'team' => '- Maintainer'
-          }
-        },
         'description' => 'Enable a test suite to be used with this package. For more details see L<README.package-tests.rst|https://anonscm.debian.org/cgit/autopkgtest/autopkgtest.git/plain/doc/README.package-tests.rst>',
         'migrate_from' => {
           'formula' => '$xs_testsuite',
@@ -136,17 +120,30 @@ $str ? \'autopkgtest-pkg-\'.$str : undef;
         'type' => 'leaf',
         'value_type' => 'uniline',
         'warn_unless' => {
+          'defined-test' => {
+            'code' => 'my $m = $self->grab_value(\'- Maintainer\');
+my ($team) = ( $m =~ /(pkg-(?:perl|ruby))/ );
+not defined $team or defined $_;',
+            'fix' => 'my $m = $self->grab_value(\'- Maintainer\');
+my ($str) = ($m =~ /pkg-(perl|ruby)/);
+$_ = $str ? \'autopkgtest-pkg-\'.$str : undef;',
+            'msg' => 'Undefined while packaging team supports test suite'
+          },
           'team-test' => {
             'code' => 'my $m = $self->grab_value(\'- Maintainer\');
 my ($team) = ( $m =~ /(pkg-(?:perl|ruby))/ );
-not defined $team or $_ eq \'autopkgtest-\'.$team ;',
-            'fix' => '$_ = undef; # restore default value',
-            'msg' => 'Wrong team value'
+not defined $_ or not defined $team or $_ eq \'autopkgtest-\'.$team ;',
+            'fix' => 'my $m = $self->grab_value(\'- Maintainer\');
+my ($str) = ($m =~ /pkg-(perl|ruby)/);
+$_ = $str ? \'autopkgtest-pkg-\'.$str : undef;',
+            'msg' => 'value does not match maintainer team'
           }
         },
         'warn_unless_match' => {
           '^autopkgtest(-pkg-(perl|ruby))?$' => {
-            'fix' => '$_ = undef; # restore default value',
+            'fix' => 'my $m = $self->grab_value(\'- Maintainer\');
+my ($str) = ($m =~ /pkg-(perl|ruby)/);
+$_ = $str ? \'autopkgtest-pkg-\'.$str : undef;',
             'msg' => 'Unknown value'
           }
         }
diff --git a/t/dpkg.t b/t/dpkg.t
index 97cbbde..295e284 100644
--- a/t/dpkg.t
+++ b/t/dpkg.t
@@ -20,7 +20,7 @@ if ( $@ ) {
     plan skip_all => "AptPkg::Config is not installed";
 }
 elsif ( -r '/etc/debian_version' ) {
-    plan tests => 23;
+    plan tests => 25;
 }
 else {
     plan skip_all => "Not a Debian system";
@@ -66,6 +66,7 @@ my $dpkg = $model->instance(
 );
 
 my $root = $dpkg->config_root ;
+$dpkg->initial_load_stop;
 
 my $opt = 'config\..*|configure|.*Makefile.in|aclocal.m4|\.pc' ;
 
@@ -111,19 +112,28 @@ warning_like {
     $root->load('control source Testsuite=autopkgtest-foobar');
 } qr/unknown value/i, "check that a warning is emitted for unknown Testsuite value";
 
-# delete wrong Testsuite value
-$root->load('control source Testsuite~') ;
+my @teams = (
+    'Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>',
+    'Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>',
+);
+
+foreach my $team (@teams) {
+    # reset testsuite values
+    $root->load('control source Maintainer~ Testsuite~') ;
+    my ($str) = ($team =~ /pkg-(perl|ruby)/);
+    my $target =  "autopkgtest-pkg-$str";
 
-$root->load('control source Maintainer="Debian Perl Group <pkg-perl-maintainers at lists.alioth.debian.org>"');
-is($root->grab_value("control source Testsuite"), 'autopkgtest-pkg-perl','check Testsuite pkg-perl output');
+    $root->load(qq!control source Maintainer="$team"!);
+    is($root->grab_value("control source Testsuite"), undef,'check Testsuite default value');
+    $root->grab('control source Testsuite')->apply_fixes;
 
-$root->load('control source Maintainer="Debian Ruby Extras Maintainers <pkg-ruby-extras-maintainers at lists.alioth.debian.org>"');
-is($root->grab_value("control source Testsuite"), 'autopkgtest-pkg-ruby','check Testsuite pkg-ruby output');
+    is($root->grab_value("control source Testsuite"), $target,"check Testsuite $str output");
+}
 
+# perl vs ruby, requires that loop above does not finish with perl team
 warning_like {
     $root->load('control source Testsuite=autopkgtest-pkg-perl');
-} qr/wrong team value/i, "check that a warning is emitted for Testsuite value mistmatch";
-
+} qr/maintainer team/i, "check that a warning is emitted for Testsuite value mistmatch";
 
 
 my $lic_text = $root->grab("copyright License:FooBar text");
diff --git a/t/model_tests.d/dpkg-control-test-conf.pl b/t/model_tests.d/dpkg-control-test-conf.pl
index 1303461..303514a 100644
--- a/t/model_tests.d/dpkg-control-test-conf.pl
+++ b/t/model_tests.d/dpkg-control-test-conf.pl
@@ -159,6 +159,7 @@ providing the following file:
     {
         # test for #713053,  XS-Ruby-Versions and XB-Ruby-Versions fields
         name => 'ruby',
+        apply_fix => 1, # to fix pkg-testsuite param
         check => {
             'source XS-Ruby-Versions' => 'all',
             'binary:libfast-xs-ruby XB-Ruby-Versions' => '${ruby:Versions}',

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