[Pkg-debile-commits] [debile-slave] 83/100: Added generator version and firehose export.
Sylvestre Ledru
sylvestre at alioth.debian.org
Mon Aug 19 14:53:14 UTC 2013
This is an automated email from the git hooks/post-receive script.
sylvestre pushed a commit to branch master
in repository debile-slave.
commit 1e00116a6b841225ff9d89da2334ada039da6633
Author: Léo Cavaillé <leo at cavaille.net>
Date: Fri Jul 19 19:51:46 2013 +0200
Added generator version and firehose export.
Replaced prints by logging module.
The firehose report is exported to XML and copied to the pool.
---
ethel/commands/__init__.py | 2 +-
ethel/commands/adequate.py | 5 +++-
ethel/commands/build.py | 5 +++-
ethel/commands/cppcheck.py | 6 +++--
ethel/commands/desktop_file_validate.py | 5 +++-
ethel/commands/lintian.py | 5 +++-
ethel/commands/lintian4py.py | 5 +++-
ethel/commands/pep8.py | 5 +++-
ethel/commands/perlcritic.py | 5 +++-
ethel/commands/piuparts.py | 5 +++-
ethel/daemon.py | 40 ++++++++++++++++++++++---------
ethel/runners/adequate.py | 4 ++++
ethel/runners/cppcheck.py | 8 +++++++
ethel/runners/desktop_file_validate.py | 4 ++++
ethel/runners/lintian.py | 9 +++++++
ethel/runners/pep8.py | 7 ++++++
ethel/runners/perlcritic.py | 5 ++++
ethel/runners/piuparts.py | 4 ++++
ethel/runners/sbuild.py | 14 ++++++++++-
19 files changed, 120 insertions(+), 23 deletions(-)
diff --git a/ethel/commands/__init__.py b/ethel/commands/__init__.py
index 4c700f5..ec11e60 100644
--- a/ethel/commands/__init__.py
+++ b/ethel/commands/__init__.py
@@ -19,4 +19,4 @@ PLUGINS = {
def load_module(what):
path = PLUGINS[what]
mod = importlib.import_module(path)
- return mod.run
+ return (mod.run, mod.get_version)
diff --git a/ethel/commands/adequate.py b/ethel/commands/adequate.py
index 64961ca..df754fe 100644
--- a/ethel/commands/adequate.py
+++ b/ethel/commands/adequate.py
@@ -1,4 +1,4 @@
-from ethel.runners.adequate import adequate
+from ethel.runners.adequate import adequate, version
from ethel.config import load
@@ -17,3 +17,6 @@ def run(debs, package, job, firehose):
arch=arch
)
return adequate(chroot_name, debs, firehose)
+
+def get_version():
+ return version()
diff --git a/ethel/commands/build.py b/ethel/commands/build.py
index 42253a5..77c46a3 100644
--- a/ethel/commands/build.py
+++ b/ethel/commands/build.py
@@ -1,4 +1,4 @@
-from ethel.runners.sbuild import sbuild
+from ethel.runners.sbuild import sbuild, version
from ethel.utils import upload
import glob
import os
@@ -27,3 +27,6 @@ def run(dsc, package, job, firehose):
upload(changes, job['_id'])
return (info, out, ftbfs)
+
+def get_version():
+ return version()
diff --git a/ethel/commands/cppcheck.py b/ethel/commands/cppcheck.py
index 2bd588b..1680c36 100644
--- a/ethel/commands/cppcheck.py
+++ b/ethel/commands/cppcheck.py
@@ -1,5 +1,7 @@
-from ethel.runners.cppcheck import cppcheck
-
+from ethel.runners.cppcheck import cppcheck, version
def run(dsc, package, job, firehose):
return cppcheck(dsc, firehose)
+
+def get_version():
+ return version()
diff --git a/ethel/commands/desktop_file_validate.py b/ethel/commands/desktop_file_validate.py
index 6d50eaf..06a2361 100644
--- a/ethel/commands/desktop_file_validate.py
+++ b/ethel/commands/desktop_file_validate.py
@@ -1,4 +1,4 @@
-from ethel.runners.desktop_file_validate import desktop_file_validate
+from ethel.runners.desktop_file_validate import desktop_file_validate, version
from ethel.utils import run_command, cd
@@ -6,3 +6,6 @@ def run(dsc, source, job, firehose):
run_command(["dpkg-source", "-x", dsc, "source"])
with cd('source'):
return desktop_file_validate('source', firehose)
+
+def get_version():
+ return version()
diff --git a/ethel/commands/lintian.py b/ethel/commands/lintian.py
index dddcb37..952c89c 100644
--- a/ethel/commands/lintian.py
+++ b/ethel/commands/lintian.py
@@ -1,7 +1,10 @@
-from ethel.runners.lintian import lintian
+from ethel.runners.lintian import lintian, version
def run(dfiles, package, job, firehose):
if not isinstance(dfiles, list):
dfiles = [dfiles]
return lintian(dfiles, firehose, lintian_binary='lintian')
+
+def get_version():
+ return version(lintian_binary='lintian')
diff --git a/ethel/commands/lintian4py.py b/ethel/commands/lintian4py.py
index 6736279..2166a64 100644
--- a/ethel/commands/lintian4py.py
+++ b/ethel/commands/lintian4py.py
@@ -1,7 +1,10 @@
-from ethel.runners.lintian import lintian
+from ethel.runners.lintian import lintian, version
def run(dfiles, package, job, firehose):
if not isinstance(dfiles, list):
dfiles = [dfiles]
return lintian(dfiles, firehose, lintian_binary='lintian4py')
+
+def get_version():
+ return version(lintian_binary='lintian4py')
diff --git a/ethel/commands/pep8.py b/ethel/commands/pep8.py
index 9611203..f05d546 100644
--- a/ethel/commands/pep8.py
+++ b/ethel/commands/pep8.py
@@ -1,5 +1,8 @@
-from ethel.runners.pep8 import pep8
+from ethel.runners.pep8 import pep8, version
def run(dsc, package, job, firehose):
return pep8(dsc, firehose)
+
+def get_version():
+ return version()
diff --git a/ethel/commands/perlcritic.py b/ethel/commands/perlcritic.py
index 8cb2421..6ae7ebc 100644
--- a/ethel/commands/perlcritic.py
+++ b/ethel/commands/perlcritic.py
@@ -1,5 +1,8 @@
-from ethel.runners.perlcritic import perlcritic
+from ethel.runners.perlcritic import perlcritic, version
def run(dsc, package, job, firehose):
return perlcritic(dsc, firehose)
+
+def get_version():
+ return version()
diff --git a/ethel/commands/piuparts.py b/ethel/commands/piuparts.py
index 87052c5..b9abb9a 100644
--- a/ethel/commands/piuparts.py
+++ b/ethel/commands/piuparts.py
@@ -1,4 +1,4 @@
-from ethel.runners.piuparts import piuparts
+from ethel.runners.piuparts import piuparts, version
from ethel.config import load
@@ -18,3 +18,6 @@ def run(debs, package, job, firehose):
)
return piuparts(chroot_name, debs, firehose)
+
+def get_version():
+ return version()
diff --git a/ethel/daemon.py b/ethel/daemon.py
index 4b748c1..0ebe2fe 100644
--- a/ethel/daemon.py
+++ b/ethel/daemon.py
@@ -7,6 +7,7 @@ from contextlib import contextmanager
from ethel.utils import tdir, cd, run_command
from ethel.config import load
+import logging
import time
config = load()
@@ -23,20 +24,20 @@ def listize(entry):
@contextmanager
-def workon(suites, arches, things):
- job = proxy.get_next_job(suites, arches, things)
+def workon(suites, arches, capabilities):
+ job = proxy.get_next_job(suites, arches, capabilities)
if job is None:
yield
else:
- print("[ethel] aquired job %s (%s) for %s/%s" % (
- job['_id'], job['type'], job['suite'], job['arch']))
-
+ logging.info("Acquired job %s (%s) for %s/%s", job['_id'], job['type'], job['suite'], job['arch'])
try:
yield job
except:
+ logging.warn("Forfeiting the job because of internal exception")
proxy.forfeit_job(job['_id'])
raise
else:
+ logging.info("Successfully closing the job")
proxy.close_job(job['_id'])
@@ -60,14 +61,18 @@ def generate_sut_from_binary(package):
return DebianBinary(name, version, local, arch)
-def create_firehose(package):
+def create_firehose(package, version_getter):
+ logging.info("Initializing empty firehose report")
sut = {
"sources": generate_sut_from_source,
"binaries": generate_sut_from_binary
}[package['_type']](package)
+ gname_, gversion = version_getter()
+ gname = "ethel/%s" % gname_
+
return Analysis(metadata=Metadata(
- generator=Generator(name="ethel", version="fixme"),
+ generator=Generator(name=gname, version=gversion),
sut=sut, file_=None, stats=None), results=[])
@@ -81,6 +86,7 @@ def iterate():
package_id = job['package']
type_ = job['package_type']
+ logging.debug("Fetching the %s package, id=%s", type_, package_id)
package = None
if type_ == 'binary':
package = proxy.get_binary_package(package_id)
@@ -89,8 +95,8 @@ def iterate():
else:
raise IDidNothingError("SHIT")
- handler = load_module(job['type'])
- firehose = create_firehose(package)
+ handler, version_getter = load_module(job['type'])
+ firehose = create_firehose(package, version_getter)
with tdir() as fd:
with cd(fd):
@@ -101,9 +107,18 @@ def iterate():
type_ = {"sources": "source",
"binaries": "binary"}[package['_type']]
- print("[ethel] - filing report")
+ logging.info("Job worker returned, filing reports")
report = proxy.submit_report(firehose.to_json(),
job['_id'], err)
+
+ logging.info("Sending the XML firehose report to the pool")
+ open('firehose.xml', 'w').write(firehose.to_xml_bytes())
+ remote_firehose_path = proxy.get_firehose_write_location(report)
+ cmd = config['copy'].format(src='firehose.xml',
+ dest=remote_firehose_path)
+ out, err, ret = run_command(cmd)
+
+ logging.info("Sending the logs to the pool")
remote_path = proxy.get_log_write_location(report)
open('ethel-log', 'wb').write(log.encode('utf-8'))
cmd = config['copy'].format(src='ethel-log',
@@ -115,9 +130,12 @@ def iterate():
def main():
+ logging.basicConfig(format='%(asctime)s - %(levelname)8s - [ethel] %(message)s', level=logging.DEBUG)
+ logging.info("Booting ethel daemon")
while True:
+ logging.debug("Checking for new jobs")
try:
iterate()
except IDidNothingError:
- #print("[ethel] nothing to do.")
+ logging.debug("Nothing to do for now, sleeping 30s")
time.sleep(30)
diff --git a/ethel/runners/adequate.py b/ethel/runners/adequate.py
index 95e44b5..4131401 100644
--- a/ethel/runners/adequate.py
+++ b/ethel/runners/adequate.py
@@ -32,3 +32,7 @@ def adequate(chroot_name, packages, analysis):
analysis.results.append(issue)
return analysis, out, failed
+
+def version():
+ #TODO
+ return ('adequate', 'n/a')
diff --git a/ethel/runners/cppcheck.py b/ethel/runners/cppcheck.py
index 7675d90..f11e918 100644
--- a/ethel/runners/cppcheck.py
+++ b/ethel/runners/cppcheck.py
@@ -24,3 +24,11 @@ def cppcheck(dsc, analysis):
failed = True
return (analysis, err, failed)
+
+def version():
+ out, err, ret = run_command([
+ 'cppcheck', '--version'
+ ])
+ #TODO: if ret != 0, not installed !
+ name, version = out.split(" ")
+ return (name, version.strip())
diff --git a/ethel/runners/desktop_file_validate.py b/ethel/runners/desktop_file_validate.py
index 58b3096..de27393 100644
--- a/ethel/runners/desktop_file_validate.py
+++ b/ethel/runners/desktop_file_validate.py
@@ -15,3 +15,7 @@ def desktop_file_validate(package_root, analysis):
log += out
log = log.strip()
return (analysis, log, failed)
+
+def version():
+ #TODO
+ return ('desktop_file_validate', 'n/a')
diff --git a/ethel/runners/lintian.py b/ethel/runners/lintian.py
index 5054bcb..8835e13 100644
--- a/ethel/runners/lintian.py
+++ b/ethel/runners/lintian.py
@@ -17,3 +17,12 @@ def lintian(packages, analysis, lintian_binary='lintian'):
log += out
return (analysis, log, failed)
+
+
+def version(lintian_binary='lintian'):
+ out, err, ret = run_command([
+ lintian_binary, '--version'
+ ])
+ #TODO: if ret != 0, not installed !
+ name, version = out.split(" ")
+ return (name, version.strip())
diff --git a/ethel/runners/pep8.py b/ethel/runners/pep8.py
index dc778a4..87f1388 100644
--- a/ethel/runners/pep8.py
+++ b/ethel/runners/pep8.py
@@ -13,3 +13,10 @@ def pep8(dsc, analysis):
analysis.results.append(issue)
return (analysis, out, failed)
+
+def version():
+ out, err, ret = run_command([
+ 'pep8', '--version'
+ ])
+ #TODO: if ret != 0, not installed !
+ return ('pep8', out.strip())
diff --git a/ethel/runners/perlcritic.py b/ethel/runners/perlcritic.py
index f8a3987..1105a99 100644
--- a/ethel/runners/perlcritic.py
+++ b/ethel/runners/perlcritic.py
@@ -18,3 +18,8 @@ def perlcritic(dsc, analysis):
analysis.results.append(issue)
return (analysis, out, failed)
+
+def version():
+ out, err, ret = run_command([ 'perlcritic', '--version' ])
+ #TODO : check ret for perlcritic installation
+ return ('perlcritic', out.strip())
diff --git a/ethel/runners/piuparts.py b/ethel/runners/piuparts.py
index 4f701bb..a01a128 100644
--- a/ethel/runners/piuparts.py
+++ b/ethel/runners/piuparts.py
@@ -59,3 +59,7 @@ def piuparts(chroot, packages, analysis):
analysis.results.append(x)
return analysis, out, failed
+
+def version():
+ #TODO
+ return ('piuparts', 'n/a')
diff --git a/ethel/runners/sbuild.py b/ethel/runners/sbuild.py
index 5d0b276..5ac819f 100644
--- a/ethel/runners/sbuild.py
+++ b/ethel/runners/sbuild.py
@@ -12,7 +12,7 @@ import os
STATS = re.compile("Build needed (?P<time>.*), (?P<space>.*) dis(c|k) space")
-
+VERSION = re.compile("sbuild \(Debian sbuild\) (?P<version>)")
def parse_sbuild_log(log, sut):
gccversion = None
@@ -80,3 +80,15 @@ def sbuild(package, suite, arch):
info = parse_sbuild_log(out, sut=sut)
return info, out, ftbfs
+
+# FIXME: do we want to use sbuild version and/or compiler version
+# see gcc version in parse_sbuild_log
+def version():
+ out, err, ret = run_command([
+ "sbuild", '--version'
+ ])
+ # TODO check ret
+ vline = out.splitlines()[0]
+ v = VERSION.match(vline)
+ vdict = v.groupdict()
+ return ('sbuild', vdict['version'])
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-slave.git
More information about the Pkg-debile-commits
mailing list