[Pkg-debile-commits] [debile-slave] 45/100: moving api around
Sylvestre Ledru
sylvestre at alioth.debian.org
Mon Aug 19 14:53:06 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 84c856eda9288debba79271ea004cb3ea29d9db6
Author: Paul Tagliamonte <tag at pault.ag>
Date: Thu May 30 20:15:27 2013 -0400
moving api around
---
ethel/commands/adequate.py | 14 ++++++--------
ethel/daemon.py | 39 +++++++++++++++++++++++++++++++++++++--
ethel/runners/adequate.py | 35 +++++++++++++++--------------------
3 files changed, 58 insertions(+), 30 deletions(-)
diff --git a/ethel/commands/adequate.py b/ethel/commands/adequate.py
index a43763d..6b8d37a 100644
--- a/ethel/commands/adequate.py
+++ b/ethel/commands/adequate.py
@@ -1,11 +1,9 @@
+from ethel.runners.adequate import adequate
-def run(debs, package, job):
- print(debs)
+def run(debs, package, firehose):
+ if any((not x.endswith(".deb") for x in debs)):
+ raise Exception("Non-deb given")
- info = None
- log = ""
- err = 0
-
- raise Exception
- return info, log, err
+ chroot_name = "{suite}-{arch}".format(**package)
+ return adequate(chroot_name, debs, firehose)
diff --git a/ethel/daemon.py b/ethel/daemon.py
index 011a8d3..45af52b 100644
--- a/ethel/daemon.py
+++ b/ethel/daemon.py
@@ -4,6 +4,9 @@ from contextlib import contextmanager
from ethel.utils import tdir, cd
from ethel.config import load
+from firehose.model import (Analysis, Generator, Metadata,
+ DebianBinary, DebianSource)
+
config = load()
proxy = get_proxy()
@@ -35,6 +38,36 @@ def workon(suites, arches, things):
proxy.close_job(job['_id'])
+def generate_sut_from_source(package):
+ name = package['source']
+ local = None
+ version = package['version']
+ if "-" in version:
+ version, local = version.rsplit("-", 1)
+ return DebianSource(name, version, local)
+
+
+def generate_sut_from_binary(package):
+ source = proxy.get_source_package(package['source'])
+ arch = package['arch']
+ name = source['source']
+ local = None
+ version = source['version']
+ if "-" in version:
+ version, local = version.rsplit("-", 1)
+ return DebianBinary(name, version, local, arch)
+
+
+def create_firehose(package):
+ sut = {
+ "sources": generate_sut_from_source,
+ "binaries": generate_sut_from_binary
+ }[package['_type']](package)
+
+ return Analysis(metadata=Metadata(
+ generator=Generator(name="ethel", version="fixme"),
+ sut=sut, file_=None, stats=None), results=[])
+
def iterate():
suites = listize(config['suites'])
@@ -55,14 +88,16 @@ def iterate():
raise IDidNothingError("SHIT")
handler = load_module(job['type'])
+ firehose = create_firehose(package)
+
with tdir() as fd:
with cd(fd):
with checkout(package) as target:
- info, log, err = handler(target, package, job)
+ log, err = handler(target, package, firehose)
type_ = {"sources": "source",
"binaries": "binary"}[package['_type']]
- proxy.submit_report(info, log, job['_id'], err)
+ proxy.submit_report(firehose, log, job['_id'], err)
iterate()
diff --git a/ethel/runners/adequate.py b/ethel/runners/adequate.py
index 31beefb..cd29aa0 100644
--- a/ethel/runners/adequate.py
+++ b/ethel/runners/adequate.py
@@ -1,39 +1,34 @@
-from ethel.chroot import schroot, copy, scmd
from ethel.wrappers.adequate import parse_adequate
-
from firehose.model import Issue, Message, File, Location
-from storz.wrapper import generate_analysis
+from schroot import schroot
import os
-def adequate(chroot, packages, job): # make it package*s*
- analysis = generate_analysis("adequate", "unstable", package)
-
- with schroot(chroot) as session:
- deb = os.path.basename(package)
- if not deb.endswith('.deb'):
- raise ValueError("Stop with the crack smoking")
+def adequate(chroot_name, packages, analysis):
+ with schroot(chroot_name) as chroot:
+ for deb in packages:
+ chroot.copy(deb, "/tmp")
- where = '/tmp/%s' % (deb)
- copy(session, package, where)
-
- out, err = scmd(session, [
+ ret, out, err = chroot.run([
'apt-get', 'install', '-y', 'adequate'
], user='root')
- out, err = scmd(session, [
- 'dpkg', '-i', where
- ], user='root', expected=(0, 1))
+ ret, out, err = chroot.run([
+ 'dpkg', '-i'
+ ] + [
+ "/tmp/%s" % (x) for x in packages
+ ], user='root', return_codes=(0, 1))
- out, err = scmd(session, [
+ ret, out, err = chroot.run([
'apt-get', 'install', '-y', '-f'
], user='root')
- out, err = scmd(session, ['adequate', deb.split("_", 1)[0]])
+ ret, out, err = chroot.run(['adequate', deb.split("_", 1)[0]])
+
failed = False
for issue in parse_adequate(out.splitlines()):
failed = True
analysis.results.append(issue)
- return failed, out, analysis
+ return failed, out
--
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