Here is the patch.
From 4f0e00d0dda4ff8e11eaa36199e196621e280c13 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20A=2E=20Col=C3=B3n=20V=C3=A9lez?=
<[email protected]>
Date: Tue, 15 Sep 2015 05:26:48 -0400
Subject: [PATCH] Add a new --souce-only option. (Closes: #799056)
- Get the changes file.
- Format the email subject like:
Log for successful build of foo_1.0 source on i386 (dist=unstable)
- Add the --source-only option.
- Update the documentation.
---
lib/Sbuild/Build.pm | 8 +++++++-
lib/Sbuild/Options.pm | 5 +++++
man/sbuild.1.in | 8 +++++++-
3 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 4fe67b1..b021c1a 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -1892,7 +1892,10 @@ sub get_changes {
my $path=shift;
my $changes;
- if ( -r $path . '/' . $self->get('Package_SVersion') . "_all.changes") {
+ if ( -r $path . '/' . $self->get('Package_SVersion') . "_source.changes") {
+ $changes = $self->get('Package_SVersion') . "_source.changes";
+ }
+ elsif ( -r $path . '/' . $self->get('Package_SVersion') . "_all.changes") {
$changes = $self->get('Package_SVersion') . "_all.changes";
}
else {
@@ -2336,6 +2339,9 @@ sub close_build_log {
my $subject = "Log for " . $self->get_status() .
" build of " . $self->get('Package_Version');
+ if ($self->get_conf('BUILD_SOURCE') && !$self->get_conf('BUILD_ARCH_ALL') && !$self->get_conf('BUILD_ARCH_ANY')) {
+ $subject .= " source";
+ }
if ($self->get_conf('BUILD_ARCH_ALL') && !$self->get_conf('BUILD_ARCH_ANY')) {
$subject .= " on all";
} elsif ($self->get('Host Arch')) {
diff --git a/lib/Sbuild/Options.pm b/lib/Sbuild/Options.pm
index b47b3f5..c76da3a 100644
--- a/lib/Sbuild/Options.pm
+++ b/lib/Sbuild/Options.pm
@@ -201,6 +201,11 @@ sub set_options {
"no-source" => sub {
$self->set_conf('BUILD_SOURCE', 0);
},
+ "source-only" => sub {
+ $self->set_conf('BUILD_SOURCE', 1);
+ $self->set_conf('BUILD_ARCH_ALL', 0);
+ $self->set_conf('BUILD_ARCH_ANY', 0);
+ },
"archive=s" => sub {
$self->set_conf('ARCHIVE', $_[1]);
},
diff --git a/man/sbuild.1.in b/man/sbuild.1.in
index c76e61c..af6b8a6 100644
--- a/man/sbuild.1.in
+++ b/man/sbuild.1.in
@@ -34,6 +34,7 @@ sbuild \- build debian packages from source
.RB [ \-\-host=\fIarchitecture\fP ]
.RB [ \-\-profiles=\fIprofile[,...]\fP ]
.RB [ \-s \[or] \-\-source ]
+.RB [ \-\-source\-only ]
.RB [ \-\-force\-orig\-source ]
.RB [ \-\-make\-binNMU=\fIchangelog-entry\fP ]
.RB [ \-\-binNMU=\fINMU-version\fP ]
@@ -185,7 +186,7 @@ Do not build Architecture: all packages, i.e. use dpkg\-buildpackage \-B
instead of \-b. This option is the opposite of \-\-arch\-all.
.TP
.BR "\-\-arch\-all\-only"
-Only build Architecture:all packages, i.e. use dpkg-buildpackage \-A
+Only build Architecture:all packages, i.e. use dpkg\-buildpackage \-A
instead of \-B. The \-\-arch=\fIarchitecture\fP option can still be used to
specify the architecture used to build the package.
.TP
@@ -308,6 +309,11 @@ Also build source package, i.e. use dpkg\-buildpackage without \-B.
Don't build source package, i.e. use dpkg\-buildpackage with \-B. This option
is the opposite of \-\-source.
.TP
+.BR "\-\-source\-only"
+Only build the source package, i.e. use dpkg\-buildpackage \-S
+instead of \-B. The \-\-arch=\fIarchitecture\fP option can still be used to
+specify the architecture used to build the package.
+.TP
.BR "\-\-force\-orig\-source"
When used with in conjunction with \-s, this option forces the inclusion of the
orig.tar.gz file in the generated .changes file, even in cases where it would
--
2.5.1