Skip to content

Commit

Permalink
[backend] support to enable ccache builds via a build option in the r…
Browse files Browse the repository at this point in the history
…ecipe

We support --enable-ccache and --enable-ccache=ccachetype.
  • Loading branch information
mlschroe committed Mar 31, 2022
1 parent 2e6e8ca commit 2e9e488
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/backend/BSSched/BuildJob.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1064,13 +1064,20 @@ sub create {
unshift @bdeps, @{$genbuildreqs->[1]} if $genbuildreqs;
unshift @bdeps, @{$info->{'dep'} || []}, @btdeps, @{$ctx->{'extradeps'} || []};
push @bdeps, '--ignoreignore--' if @sysdeps || $buildtype eq 'simpleimage';
if ($packid && exists($bconf->{'buildflags:useccache'}) && ($buildtype eq 'arch' || $buildtype eq 'spec' || $buildtype eq 'dsc')) {
my $opackid = $packid;
$opackid = $pdata->{'releasename'} if $pdata->{'releasename'};
if (grep {$_ eq "useccache:$opackid" || $_ eq "useccache:$packid"} @{$bconf->{'buildflags'} || []}) {
# enable ccache support if requested
if ($buildtype eq 'arch' || $buildtype eq 'spec' || $buildtype eq 'dsc') {
my @enable_ccache = grep {/^--enable-ccache/} @{$info->{'dep'} || []};
if (@enable_ccache) {
$ccache = $bconf->{'buildflags:ccachetype'} || 'ccache';
push @bdeps, @{$bconf->{'substitute'}->{"build-packages:$ccache"} || [ $ccache ] };
$ccache = $1 if $enable_ccache[0] =~ /--enable-ccache=(.+)$/;
} elsif ($packid && exists($bconf->{'buildflags:useccache'})) {
my $opackid = $packid;
$opackid = $pdata->{'releasename'} if $pdata->{'releasename'};
if (grep {$_ eq "useccache:$opackid" || $_ eq "useccache:$packid"} @{$bconf->{'buildflags'} || []}) {
$ccache = $bconf->{'buildflags:ccachetype'} || 'ccache';
}
}
push @bdeps, @{$bconf->{'substitute'}->{"build-packages:$ccache"} || [ $ccache ] } if $ccache;
}

if ($kiwimode || $buildtype eq 'buildenv') {
Expand Down

0 comments on commit 2e9e488

Please sign in to comment.