[Pkg-debile-commits] [debile-master] 113/126: UUID for jobs
Sylvestre Ledru
sylvestre at alioth.debian.org
Mon Aug 19 14:56:26 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 46c231117a814411ff7657430466c4952189eec4
Author: Léo Cavaillé <leo at cavaille.net>
Date: Fri Aug 2 15:46:02 2013 +0200
UUID for jobs
---
lucy/cli/init.py | 2 +-
lucy/incoming.py | 22 ++++++++++++----------
lucy/orm.py | 7 ++++++-
scripts/lucy-processd | 2 +-
4 files changed, 20 insertions(+), 13 deletions(-)
diff --git a/lucy/cli/init.py b/lucy/cli/init.py
index d37bc6f..07f8047 100644
--- a/lucy/cli/init.py
+++ b/lucy/cli/init.py
@@ -9,7 +9,7 @@ import json
metadata = lucymodel.Base.metadata
def main():
- engine = create_engine('postgresql://leo:prout@localhost/lucy', echo=True)
+ engine = create_engine('postgresql://lucy:adamngoodpassword@localhost/lucy', echo=True)
metadata.drop_all(bind=engine)
metadata.create_all(bind=engine)
diff --git a/lucy/incoming.py b/lucy/incoming.py
index 6a76ad2..733878c 100644
--- a/lucy/incoming.py
+++ b/lucy/incoming.py
@@ -1,5 +1,5 @@
from sqlalchemy.orm.exc import NoResultFound, MultipleResultsFound
-from lucy.orm import User, Source, Machine, Binary, Job, Group
+from lucy.orm import User, Source, Machine, Binary, Job, Group, BinaryFiles
from lucy.archive import move_to_pool
from lucy.changes import parse_changes_file, ChangesFileException
@@ -10,6 +10,7 @@ from lucy.server import Session
import os
import logging
+import uuid
def listize(entry):
items = [x.strip() for x in entry.split(",")]
@@ -64,12 +65,13 @@ def accept_source(changes):
group = Group(name=changes['X-Lucy-Group'])
# Check if previous runs happened before on this version
- previous_runs = session.query(Source.run)\
+ previous_runs = [ e[0] for e in session.query(Source.run)\
.join(Source.user)\
.filter(Source.name == changes['source'])\
.filter(Source.version == changes['version'])\
.filter(User.id == owner.id)\
- .all()
+ .all()]
+ print previous_runs
if previous_runs:
run_nb = max(previous_runs) + 1
else:
@@ -104,7 +106,8 @@ def add_jobs(package):
for type in listize(config.get('jobs', package.type)):
# For source packages, use only unstable and set arch to all
# so that any builder arch can take jobs
- j = Job(package=package,
+ j = Job(uuid=uuid.uuid4(),
+ package=package,
suite=package.suite,
arch=package.arch,
type=type)
@@ -121,7 +124,8 @@ def add_jobs(package):
if package.type == 'source':
for arch in listize(config.get('jobs', 'arches')):
- j = Job(arch=arch,
+ j = Job(uuid=uuid.uuid4(),
+ arch=arch,
suite=package.suite,
type='build',
package=package)
@@ -165,7 +169,7 @@ def accept_binary(changes):
return reject(changes, 'no-job')
try:
- j = session.query(Job).filter(Job.id == job).one()
+ j = session.query(Job).filter(Job.id == job_id).one()
except NoResultFound:
return reject(changes, 'invalid-job')
@@ -175,7 +179,7 @@ def accept_binary(changes):
except NoResultFound:
return reject(changes, 'invalid-job')
- buildd = session.query(Machine).filter(Machine.key == key).first()
+ buildd = session.query(Machine).filter(Machine.gpg_fingerprint == key).first()
if not buildd:
return reject(changes, 'youre-not-a-machine')
@@ -184,9 +188,7 @@ def accept_binary(changes):
version=changes['version'],
arch=arch,
suite=suite,
- files=[os.path.basename(x) for x in binaries],
- builder=buildd,
- run=s.run)
+ run=int(s.run))
session.add(b)
session.commit()
add_jobs(b)
diff --git a/lucy/orm.py b/lucy/orm.py
index 6d4418d..f7e1a9c 100644
--- a/lucy/orm.py
+++ b/lucy/orm.py
@@ -4,13 +4,17 @@ Base = declarative_base()
from sqlalchemy.orm import relationship, backref
from sqlalchemy import Column, Integer, String, DateTime, ForeignKey
+from sqlalchemy.dialects.postgresql import UUID
import datetime as dt
def row2dict(row):
d = {}
for column in row.__table__.columns:
- d[column.name] = getattr(row, column.name)
+ if column.name == 'uuid':
+ d[column.name] = str(getattr(row, column.name))
+ else:
+ d[column.name] = getattr(row, column.name)
return d
class User(Base):
@@ -94,6 +98,7 @@ class Binary(Package):
class Job(Base):
__tablename__ = 'jobs'
id = Column(Integer, primary_key=True)
+ uuid = Column(UUID(as_uuid=True))
assigned_at = Column(DateTime)
finished_at = Column(DateTime)
machine_id = Column(Integer, ForeignKey('machines.id'))
diff --git a/scripts/lucy-processd b/scripts/lucy-processd
index 13a4a76..50a7e8d 100755
--- a/scripts/lucy-processd
+++ b/scripts/lucy-processd
@@ -5,6 +5,6 @@ lucy-process-incoming
#FIXME: hardcoded path :(
inoticoming \
--foreground \
- /tmp/incoming/ \
+ /srv/local-mirror/incoming/ \
--suffix .changes lucy-process-incoming \
\;
--
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