Skip to content

Commit

Permalink
[backend] refactor bininfo.merge handling
Browse files Browse the repository at this point in the history
All now done in BuildResult.pm, like it ought to be.
  • Loading branch information
mlschroe committed Feb 16, 2018
1 parent a4faa8a commit a291ded
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
9 changes: 1 addition & 8 deletions src/backend/BSSched/BuildJob.pm
Original file line number Diff line number Diff line change
Expand Up @@ -658,14 +658,7 @@ sub fakejobfinished_nouseforbuild {
BSUtil::store("$dst/.bininfo.new", "$dst/.bininfo", $bininfo);
my @bininfo_s = stat("$dst/.bininfo");
$bininfo->{'.bininfo'} = {'id' => "$bininfo_s[9]/$bininfo_s[7]/$bininfo_s[1]"} if @bininfo_s;
my $gbininfo = {};
$gbininfo = BSUtil::retrieve("$gdst/:bininfo.merge", 1) if -e "$gdst/:bininfo.merge";
if ($gbininfo) {
$gbininfo->{$packid} = $bininfo;
BSUtil::store("$gdst/.:bininfo.merge", "$gdst/:bininfo.merge", $gbininfo);
} else {
writestr("$gdst/.:bininfo.merge", "$gdst/:bininfo.merge", ''); # corrupt file, mark
}
BSSched::BuildResult::update_bininfo_merge($gdst, $packid, $bininfo);
delete $bininfo->{'.bininfo'};
# write history file
my $h = {'versrel' => $pdata->{'versrel'}, 'bcnt' => "0", 'time' => time(), 'srcmd5' => $pdata->{'srcmd5'}, 'rev' => $pdata->{'rev'}, 'reason' => "", 'duration' => "0"};
Expand Down
4 changes: 1 addition & 3 deletions src/backend/BSSched/BuildRepo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -381,9 +381,7 @@ sub fctx_rebuild_full {

if ($out_of_sync) {
print "detected out-of-sync condition for $out_of_sync, rebuilding bad bininfos\n";
unlink("$gdst/:bininfo");
unlink("$gdst/:bininfo.merge");
$gbininfo = BSSched::BuildResult::read_gbininfo($gdst);
$gbininfo = BSSched::BuildResult::rebuild_gbininfo($gdst);
my %newfull = fctx_gbininfo2full($fctx, $gbininfo, undef, undef, $fctx->{'newuseforbuild'});
fctx_rebuild_full($fctx, \%newfull, $gbininfo);
return;
Expand Down
11 changes: 11 additions & 0 deletions src/backend/BSSched/BuildResult.pm
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,17 @@ sub read_gbininfo {
return $gbininfo;
}

=head2 rebuild_gbininfo - force a rebuild of the bininfo data
=cut

sub rebuild_gbininfo {
my ($gdst) = @_;
unlink("$gdst/:bininfo");
unlink("$gdst/:bininfo.merge");
return read_gbininfo($gdst);
}

=head2 findmeta - find the correct meta for a binary in a package directory
=cut
Expand Down
4 changes: 1 addition & 3 deletions src/backend/BSSched/EventHandler.pm
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,8 @@ sub event_scanprjbinaries {
}
}
my $reporoot = $gctx->{'reporoot'};
unlink("$reporoot/$prp/$myarch/:bininfo");
unlink("$reporoot/$prp/$myarch/:bininfo.merge");
print "reading project binary state of repository $projid/$repoid\n";
BSSched::BuildResult::read_gbininfo("$reporoot/$prp/$myarch");
BSSched::BuildResult::rebuild_gbininfo("$reporoot/$prp/$myarch");
$changed_high->{$prp} = 1;
}
}
Expand Down

0 comments on commit a291ded

Please sign in to comment.