summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@mapreri.org>2015-05-30 02:32:09 +0200
committerHolger Levsen <holger@layer-acht.org>2015-06-01 16:39:12 +0200
commit427e2f31a1dcbc3b6a6c968d4d4dbdf217ea7a99 (patch)
tree61edb379484dedc1e2ae761fb722a033819dcaa9
parent54ad86450990e11f02bfceb4b6e885f431af112a (diff)
downloadjenkins.debian.net-427e2f31a1dcbc3b6a6c968d4d4dbdf217ea7a99.tar.xz
reproducible: common: add a pkg_has_rbuild function, trying to reduce code duplication...
-rwxr-xr-xbin/reproducible_common.py20
1 files changed, 19 insertions, 1 deletions
diff --git a/bin/reproducible_common.py b/bin/reproducible_common.py
index bce5aca0..4d38d946 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: