Mailinglist Archive: opensuse-buildservice (256 mails)

< Previous Next >
Re: [opensuse-buildservice] extending the /source/project backend call
On 2011-08-03 09:15:20 +0200, Michael Schroeder wrote:
On Tue, Aug 02, 2011 at 08:41:31PM +0200, Marcus Hüwe wrote:
what about extending the /source/project backend call with an
additional "withsrcmd5" query parameter? Instead of the plain
package list it will return also the latest srcmd5 for each
package.
This call can be used by osc to check which packages in a local
project have to be updated. It would probably speed up the
update process for large projects because osc only needs to
do one http request (instead one for each package) in order
to decide if a package has to be updated or not.

Something like this already exists: you get a "sourceinfolist"
if you do a view=info request on a project. The API currently
blocks this, though, as there's code missing that filters out
packages where the requester has no access rights.

That's what I was looking for:) In the meantime the API also supports
the "view" parameter (see 3d15d72230a43454c621a7c8ce8ffe94d4bfe507).

A drawback is that this call might be a bit "expensive" because
for each package the getfilelist() function has to be called
(a simple getrev() for each package won't work with links or
branches).

That actually depends a bit on your osc settings: Depending on
whether you want expanded/unexpanded/baserev expanded checkouts,
you need a different srcmd5. view=info currently returns the
expanded version (i.e. the version used for building the package).

I just extended "sub sourceinfo" so that it stores the srcmd5 and
the xsrcmd5 (if present). It seems the sourceinfo stuff isn't used
at the moment (at least I didn't find anything in backend/api code)
so the change shouldn't break anything.

Is the attached patch ok?


Marcus

Btw. what's the difference between the "latest" and "build" revision
(both lead to the same revision when using getrev())?
diff --git a/src/backend/BSXML.pm b/src/backend/BSXML.pm
index c58dfe3..0fa96ff 100644
--- a/src/backend/BSXML.pm
+++ b/src/backend/BSXML.pm
@@ -406,6 +406,7 @@ our $sourceinfo = [
'rev',
'vrev',
'srcmd5',
+ 'xsrcmd5',
'verifymd5',
[],
'filename',
diff --git a/src/backend/bs_srcserver b/src/backend/bs_srcserver
index 98a4536..c43e484 100755
--- a/src/backend/bs_srcserver
+++ b/src/backend/bs_srcserver
@@ -6259,7 +6259,7 @@ sub sourceinfo {
$r->{'error'} = $files || 'could not get file list';
return $r;
}
- $r->{'srcmd5'} = $rev->{'srcmd5'};
+ $r->{'xsrcmd5'} = $rev->{'srcmd5'};
my $meta = '';
$meta .= "$files->{$_} $_\n" for sort keys %$files;
$r->{'verifymd5'} = Digest::MD5::md5_hex($meta);
< Previous Next >