Skip to content

Commit

Permalink
[backend] map annotation urls when exporting containers to remote ins…
Browse files Browse the repository at this point in the history
…tances
  • Loading branch information
mlschroe committed Feb 1, 2018
1 parent 0bddcad commit 23cfecf
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/backend/bs_repserver
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,24 @@ sub processavailable {
return \@res;
}

sub mapannotationurls {
my ($p) = @_;
my $annotation = BSUtil::fromxml($p->{'annotation'}, $BSXML::binannotation, 1);
return unless $annotation && $annotation->{'repo'};
for my $r (@{$annotation->{'repo'}}) {
my $url = $r->{'url'};
next unless $url;
my $urlprp;
if ($url =~ /^obs:\/{1,3}([^\/]+)\/([^\/]+)\/?$/) {
$urlprp = "$1/$2";
} else {
$urlprp = BSUrlmapper::urlmapper($url);
}
($r->{'project'}, $r->{'repository'}) = split('/', $urlprp, 2) if $urlprp;
}
$p->{'annotation'} = BSUtil::toxml($annotation, $BSXML::binannotation);
}

sub getbinarylist_repository {
my ($cgi, $projid, $repoid, $arch) = @_;

Expand Down Expand Up @@ -609,6 +627,7 @@ sub getbinarylist_repository {
my %data = $repo->pkgnames();
for my $p (values %data) {
$p = $pool->pkg2data($p);
mapannotationurls($p) if $p->{'annotation'};
}
if (keys(%data) < 100 && $s[7] < 10000) {
# small repo, feed from memory
Expand Down

0 comments on commit 23cfecf

Please sign in to comment.