From 3312dad577224d465985bde954fd4e261dce6982 Mon Sep 17 00:00:00 2001 From: Michael Schroeder Date: Tue, 1 Oct 2024 10:40:35 +0200 Subject: [PATCH] Refactor basecontainer handling in pbuild --- PBuild/Job.pm | 6 ++---- PBuild/Recipe.pm | 7 ++++--- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/PBuild/Job.pm b/PBuild/Job.pm index 01f60a60a..18f329355 100644 --- a/PBuild/Job.pm +++ b/PBuild/Job.pm @@ -192,10 +192,8 @@ sub export_origtar { # sub findbasecontainer { my ($ctx, $p, $bdeps) = @_; - my $cname = (grep {/^container:/} @{$p->{'dep'} || []})[-1]; - return undef unless $cname; - my $bconf = $ctx->{'bconf'}; - my %providers = map {$_ => 1} @{$bconf->{'whatprovidesh'}->{$cname} || []}; + return undef unless $p->{'basecontainer'}; + my %providers = map {$_ => 1} Build::whatprovides($ctx->{'bconf'}, $p->{'basecontainer'}); return (grep {$providers{$_}} @{$bdeps || []})[0]; } diff --git a/PBuild/Recipe.pm b/PBuild/Recipe.pm index 23209e30d..8ca6dd797 100644 --- a/PBuild/Recipe.pm +++ b/PBuild/Recipe.pm @@ -154,11 +154,12 @@ sub parse { if ($p->{'files'}->{'_service'}) { push @{$p->{'buildtimeservice'}}, $_ for PBuild::Service::get_buildtimeservices($p); } - my $imagetype = $bt eq 'kiwi' && $d->{'imagetype'} ? ($d->{'imagetype'}->[0] || '') : ''; - if ($bt eq 'kiwi' && $imagetype eq 'product') { + my $kiwi_imagetype = $bt eq 'kiwi' && $d->{'imagetype'} ? ($d->{'imagetype'}->[0] || '') : ''; + if ($kiwi_imagetype eq 'product' || $bt eq 'productcompose') { $p->{'nodbgpkgs'} = 1 if defined($d->{'debugmedium'}) && $d->{'debugmedium'} <= 0; $p->{'nosrcpkgs'} = 1 if defined($d->{'sourcemedium'}) && $d->{'sourcemedium'} <= 0; } + $p->{'basecontainer'} = $d->{'basecontainer'} if $d->{'basecontainer'}; my $myarch = $bconf->{'target'} ? (split('-', $bconf->{'target'}))[0] : $arch; $p->{'error'} = 'excluded' if $d->{'exclarch'} && !grep {$_ eq $myarch} @{$d->{'exclarch'}}; $p->{'error'} = 'excluded' if $d->{'badarch'} && grep {$_ eq $myarch} @{$d->{'badarch'}}; @@ -166,7 +167,7 @@ sub parse { $p->{'remoteassets'} = $d->{'remoteassets'} if $d->{'remoteassets'}; # check if we can build this - if ($bt eq 'kiwi' && $imagetype eq 'product') { + if ($kiwi_imagetype eq 'product') { $p->{'error'} = 'cannot build kiwi products yet'; return; }