[Pkg-debile-commits] [debile-slave] 43/100: ifixing crap

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 1da3bc44c62a1db86a9898352848b838bff6ca7e
Author: Paul Tagliamonte <tag at pault.ag>
Date:   Thu May 30 19:22:35 2013 -0400

    ifixing crap
---
 ethel/client.py            |    6 ++--
 ethel/commands/__init__.py |    4 ++-
 ethel/daemon.py            |   65 +++++++++++++++++++++++++++++---------------
 ethel/runners/adequate.py  |    9 +-----
 4 files changed, 51 insertions(+), 33 deletions(-)

diff --git a/ethel/client.py b/ethel/client.py
index 19bf443..0067486 100644
--- a/ethel/client.py
+++ b/ethel/client.py
@@ -5,6 +5,7 @@ from contextlib import contextmanager
 import xmlrpc.client
 import time
 import glob
+import os
 
 
 def get_proxy():
@@ -33,9 +34,10 @@ def checkout(package):
         yield dsc
 
     def binary():
-        url_base = proxy.get_binary_base_url(package['_id'])
+        info = proxy.get_deb_info(package['_id'])
+        url_base = info['root']
         out, err, ret = run_command(['wget'] + [
-            os.path.join(url_base, x) for x in package['binaries']])
+            os.path.join(url_base, x) for x in info['packages']])
         if ret != 0:
             raise Exception("zomgwtf")
         yield package['binaries']
diff --git a/ethel/commands/__init__.py b/ethel/commands/__init__.py
index 5370a65..d1bd031 100644
--- a/ethel/commands/__init__.py
+++ b/ethel/commands/__init__.py
@@ -1,7 +1,9 @@
 import importlib
 
+
 PLUGINS = {
-    "build": "ethel.commands.build"
+    "build": "ethel.commands.build",
+    "adequate": "ethel.commands.adequate",
 }
 
 
diff --git a/ethel/daemon.py b/ethel/daemon.py
index 01bc09d..011a8d3 100644
--- a/ethel/daemon.py
+++ b/ethel/daemon.py
@@ -1,7 +1,8 @@
 from ethel.commands import PLUGINS, load_module
 from ethel.client import get_proxy, checkout
-from ethel.config import load
+from contextlib import contextmanager
 from ethel.utils import tdir, cd
+from ethel.config import load
 
 config = load()
 proxy = get_proxy()
@@ -16,32 +17,52 @@ def listize(entry):
     return [None if x == "null" else x for x in items]
 
 
+ at contextmanager
+def workon(suites, arches, things):
+    job = proxy.get_next_job(suites, arches, things)
+    if job is None:
+        yield
+    else:
+        print("[ethel] aquired job %s (%s) for %s/%s" % (
+            job['_id'], job['type'], job['suite'], job['arch']))
+
+        try:
+            yield job
+        except:
+            proxy.forfeit_job(job['_id'])
+            raise
+        else:
+            proxy.close_job(job['_id'])
+
+
+
 def iterate():
     suites = listize(config['suites'])
     arches = listize(config['arches'])
-    job = proxy.get_next_job(suites, arches, list(PLUGINS.keys()))
-    if job is None:
-        raise IDidNothingError("No more jobs")
-    package_id = job['package']
-    type_ = job['package_type']
-
-    package = None
-    if type_ == 'binary':
-        package = proxy.get_binary_package(package_id)
-    elif type_ == 'source':
-        package = proxy.get_source_package(package_id)
-    else:
-        raise IDidNothingError("SHIT")
+    with workon(suites, arches, list(PLUGINS.keys())) as job:
+        if job is None:
+            raise IDidNothingError("No more jobs")
+
+        package_id = job['package']
+        type_ = job['package_type']
+
+        package = None
+        if type_ == 'binary':
+            package = proxy.get_binary_package(package_id)
+        elif type_ == 'source':
+            package = proxy.get_source_package(package_id)
+        else:
+            raise IDidNothingError("SHIT")
 
-    handler = load_module(job['type'])
-    with tdir() as fd:
-        with cd(fd):
-            with checkout(package) as target:
-                info, log, err = handler(target, package, job)
+        handler = load_module(job['type'])
+        with tdir() as fd:
+            with cd(fd):
+                with checkout(package) as target:
+                    info, log, err = handler(target, package, job)
 
-                type_ = {"sources": "source",
-                         "binaries": "binary"}[package['_type']]
+                    type_ = {"sources": "source",
+                             "binaries": "binary"}[package['_type']]
 
-                proxy.submit_report(info, log, job['_id'], err)
+                    proxy.submit_report(info, log, job['_id'], err)
 
 iterate()
diff --git a/ethel/runners/adequate.py b/ethel/runners/adequate.py
index 38e3630..31beefb 100644
--- a/ethel/runners/adequate.py
+++ b/ethel/runners/adequate.py
@@ -7,7 +7,7 @@ from storz.wrapper import generate_analysis
 import os
 
 
-def adequate(chroot, package):  # make it package*s*
+def adequate(chroot, packages, job):  # make it package*s*
     analysis = generate_analysis("adequate", "unstable", package)
 
     with schroot(chroot) as session:
@@ -37,10 +37,3 @@ def adequate(chroot, package):  # make it package*s*
             analysis.results.append(issue)
 
         return failed, out, analysis
-
-
-def main():
-    import sys
-    output = open(sys.argv[3], 'wb')
-    failed, out, analysis = adequate(sys.argv[1], sys.argv[2])
-    output.write(analysis.to_xml_bytes())

-- 
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