Skip to content

Commit

Permalink
[backend] BuildJob: read genbuildreqs from disk if we do not have it yet
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Apr 12, 2023
1 parent b68f5af commit 9a71851
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/backend/BSSched/BuildJob.pm
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,15 @@ sub update_buildavg {

sub set_genbuildreqs {
my ($gctx, $prp, $packid, $file, $verifymd5) = @_;
my $myarch = $gctx->{'arch'};
my $reporoot = $gctx->{'reporoot'};
my $gdst = "$reporoot/$prp/$myarch";
my $filecontent = $file ? readstr($file, 1) : undef;
my $genbuildreqs = $gctx->{'genbuildreqs'}->{$prp};
if (!$genbuildreqs && -e "$gdst/:genbuildreqs") {
$genbuildreqs = BSUtil::retrieve("$gdst/:genbuildreqs", 1) || {};
$gctx->{'genbuildreqs'}->{$prp} = $genbuildreqs if %$genbuildreqs;
}
if (defined $filecontent) {
my $md5 = Digest::MD5::md5_hex($filecontent);
return if $genbuildreqs && ($genbuildreqs->{$packid} || [''])->[0] eq $md5 && (($genbuildreqs->{$packid} || [])->[2] || '') eq ($verifymd5 || '');
Expand All @@ -382,9 +389,6 @@ sub set_genbuildreqs {
return if !$genbuildreqs || !delete($genbuildreqs->{$packid});
delete($gctx->{'genbuildreqs'}->{$prp}) if !%$genbuildreqs;
}
my $myarch = $gctx->{'arch'};
my $reporoot = $gctx->{'reporoot'};
my $gdst = "$reporoot/$prp/$myarch";
if (%{$genbuildreqs || {}}) {
mkdir_p($gdst);
BSUtil::store("$gdst/.:genbuildreqs", "$gdst/:genbuildreqs", $genbuildreqs);
Expand Down

0 comments on commit 9a71851

Please sign in to comment.