[libconfig-model-dpkg-perl] 02/02: Dependency: fix build profile pass-through (Closes: #826573)

dod at debian.org dod at debian.org
Fri Jun 10 17:01:38 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 2a659db51948f3e313c93326b3b932441e38b67f
Author: Dominique Dumont <dod at debian.org>
Date:   Fri Jun 10 18:48:51 2016 +0200

    Dependency: fix build profile pass-through (Closes: #826573)
    
    Fixing build profile required to change the internal representation
    of a dependency.
    
    The first version was a list of list
     ( [ dep1, operator, version ], [dep2, oper, version ] ),
    e.g ( [ 'foo', '>=', '2.0'], ['bar', '>=', '3.1'] )
    The last 2 items were optional.
    
    Then, arch restriction was stappled on. The new representation
    was a list of variable length list :
     ( [ dep1, operator, version, arch1 ,!arch2,...], ['dep2'...] ),
    
    The build profile could not be added in this list.
    
    So the internal representation was changed to a list of hashes:
    [
      {
        name => 'dep1',
        dep  => [ '>=', '3.1'], # optional
        arch => [ 'arch1', 'arch2',...] # optional
        profiles => [ [ 'stage1', 'cross'], ['nojava'] ] # optional
      },
      {
        name => 'dep2',
      }
    ]
    
    Hence this change is quite big:
    - modified grammar to store data in new structure
    - modified grammar to better parse profile (with checks)
    - updated struct_to_dep for new structure
    - updated all internal use of dependency structure
    - updated all required tests
---
 lib/Config/Model/Dpkg/Dependency.pm       | 131 ++++++++++++++++++------------
 t/dependency-check.t                      |  61 ++++++++++----
 t/dependency-grammar.t                    | 120 ++++++++++++++++++++++-----
 t/model_tests.d/dependency-cache.txt      |   2 +
 t/model_tests.d/dpkg-control-test-conf.pl |   2 +
 5 files changed, 229 insertions(+), 87 deletions(-)

diff --git a/lib/Config/Model/Dpkg/Dependency.pm b/lib/Config/Model/Dpkg/Dependency.pm
index 57a9db5..193c9a1 100644
--- a/lib/Config/Model/Dpkg/Dependency.pm
+++ b/lib/Config/Model/Dpkg/Dependency.pm
@@ -203,20 +203,32 @@ depend: pkg_dep | variable
 variable: /\$\{[\w:\-]+\}[\w\.\-~+]*/
 
 pkg_dep: pkg_name dep_version(?) arch_restriction(?) profile_restriction(s?) {
-    my $dv = $item[2] ;
-    my $ar = $item[3] ;
-    my @ret = ( $item{pkg_name} ) ;
-    if    (@$dv and @$ar) { push @ret, @{$dv->[0]}, @{$ar->[0]} ;}
-    elsif (@$dv)          { push @ret, @{$dv->[0]} ;}
-    elsif (@$ar)          { push @ret, undef, undef, @{$ar->[0]} ;}
-    $return = \@ret ; ;
-   }
+    my %ret = ( name => $item{pkg_name} );
+    $ret{dep}     = $item[2][0] if @{$item[2]};
+    $ret{arch}    = $item[3][0] if @{$item[3]};
+    $ret{profile} = $item[4] if @{$item[4]};
+    $return = \%ret ;
+}
 
-profile_restriction: '<' profile(s) '>'
+# see https://wiki.debian.org/BuildProfileSpec
+profile_restriction: '<' profile(s) '>' { $return = $item[2]; }
 
-profile: not(?) profile_name
+profile: not(?) profile_name profile_extention(?) {
+  $return = join('', @{$item[1]}, $item{profile_name}, @{$item[3]});
+}
 
-profile_name: /[a-z][a-z0-9-]*/
+profile_extention: '.' /[\w\-]+/ '.' /[\w-]+/ {
+    $return = join('', @item[1..4]) ;
+}
+
+profile_name: 'cross' | 'pkg' | 'stage1'| 'stage2' |
+   'nobiarch' | 'nocheck' | 'nodoc' | 'nogolang' | 'nojava' | 'noperl' | 'nopython' | 'noudeb' |
+{
+    my @a = ('cross', 'pkg', 'stage1', 'stage2',
+            'nobiarch', 'nocheck', 'nodoc', 'nogolang', 'nojava', 'noperl', 'nopython', 'noudeb');
+    my ($bad) = split / /, $text;
+    $add_error->("Unknown build profile name '$bad'","Expected one of @a") ;
+}
 
 arch_restriction: '[' osarch(s) ']'
     {
@@ -352,10 +364,11 @@ sub check_dependency {
 }
 
 sub check_debhelper_version {
-    my ($self, $apply_fix, $depend) = @_ ;
-    my ( $dep_name, $oper, $dep_v, @archs ) = @$depend ;
+    my ($self, $apply_fix, $dep_info) = @_ ;
+    my $dep_name = $dep_info->{name};
+    my ($oper, $dep_v) = @{ $dep_info->{dep} || []};
 
-    my $dep_string = $self->struct_to_dep($depend) ;
+    my $dep_string = $self->struct_to_dep($dep_info) ;
     my $lintian_dep = Lintian::Relation->new( $dep_string ) ;
     $logger->debug("checking '$dep_string' with lintian");
 
@@ -381,7 +394,7 @@ sub check_debhelper_version {
     # $show_rel avoids undef warnings
     my $show_rel = join(' ', map { $_ || ''} ($oper, $dep_v));
     if ($apply_fix) {
-        @$depend = ( 'debhelper', '>=', $compat_value ) ; # notify_change called in check_value
+        $dep_info->{dep} = [ '>=', $compat_value] ; # notify_change called in check_value
         $logger->info("fixed debhelper dependency from "
             ."$dep_name $show_rel -> ".$min_dep->unparse." (for compat $compat_value)");
     }
@@ -410,23 +423,29 @@ sub struct_to_dep {
     my @alternatives ;
     foreach my $d (@input) {
         my $line = '';
-        # empty str or ref to empty array are skipped
-        if( ref ($d) and @$d) {
-            $line .= "$d->[0]";
 
-            # skip test for relations like << or <
-            $skip ++ if defined $d->[1] and $d->[1] =~ /</ ;
-            $line .= " ($d->[1] $d->[2])" if defined $d->[2];
+        # empty name is skipped
+        if (ref $d) {
+            my ($name, $dep,$arch, $prof) = @{$d}{qw/name dep arch profile/} ;
+            if ( $name) {
+                $line .= $name;
 
-            if (@$d > 3) {
-                $line .= ' ['. join(' ',@$d[3..$#$d]) .']' ;
-            }
+                # skip test for relations like << or <
+                $skip ++ if defined $dep->[0] and $dep->[0] =~ /</ ;
+                $line .= " (@$dep)" if defined $dep->[1];
 
-        }
-        elsif (not ref($d) and $d) {
-            $line .= $d ;
-        } ;
+                $line .= " [@$arch]" if $arch;
 
+                if ($prof) {
+                    foreach my $prof_or (@$prof) {
+                        $line .= ' <'.join(' ',@$prof_or).'>';
+                    }
+                }
+            }
+        }
+        else {
+            $line .= $d;
+        }
         push @alternatives, $line if $line ;
     }
 
@@ -456,7 +475,8 @@ sub check_depend_chain {
     foreach my $depend (@$input) {
         if (ref ($depend)) {
             # is a dependency (not a variable a la ${perl-Depends})
-            my ($dep_name, $oper, $dep_v) = @$depend ;
+            my $dep_name = $depend->{name};
+            my ($oper, $dep_v) = @{ $depend->{dep} || []};
             $logger->debug("scanning dependency $dep_name"
                 .(defined $dep_v ? " $dep_v" : ''));
             if ($dep_name =~ /lib[\w+\-]+-perl/) {
@@ -486,12 +506,13 @@ sub extract_cpan_version {
 # does modify $input when applying fix
 sub check_perl_lib_dep {
     my ($self, $apply_fix, $actual_dep, $depend, $input) = @_;
-    my ( $dep_name, $oper, $dep_v ) = @$depend;
+    my $dep_name = $depend->{name};
+    my ($oper, $dep_v) = @{ $depend->{dep} || []};
 
     $logger->debug("called for $dep_name with $actual_dep with apply_fix $apply_fix");
 
-    my ($old_perl_dep) = grep { $_->[0] eq 'perl' } @$input;
-    my $old_perl_versioned_dep = $old_perl_dep->[2];
+    my ($old_perl_dep) = grep { $_->{name} eq 'perl' } @$input;
+    my $old_perl_versioned_dep = $old_perl_dep->{dep}[1];
 
     # The dependency should be in the form perl (>= 5.10.1) | libtest-simple-perl (>= 0.88)".
     # cf http://pkg-perl.alioth.debian.org/policy.html#debian_control_handling
@@ -513,9 +534,9 @@ sub check_perl_lib_dep {
 
     return 1 if (defined $dep_v && $dep_v =~ m/^\$/) ; # version like ${foobar}
 
-    my @ideal_perl_dep = qw/perl/ ;
-    my @ideal_lib_dep ;
-    my @ideal_dep_chain = (\@ideal_perl_dep);
+    my %ideal_perl_dep = qw/name perl/ ;
+    my %ideal_lib_dep ;
+    my @ideal_dep_chain = (\%ideal_perl_dep);
 
     my @res = $self->get_available_version( $dep_name);
 
@@ -569,13 +590,13 @@ sub check_perl_lib_dep {
         $v_normal = $old_perl_versioned_dep;
     }
 
-	my ($has_older_perl) = $self->check_versioned_dep(  ['perl', '>=', $v_normal] );
-	push @ideal_perl_dep, '>=', $v_normal if $has_older_perl;
+	my ($has_older_perl) = $self->check_versioned_dep( { name => 'perl', dep => ['>=', $v_normal]} );
+	$ideal_perl_dep{dep} = [ '>=', $v_normal ] if $has_older_perl;
 
     if ($removed or $deprecated or $has_older_perl) {
         my ($has_older_lib) = $self->check_versioned_dep(  $depend );
-        push @ideal_lib_dep, $dep_name;
-        push @ideal_lib_dep, '>=', $dep_v if $dep_v and $has_older_lib;
+        $ideal_lib_dep{name} = $dep_name;
+        $ideal_lib_dep{dep} = [ '>=', $dep_v ] if $dep_v and $has_older_lib;
     }
 
     my %perl_version =  $self->get_available_version( 'perl');
@@ -588,9 +609,9 @@ sub check_perl_lib_dep {
 	);
 
 	my @ordered_ideal_dep
-        = $removed || $deprecated  ? ( \@ideal_lib_dep )
-        : $has_older_perl_in_sid ? ( \@ideal_perl_dep, \@ideal_lib_dep )
-        :                          ( \@ideal_lib_dep, \@ideal_perl_dep ) ;
+        = $removed || $deprecated  ? ( \%ideal_lib_dep )
+        : $has_older_perl_in_sid ? ( \%ideal_perl_dep, \%ideal_lib_dep )
+        :                          ( \%ideal_lib_dep, \%ideal_perl_dep ) ;
 
 	my $ideal_dep = $self->struct_to_dep( @ordered_ideal_dep );
 
@@ -600,7 +621,9 @@ sub check_perl_lib_dep {
 	if ( $actual_dep ne $ideal_dep ) {
 		if ($apply_fix) {
 			@$input = @ordered_ideal_dep ; # notify_change called in check_value
-			$logger->info("fixed dependency with: $ideal_dep, was @$depend");
+            if ($logger->is_info) {
+                $logger->info("fixed dependency with: $ideal_dep, was ". $self->struct_to_dep($depend));
+            }
 		}
 		else {
 			$self->{nb_of_fixes}++;
@@ -622,7 +645,8 @@ sub check_perl_lib_dep {
 
 sub check_versioned_dep {
     my ($self ,$dep_info) = @_ ;
-    my ( $pkg,  $oper,      $vers )    = @$dep_info;
+    my $pkg = $dep_info->{name};
+    my ($oper, $vers) = @{ $dep_info->{dep} || []};
     $logger->debug("called with '" . $self->struct_to_dep($dep_info) ."'") if $logger->is_debug;
 
     # special case to keep lintian happy
@@ -682,7 +706,8 @@ sub has_older_version_than {
 #
 sub check_or_fix_essential_package {
     my ( $self, $apply_fix, $dep_info ) = @_;
-    my ( $pkg,  $oper,      $vers )    = @$dep_info;
+    my $pkg = $dep_info->{name};
+    my ($oper, $vers) = @{ $dep_info->{dep} || []};
     $logger->debug("called with '", scalar $self->struct_to_dep($dep_info), "' and fix $apply_fix") if $logger->is_debug;
 
     # Remove unversioned dependency on essential package (Debian bug 684208)
@@ -695,7 +720,7 @@ sub check_or_fix_essential_package {
     if ($is_essential and not defined $oper) {
         $logger->debug( "found unversioned dependency on essential package: $pkg");
         if ($apply_fix) {
-            @$dep_info = ();
+            %$dep_info = ();
             $logger->info("fix: removed unversioned essential dependency on $pkg");
         }
         else {
@@ -714,7 +739,7 @@ my %pkg_replace = (
 
 sub check_or_fix_pkg_name {
     my ( $self, $apply_fix, $dep_info, $old ) = @_;
-    my ( $pkg,  $oper,      $vers )    = @$dep_info;
+    my $pkg = $dep_info->{name};
 
     $logger->debug("called with '", scalar $self->struct_to_dep($dep_info), "' and fix $apply_fix")
         if $logger->is_debug;
@@ -751,7 +776,7 @@ sub check_or_fix_pkg_name {
 
 sub check_or_fix_dep {
     my ( $self, $apply_fix, $dep_info, $old ) = @_;
-    my ( $pkg,  $oper,      $vers, @archs )    = @$dep_info;
+    my $pkg = $dep_info->{name};
 
     $logger->debug("called with '", scalar $self->struct_to_dep($dep_info), "' and fix $apply_fix")
         if $logger->is_debug;
@@ -770,15 +795,17 @@ sub check_or_fix_dep {
 
 sub warn_or_remove_vers_dep {
     my ( $self, $apply_fix, $dep_info, $list ) = @_;
-    my ( $pkg,  $oper,      $vers )    = @$dep_info;
+    my $pkg = $dep_info->{name};
+    my ($oper, $vers) = @{ $dep_info->{dep} || []};
 
     if ($apply_fix) {
-        splice @$dep_info, 1, 2;    # remove versioned dep, notify_change called in check_value
-        $logger->info("fix: removed versioned dependency from @$dep_info -> $pkg");
+        delete $dep_info->{dep};    # remove versioned dep, notify_change called in check_value
+        $logger->info("fix: removed versioned dependency from $dep_info->{name} -> $pkg");
     }
     else {
         $self->{nb_of_fixes}++;
-        my $msg = "unnecessary versioned dependency: @$dep_info. Debian has @$list";
+        my $msg = "unnecessary versioned dependency: ". $self-> struct_to_dep($dep_info)
+            . ". Debian has @$list";
         $self->add_warning( $msg);
         $logger->info("will warn: $msg (fix++)");
     }
diff --git a/t/dependency-check.t b/t/dependency-check.t
index 7a2221f..92605da 100644
--- a/t/dependency-check.t
+++ b/t/dependency-check.t
@@ -141,12 +141,20 @@ my $c_unit = $unit->config_root ;
 my $dep_value = $c_unit->grab("binary:dummy Depends:0");
 
 my @struct_2_dep = (
-    [['foo']] => 'foo',
-    [['foo'],['bar']] => 'foo | bar',
-    [[ 'foo', '>=' , '2.15']] => 'foo (>= 2.15)',
-    [[ 'foo', '>=' , '2.15', 'linux-i386', 'hurd']] => 'foo (>= 2.15) [linux-i386 hurd]',
-    [[ 'foo', undef , undef, 'linux-i386', 'hurd']] => 'foo [linux-i386 hurd]',
-    [[ 'udev', undef , undef, 'linux-any'],[ 'makedev', undef , undef, 'linux-any']] => 'udev [linux-any] | makedev [linux-any]',
+    [{ name => 'foo' }] => 'foo',
+    [{ name => 'foo' }, { name => 'bar'}] => 'foo | bar',
+    [{ name =>  'foo', dep => [ '>=' , '2.15']}] => 'foo (>= 2.15)',
+    [{ name =>  'foo', dep => [ '>=' , '2.15'], arch => ['linux-i386', 'hurd']}]
+    => 'foo (>= 2.15) [linux-i386 hurd]',
+    [{ name =>  'foo', arch => ['linux-i386', 'hurd']}] => 'foo [linux-i386 hurd]',
+    [{ name =>  'udev', arch => [ 'linux-any']},{ name => 'makedev', arch => [ 'linux-any']}]
+    => 'udev [linux-any] | makedev [linux-any]',
+    [{name => 'foo', profile => [ ['stage1', 'cross'] ]}]
+    => 'foo <stage1 cross>',
+    [{name => 'foo', profile => [ ['stage1', 'cross'], ['stage1'] ]}]
+    => 'foo <stage1 cross> <stage1>',
+    [{name => 'foo', profile => [ ['stage1', 'cross'], ['pkg.foo-src.yada-yada'] ]}]
+    => 'foo <stage1 cross> <pkg.foo-src.yada-yada>',
 );
 
 while (@struct_2_dep) {
@@ -190,7 +198,7 @@ warning_like {
  [ qr/unnecessary/ ] ,
   "test warn on perl dep with old version";
 
-my $res = $dep_value->check_versioned_dep(  ['perl','>=','5.6.0'] );
+my $res = $dep_value->check_versioned_dep( {name => 'perl', dep => ['>=','5.6.0']} );
 is( $res, 0,"check perl (>= 5.6.0) dependency: no older version");
 
 
@@ -198,15 +206,36 @@ is( $res, 0,"check perl (>= 5.6.0) dependency: no older version");
 # exit ;
 my @chain_tests = (
     # tag name for display, test data, expected result: 1 (good dep) or expected fixed structure
-    'libcpan-meta-perl' => [ ['libcpan-meta-perl']]  => [[qw/perl >= 5.13.10/],['libcpan-meta-perl']],
-    'libmodule-build-perl perl 5.10' => [ [qw/perl >= 5.10/], ['libmodule-build-perl']]  => [['libmodule-build-perl']],
+    'libcpan-meta-perl'
+    => [ { name => 'libcpan-meta-perl'}]
+    => [ { name => 'perl', dep => [qw/>= 5.13.10/]} ,{ name => 'libcpan-meta-perl'}],
+
+    'libmodule-build-perl perl 5.10'
+    => [ { name => 'perl', dep => [qw/>= 5.10/]}, { name => 'libmodule-build-perl'}]
+    => [ { name => 'libmodule-build-perl'}],
+
     # test Debian #719225
-    'libarchive-extract-perl' => [ [qw/libarchive-extract-perl >= 0.68/] , [qw/perl >= 5.17.9/]]  =>  [ ['libarchive-extract-perl'] ,],
-    'libarchive-extract-perl' => [ [qw/perl >= 5.17.9/], ['libarchive-extract-perl'] , ]  => 0, # Archive::Extract is now removed from core
-    'libmodule-build-perl to fix' =>  [ [qw/perl >= 5.11.3/], [qw/libmodule-build-perl >= 0.360000/] ] => [ ['libmodule-build-perl'] ] ,
+    'libarchive-extract-perl'
+    => [ { name => 'libarchive-extract-perl', dep => [qw/>= 0.68/]} ,
+         { name => 'perl', dep => [qw/perl >= 5.17.9/]} ]
+    => [ { name => 'libarchive-extract-perl'} ,],
+
+    'libarchive-extract-perl'
+    => [ { name => 'perl', dep => [qw/>= 5.17.9/] }, { name => 'libarchive-extract-perl'} ]
+    => 0, # Archive::Extract is now removed from core
+
+    'libmodule-build-perl to fix'
+    =>  [ { name => 'perl', dep => [qw/>= 5.11.3/]},
+          { name => 'libmodule-build-perl', dep => [qw/>= 0.360000/ ]}]
+    => [ { name => 'libmodule-build-perl'} ] ,
+
     # test that cme does not restrict needlessly the alternate Perl version
-    'libmodule-metadata-perl to fix' =>  [ [qw/perl >= 5.13.9/], [ qw/libmodule-metadata-perl/ ]] => 1 ,
-    'libmodule-parsexs-perl to fix'  =>  [ [ qw/perl >= 5.12/ ], [ qw/libextutils-parsexs-perl/]] => 1 ,
+    'libmodule-metadata-perl to fix'
+    =>  [ { name => 'perl', dep => [qw/>= 5.13.9/]}, { name => 'libmodule-metadata-perl'} ]
+    => 1 ,
+    'libmodule-parsexs-perl to fix'
+    =>  [ { name => 'perl', dep => [qw/>= 5.12/]}, { name => 'libextutils-parsexs-perl'}]
+    => 1 ,
 );
 
 while (@chain_tests) {
@@ -249,10 +278,10 @@ if ($trace) {
 my $perl_dep = $control->grab("binary:libdist-zilla-plugins-cjm-perl Depends:3");
 is($perl_dep->fetch,"perl (>= 5.10.1)","check dependency value from config tree");
 
-my $res = $perl_dep->check_versioned_dep(['perl','>=','5.28.1']) ;
+my $res = $perl_dep->check_versioned_dep({name => 'perl', dep => ['>=','5.28.1']}) ;
 is($res,1,"check perl (>= 5.28.1) dependency: has older version");
 
-$res = $perl_dep->check_versioned_dep(['perl','>=','5.6.0']) ;
+$res = $perl_dep->check_versioned_dep({ name =>'perl', dep =>['>=','5.6.0']}) ;
 is($res,0,"check perl (>= 5.6.0) dependency: no older version");
 
 my $dpkg_dep = $control->grab("source Build-Depends:2");
diff --git a/t/dependency-grammar.t b/t/dependency-grammar.t
index 8a7d485..289526e 100644
--- a/t/dependency-grammar.t
+++ b/t/dependency-grammar.t
@@ -50,26 +50,101 @@ sub test_good {
     # dep, data struct
     my $pat = shift;
     my @tests = (
-        [ 'foo' ,  ['foo']  ],
-        [ 'foo | bar ' , ['foo' ], ['bar'] ],
-        [ 'foo | bar | baz ' , ['foo' ], ['bar'], ['baz'] ],
-
-        [ 'foo ( >= 1.24 )| bar ' , ['foo','>=','1.24' ], ['bar'] ],
-        [ 'foo ( >= 1.24 )| bar ( << 1.3a3)' , ['foo','>=','1.24' ], [qw/bar << 1.3a3/] ],
-        [ 'foo(>=1.24)|bar(<<1.3a3)  ' , ['foo','>=','1.24' ], [qw/bar << 1.3a3/] ],
-
-        [ 'foo ( >= 1.24 )| bar [ linux-any]' , ['foo','>=','1.24' ], ['bar', undef, undef, 'linux-any'] ],
-        [ 'xserver-xorg-input-evdev [alpha amd64 hurd-arm linux-armeb]' ,
-            [ 'xserver-xorg-input-evdev', undef, undef, qw[alpha amd64 hurd-arm linux-armeb] ],
-         ],
-        [ 'xserver-xorg-input-evdev [!alpha !amd64 !arm !armeb]' , [ 'xserver-xorg-input-evdev', undef, undef,
-                                                                   qw[!alpha !amd64 !arm !armeb]
-                                                                ],
-         ],
-        [ 'hal (>= 0.5.12~git20090406) [kfreebsd-any]', [ 'hal', '>=','0.5.12~git20090406', 'kfreebsd-any']],
+        [ 'foo' ,  { name => 'foo' }  ],
+        [ 'foo | bar ' , { name => 'foo' }, { name => 'bar' } ],
+        [ 'foo | bar | baz ' , { name => 'foo' }, { name => 'bar'}, { name => 'baz'} ],
+
+        [
+            'foo ( >= 1.24 )| bar ' ,
+            { name => 'foo' , dep => [ '>=','1.24' ]},
+            { name => 'bar'}
+        ],
+
+        [
+            'foo ( >= 1.24 )| bar ( << 1.3a3)' ,
+            { name => 'foo',dep => [ '>=','1.24' ]},
+            { name => 'bar', dep => [ '<<', '1.3a3']}
+        ],
+        [
+            'foo(>=1.24)|bar(<<1.3a3)  ' ,
+            { name => 'foo', dep => ['>=','1.24' ]},
+            { name => 'bar', dep => ['<<', '1.3a3']}
+        ],
+
+        [
+            'foo ( >= 1.24 )| bar [ linux-any]' ,
+            { name => 'foo', dep => ['>=','1.24' ]},
+            { name => 'bar', arch => ['linux-any']},
+        ],
+        [
+            'xserver-xorg-input-evdev [alpha amd64 hurd-arm linux-armeb]' ,
+            {
+                name => 'xserver-xorg-input-evdev',
+                arch => [ qw/alpha amd64 hurd-arm linux-armeb/ ]
+            },
+        ],
+
+        [
+            'xserver-xorg-input-evdev [!alpha !amd64 !arm !armeb]' ,
+            {
+                name => 'xserver-xorg-input-evdev',
+                arch => [ qw/!alpha !amd64 !arm !armeb/ ]
+            }
+        ],
+
+        [
+            'hal (>= 0.5.12~git20090406) [kfreebsd-any]',
+            {
+                name => 'hal',
+                dep => [ '>=','0.5.12~git20090406'] ,
+                arch => ['kfreebsd-any']
+            }
+        ],
 
         [ ('${foo}') x 2 ],
         [ ('${foo}.1-2~') x 2 ],
+
+        # see #826573 and https://wiki.debian.org/BuildProfileSpec
+        [
+            'mingw-w64-i686-dev (>= 3.0~svn5915)  [ linux-any] <!stage1>',
+            {
+                name => 'mingw-w64-i686-dev',
+                dep => ['>=', '3.0~svn5915'],
+                arch => ['linux-any'],
+                profile => [['!stage1']]
+
+            }
+        ],
+        [
+            'foo (>= 1.0) [i386 arm] <!stage1> <!cross>' ,
+            {
+                name => 'foo',
+                dep => ['>=', '1.0'],
+                arch => ['i386', 'arm'],
+                profile => [ ['!stage1'], ['!cross'] ]
+            }
+        ],
+        [
+            'foo <stage1 cross>',
+            {
+                name => 'foo',
+                profile => [ ['stage1', 'cross'] ]
+            }
+        ],
+        [
+            'foo <stage1 cross> <stage1>',
+            {
+                name => 'foo',
+                profile => [ ['stage1', 'cross'], ['stage1'] ]
+            }
+        ],
+        [
+            'foo <stage1 cross> <pkg.foo-src.yada-yada>',
+            {
+                name => 'foo',
+                profile => [ ['stage1', 'cross'], ['pkg.foo-src.yada-yada'] ]
+            }
+        ],
     ) ;
 
     foreach my $td ( @tests ) {
@@ -95,8 +170,15 @@ sub test_errors {
                                                 q!bad arch in architecture specification: 'binux'! ],
         [ 'foo ( >= 1.24 )| bar [ linux-nany]' , q!bad arch in architecture specification: 'nany'! ],
 
-        [ 'xserver-xorg-input-evdev [alpha !amd64 !arm armeb]' ,
-            q(some names are prepended with '!' while others aren't.: 'alpha !amd64 !arm armeb') ],
+        [
+            'xserver-xorg-input-evdev [alpha !amd64 !arm armeb]'
+            => q(some names are prepended with '!' while others aren't.: 'alpha !amd64 !arm armeb')
+        ],
+        [
+            'foo <stage3 cross> <stage1>'
+            => q!Unknown build profile name 'stage3': 'Expected one of !
+             . q!cross pkg stage1 stage2 nobiarch nocheck nodoc nogolang nojava noperl nopython noudeb'!
+        ],
 
     ) ;
 
diff --git a/t/model_tests.d/dependency-cache.txt b/t/model_tests.d/dependency-cache.txt
index 58649bf..d71bfe4 100644
--- a/t/model_tests.d/dependency-cache.txt
+++ b/t/model_tests.d/dependency-cache.txt
@@ -107,6 +107,8 @@ libxxf86vm-dev => etch 1:1.0.1-2 lenny 1:1.0.2-1 squeeze 1:1.1.0-2 wheezy 1:1.1.
 libyaml-perl => etch 0.62-1 lenny 0.66-1 squeeze 0.71-1 wheezy 0.73-1 sid 0.73-1
 lsb-base => lenny 3.2-20 squeeze-p-u 3.2-23.2squeeze1 squeeze 3.2-23.2squeeze1 sid 3.2-27
 makedev => squeeze 2.3.1-89 wheezy 2.3.1-92 jessie 2.3.1-92 sid 2.3.1-93
+mingw-w64-i686-dev => oldstable 2.0.3-1 stable 3.2.0-2 unstable 4.0.5-2 experimental 5.0~rc2-1
+mingw-w64-x86-64-dev => oldstable 2.0.3-1 stable-kfreebsd 3.2.0-2 testing 4.0.5-2 experimental 5.0~rc2-1
 muscle => etch 3.60-1 lenny 3.70+fix1-2 squeeze 3.70+fix1-2 wheezy 3.70+fix1-2 sid 3.70+fix1-2
 mysql-server => squeeze-security 5.1.73-1 squeeze 5.1.73-1 squeeze-lts 5.1.73-1+deb6u1 jessie-kfreebsd 5.5.42-1 jessie-kfreebsd-p-u 5.5.43-0+deb8u1 wheezy-security 5.5.44-0+deb7u1 wheezy 5.5.44-0+deb7u1 jessie-kfreebsd-security 5.5.44-0+deb8u1 jessie-security 5.5.44-0+deb8u1 jessie 5.5.44-0+deb8u1 stretch 5.6.25-4 sid 5.6.25-4
 opennebula => squeeze-backports 2.0.1-6~bpo60+1 wheezy 3.4.1-3.1 stretch 4.12.3+dfsg-3 sid 4.12.3+dfsg-3
diff --git a/t/model_tests.d/dpkg-control-test-conf.pl b/t/model_tests.d/dpkg-control-test-conf.pl
index 3966564..7524b7a 100644
--- a/t/model_tests.d/dpkg-control-test-conf.pl
+++ b/t/model_tests.d/dpkg-control-test-conf.pl
@@ -189,9 +189,11 @@ providing the following file:
     {
         name => 'build-profiles',
         load_warnings => [ qr/standards version/ ],
+        apply_fix => 1,
         check => {
             'binary:pkg-config Build-Profiles' => '<!stage1>',
             'binary:pkg-config-stage1 Build-Profiles' => '<stage1>',
+            'source Build-Depends:3' => 'libglib2.0-dev <!stage1>'
         },
     }
 );

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