Mailinglist Archive: obs-commits (76 mails)

< Previous Next >
[obs-commits] [PATCH] [backend] bs_repserver: add updateinfo.xml query support
From: Michael Schroeder <mls@xxxxxxx>

---
src/backend/bs_repserver | 27 ++++++++++++++++++++++++++-
1 files changed, 26 insertions(+), 1 deletions(-)

diff --git a/src/backend/bs_repserver b/src/backend/bs_repserver
index 9c14279..b7d499b 100755
--- a/src/backend/bs_repserver
+++ b/src/backend/bs_repserver
@@ -752,7 +752,32 @@ sub getbinary_info {
my ($cgi, $projid, $repoid, $arch, $path) = @_;
my @s = stat($path);
die("404 $path: $!\n") unless @s;
- my $res = Build::query($path, 'evra' => 1, 'description' => 1);
+ my $res = Build::query($path, 'evra' => 1, 'description' => 1) || {};
+ if (!%$res && $path =~ /\/updateinfo\.xml$/) {
+ my $updateinfos = readxml($path, $BSXML::updateinfo, 1);
+ if ($updateinfos && @{$updateinfos->{'update'} || []} == 1) {
+ my $updateinfo = $updateinfos->{'update'}->[0];
+ $res->{'name'} = $updateinfo->{'id'};
+ $res->{'version'} = $updateinfo->{'version'};
+ $res->{'summary'} = $updateinfo->{'title'};
+ $res->{'description'} = $updateinfo->{'description'};
+ my $collection = ($updateinfo->{'pkglist'} || {})->{'collection'} || [];
+ if (@$collection) {
+ # only look at first collection
+ for my $package (@{$collection->[0]->{'package'} || []}) {
+ my $nevr = $package->{'name'};
+ $nevr .= ".$package->{'arch'}" if $package->{'arch'};
+ if ($package->{'version'}) {
+ $nevr .= " = ";
+ $nevr .= "$package->{'epoch'}:" if $package->{'epoch'};
+ $nevr .= "$package->{'version'}" if $package->{'version'};
+ $nevr .= "-$package->{'release'}" if defined $package->{'release'};
+ }
+ push @{$res->{'provides'}}, $nevr;
+ }
+ }
+ }
+ }
delete $res->{'source'};
delete $res->{'hdrmd5'};
$res->{'mtime'} = $s[9];
--
1.7.7

--
To unsubscribe, e-mail: obs-commits+unsubscribe@xxxxxxxxxxxx
To contact the owner, e-mail: obs-commits+owner@xxxxxxxxxxxx

< Previous Next >
List Navigation