Hello:

Here is the implementation of the suggestion I mentioned in the
previous message. I tested it using:
- "-s --no-arch-all --no-arch-any"
- "-As --no-arch-any"

and it produced the desired results..

The first two patches are the ones related to this wishlist bug while
the optional third patch is related to the points raised in this bug
report about possible confusions.

- The first patch adds new options to only manipulate BUILD_ARCH_ANY.
It only changes one parameter so the behavior is more intuitive.
- The second patch adds support for source only builds. The current
code only handled all.changes and $arch.changes and ignored the
source.changes file. It also adds "source" to the email subject to
notify that it was a source only build.
- The third patch is optional and unrelated but as mentioned before
tackles the concerns raised earlier.

Cheers,
Miguel
From 4f626082b54160a1893f3565175c72f097126b75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20A=2E=20Col=C3=B3n=20V=C3=A9lez?=
 <[email protected]>
Date: Tue, 29 Sep 2015 07:09:53 -0400
Subject: [PATCH 1/3] Add the --no-arch-any and --arch-any options.

 - Add the --no-arch-any and --arch-any options.
 - Update the documentation.
---
 lib/Sbuild/Options.pm | 6 ++++++
 man/sbuild.1.in       | 9 +++++++++
 2 files changed, 15 insertions(+)

diff --git a/lib/Sbuild/Options.pm b/lib/Sbuild/Options.pm
index b47b3f5..6ccac59 100644
--- a/lib/Sbuild/Options.pm
+++ b/lib/Sbuild/Options.pm
@@ -55,6 +55,12 @@ sub set_options {
 		       "no-arch-all" => sub {
 			   $self->set_conf('BUILD_ARCH_ALL', 0);
 		       },
+		       "arch-any" => sub {
+			   $self->set_conf('BUILD_ARCH_ANY', 1);
+		       },
+		       "no-arch-any" => sub {
+			   $self->set_conf('BUILD_ARCH_ANY', 0);
+		       },
 		       "arch-all-only" => sub {
 			   $self->set_conf('BUILD_ARCH_ALL', 1);
 			   $self->set_conf('BUILD_ARCH_ANY', 0);
diff --git a/man/sbuild.1.in b/man/sbuild.1.in
index c76e61c..fd79fda 100644
--- a/man/sbuild.1.in
+++ b/man/sbuild.1.in
@@ -29,6 +29,7 @@ sbuild \- build debian packages from source
 .RB [ \-d \[or] \-\-dist=\fIdistribution\fP ]
 .RB [ \-c \[or] \-\-chroot=\fIchroot\fP ]
 .RB [ \-\-arch=\fIarchitecture\fP ]
+.RB [ \-\-arch\-any " \[or] " \-\-no\-arch\-any ]
 .RB [ \-\-arch\-all\-only ]
 .RB [ \-\-build=\fIarchitecture\fP ]
 .RB [ \-\-host=\fIarchitecture\fP ]
@@ -184,6 +185,14 @@ instead of \-B.
 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\-any"
+Build Architecture: any packages. This is the default behavior.
+.TP
+.BR "\-\-no\-arch\-any"
+Do not build Architecture: any packages. This option is the opposite
+of \-\-arch\-any and only useful when used together with \-\-arch\-all
+or \-\-source.
+.TP
 .BR "\-\-arch\-all\-only"
 Only build Architecture:all packages, i.e. use dpkg-buildpackage \-A
 instead of \-B.  The \-\-arch=\fIarchitecture\fP option can still be used to
-- 
2.5.3

From 480e4f5b5eec17d5f7a0464732119e2cd751a933 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20A=2E=20Col=C3=B3n=20V=C3=A9lez?=
 <[email protected]>
Date: Tue, 29 Sep 2015 07:13:11 -0400
Subject: [PATCH 2/3] Successfully handle a source only build. (Closes:
 #799056)

 - Get the *_source.changes file.
 - Format the email subject like:
   Log for successful build of foo_1.0 source on i386 (dist=unstable)
---
 lib/Sbuild/Build.pm | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

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')) {
-- 
2.5.3

From 02f8ef6eaed463528ff3c2951c1f56d2aa467e02 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Miguel=20A=2E=20Col=C3=B3n=20V=C3=A9lez?=
 <[email protected]>
Date: Tue, 29 Sep 2015 07:24:29 -0400
Subject: [PATCH 3/3] Deprecate --arch-all-only in favor of -A --no-arch-any.

 - Update lib/Buildd/Daemon.pm when building all packages.
 - Remove --arch-all-only from the options.
 - Remove --arch-all-only from the documentation.
 .
 This makes the behavior when used with other options more transparent.
---
 lib/Buildd/Daemon.pm  | 3 ++-
 lib/Sbuild/Options.pm | 4 ----
 man/sbuild.1.in       | 6 ------
 3 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/lib/Buildd/Daemon.pm b/lib/Buildd/Daemon.pm
index 867176e..ad22fe7 100644
--- a/lib/Buildd/Daemon.pm
+++ b/lib/Buildd/Daemon.pm
@@ -543,7 +543,8 @@ sub do_build {
     }
     if ($dist_config->get('BUILT_ARCHITECTURE')) {
         if ($dist_config->get('BUILT_ARCHITECTURE') eq 'all') {
-	    push ( @sbuild_args, "--arch-all-only" );
+	    push ( @sbuild_args, "--arch-all" );
+	    push ( @sbuild_args, "--no-arch-any" );
         } else {
             push ( @sbuild_args, "--arch=" . $dist_config->get('BUILT_ARCHITECTURE') );
 	}
diff --git a/lib/Sbuild/Options.pm b/lib/Sbuild/Options.pm
index 6ccac59..6a36330 100644
--- a/lib/Sbuild/Options.pm
+++ b/lib/Sbuild/Options.pm
@@ -61,10 +61,6 @@ sub set_options {
 		       "no-arch-any" => sub {
 			   $self->set_conf('BUILD_ARCH_ANY', 0);
 		       },
-		       "arch-all-only" => sub {
-			   $self->set_conf('BUILD_ARCH_ALL', 1);
-			   $self->set_conf('BUILD_ARCH_ANY', 0);
-		       },
 		       "profiles=s" => sub {
 			   $_[1] =~ tr/,/ /;
 			   $self->set_conf('BUILD_PROFILES', $_[1]);
diff --git a/man/sbuild.1.in b/man/sbuild.1.in
index fd79fda..4060d5c 100644
--- a/man/sbuild.1.in
+++ b/man/sbuild.1.in
@@ -30,7 +30,6 @@ sbuild \- build debian packages from source
 .RB [ \-c \[or] \-\-chroot=\fIchroot\fP ]
 .RB [ \-\-arch=\fIarchitecture\fP ]
 .RB [ \-\-arch\-any " \[or] " \-\-no\-arch\-any ]
-.RB [ \-\-arch\-all\-only ]
 .RB [ \-\-build=\fIarchitecture\fP ]
 .RB [ \-\-host=\fIarchitecture\fP ]
 .RB [ \-\-profiles=\fIprofile[,...]\fP ]
@@ -193,11 +192,6 @@ Do not build Architecture: any packages. This option is the opposite
 of \-\-arch\-any and only useful when used together with \-\-arch\-all
 or \-\-source.
 .TP
-.BR "\-\-arch\-all\-only"
-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
 .BR \-b ", " "\-\-batch"
 Operate in batchmode, i.e. write a build-progress file during execution
 and files on shutdown to facilitate a clean restart.
-- 
2.5.3

Reply via email to