Skip to content

Commit

Permalink
[backend] automatically rebuild the binarylists if the worker detects…
Browse files Browse the repository at this point in the history
… bogus entries
  • Loading branch information
mlschroe authored and adrianschroeter committed Feb 14, 2013
1 parent 1890ec9 commit eb3227f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/backend/bs_repserver
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,23 @@ sub getpackagebinaryversionlist {
return ({ 'binaryversionlist' => \@res }, $BSXML::packagebinaryversionlist);
}

# the worker thinks that out packagebinaryversionlist contains bogus entries
sub badpackagebinaryversionlist {
my ($cgi, $projid, $repoid, $arch, $packids) = @_;
my $dir = "$reporoot/$projid/$repoid/$arch";
my $gbininfo = read_gbininfo($dir);
if ($gbininfo) {
$packids = [ sort keys %$gbininfo ] unless $packids;
for my $packid (@$packids) {
unlink("$dir/$packid/.bininfo");
}
unlink("$dir/:bininfo");
unlink("$dir/:bininfo.merge");
forwardevent($cgi, 'scanprjbinaries', $projid, $packids->[0], $repoid, $arch);
}
return $BSStdServer::return_ok;
}

sub getbinaries {
my ($cgi, $projid, $repoid, $arch) = @_;
my $prp = "$projid/$repoid";
Expand Down Expand Up @@ -3440,6 +3457,7 @@ my $dispatches = [
'!worker /getbinaryversions $project $repository $arch binaries: nometa:bool?' => \&getbinaryversions,
'!worker /getjobdata $arch $job $jobid:md5' => \&getjobdata,
'!worker /getpackagebinaryversionlist $project $repository $arch $package* withcode:bool?' => \&getpackagebinaryversionlist,
'!worker /badpackagebinaryversionlist $project $repository $arch $package*' => \&badpackagebinaryversionlist,
'!worker /getpreinstallimageinfos $prpa+ match:?' => \&getpreinstallimageinfos,

# published files
Expand Down
27 changes: 27 additions & 0 deletions src/backend/bs_sched
Original file line number Diff line number Diff line change
Expand Up @@ -5391,6 +5391,32 @@ sub event_scanrepo {
}
}

sub event_scanprjbinaries {
my ($ectx, $ev) = @_;
my $changed_high = $ectx->{'changed_high'};
my $projid = $ev->{'project'};
my $repoid = $ev->{'repository'};
my $packid = $ev->{'package'};
if (defined($projid) && defined($repoid)) {
my $prp = "$projid/$repoid";
delete $remotegbininfos{"$prp/$myarch"};
return if $remoteprojs{$projid};
if (defined($packid)) {
unlink("$prp/$myarch/$packid/.bininfo");
} else {
for my $packid (grep {!/^[:\.]/} ls("$prp/$myarch")) {
next if $packid eq '_deltas';
next unless -d "$prp/$myarch/$packid";
unlink("$prp/$myarch/$packid/.bininfo");
}
}
unlink("$reporoot/$prp/$myarch/:bininfo");
unlink("$reporoot/$prp/$myarch/:bininfo.merge");
print "reading project binary state of repository $projid/$repoid\n";
read_gbininfo("$reporoot/$prp/$myarch");
}
}

sub event_dumprepo {
my ($ectx, $ev) = @_;

Expand Down Expand Up @@ -5556,6 +5582,7 @@ my %event_handlers = (
'unblocked' => \&event_check_med,
'relsync' => \&event_check_med,
'scanrepo' => \&event_scanrepo,
'scanprjbinaries' => \&event_scanprjbinaries,
'dumprepo' => \&event_dumprepo,
'wipenotyet' => \&event_wipenotyet,
'wipe' => \&event_wipe,
Expand Down
10 changes: 10 additions & 0 deletions src/backend/bs_worker
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,16 @@ sub getbinaries_kiwiproduct {
unlink("$ddir/$_.new.rpm");
delete $cachenew{"$ddir/$_"};
}
if ($bvl && $server ne $buildinfo->{'srcserver'}) {
# the bvl entry seems to be wrong. tell our server about that.
eval {
BSRPC::rpc({
'uri' => "$server/badpackagebinaryversionlist",
'timeout' => $gettimeout,
}, undef, "project=$projid", "repository=$repoid", "arch=$arch", "package=$packid");
};
warn($@) if $@;
}
$res = BSRPC::rpc({
'uri' => "$server/build/$projid/$repoid/$arch/$packid",
'directory' => $ddir,
Expand Down

0 comments on commit eb3227f

Please sign in to comment.