Skip to content

Commit

Permalink
Merge pull request #8662 from mlschroe/master
Browse files Browse the repository at this point in the history
[backend] make clean_obsolete_dodpackages module aware
  • Loading branch information
mlschroe committed Nov 6, 2019
2 parents 0a36a72 + ae7b02d commit bf38a01
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/backend/BSSched/BuildRepo.pm
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,7 @@ sub addrepo_scan {
return undef unless $r;
# write solv file (unless alien arch)
if ($dirty && $arch eq $gctx->{'arch'}) {
@bins = BSSched::DoD::clean_obsolete_dodpackages($r, $dir, @bins) if $doddata;
@bins = BSSched::DoD::clean_obsolete_dodpackages($pool, $r, $dir, @bins) if $doddata;
writesolv("$dir.solv.new", "$dir.solv", $r);
}
$repocache->setcache($prp, $arch) if $repocache;
Expand Down
20 changes: 19 additions & 1 deletion src/backend/BSSched/DoD.pm
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,28 @@ sub put_doddata_in_cache {
=cut

sub clean_obsolete_dodpackages {
my ($cache, $dir, @bins) = @_;
my ($pool, $cache, $dir, @bins) = @_;

return @bins unless defined &BSSolv::repo::pkgpaths;
my %paths = $cache->pkgpaths();
if (defined(&BSSolv::repo::mayhavemodules) && $cache->mayhavemodules()) {
# find all modules
my @modules;
my @nbins = @bins;
while (@nbins) {
my (undef, $id) = splice(@nbins, 0, 2);
push @modules, $pool->pkg2modules($id);
}
print "clean_obsolete_dodpackages: @modules\n";
if (@modules) {
my @oldpoolmodules = $pool->getmodules();
for my $module (sort(BSUtil::unify(@modules))) {
$pool->setmodules([ $module ]);
%paths = (%paths, $cache->pkgpaths());
}
$pool->setmodules(\@oldpoolmodules);
}
}
my @nbins;
my $nbinsdirty;
while (@bins) {
Expand Down
14 changes: 6 additions & 8 deletions src/backend/bs_repserver
Original file line number Diff line number Diff line change
Expand Up @@ -134,22 +134,20 @@ sub fetchdodbinary {
die("$path has an unsupported suffix\n") unless $path =~ /\.($binsufsre)$/;
my $suf = $1;
my $pkgname = $pool->pkg2name($p);
BSVerify::verify_filename($pkgname);
BSVerify::verify_simple($pkgname);
my $localname = "$reporoot/$reponame/$arch/:full/$pkgname.$suf";
if (defined(&BSSolv::pool::pkg2inmodule) && $pool->pkg2inmodule($p)) {
# use nevra for module packages
my $evr = $pool->pkg2evr($p);
my $arch = $pool->pkg2arch($p);
$localname = "$reporoot/$reponame/$arch/:full/$pkgname-$evr.$arch.$suf";
$pkgname .= '-' . $pool->pkg2evr($p) . '.' . $pool->pkg2arch($p);
}
$pkgname .= ".$suf";
BSVerify::verify_filename($pkgname);
BSVerify::verify_simple($pkgname);
my $localname = "$reporoot/$reponame/$arch/:full/$pkgname";
return $localname if -e $localname;
# we really need to download, handoff to ajax if not already done
BSHandoff::handoff(@$handoff) if $handoff && !$BSStdServer::isajax;
my $url = $repo->dodurl();
$url .= '/' unless $url =~ /\/$/;
$url .= $pool->pkg2path($p);
my $tmp = "$reporoot/$reponame/$arch/:full/.dod.$$.$pkgname.$suf";
my $tmp = "$reporoot/$reponame/$arch/:full/.dod.$$.$pkgname";
#print "fetching: $url\n";
my $param = {'uri' => $url, 'filename' => $tmp, 'receiver' => \&BSHTTP::file_receiver, 'proxy' => $proxy};
$param->{'maxredirects'} = $maxredirects if defined $maxredirects;
Expand Down
3 changes: 1 addition & 2 deletions src/backend/bs_srcserver
Original file line number Diff line number Diff line change
Expand Up @@ -4177,8 +4177,7 @@ sub getbinary {
return published_path($cgi, $projid, $repoid);
}
my $reposerver = $BSConfig::partitioning ? BSSrcServer::Partition::projid2reposerver($projid) : $BSConfig::reposerver;
my @args;
push @args, "view=$view" if $view;
my @args = BSRPC::args($cgi, 'view', 'module');
my $param = {
'uri' => "$reposerver/build/$projid/$repoid/$arch/$packid/$filename",
'ignorestatus' => 1,
Expand Down

0 comments on commit bf38a01

Please sign in to comment.