[Pkg-debile-commits] [debile-slave] 31/100: meh

Sylvestre Ledru sylvestre at alioth.debian.org
Mon Aug 19 14:53:03 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 44324b845b2774ac6a9abc549d9e53babea41483
Author: Paul Tagliamonte <tag at pault.ag>
Date:   Sun May 26 23:23:31 2013 -0400

    meh
---
 ethel/client.py          |   53 +++++++++++++++++++---------------------------
 ethel/commands/sbuild.py |    4 +++-
 ethel/daemon.py          |   50 -------------------------------------------
 3 files changed, 25 insertions(+), 82 deletions(-)

diff --git a/ethel/client.py b/ethel/client.py
index ba4300e..270a344 100644
--- a/ethel/client.py
+++ b/ethel/client.py
@@ -1,9 +1,7 @@
-from ethel.utils import tdir, cd, dget, upload
+from ethel.utils import tdir, cd, dget, upload, run_command
 from ethel.config import load
-from ethel.commands.sbuild import sbuild
 
-# from storz.decompress import digest_firehose_tree
-# from firehose.model import Analysis
+from contextlib import contextmanager
 import xmlrpc.client
 import time
 import glob
@@ -21,34 +19,27 @@ def get_proxy():
     return proxy
 
 
-def build_next():
+ at contextmanager
+def checkout(package):
     proxy = get_proxy()
+    _type = package['_type']
+    if _type not in ['binaries', 'sources']:
+        raise ValueError("_type sucks")
+
+    def source():
+        dsc = "{source}_{version}.dsc".format(**package)
+        url = proxy.get_dsc_url(package['_id'])
+        dget(url)
+        yield dsc
+
+    def binary():
+        url_base = proxy.get_binary_base_url(package['_id'])
+        out, err, ret = run_command(['wget'] + [
+            os.path.join(url_base, x) for x in package['binaries']])
+        if ret != 0:
+            raise Exception("zomgwtf")
+        yield package['binaries']
 
-    job = proxy.get_next_job('unstable-amd64')
-
-    if job is None:
-        raise Exception("Nice. All done.")
-
-    url = proxy.get_dsc_url(job['package'])
-    info = proxy.get_source(job['package'])
-    dsc = "{source}_{version}.dsc".format(**info)
-    # fluxbox_1.3.5-1_amd64.changes
-    build = "{source}_{version}_{arch}.changes".format(source=info['source'],
-                                                       version=info['version'],
-                                                       arch='amd64')
     with tdir() as where:
         with cd(where):
-            dget(url)
-            ftbfs, out, info = sbuild(dsc, 'unstable', 'unstable-amd64')
-            upload(build, job['_id'])
-            proxy.close_job(job['_id'])
-
-
-def buildd():
-    while True:
-        try:
-            print("next build.")
-            build_next()
-        except Exception as e:
-            print("Fallthrough. %s" % (e))
-            time.sleep(10)
+            yield {"source": source, "binary": binary}[_type]()
diff --git a/ethel/commands/sbuild.py b/ethel/commands/sbuild.py
index e8b5930..b81ce90 100644
--- a/ethel/commands/sbuild.py
+++ b/ethel/commands/sbuild.py
@@ -52,7 +52,9 @@ def parse_sbuild_log(log, sut):
     return obj
 
 
-def sbuild(package, dist, chroot):
+def sbuild(package, dist, arch):
+    chroot = "%s-%s" % (dist, arch)
+
     dsc = os.path.basename(package)
     if not dsc.endswith('.dsc'):
         raise ValueError("WTF")
diff --git a/ethel/daemon.py b/ethel/daemon.py
deleted file mode 100644
index 1366cfd..0000000
--- a/ethel/daemon.py
+++ /dev/null
@@ -1,50 +0,0 @@
-from ethel.commands.sbuild import sbuild
-from ethel.commands.adequate import adequate
-from ethel.commands.piuparts import piuparts
-from ethel.utils import tdir, dget
-from ethel.client import get_proxy
-
-import time
-import glob
-import os
-
-
-proxy = get_proxy()
-
-
-def binary_build(package, chroot):
-    dist, _ = chroot.split("-", 1)
-    print("sbuilding %s - %s / %s" % (package, dist, chroot))
-    yield sbuild(package, dist, chroot)
-    for deb in glob.glob("*deb"):
-        yield adequate(chroot, deb)
-        yield piuparts(chroot, deb)
-
-
-def daemon():
-    while True:
-        process()
-
-
-def process():
-    obj = proxy.get_next_job('amd64')
-    if obj is None:
-        print("Nothing to do. Hanging.")
-        time.sleep(5)
-        return
-
-    build_type = obj['type']
-    pid = obj['package']
-    url = proxy.get_dsc_url(pid)
-
-    with tdir() as where:
-        os.chdir(where)
-        print("Fetching..")
-        dget(url)
-
-        for package in glob.glob("*dsc"):
-            print("Building %s" % (package))
-            package = os.path.abspath(package)
-            for (fail, log, report) in binary_build(package, 'unstable-amd64'):
-                print(proxy.submit_report(obj['_id'], report, log, fail))
-    proxy.close_job(obj['_id'])

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