[Pkg-debile-commits] [debile-slave] 12/100: big steps
Sylvestre Ledru
sylvestre at alioth.debian.org
Mon Aug 19 14:53:00 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 37c444963d4d53a99c3c8aee985b8847bc3e9d35
Author: Paul Tagliamonte <tag at pault.ag>
Date: Wed May 22 21:24:14 2013 -0400
big steps
---
ethel/client.py | 4 +--
ethel/commands/adequate.py | 10 ++++---
ethel/commands/piuparts.py | 3 +-
ethel/commands/sbuild.py | 65 +++++++++++++++++++++++++++++++++++++++++++-
ethel/daemon.py | 38 ++++++++++++++++++++------
ethel/utils.py | 5 +++-
6 files changed, 107 insertions(+), 18 deletions(-)
diff --git a/ethel/client.py b/ethel/client.py
index fa2b64a..e4a2503 100644
--- a/ethel/client.py
+++ b/ethel/client.py
@@ -17,10 +17,10 @@ def get_proxy():
return proxy
-def submit_report(report, job):
+def submit_report(report, job, log):
proxy = get_proxy()
report = Analysis.from_xml(report)
- obj = proxy.submit_report(job, digest_firehose_tree(report))
+ obj = proxy.submit_report(job, digest_firehose_tree(report), log)
return obj
diff --git a/ethel/commands/adequate.py b/ethel/commands/adequate.py
index c62721c..e3f8b00 100644
--- a/ethel/commands/adequate.py
+++ b/ethel/commands/adequate.py
@@ -48,17 +48,19 @@ def adequate(chroot, package):
out, err = scmd(session, [
'dpkg', '-i', where
- ], user='root', expected=1)
+ ], user='root', expected=(0, 1))
out, err = scmd(session, [
'apt-get', 'install', '-y', '-f'
], user='root')
- #out, err = scmd(session, ['adequate', deb.split("_", 1)[0]])
- out, err = scmd(session, ['adequate', '--all'])
+ out, err = scmd(session, ['adequate', deb.split("_", 1)[0]])
+ failed = False
for issue in parse_output(out.splitlines()):
+ failed = True
analysis.results.append(issue)
- return analysis
+
+ return failed, out, analysis
def main():
diff --git a/ethel/commands/piuparts.py b/ethel/commands/piuparts.py
index 2fbc92b..6af8be9 100644
--- a/ethel/commands/piuparts.py
+++ b/ethel/commands/piuparts.py
@@ -51,7 +51,8 @@ def piuparts(chroot, package):
for x in parse_log(out.splitlines(), package):
analysis.results.append(x)
- return analysis
+
+ return failed, out, analysis
def parse_log(lines, path):
diff --git a/ethel/commands/sbuild.py b/ethel/commands/sbuild.py
index aed2bb3..f0a7d31 100644
--- a/ethel/commands/sbuild.py
+++ b/ethel/commands/sbuild.py
@@ -1,11 +1,71 @@
from ethel.utils import safe_run, run_command, tdir
+from firehose.model import Issue, Message, File, Location, Stats, DebianBinary
+from storz.wrapper import generate_analysis
+import firehose.parsers.gcc as fgcc
+
from contextlib import contextmanager
+from datetime import timedelta
+from io import StringIO
import sys
+import re
import os
+STATS = re.compile("Build needed (?P<time>.*), (?P<space>.*) dis(c|k) space")
+
+
+def parse_sbuild_log(log, sut):
+ gccversion = None
+ stats = None
+
+ for line in log.splitlines():
+ flag = "Toolchain package versions: "
+ stat = STATS.match(line)
+ if stat:
+ info = stat.groupdict()
+ hours, minutes, seconds = [int(x) for x in info['time'].split(":")]
+ timed = timedelta(hours=hours, minutes=minutes, seconds=seconds)
+ stats = Stats(timed.total_seconds())
+ if line.startswith(flag):
+ line = line[len(flag):].strip()
+ packages = line.split(" ")
+ versions = {}
+ for package in packages:
+ if "_" not in package:
+ continue
+ b, bv = package.split("_", 1)
+ versions[b] = bv
+ vs = list(filter(lambda x: x.startswith("gcc"), versions))
+ if vs == []:
+ continue
+ vs = vs[0]
+ gccversion = versions[vs]
+
+ obj = fgcc.parse_file(
+ StringIO(log),
+ sut=sut,
+ gccversion=gccversion,
+ stats=stats
+ )
+
+ return obj
+
+
def sbuild(package, dist, chroot):
+ dsc = os.path.basename(package)
+ if not dsc.endswith('.dsc'):
+ raise ValueError("WTF")
+
+ source, dsc = dsc.split("_", 1)
+ version, _ = dsc.rsplit(".", 1)
+ local = None
+ if "-" in version:
+ version, local = version.rsplit("-", 1)
+
+ dist, arch = chroot.split("-", 1)
+ sut = DebianBinary(source, version, local, arch)
+
out, err, ret = run_command([
"sbuild",
"-c", chroot,
@@ -16,8 +76,11 @@ def sbuild(package, dist, chroot):
"-j", "8",
package,
])
+ ftbfs = ret != 0
out, err = out.decode('utf-8'), err.decode('utf-8')
- return out, err, ret
+ info = parse_sbuild_log(out, sut=sut)
+
+ return ftbfs, out, info
def main():
diff --git a/ethel/daemon.py b/ethel/daemon.py
index d46d16b..bd39fdf 100644
--- a/ethel/daemon.py
+++ b/ethel/daemon.py
@@ -1,29 +1,49 @@
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))
- sbuild(package, dist, chroot)
- #piuparts
- #lintian
- #adequate
-
+ 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)
+
+ build_type = obj['type']
+ pid = obj['package']
+ url = proxy.get_dsc_url(pid)
+
with tdir() as where:
os.chdir(where)
-
print("Fetching..")
- dget("http://localhost/pool/9d0aa4bc/c250/11e2/"
- "8600/3859f9e5ff01/3/8/5/9/fluxbox_1.3.5-1.dsc")
+ dget(url)
for package in glob.glob("*dsc"):
print("Building %s" % (package))
package = os.path.abspath(package)
- binary_build(package, 'unstable-amd64')
+ for (fail, log, report) in binary_build(package, 'unstable-amd64'):
+ print(proxy.submit_report(obj['_id'], report, log, fail))
+ proxy.close_job(obj['_id'])
diff --git a/ethel/utils.py b/ethel/utils.py
index 3728edd..da73838 100644
--- a/ethel/utils.py
+++ b/ethel/utils.py
@@ -36,10 +36,13 @@ def run_command(command, stdin=None):
def safe_run(cmd, expected=0):
+ if not isinstance(expected, tuple):
+ expected = (expected, )
+
out, err, ret = run_command(cmd)
out, err = (x.decode('utf-8') for x in (out, err))
- if ret != expected:
+ if not ret in expected:
e = EthelSubprocessError(out, err, ret, cmd)
raise e
--
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