[Qa-jenkins-scm] [jenkins.debian.net] 01/05: reproducible: common: add a pkg_has_rbuild function, trying to reduce code duplication...

Holger Levsen holger at moszumanska.debian.org
Mon Jun 1 14:39:22 UTC 2015


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch master
in repository jenkins.debian.net.

commit 427e2f31a1dcbc3b6a6c968d4d4dbdf217ea7a99
Author: Mattia Rizzolo <mattia at mapreri.org>
Date:   Sat May 30 02:32:09 2015 +0200

    reproducible: common: add a pkg_has_rbuild function, trying to reduce code duplication...
---
 bin/reproducible_common.py | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index bce5aca..4d38d94 100755
--- a/bin/reproducible_common.py
+++ b/bin/reproducible_common.py
@@ -417,7 +417,7 @@ def pkg_has_buildinfo(package, version=False, suite=defaultsuite, arch=defaultar
     """
     if not version:
         query = 'SELECT r.version ' + \
-                'FROM results AS r JOIN sources AS s on r.package_id=s.id ' + \
+                'FROM results AS r JOIN sources AS s ON r.package_id=s.id ' + \
                 'WHERE s.name="{}" AND s.suite="{}" AND s.architecture="{}"'
         query = query.format(package, suite, arch)
         version = str(query_db(query)[0][0])
@@ -428,6 +428,24 @@ def pkg_has_buildinfo(package, version=False, suite=defaultsuite, arch=defaultar
     else:
         return False
 
+
+def pkg_has_rbuild(package, version=False, suite=defaultsuite, arch=defaultarch):
+    if not version:
+        query = 'SELECT r.version ' + \
+                'FROM results AS r JOIN sources AS s ON r.package_id=s.id ' + \
+                'WHERE s.name="{}" AND s.suite="{}" AND s.architecture="{}"'
+        query = query.format(package, suite, arch)
+        version = str(query_db(query)[0][0])
+    rbuild = RBUILD_PATH + '/' + suite + '/' + arch + '/' + package + '_' + \
+             strip_epoch(version) + '.rbuild.log'
+    if os.access(rbuild, os.R_OK):
+        return (rbuild, os.stat(rbuild).st_size)
+    elif os.access(rbuild+'.gz', os.R_OK):
+        return (rbuild+'.gz', os.stat(rbuild+'.gz').st_size)
+    else:
+        return ()
+
+
 def get_bugs():
     """
     This function returns a dict:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/qa/jenkins.debian.net.git



More information about the Qa-jenkins-scm mailing list