diff --git a/debian/changelog b/debian/changelog index a54a79f..5eb69fb 100644 --- a/debian/changelog +++ b/debian/changelog @@ -11,6 +11,10 @@ ubuntu-dev-tools (0.120) UNRELEASED; urgency=low * pull-{lp,debian}-source, pull-debian-debdiff: Catch KeyboardInterrupt. (LP: #713845) + [ Julian Taylor ] + * add support for cowbuilder and cowbuilder-dist in builder.py + - allows use in sponsor-patch and backportpackage (LP: #728751) + -- Stefano Rivera <stefanor@debian.org> Sat, 05 Mar 2011 00:47:57 +0200 ubuntu-dev-tools (0.119) unstable; urgency=low diff --git a/doc/backportpackage.1 b/doc/backportpackage.1 index 3a21b36..03ec5ad 100644 --- a/doc/backportpackage.1 +++ b/doc/backportpackage.1 @@ -46,13 +46,15 @@ defaults to \fB~ppa1\fR, otherwise the default is blank. .TP .B \-b\fR, \fB\-\-build Build the package with the specified builder before uploading. Note -for \fBpbuilder\fR(8) users: This assumes the common configuration, +for \fBcowbuilder\fR(8) and \fBpbuilder\fR(8) users: +This assumes the common configuration, where the \fBARCH\fR and \fBDIST\fR environment is read by \fBpbuilderrc\fR(5) to select the correct base image. .TP .B \-B \fIBUILDER\fR, \fB\-\-builder\fR=\fIBUILDER Use the specified builder to build the package. Supported are -\fBpbuilder\fR(8), \fBpbuilder-dist\fR(1), and \fBsbuild\fR(1). +\fBcowbuilder\fR(8), \fBcowbuilder-dist\fR(1), \fBpbuilder\fR(8), +\fBpbuilder-dist\fR(1), and \fBsbuild\fR(1). The default is \fBpbuilder\fR(8). .TP .B \-U\fR, \fB\-\-update diff --git a/doc/sponsor-patch.1 b/doc/sponsor-patch.1 index 9fd871a..833f2ae 100644 --- a/doc/sponsor-patch.1 +++ b/doc/sponsor-patch.1 @@ -54,13 +54,15 @@ The output of the build tool will be placed in \fIworkdir\fR/\fBbuildresult/\fR. .SH OPTIONS .TP .BR \-b ", " \-\-build -Build the package with the specified builder. Note for \fBpbuilder\fR(8) users: +Build the package with the specified builder. Note for \fBpbuilder\fR(8) and +\fBcowbuilder\fR(8) users: This assumes the common configuration, where the \fBARCH\fR and \fBDIST\fR environment is read by \fBpbuilderrc\fR(5) to select the correct base image. .TP .B \-B \fIBUILDER\fR, \fB\-\-builder\fR=\fIBUILDER Use the specify builder to build the package. -Supported are \fBpbuilder\fR(8), \fBpbuilder-dist\fR(1), and \fBsbuild\fR(1). +Supported are \fBcowbuilder\fR(8), \fBcowbuilder-dist\fR(1), \fBpbuilder\fR(8), +\fBpbuilder-dist\fR(1), and \fBsbuild\fR(1). The default is \fBpbuilder\fR(8). .TP .BR \-e ", " \-\-edit @@ -143,6 +145,8 @@ Performing a test build of bug \fB1234\fR in your PPA: .BR dput (1), .BR edit-patch (1), .BR lintian (1), +.BR cowbuilder (8), +.BR cowbuilder-dist (1), .BR pbuilder (8), .BR pbuilder-dist (1), .BR sbuild (1), diff --git a/ubuntutools/builder.py b/ubuntutools/builder.py index a71922a..56806de 100644 --- a/ubuntutools/builder.py +++ b/ubuntutools/builder.py @@ -55,13 +55,14 @@ class Builder(object): class Pbuilder(Builder): - def __init__(self): + def __init__(self, command="pbuilder"): Builder.__init__(self, "pbuilder") + self._command = command def build(self, dsc_file, dist, result_directory): _build_preparation(result_directory) cmd = ["sudo", "-E", "ARCH=" + self.architecture, "DIST=" + dist, - "pbuilder", "--build", + self._command, "--build", "--architecture", self.architecture, "--distribution", dist, "--buildresult", result_directory, dsc_file] Logger.command(cmd) @@ -70,7 +71,7 @@ class Pbuilder(Builder): def update(self, dist): cmd = ["sudo", "-E", "ARCH=" + self.architecture, "DIST=" + dist, - "pbuilder", "--update", + self._command, "--update", "--architecture", self.architecture, "--distribution", dist] Logger.command(cmd) returncode = subprocess.call(cmd) @@ -78,19 +79,20 @@ class Pbuilder(Builder): class Pbuilderdist(Builder): - def __init__(self): + def __init__(self, command="pbuilder-dist"): Builder.__init__(self, "pbuilder-dist") + self._command = command def build(self, dsc_file, dist, result_directory): _build_preparation(result_directory) - cmd = ["pbuilder-dist", dist, self.architecture, + cmd = [self._command, dist, self.architecture, "build", dsc_file, "--buildresult", result_directory] Logger.command(cmd) returncode = subprocess.call(cmd) return self._build_failure(returncode, dsc_file) def update(self, dist): - cmd = ["pbuilder-dist", dist, self.architecture, "update"] + cmd = [self._command, dist, self.architecture, "update"] Logger.command(cmd) returncode = subprocess.call(cmd) return self._update_failure(returncode, dist) @@ -146,12 +148,17 @@ class Sbuild(Builder): def get_builder(builder): - if builder == 'pbuilder': + if builder == 'cowbuilder': + return Pbuilder("cowbuilder") + elif builder == 'cowbuilder-dist': + return Pbuilderdist("cowbuilder-dist") + elif builder == 'pbuilder': return Pbuilder() elif builder == 'pbuilder-dist': return Pbuilderdist() elif builder == 'sbuild': return Sbuild() - Logger.error("Unsupported builder specified: %s. Only pbuilder, " - "pbuilder-dist and sbuild are supported." % builder) + Logger.error("Unsupported builder specified: %s. Only cowbuilder, " + "cowbuilder-dist, pbuilder, pbuilder-dist " + "and sbuild are supported." % builder)