Skip to content

Commit

Permalink
Merge pull request #7227 from mlschroe/master
Browse files Browse the repository at this point in the history
binarychecksums: use XML for communicating with a remote server
  • Loading branch information
mlschroe committed Mar 20, 2019
2 parents d3138f5 + 41bf7de commit 8e3d84f
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 11 deletions.
5 changes: 3 additions & 2 deletions src/backend/BSSched/BuildJob.pm
Expand Up @@ -979,8 +979,9 @@ sub create {
# make sure we have the preinstalls and vminstalls
my @missing = grep {!$ctx->{'dep2pkg'}->{$_}} (@pdeps, @vmdeps);
if (@missing) {
@missing = sort(BSUtil::unify(@missing));
return ('unresolvable', "missing pre/vminstalls: ".join(', ', @missing));
my $missing = join(', ', sort(BSUtil::unify(@missing)));
print " missing pre/vminstalls: $missing\n" if $ctx->{'verbose'};
return ('unresolvable', "missing pre/vminstalls: $missing");
}

# kill those ancient other jobs
Expand Down
8 changes: 8 additions & 0 deletions src/backend/BSXML.pm
Expand Up @@ -773,6 +773,14 @@ our $packagebinaryversionlist = [
]],
];

our $packagebinarychecksums = [
'packagebinarychecksums' =>
[[ 'binarychecksums' =>
'package',
'_content',
]],
];

our $worker = [
'worker' =>
'hostarch',
Expand Down
10 changes: 7 additions & 3 deletions src/backend/bs_repserver
Expand Up @@ -362,17 +362,21 @@ sub getbinarychecksums {
my $prp = "$projid/$repoid";

my $r = "$reporoot/$prp/$arch/:repo";
if (-s "$r/.newchecksums") {
if ($cgi->{'view'} eq 'binarychecksums' || -s "$r/.newchecksums") {
my $checksums = BSUtil::retrieve("$r/.checksums", 1) || {};
my $newchecksums = BSUtil::retrieve("$r/.newchecksums", 1) || {};
$checksums->{$_} = delete $newchecksums->{$_} for keys %$newchecksums;
if ($cgi->{'view'} eq 'binarychecksums') {
my @res = map { {'package' => $_, '_content' => $checksums->{$_}} } sort keys %$checksums;
return ({ 'binarychecksums' => \@res }, $BSXML::packagebinarychecksums);
}
return (BSUtil::tostorable($checksums), 'Content-Type: application/octet-stream');
}
my $fd;
if (!open($fd, '<', "$r/.checksums")) {
return (BSUtil::tostorable({}), 'Content-Type: application/octet-stream');
}
BSServer::reply_file($fd, 'Content-Type: application/octet-stream');
BSWatcher::reply_file($fd, 'Content-Type: application/octet-stream');
return undef;
}

Expand All @@ -395,7 +399,7 @@ sub getpackagelist_build {
my $view = $cgi->{'view'};
die "must specify view\n" unless $view;
return getrepositorystatus($cgi, $projid, $repoid, $arch) if $view eq 'status';
return getbinarychecksums($cgi, $projid, $repoid, $arch) if $view eq 'binarychecksums';
return getbinarychecksums($cgi, $projid, $repoid, $arch) if $view eq 'binarychecksums' || $view eq 'rawbinarychecksums';
$cgi->{'withcode'} = 1 if $view eq 'binaryversionscode' || $view eq 'gbininfocode';
return getgbininfo($cgi, $projid, $repoid, $arch) if $view eq 'gbininfo' || $view eq 'gbininfocode';
return getpackagebinaryversionlist($cgi, $projid, $repoid, $arch, $cgi->{'package'}) if $view eq 'binaryversions' || $view eq 'binaryversionscode';
Expand Down
21 changes: 15 additions & 6 deletions src/backend/bs_worker
Expand Up @@ -1766,12 +1766,21 @@ sub getbinaries_kiwiproduct {
if (@done && !$chksumfiles{"$prp/$arch"}) {
# get checksums file
eval {
BSRPC::rpc({
'uri' => "$server/build/$projid/$repoid/$arch",
'timeout' => $gettimeout,
'receiver' => \&BSHTTP::file_receiver,
'filename' => "$ddir/.checksums.$arch",
}, undef, 'view=binarychecksums');
if ($server eq $buildinfo->{'srcserver'}) {
my $chk = BSRPC::rpc({
'uri' => "$server/build/$projid/$repoid/$arch",
'timeout' => $gettimeout,
}, $BSXML::packagebinarychecksums, 'view=binarychecksums');
$chk = { map { $_->{'name'} => $_->{'_content'} } @{$chk->{'binarychecksums'} || []} };
BSUtil::store("$ddir/.checksums.$arch", undef, $chk);
} else {
BSRPC::rpc({
'uri' => "$server/build/$projid/$repoid/$arch",
'timeout' => $gettimeout,
'receiver' => \&BSHTTP::file_receiver,
'filename' => "$ddir/.checksums.$arch",
}, undef, 'view=rawbinarychecksums');
}
$chksumfiles{"$prp/$arch"} = "$ddir/.checksums.$arch" if -s "$ddir/.checksums.$arch";
};
}
Expand Down

0 comments on commit 8e3d84f

Please sign in to comment.