Hi,

Quoting Johannes Schauer (2015-12-25 18:39:37)
> On Thu, 24 Dec 2015 11:11:58 +0100 Johannes Schauer <jo...@debian.org> wrote:
> > Maybe a good fix would already be to properly document how --source,
> > --arch-all and --arch-all-only play together. Here is an overview of which
> > combination of these options leads to which flag being passed to
> > dpkg-buildpackage:
> > 
> >   --source  |  --arch-all  | --arch-all-only  | dpkg-buildpackage flag
> > ------------+--------------+------------------+------------------------
> >     set     |     set      |      set         |        -g
> >     set     |     set      |                  |
> >     set     |              |      set         |        -S
> >     set     |              |                  |        -G
> >             |     set      |      set         |        -A
> >             |     set      |                  |        -b
> >             |              |      set         |
> >             |              |                  |        -B
> 
> actually above table is partly a lie. The --arch-all-only option, while being
> the only option that can set the BUILD_ARCH_ANY configuration variable is
> *also* setting the BUILD_ARCH_ALL variable so it has to be used together with
> --no-arch-all directly after it in cases where --arch-all is not set.
> 
> This will be vastly simplified with the --arch-any and --no-arch-any option
> from bug #799056.

a proposed patch to fix all this in the documentation and to deprecate the
--arch-all-only option in favour of a simpler interface is attached.

Please comment!

Thanks!

cheers, josch
From 82fb15b29d0a25b5cb7ae80e307b56ba82cf0e29 Mon Sep 17 00:00:00 2001
From: Johannes 'josch' Schauer <jo...@mister-muffin.de>
Date: Sun, 3 Jan 2016 12:17:23 +0100
Subject: [PATCH] Add documentation related to generated build artifacts
 (closes: #782553)

 - deprecated --arch-all-only
 - throw an error if no artifacts are to be created
 - add references to the command line options to config variables
   BUILD_ARCH_AND, BUILD_ARCH_ALL and BUILD_SOURCE
 - add a new section in sbuild man page explaining the
   --arch-all/no--arch-all, --arch-any/--no-arch-any and
   --source/--no-source options
---
 lib/Buildd/Daemon.pm  |  2 +-
 lib/Sbuild/Build.pm   |  7 +++++
 lib/Sbuild/Conf.pm    |  6 ++--
 lib/Sbuild/Options.pm |  1 +
 man/sbuild.1.in       | 86 ++++++++++++++++++++++++++++++++++++++++++++++-----
 5 files changed, 91 insertions(+), 11 deletions(-)

diff --git a/lib/Buildd/Daemon.pm b/lib/Buildd/Daemon.pm
index 140fc0c..9c75537 100644
--- a/lib/Buildd/Daemon.pm
+++ b/lib/Buildd/Daemon.pm
@@ -543,7 +543,7 @@ 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", "--no-arch-any" );
         } else {
             push ( @sbuild_args, "--arch=" . $dist_config->get('BUILT_ARCHITECTURE') );
 	}
