Hi,
I just found a little bug in the multiarch patch I've attached in the
last message. Line 68 was:
+ archs[0] = arch
But should actually be:
+ archs.append(arch)
I'm attaching a new patch with the above fix plus a new command for
the network client, which lets dump a specific job, for example:
[EMAIL PROTECTED]> job status
E: usage: job status <name> <ver> <dist> [arch]
[EMAIL PROTECTED]> job status liblscp 0.5.5-0.1 sid
I: Job 1 for liblscp_0.5.5-0.1 is status BUILD_OK on sid/i386 for None
[EMAIL PROTECTED]> job status liblscp 0.5.5-0.1 sid amd64
I: Job 2 for liblscp_0.5.5-0.1 is status BUILD_OK on sid/amd64 for None
Ciao!
Free
Index: rebuildd/Job.py
===================================================================
--- rebuildd/Job.py (revision 144)
+++ rebuildd/Job.py (working copy)
@@ -101,10 +101,15 @@
with self.status_lock:
self.status = JobStatus.BUILDING
+ arch = self.arch
+ # if arch is 'any' use the first arch defined
+ if arch == 'any':
+ arch = RebuilddConfig().get('build', 'archs').split(' ')[0]
+
# execute commands
for cmd, failed_status in ([Dists().dists[self.dist].get_source_cmd(self.package),
JobStatus.SOURCE_FAILED],
- [Dists().dists[self.dist].get_build_cmd(self.package),
+ [Dists().dists[self.dist].get_build_cmd(self.package, arch),
JobStatus.BUILD_FAILED],
[Dists().dists[self.dist].get_post_build_cmd(self.package),
JobStatus.POST_BUILD_FAILED]):
Index: rebuildd/Rebuildd.py
===================================================================
--- rebuildd/Rebuildd.py (revision 144)
+++ rebuildd/Rebuildd.py (working copy)
@@ -126,7 +126,8 @@
return 0
jobs = []
- jobs.extend(Job.selectBy(status=JobStatus.WAIT, arch=self.cfg.arch)[:max_new])
+ for arch in self.cfg.get('build', 'archs').split(' '):
+ jobs.extend(Job.selectBy(status=JobStatus.WAIT, arch=arch)[:max_new])
if self.cfg.getboolean('build', 'build_arch_any'):
jobs.extend(Job.selectBy(status=JobStatus.WAIT, arch='any')[:max_new])
@@ -146,11 +147,11 @@
# try to see if there's a job for us
for cpackage in candidate_packages:
candidate_jobs = []
- candidate_jobs.extend(Job.selectBy(package=cpackage, arch=self.cfg.arch))
+ candidate_jobs.extend(Job.selectBy(package=cpackage, arch=job.arch))
if self.cfg.getboolean('build', 'build_arch_any'):
candidate_jobs.extend(Job.selectBy(package=cpackage, arch='any'))
for cjob in candidate_jobs:
- if newjob and newjob.arch == self.cfg.arch and cjob.arch == self.cfg.arch and cjob.status == JobStatus.WAIT:
+ if newjob and newjob.arch == job.arch and cjob.arch == job.arch and cjob.status == JobStatus.WAIT:
cjob.status = JobStatus.GIVEUP
elif newjob and newjob.arch == "any" and cjob.status == JobStatus.WAIT:
cjob.status = JobStatus.GIVEUP
@@ -231,6 +232,32 @@
return ret
+ def dump_job(self, name, version, dist, arch=None):
+ """Dump a particular job"""
+
+ if not arch:
+ # if arch is not set use the first arch defined
+ arch = RebuilddConfig().get('build', 'archs').split(' ')[0]
+
+ pkgs = Package.selectBy(name=name, version=version)
+ if not pkgs.count():
+ return ''
+ pkg = pkgs[0]
+
+ jobs = Job.selectBy(package=pkg, dist=dist, arch=arch)
+ if not jobs.count():
+ return ''
+ job = jobs[0]
+
+ return "I: Job %s for %s_%s is status %s on %s/%s for %s\n" % \
+ (job.id,
+ job.package.name,
+ job.package.version,
+ JobStatus.whatis(job.status),
+ job.dist,
+ job.arch,
+ job.mailto)
+
def cancel_job(self, jobid):
"""Cancel a job"""
@@ -271,30 +298,38 @@
if not Dists().dists.has_key(dist):
return False
+ archs = []
if not arch:
- arch = self.cfg.arch
-
- pkgs = Package.selectBy(name=name, version=version)
- if pkgs.count():
- # If several packages exists, just take the first
- pkg = pkgs[0]
+ # Add a job for every arch we support
+ archs = self.cfg.get('build', 'archs').split(' ')
else:
- # Maybe we found no packages, so create a brand new one!
- pkg = Package(name=name, version=version, priority=priority)
+ # Just add one job
+ archs.append(arch)
- jobs_count = Job.selectBy(package=pkg, dist=dist, arch=arch, mailto=mailto, status=JobStatus.WAIT).count()
- if jobs_count:
- RebuilddLog.error("Job already existing for %s_%s on %s/%s, don't adding it" \
- % (pkg.name, pkg.version, dist, arch))
- return False
+ for arch in archs:
- job = Job(package=pkg, dist=dist, arch=arch)
- job.status = JobStatus.WAIT
- job.arch = arch
- job.mailto = mailto
+ pkgs = Package.selectBy(name=name, version=version)
+ if pkgs.count():
+ # If several packages exists, just take the first
+ pkg = pkgs[0]
+ else:
+ # Maybe we found no packages, so create a brand new one!
+ pkg = Package(name=name, version=version, priority=priority)
- RebuilddLog.info("Added job for %s_%s on %s/%s for %s" \
- % (name, version, dist, arch, mailto))
+ jobs_count = Job.selectBy(package=pkg, dist=dist, arch=arch, mailto=mailto, status=JobStatus.WAIT).count()
+ if jobs_count:
+ RebuilddLog.error("Job already existing for %s_%s on %s/%s, don't adding it" \
+ % (pkg.name, pkg.version, dist, arch))
+ return False
+
+ job = Job(package=pkg, dist=dist, arch=arch)
+ job.status = JobStatus.WAIT
+ job.arch = arch
+ job.mailto = mailto
+
+ RebuilddLog.info("Added job for %s_%s on %s/%s for %s" \
+ % (name, version, dist, arch, mailto))
+
return True
def clean_jobs(self):
Index: rebuildd/Distribution.py
===================================================================
--- rebuildd/Distribution.py (revision 144)
+++ rebuildd/Distribution.py (working copy)
@@ -35,20 +35,20 @@
RebuilddLog.error("get_source_cmd has invalid format: %s" % error)
return None
- def get_build_cmd(self, package):
+ def get_build_cmd(self, package, arch):
"""Return command used for building source for this distribution"""
# Strip epochs (x:) away
try:
index = package.version.index(":")
return RebuilddConfig().get('build', 'build_cmd') \
- % (self.name, package.name, package.version[index+1:])
+ % (self.name, arch, package.name, package.version[index+1:])
except ValueError:
pass
try:
return RebuilddConfig().get('build', 'build_cmd') \
- % (self.name, package.name, package.version)
+ % (self.name, arch, package.name, package.version)
except TypeError, error:
RebuilddLog.error("get_build_cmd has invalid format: %s" % error)
return None
Index: rebuildd/RebuilddConfig.py
===================================================================
--- rebuildd/RebuilddConfig.py (revision 144)
+++ rebuildd/RebuilddConfig.py (working copy)
@@ -46,13 +46,16 @@
self.set('build', 'max_jobs', '5')
self.set('build', 'kill_timeout', '90')
self.set('build', 'source_cmd', 'apt-get -q --download-only -t %s source %s=%s')
- self.set('build', 'build_cmd', 'pbuilder build --basetgz /var/cache/pbuilder/%s.tgz %s_%s.dsc')
+ self.set('build', 'build_cmd', 'pbuilder build --basetgz /var/cache/pbuilder/%s-%s.tgz %s_%s.dsc')
self.set('build', 'post_build_cmd', '')
self.set('build', 'dists', 'etch lenny sid')
self.set('build', 'work_dir', '/var/cache/rebuildd/build')
self.set('build', 'database_uri', 'sqlite:///var/lib/rebuildd/rebuildd.db')
self.set('build', 'build_more_recent', '1')
self.set('build', 'build_arch_any', '1')
+ parch = os.popen("dpkg --print-architecture")
+ self.set('build', 'archs', parch.readline().strip())
+ parch.close()
self.set('mail', 'from', '[EMAIL PROTECTED]')
self.set('mail', 'mailto', '[EMAIL PROTECTED]')
@@ -77,10 +80,6 @@
self.set('log', 'mail_failed', '1')
self.set('log', 'mail_successful', '0')
- parch = os.popen("dpkg --print-architecture")
- self.arch = parch.readline().strip()
- parch.close()
-
if not dontparse:
self.reload()
Index: rebuildd/RebuilddNetworkClient.py
===================================================================
--- rebuildd/RebuilddNetworkClient.py (revision 144)
+++ rebuildd/RebuilddNetworkClient.py (working copy)
@@ -129,6 +129,9 @@
if len(args) > 0 and args[0] == "reload":
return self.exec_cmd_job_reload(*args)
+ if len(args) > 0 and args[0] == "status":
+ return self.exec_cmd_job_status(*args)
+
return "E: usage: job <command> [args]\n"
def exec_cmd_job_add(self, *args):
@@ -163,6 +166,24 @@
return "I: job added\n"
return "E: error adding job\n"
+ def exec_cmd_job_status(self, *args):
+ """Add job"""
+ ret = False
+ if len(args) < 3:
+ return "E: usage: job status <name> <ver> <dist> [arch]\n"
+
+ if len(args) == 4:
+ return self.rebuildd.dump_job(name=args[1],
+ version=args[2],
+ dist=args[3])
+
+ if len(args) == 5:
+ return self.rebuildd.dump_job(name=args[1],
+ version=args[2],
+ dist=args[3],
+ arch=args[4])
+ return "E: error dumping job\n"
+
def exec_cmd_job_cancel(self, *args):
"""Cancel job"""
|--==> Free Ekanayaka writes:
FE> Hi Julien,
|--==> Julien Danjou writes:
FE> [...]
>>>I'll attach it as soon as I'm done!
JD> Thanks :)
FE> Here you go.. The patch seems to work fine in most situations, but
FE> probably needs to be checked against corner cases (especially when the
FE> build_more_recent and build_arch_any options are used).
FE> I've made a few comments to the new code, hope that's clear enough,
FE> anyway the changes are very few.
FE> While I am at it I attach another patch which fixes the renaming from
FE> Job.build_status to Job.build in the webpy templates (maybe you did it
FE> yourself but didn't commit).
FE> If you don't mind I'd like to be added to the rebuildd Alioth project
FE> (I'm free-guest), so that if I play more with the code I can commit it
FE> in a branch, and you can review it more easily.
FE> Ciao!
FE> Free