Skip to content

Commit

Permalink
[backend] get rid of repodatas_alien
Browse files Browse the repository at this point in the history
  • Loading branch information
mlschroe committed Jan 18, 2016
1 parent b660856 commit 68c85f8
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 39 deletions.
4 changes: 2 additions & 2 deletions src/backend/BSSched/BuildJob/Package.pm
Expand Up @@ -193,8 +193,8 @@ sub check {
# even more work, generate new meta, check if it changed
my @new_meta;
my $repodatas = $gctx->{'repodatas'};
my $dep2meta = $repodatas->{$prp}->{'meta'};
$repodatas->{$prp}->{'meta'} = $dep2meta = {} unless $dep2meta;
my $dep2meta = $repodatas->{"$prp/$myarch"}->{'meta'};
$repodatas->{"$prp/$myarch"}->{'meta'} = $dep2meta = {} unless $dep2meta;
for my $bpack (@$edeps) {
my $pkg = $dep2pkg->{$bpack};
my $path = $pool->pkg2fullpath($pkg, $myarch);
Expand Down
18 changes: 6 additions & 12 deletions src/backend/BSSched/BuildRepo.pm
Expand Up @@ -64,7 +64,6 @@ package BSSched::BuildRepo;
# repodatas
# reporoot
# remoteprojs
# repodatas_alien
#
# ctx usage
# gctx
Expand Down Expand Up @@ -655,6 +654,7 @@ sub move_into_full {
my $prp = $fctx->{'prp'};
my $gdst = $fctx->{'gdst'};
my $gctx = $fctx->{'gctx'};
my $prpa = "$prp/$gctx->{'arch'}";
my $repodatas = $gctx->{'repodatas'};
my $pool;
my $satrepo;
Expand Down Expand Up @@ -682,7 +682,7 @@ sub move_into_full {
$fctx->{'oldids'} = \%oldids;
$fctx->{'metacache'} = $metacache;
$fctx->{'metacache_ismerge'} = $metacache_ismerge;
$fctx->{'dep2meta'} = $repodatas->{$prp}->{'meta'} if $repodatas->{$prp} && $repodatas->{$prp}->{'meta'};
$fctx->{'dep2meta'} = $repodatas->{$prpa}->{'meta'} if $repodatas->{$prpa} && $repodatas->{$prpa}->{'meta'};
mkdir_p("$gdst/:full") if $new && %$new && ! -d "$gdst/:full";

if ($BSSched::BuildResult::new_full_handling) {
Expand Down Expand Up @@ -713,7 +713,7 @@ sub move_into_full {
BSUtil::store("$gdst/.:full.metacache", "$gdst/:full.metacache", $metacache);
}
}
delete $repodatas->{$prp}->{'solv'};
delete $repodatas->{$prpa}->{'solv'};
}

=head2 sync_fullcache - TODO
Expand Down Expand Up @@ -741,7 +741,7 @@ sub sync_fullcache {
$satrepo = $pool->repofrombins($prp, "$gdst/:full", %oldids);
}
writesolv("$gdst/:full.solv.new", "$gdst/:full.solv", $satrepo);
delete $gctx->{'repodatas'}->{$prp}->{'solv'};
delete $gctx->{'repodatas'}->{"$prp/$myarch"}->{'solv'};
if ($fullcache->{'metacache'}) {
if ($fullcache->{'metacache_ismerge'}) {
BSUtil::store("$gdst/.:full.metacache.merge", "$gdst/:full.metacache.merge", $fullcache->{'metacache'});
Expand Down Expand Up @@ -863,7 +863,7 @@ sub addrepo {

# first check the cache
my $now = time();
my $repodata = $arch eq $myarch ? $gctx->{'repodatas'}->{$prp} : $gctx->{'repodatas_alien'}->{"$prp/$arch"};
my $repodata = $gctx->{'repodatas'}->{"$prp/$arch"};
if ($repodata && $repodata->{'lastscan'} && $repodata->{'lastscan'} + 24 * 3600 + ($repodata->{'random'} || 0) * 1800 > $now) {
if (exists $repodata->{'solv'}) {
my $r;
Expand Down Expand Up @@ -901,13 +901,7 @@ sub addrepo {
if ($remoteprojs->{$projid}) {
return BSSched::Remote::addrepo_remote($ctx, $pool, $prp, $arch, $remoteprojs->{$projid});
}
if (!$repodata) {
if ($arch eq $myarch) {
$gctx->{'repodatas'}->{$prp} = $repodata = {};
} else {
$gctx->{'repodatas_alien'}->{"$prp/$arch"} = $repodata = {};
}
}
$gctx->{'repodatas'}->{"$prp/$arch"} = $repodata = {} unless $repodata;
my $r = addrepo_scan($ctx, $pool, $prp, $arch, $repodata);
if ($r && $arch eq $myarch) {
$repodata->{'lastscan'} = time();
Expand Down
8 changes: 1 addition & 7 deletions src/backend/BSSched/DoD.pm
Expand Up @@ -141,14 +141,8 @@ sub dodfetch_resume {
$ctx->setchanged($handle);
# drop cache
my $gctx = $ctx->{'gctx'};
my $myarch = $gctx->{'arch'};
my $prpa = $handle->{'_prpa'};
my ($projid, $repoid, $arch) = split('/', $handle->{'_prpa'}, 3);
if ($arch eq $myarch) {
delete $gctx->{'repodatas'}->{"$projid/$repoid"};
} else {
delete $gctx->{'repodatas_alien'}->{$prpa};
}
delete $gctx->{'repodatas'}->{$prpa};
}

=head2 dodfetch - TODO: add summary
Expand Down
9 changes: 6 additions & 3 deletions src/backend/BSSched/EventHandler.pm
Expand Up @@ -164,7 +164,8 @@ sub event_repository {
$changed_med->{$prp} = 2;
my $repounchanged = $gctx->{'repounchanged'};
if ($ev->{'type'} eq 'repository') {
delete $gctx->{'repodatas'}->{$prp};
my $myarch = $gctx->{'arch'};
delete $gctx->{'repodatas'}->{"$prp/$myarch"};
delete $repounchanged->{$prp};
} elsif ($ev->{'type'} eq 'repoinfo') {
$repounchanged->{$prp} = 2 if $repounchanged->{$prp};
Expand Down Expand Up @@ -259,8 +260,9 @@ sub event_scanrepo {
}
if (defined($projid) && defined($repoid)) {
my $prp = "$projid/$repoid";
my $myarch = $gctx->{'arch'};
print "reading packages of repository $projid/$repoid\n";
delete $gctx->{'repodatas'}->{$prp};
delete $gctx->{'repodatas'}->{"$prp/$myarch"};
my $ctx = BSSched::Checker->new($gctx, $prp);
my $pool = BSSolv::pool->new();
$ctx->addrepo($pool, $prp);
Expand Down Expand Up @@ -319,7 +321,8 @@ sub event_dumprepo {

my $gctx = $ectx->{'gctx'};
my $prp = "$ev->{'project'}/$ev->{'repository'}";
my $repodata = $gctx->{'repodatas'}->{$prp} || {};
my $arch = $ev->{'arch'} || $gctx->{'arch'};
my $repodata = $gctx->{'repodatas'}->{"$prp/$arch"} || {};
local *F;
open(F, '>', "/tmp/repodump");
print F "# repodump for $prp\n\n";
Expand Down
14 changes: 3 additions & 11 deletions src/backend/BSSched/Remote.pm
Expand Up @@ -49,7 +49,6 @@ package BSSched::Remote;
# asyncmode
# rctx
# repodatas
# repodatas_alien
# remotecache
# prpnotready
# remotegbininfos
Expand Down Expand Up @@ -372,18 +371,11 @@ sub addrepo_remote_resume {
sub addrepo_remote_unpackcpio {
my ($gctx, $pool, $prp, $arch, $cpio, $solvok, $error) = @_;

my $repodata;
my $myarch = $gctx->{'arch'};

if ($arch eq $myarch) {
my $repodatas = $gctx->{'repodatas'};
$repodatas->{$prp} ||= {};
$repodata = $repodatas->{$prp};
} else {
my $repodatas_alien = $gctx->{'repodatas_alien'};
$repodatas_alien->{"$prp/$arch"} ||= {};
$repodata = $repodatas_alien->{"$prp/$arch"};
}
my $repodatas = $gctx->{'repodatas'};
my $repodata = $repodatas->{"$prp/$myarch"};
$repodatas->{"$prp/$myarch"} = $repodata = {} unless $repodata;

my $remotecache = $gctx->{'remotecache'};
my $cachemd5 = Digest::MD5::md5_hex("$prp/$arch");
Expand Down
7 changes: 3 additions & 4 deletions src/backend/bs_sched
Expand Up @@ -401,7 +401,6 @@ my $gctx = {
# 'meta' meta cache
# 'solv' solv data cache (for remote repos)
'repodatas' => {},
'repodatas_alien' => {}, # repodatas for other architectures

# remote bininfo cache
'remotegbininfos' => {},
Expand Down Expand Up @@ -868,7 +867,7 @@ eval {
delete $gctx->{'prpnotready'}->{$prp};
delete $gctx->{'prpunfinished'}->{$prp};
delete $gctx->{'prpchecktimes'}->{$prp};
delete $gctx->{'repodatas'}->{$prp};
delete $gctx->{'repodatas'}->{"$prp/$myarch"};
delete $gctx->{'lastcheck'}->{$prp};
delete $gctx->{'prpcheckuseforbuild'}->{$prp};
my $ctx = BSSched::Checker->new($gctx, $prp);
Expand Down Expand Up @@ -1016,7 +1015,7 @@ eval {
delete $gctx->{'lastcheck'}->{$prp};
# delete pkg meta cache
my $repodatas = $gctx->{'repodatas'};
delete $repodatas->{$prp}->{'meta'} if $repodatas->{$prp};
delete $repodatas->{"$prp/$myarch"}->{'meta'} if $repodatas->{"$prp/$myarch"};

if (!$gctx->{'prpnoleaf'}->{$prp}) {
# only free repo data if all projects we depend on are finished, too.
Expand All @@ -1035,7 +1034,7 @@ eval {
}
if (!@unfinishedprps) {
print " leaf prp, freeing data\n";
delete $repodatas->{$prp};
delete $repodatas->{"$prp/$myarch"};
} else {
print " leaf prp, unfinished prps: @unfinishedprps\n";
}
Expand Down

0 comments on commit 68c85f8

Please sign in to comment.