[Pkg-debile-commits] [debile-master] 33/126: meh
Sylvestre Ledru
sylvestre at alioth.debian.org
Mon Aug 19 14:56:09 UTC 2013
This is an automated email from the git hooks/post-receive script.
sylvestre pushed a commit to branch scan-build-html
in repository debile-master.
commit da75d016b41e155d7c989dcdfbd334ea07851c6f
Author: Paul Tagliamonte <tag at pault.ag>
Date: Mon May 27 00:16:49 2013 -0400
meh
---
lucy/models/report.py | 20 +++++++--
lucy/server.py | 111 ++++++++++++++++---------------------------------
2 files changed, 52 insertions(+), 79 deletions(-)
diff --git a/lucy/models/report.py b/lucy/models/report.py
index 6b18ec9..a3ed09a 100644
--- a/lucy/models/report.py
+++ b/lucy/models/report.py
@@ -1,5 +1,6 @@
from lucy.models.machine import Machine
-from lucy.models.package import Package
+from lucy.models.source import Source
+from lucy.models.binary import Binary
from lucy.models import LucyObject
from lucy.models.job import Job
@@ -7,11 +8,24 @@ from lucy.models.job import Job
class Report(LucyObject):
_type = 'reports'
- def __init__(self, report, log, builder, package, job, failed, **kwargs):
+ def __init__(self, report, log, builder, package,
+ package_type, job, failed, **kwargs):
+
+ if package_type not in ["source", "binary"]:
+ raise ValueError("Bad package type")
+
+ if package_type == 'source':
+ package = Source.load(package)
+
+ if package_type == 'binary':
+ package = Binary.load(package)
+
builder = Machine.load(builder)['_id']
package = Package.load(package)['_id']
job = Job.load(job)['_id']
- super(Report, self).__init__(builder=builder,
+
+ super(Report, self).__init__(package_type=package_type,
+ builder=builder,
package=package,
report=report,
failed=failed,
diff --git a/lucy/server.py b/lucy/server.py
index d22e652..dff23c7 100644
--- a/lucy/server.py
+++ b/lucy/server.py
@@ -12,6 +12,41 @@ import threading
NAMESPACE = threading.local()
+class LucyInterface(object):
+
+ def get_source_package(self, package):
+ pass
+
+ def get_binary_package(self, package):
+ pass
+
+ def get_dsc(self):
+ pass
+
+ def get_debs(self):
+ pass
+
+ #
+
+ def get_current_job(self):
+ pass
+
+ def get_lint_job(self):
+ pass
+
+ def get_build_job(self):
+ pass
+
+ def submit_report(self, report, log, package, package_type, job, failed):
+ pass
+
+ def close_job(self, job):
+ pass
+
+
+# =================== ok, boring shit below ===================
+
+
def get_builder_id():
return NAMESPACE.machine['_id']
@@ -43,82 +78,6 @@ class AsyncXMLRPCServer(socketserver.ThreadingMixIn, LucyAuthMixIn):
pass
-class LucyInterface(object):
- def version(self):
- return "1.0"
-
- def identify(self):
- return get_builder_id()
-
- def get_next_job(self, job_type):
- ajobs = list(Job.assigned_jobs(get_builder_id()))
- if ajobs != []:
- return dict(ajobs[0])
-
- try:
- job = Job.next_job(type=job_type)
- except KeyError:
- return None
-
- job['builder'] = get_builder_id()
- job['assigned_at'] = dt.datetime.utcnow()
- job.save()
- return dict(job)
-
- def get_dsc_url(self, package):
- config = get_config()
- package = Source.load(package)
- url = "{public}/{path}/{source}_{version}.dsc".format(
- public=config['public'],
- path=package['path'],
- source=package['source'],
- version=package['version'])
- return url
-
- def get_binary_base_url(self, package):
- config = get_config()
- package = Binary.load(package)
- url = "{public}/{path}/{arch}".format(
- public=config['public'],
- path=package.get_source()['path'],
- arch=package['arch'])
- return url
-
- def get_source(self, package):
- return dict(Source.load(package))
-
- def submit_report(self, job, report):
- job = Job.load(job)
- if job.is_finished():
- raise ValueError("Job is finished")
-
- builder = job.get_builder()
- builder = builder['_id'] if builder else None
-
- if builder != get_builder_id():
- raise ValueError("Machine isn't assigned.")
-
- r = Report(builder=get_builder_id(),
- job=job['_id'],
- report=report,
- package=job['package'])
- return r.save()
-
- def close_job(self, job):
- job = Job.load(job)
- if job.is_finished():
- raise ValueError("job is already closed")
-
- builder = job.get_builder()
- builder = builder['_id'] if builder else None
-
- if builder != get_builder_id():
- raise ValueError("Machine isn't assigned.")
-
- job['finished_at'] = dt.datetime.utcnow()
- return job.save()
-
-
def serve(server, port):
print("Serving on `{server}' on port `{port}'".format(**locals()))
server = SimpleXMLRPCServer((server, port),
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-debile/debile-master.git
More information about the Pkg-debile-commits
mailing list