Skip to content

Commit

Permalink
[backend] fix handling of build time services
Browse files Browse the repository at this point in the history
Move processing from the source server to the build job creation
code, so that they get added to the correct set of packages.
We also no longer transport them in the normal dependency set, so
that we do not need to extract them.
  • Loading branch information
mlschroe authored and adrianschroeter committed Feb 20, 2018
1 parent 4ebc613 commit be156a9
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
19 changes: 17 additions & 2 deletions src/backend/BSSched/BuildJob.pm
Original file line number Diff line number Diff line change
Expand Up @@ -896,13 +896,28 @@ sub create {

my $expanddebug = $ctx->{'expanddebug'};

# calculate build time service debs
my @btdeps;
if ($info->{'buildtimeservice'}) {
for my $service (@{$info->{'buildtimeservice'} || []}) {
if ($bconf->{'substitute'}->{"obs-service:$service"}) {
push @btdeps, @{$bconf->{'substitute'}->{"obs-service:$service"}};
} else {
my $pkgname = "obs-service-$service";
$pkgname =~ s/_/-/g if $bconf->{'binarytype'} eq 'deb';
push @btdeps, $pkgname;
}
}
@btdeps = BSUtil::unify(@btdeps);
}

# calculate sysdeps (cannot cache in the kiwi case)
my @sysdeps;
if ($buildtype eq 'kiwi') {
my $kiwitype = '';
$kiwitype = $info->{'imagetype'} && $info->{'imagetype'}->[0] eq 'product' ? 'kiwi-product' : 'kiwi-image';
@sysdeps = grep {/^kiwi-.*:/} @{$info->{'dep'} || []};
@sysdeps = Build::get_sysbuild($bconf, $kiwitype, [ @sysdeps, @{$ctx->{'extradeps'} || []} ]);
@sysdeps = Build::get_sysbuild($bconf, $kiwitype, [ @sysdeps, @btdeps, @{$ctx->{'extradeps'} || []} ]);
} else {
$ctx->{"sysbuild_$buildtype"} ||= [ Build::get_sysbuild($bconf, $buildtype) ];
@sysdeps = @{$ctx->{"sysbuild_$buildtype"}};
Expand All @@ -912,7 +927,7 @@ sub create {
# calculate packages needed for building
my @bdeps = grep {!/^\// || $bconf->{'fileprovides'}->{$_}} @{$info->{'prereq'} || []};
unshift @bdeps, '--directdepsend--' if @bdeps;
unshift @bdeps, @{$info->{'dep'} || []}, @{$ctx->{'extradeps'} || []};
unshift @bdeps, @{$info->{'dep'} || []}, @btdeps, @{$ctx->{'extradeps'} || []};
push @bdeps, '--ignoreignore--' if @sysdeps;

if ($kiwimode || $buildtype eq 'buildenv') {
Expand Down
1 change: 1 addition & 0 deletions src/backend/BSXML.pm
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ our $packinfo = [
'error',
[ 'dep' ],
[ 'prereq' ],
[ 'buildtimeservice' ],
[ 'imagetype' ], # kiwi
[ 'imagearch' ], # kiwi
'nodbgpkgs', # kiwi
Expand Down
7 changes: 2 additions & 5 deletions src/backend/bs_srcserver
Original file line number Diff line number Diff line change
Expand Up @@ -1600,13 +1600,10 @@ sub getprojpack {
}
# add all source services to be used at build time
if ($files->{'_service'}) {
my $services = BSRevision::revreadxml($rev, '_service', $files->{'_service'}, $BSXML::services, 1);
my $services = BSRevision::revreadxml($rev, '_service', $files->{'_service'}, $BSXML::services, 1) || {};
for my $service (@{$services->{'service'} || []}) {
next unless $service->{'mode'} && $service->{'mode'} eq 'buildtime';
my $pkgname = "obs-service-$service->{'name'}";
# debian does not allow _ in package name
$pkgname =~ s/_/-/g if $conf->{'binarytype'} eq 'deb';
push @{$rinfo->{'dep'}}, $pkgname;
push @{$rinfo->{'buildtimeservice'}}, $service->{'name'};
}
}
# KIWI Products support debugmedium and sourcemedium filters
Expand Down

0 comments on commit be156a9

Please sign in to comment.