Skip to content

Commit

Permalink
[backend] set priorities for repositories when using obsrepositories:…
Browse files Browse the repository at this point in the history
…/ directive
  • Loading branch information
adrianschroeter committed Feb 4, 2014
1 parent f72ad93 commit f051a97
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/backend/bs_worker
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ sub manage_cache {
}
@$content = grep {defined $_} @$content;
Storable::nstore($content, "$cachedir/content.new");
rename("$cachedir/content.new", "$cachedir/content") || die("rename $cachedir/content.new $cachedir/content: $!\n");
rename("$cachedir/content.new", "$cachedir/content") || die("rename $cachedir/content.new $cachedir/content");
close F;
}

Expand Down Expand Up @@ -2004,7 +2004,8 @@ sub patchproductkiwi {
my $counter = 0;
for my $path (@{$buildinfo->{'path'} || []}) {
my $h = { 'source' => { 'path' => "obs://$path->{'project'}/$path->{'repository'}" } };
$h->{'priority'} = $repository->{'priority'} if $repository->{'priority'};
my $prio = ($repository->{'priority'} || 0) + $counter;
$h->{'priority'} = $prio;
$h->{'local'} = $repository->{'local'} if $repository->{'local'};
if ($repository->{'name'}) {
$counter = $counter + 1;
Expand Down Expand Up @@ -2285,22 +2286,25 @@ sub dobuild {
my @kiwiargs;
my $use_parameters;
push @kiwiargs, '--kiwi-parameter', '--ignore-repos';
my $prio = 0;
for my $path (@{$kiwi->{'path'} || []}) {
if ($path->{'project'} ne '_obsrepositories') {
$prio = $prio + 1;
my $repo = "repos/$path->{'project'}/$path->{'repository'}";
push @kiwiargs, '--kiwi-parameter', '--add-repo', '--kiwi-parameter', $repo;
push @kiwiargs, '--kiwi-parameter', '--add-repotype', '--kiwi-parameter', "rpm-md";
push @kiwiargs, '--kiwi-parameter', '--add-repoprio', '--kiwi-parameter', $path->{'priority'} || 0;
push @kiwiargs, '--kiwi-parameter', '--add-repoprio', '--kiwi-parameter', ($path->{'priority'} || $prio);
next;
}
# fill in pathes from buildinfo instead
$use_parameters = 1;
for my $prjpath (@{$buildinfo->{'path'} || []}) {
$prio = $prio + 1;
my $repo ="repos/$prjpath->{'project'}/$prjpath->{'repository'}";
$repo =~ s/:/:\//g;
push @kiwiargs, '--kiwi-parameter', '--add-repo', '--kiwi-parameter', $repo;
push @kiwiargs, '--kiwi-parameter', '--add-repotype', '--kiwi-parameter', "rpm-md";
push @kiwiargs, '--kiwi-parameter', '--add-repoprio', '--kiwi-parameter', $path->{'priority'} || 0;
push @kiwiargs, '--kiwi-parameter', '--add-repoprio', '--kiwi-parameter', ($prio + ($path->{'priority'} || 0));
}
}
@args = ( @args, @kiwiargs ) if $use_parameters;
Expand Down

0 comments on commit f051a97

Please sign in to comment.