Skip to content

Commit

Permalink
Refactor basecontainer handling in pbuild
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Oct 1, 2024
1 parent 39534d2 commit 3312dad
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
6 changes: 2 additions & 4 deletions PBuild/Job.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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];
}

Expand Down
7 changes: 4 additions & 3 deletions PBuild/Recipe.pm
Original file line number Diff line number Diff line change
Expand Up @@ -154,19 +154,20 @@ 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'}};
$p->{'imagetype'} = $d->{'imagetype'} if $d->{'imagetype'};

$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;
}
Expand Down

0 comments on commit 3312dad

Please sign in to comment.