diff --git a/lib/Sbuild/Build.pm b/lib/Sbuild/Build.pm
index 1825125..cb5f15b 100644
--- a/lib/Sbuild/Build.pm
+++ b/lib/Sbuild/Build.pm
@@ -270,6 +270,13 @@ sub run {
 	$self->set('Build Arch', $self->get_conf('BUILD_ARCH'));
 	$self->set('Build Profiles', $self->get_conf('BUILD_PROFILES'));
 
+	if (!$self->get_conf('BUILD_ARCH_ANY') &&
+	    !$self->get_conf('BUILD_ARCH_ALL') &&
+	    !$self->get_conf('BUILD_SOURCE')) {
+	    Sbuild::Exception::Build->throw(error => "Neither architecture specific nor architecture independent or source package specified to be built.",
+					    failstage => "init");
+	}
+
 	my $dist = $self->get_conf('DISTRIBUTION');
 	if (!defined($dist) || !$dist) {
 	    Sbuild::Exception::Build->throw(error => "No distribution defined",
diff --git a/lib/Sbuild/Conf.pm b/lib/Sbuild/Conf.pm
index 978f9ae..97d660a 100644
--- a/lib/Sbuild/Conf.pm
+++ b/lib/Sbuild/Conf.pm
@@ -137,14 +137,14 @@ sub setup ($) {
 	    VARNAME => 'build_arch_all',
 	    GROUP => 'Build options',
 	    DEFAULT => 0,
-	    HELP => 'Build architecture: all packages by default'
+	    HELP => 'Build architecture: all packages by default. Set by the --arch-all and --no-arch-all command line options.'
 	},
 	'BUILD_ARCH_ANY'			=> {
 	    TYPE => 'BOOL',
 	    VARNAME => 'build_arch_any',
 	    GROUP => 'Build options',
 	    DEFAULT => 1,
-	    HELP => 'Build architecture: any packages by default'
+	    HELP => 'Build architecture: any packages by default. Set by the --arch-any and --no-arch-any command line options.'
 	},
 	'NOLOG'					=> {
 	    TYPE => 'BOOL',
@@ -825,7 +825,7 @@ $crossbuild_core_depends = {
 	    GROUP => 'Build options',
 	    DEFAULT => 0,
 	    CHECK => $validate_append_version,
-	    HELP => 'By default, do not build a source package (binary only build).  Set to 1 to force creation of a source package, but note that this is inappropriate for binary NMUs, where the option will always be disabled.'
+	    HELP => 'By default, do not build a source package (binary only build).  Set to 1 to force creation of a source package, but note that this is inappropriate for binary NMUs, where the option will always be disabled. Set by the --source and --no-source command line options.'
 	},
 	'ARCHIVE'				=> {
 	    TYPE => 'STRING',
diff --git a/lib/Sbuild/Options.pm b/lib/Sbuild/Options.pm
index 0084502..1282dc6 100644
--- a/lib/Sbuild/Options.pm
+++ b/lib/Sbuild/Options.pm
@@ -62,6 +62,7 @@ sub set_options {
 			   $self->set_conf('BUILD_ARCH_ANY', 0);
 		       },
 		       "arch-all-only" => sub {
+			   $self->log_warning("the --arch-all-only option is deprecated!\n");
 			   $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 26befe3..5e2c2d1 100644
--- a/man/sbuild.1.in
+++ b/man/sbuild.1.in
@@ -136,6 +136,9 @@ a symlink to the chroot located in \fI/etc/sbuild/chroot/$distribution\fP, or
 must be run in a directory containing a \fIchroot\-$distribution\fP symlink to
 the chroot (not recommended, but done for backward compatibility).
 .SH OPTIONS
+Options set on the command line overwrite settings made in the configuration
+file. For options for which a --foo and --no-foo variant exist, later options
+will overwrite earlier options.
 .TP
 .BR \-h ", " \-\-help
 Display this manual.
@@ -183,25 +186,40 @@ cross-building when used together with \-\-host.  If \-\-build is not specified,
 the default system architecture is assumed.
 .TP
 .BR \-A ", " "\-\-arch\-all"
-Also build Architecture: all packages, i.e. use dpkg\-buildpackage \-b
-instead of \-B.
+Also build Architecture: all packages. This option is the opposite of
+\-\-no\-arch\-all.
+See the section
+.BR "BUILD ARTIFACTS"
+for more information.
 .TP
 .BR "\-\-no\-arch\-all"
-Do not build Architecture: all packages, i.e. use dpkg\-buildpackage \-B
-instead of \-b. This option is the opposite of \-\-arch\-all.
+Do not build Architecture: all packages. This is the default behaviour. This
+option is the opposite of \-\-arch\-all.
+See the section
+.BR "BUILD ARTIFACTS"
+for more information.
 .TP
 .BR "\-\-arch\-any"
-Build Architecture: any packages. This is the default behavior.
+Build Architecture: any packages. This is the default behavior. This option is
+the opposite of \-\-no\-arch\-any.
+See the section
+.BR "BUILD ARTIFACTS"
+for more information.
 .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.
+See the section
+.BR "BUILD ARTIFACTS"
+for more information.
 .TP
-.BR "\-\-arch\-all\-only"
+.BR "\-\-arch\-all\-only" (deprecated)
 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.
+This option is deprecated. Use --arch-all together with --no-arch-any to get
+the same behaviour.
 .TP
 .BR \-b ", " "\-\-batch"
 Operate in batchmode, i.e. write a build-progress file during execution
@@ -321,10 +339,16 @@ values are \fBalways\fR (default), \fBnever\fR, and \fBsuccessful\fR.
 .TP
 .BR \-s ", " "\-\-source"
 Also build source package, i.e. use dpkg\-buildpackage without \-B.
+See the section
+.BR "BUILD ARTIFACTS"
+for more information.
 .TP
 .BR "\-\-no-source"
 Don't build source package, i.e. use dpkg\-buildpackage with \-B.  This option
 is the opposite of \-\-source.
+See the section
+.BR "BUILD ARTIFACTS"
+for more information.
 .TP
 .BR "\-\-force\-orig\-source"
 When used with in conjunction with \-s, this option forces the inclusion of the
@@ -562,6 +586,52 @@ By default the package is built in a path of the following format /build/package
 .BR \-\-sbuild-mode=\fImode\fP
 Behaviour changes for use in a buildd environment.  This overrides the
 \fI$sbuild_mode\fP configuration option.
+.SH BUILD ARTIFACTS
+Sbuild is meant to be used to build architecture specific binary packages from
+a given source package. In addition, sbuild is also able to generate
+architecture independent binary packages as well as to rebuild the original
+source package that was used as input. In summary, sbuild is able to build
+architecture specific binary packages, architecture independent binary packages
+and source packages. What ends up being built is determined by the
+configuration variables \fBBUILD_ARCH_ANY\fR, \fBBUILD_ARCH_ALL\fR and
+\fBBUILD_SOURCE\fR, respectively. See
+.BR sbuild.conf (5)
+for a detailed explanation of these configuration variables.
+.PP
+By default, only \fBBUILD_ARCH_ANY\fR is set to true while \fBBUILD_ARCH_ALL\fR
+and \fBBUILD_SOURCE\fR are set to false. So by default only architecture
+specific binary packages will be built. This behaviour can be changed either by
+using command line options or by modifying the configuration variables in your
+\fI~/.sbuildrc\fP. The relevant command line options to change the values of
+\fBBUILD_ARCH_ANY\fR, \fBBUILD_ARCH_ALL\fR and \fBBUILD_SOURCE\fR are
+\f[CB]--arch-any/--no-arch-any\fP, \f[CB]--arch-all/--no-arch-all\fP and
+\f[CB]--source/--no-source\fP, respectively.
+.PP
+The values of \fBBUILD_ARCH_ANY\fR, \fBBUILD_ARCH_ALL\fR and \fBBUILD_SOURCE\fR
+change the parameter that dpkg-buildpackage is called with. The following table
+displays the argument passed to dpkg-buildpackage in the last column depending
+on the configuration options in the first three columns.
+.PP
+.if t \{\
+.ft CW
+\}
+.TS
+l l l l.
+\fBBUILD_ARCH_ANY\fR	\fBBUILD_ARCH_ALL\fR	\fBBUILD_SOURCE\fR	dpkg-buildpackage flag
+_
+false	false	false	invalid
+false	false	true	-S
+false	true	false	-A
+false	true	true	-g
+true	false	false	-B
+true	false	true	-G
+true	true	false	-b
+true	true	true	no option
+.TE
+.if t \{\
+.in
+.ft P
+\}
 .SH EXTERNAL COMMANDS
 Support to run external commands during an sbuild run is provided. A set of
 external commands can be run at various stages of a build. Providing commands to
@@ -769,7 +839,9 @@ Directory containing symbolic links to chroots.  This is only used for sudo
 chroot access; schroot access uses the schroot chroot configuration.
 .TP
 .I ~/.sbuildrc
-User-specific configuration.
+User-specific configuration. A custom path to a configuration file can also be
+specified through setting the \fBSBUILD_CONFIG\fP environment variable to the
+path of an additional configuration file.
 .TP
 .I /var/lib/sbuild
 Build trees, archive signing keys, build statistics and lock files.
-- 
2.5.1

Attachment: signature.asc
Description: signature

Reply via email to