[Pkg-debile-commits] [debile-master] 38/126: messing about

Sylvestre Ledru sylvestre at alioth.debian.org
Mon Aug 19 14:56:10 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 f329d75079baef1b4ee0cb07c0ce15ca708c71bf
Author: Paul Tagliamonte <tag at pault.ag>
Date:   Tue May 28 20:46:35 2013 -0400

    messing about
---
 lucy/incoming.py   |   11 +++++++++++
 lucy/models/job.py |   34 +++++++++-------------------------
 lucy/server.py     |   12 +++---------
 3 files changed, 23 insertions(+), 34 deletions(-)

diff --git a/lucy/incoming.py b/lucy/incoming.py
index a276c73..4dee429 100644
--- a/lucy/incoming.py
+++ b/lucy/incoming.py
@@ -61,11 +61,22 @@ def accept_source(config, changes):
 
 
 def add_jobs(package, package_type, config, klass):
+
     for type in config['job_classes'][klass]:
+        if klass == 'source':
+            suite = None
+            arch = None
+        else:
+            suite = package['suite']
+            arch = package['arch']
+
         j = Job(package=package['_id'],
                 package_type=package_type,
+                suite=suite,
+                arch=arch,
                 type=type)
         print("  -> Job: ", j.save(), type)
+
     if klass == 'source':
         # add builds
         for suite in config['suites']:
diff --git a/lucy/models/job.py b/lucy/models/job.py
index 0716ebe..25fa43b 100644
--- a/lucy/models/job.py
+++ b/lucy/models/job.py
@@ -5,8 +5,8 @@ from lucy.models.machine import Machine
 class Job(LucyObject):
     _type = 'jobs'
 
-    def __init__(self, type, package, package_type, builder=None,
-                 finished_at=None, assigned_at=None, **kwargs):
+    def __init__(self, type, package, package_type, arch, suite,
+                 builder=None, finished_at=None, assigned_at=None, **kwargs):
 
         from lucy.models.source import Source
         from lucy.models.binary import Binary
@@ -23,15 +23,10 @@ class Job(LucyObject):
         if builder:
             builder = Machine.load(builder)['_id']
 
-        if type == 'build':
-            if 'arch' not in kwargs:
-                raise ValueError("Binary build but not target arch")
-
-            if 'suite' not in kwargs:
-                raise ValueError("Binary build but not target suite")
-
         super(Job, self).__init__(
             type=type,
+            arch=arch,
+            suite=suite,
             package=package,
             builder=builder,
             finished_at=finished_at,
@@ -57,27 +52,16 @@ class Job(LucyObject):
             yield x
 
     @classmethod
-    def next_job(cls, **kwargs):
+    def next_job(cls, suites, arches, **kwargs):
         k = kwargs.copy()
-        k.update({"builder": None, "finished_at": None})
+        k.update({"builder": None,
+                  "finished_at": None,
+                  "suite": {"$in": suites},
+                  "arch": {"$in": arches}})
         v = cls.single(k)
         return v
 
     @classmethod
-    def next_nonbuild_job(cls, types):
-        return cls.next_job(**{
-            "type": "build"
-        })
-
-    @classmethod
-    def next_build_job(cls, suites, arches):
-        return cls.next_job(**{
-            "type": "build",
-            "arch": {"$in": arches},
-            "suite": {"$in": suites},
-        })
-
-    @classmethod
     def unfinished_jobs(cls, **kwargs):
         k = kwargs.copy()
         k.update({"finished_at": None})
diff --git a/lucy/server.py b/lucy/server.py
index 4ca5f6e..31e8328 100644
--- a/lucy/server.py
+++ b/lucy/server.py
@@ -46,7 +46,7 @@ class LucyInterface(object):
             public=public,
             pool=package['path'],
             source=package['source'],
-            version=package['version']
+            version=package['version'],
         )
 
     def get_deb_info(self, package):
@@ -73,17 +73,11 @@ class LucyInterface(object):
         """
         return list(Job.assigned_jobs(get_builder_id()))
 
-    def get_new_build_job(self, suites, arches):
+    def get_next_job(self, suites, arches):
         """
         Get an unassigned lint job from suite suites, arches arches
         """
-        return dict(Job.next_build_job(suites, arches))
-
-    def get_new_nonbuild_job(self, types):
-        """
-        Get an unassigned lint job from type types.
-        """
-        return dict(Job.next_nonbuild_job(types))
+        return dict(Job.next_job(suites, arches))
 
     def submit_report(self, report, log, package, package_type, job, failed):
         """

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