[Buildd-tools-devel] Bug#456934: Add option to select the build dependency check algorithm

Jan-Marek Glogowski glogow at fbihome.de
Fri Dec 21 09:31:21 UTC 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 19 Dec 2007, Roger Leigh wrote:

> Michael Banck <mbanck at debian.org> writes:
>
> > On Wed, Dec 19, 2007 at 08:10:37AM +0100, Jan-Marek Glogowski wrote:
> >> > Isn't it usual sbuild behaviour to only try the first package of a set
> >> > of alternatives?
> >>
> >> Currently yes, but I consider this a bug. The patched code already runs
> >> in a loop to check for all alternatives, but it currently fails, if it
> >> can't satisfy a versioned dependency.
> >
> > Maybe this is a divergence of the sbuild package from upstream sbuild
> > then.  Fact is that the buildds will show this behaviour, so I am not
> > sure changing it in the sbuild package is the best solution.
>

...

> However, I wouldn't be opposed to adding a command-line and/or
> configuration option which would allow the user to alter this, so long
> as it is not the default behaviour.  Adding a variable to
> Sbuild/Conf.pm is pretty easy, as is a new command-line option.  If
> you would like to make a patch for that, that would be super.

Ok - I have attached a new patch to make the dependeny check algorith
select and configureable. Default is the old behaviour, but it can be
changed to check for alternatives via sbuild argument (-C) or by changing
check_depends_algorithm in the SBUILD BEHAVIOUR config group.

Tested with the bzr-svn package, which still fails with default, but
finishes with the alternatives algorithm.

Jan-Marek
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFHa4ftj6MK58wZA3cRAjI9AJ9HFuarByB6ia8+TmGtA1HORTprrwCfTJkw
zkXece2T+Thtk1QQwkO8BoU=
=aSRQ
-----END PGP SIGNATURE-----
-------------- next part --------------
diff --git a/Sbuild/Conf.pm b/Sbuild/Conf.pm
index 7413bc5..9bb58d1 100644
--- a/Sbuild/Conf.pm
+++ b/Sbuild/Conf.pm
@@ -127,6 +127,7 @@ our %alternatives = ("info-browser"		=> "info",
 		     "freetype2-dev"		=> "libttf-dev");
 
 our @no_auto_upgrade = qw(dpkg apt bash libc6 libc6-dev dpkg-dev);
+our $check_depends_algorithm = "first_only";
 
 # read conf files
 require "/etc/sbuild/sbuild.conf" if -r "/etc/sbuild/sbuild.conf";
diff --git a/debian/changelog b/debian/changelog
index c626aaa..186fbea 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,6 +7,11 @@ sbuild (0.57) unstable; urgency=low
     - Add additional syntax checks.  Thanks to Jan-Marek Glogowski.
     - filter_dependencies: Remove redundant conditional.  Thanks to
       Jan-Marek Glogowski.
+    - Add --check-depends-algorithm to select the algorithm to check the build
+      dependencies. Also adds the config option $check_depends_algorithm to
+      change this in your sbuild configuration. Thanks to Jan-Marek Glogowski.
+    - Cleanup sbuild.conf and example.sbuildrc to declare valid variables when
+      uncommented. Thanks to Jan-Marek Glogowski.
 
  -- Roger Leigh <rleigh at debian.org>  Sun, 02 Dec 2007 15:03:04 +0000
 
diff --git a/example.sbuildrc b/example.sbuildrc
index 6e64499..9f42a2f 100644
--- a/example.sbuildrc
+++ b/example.sbuildrc
@@ -64,11 +64,11 @@
 
 # Time (in minutes) of inactivity after which a build is terminated. Activity
 # is measured by output to the log file.
-#stalled_pkg_timeout = 150;
+#$stalled_pkg_timeout = 150;
 
 # Some packages may exceed the general timeout (e.g. redirecting output to
 # a file) and need a different timeout. Below are some examples.
-#individual_stalled_pkg_timeout = (smalleiffel => 300,
+#@individual_stalled_pkg_timeout = (smalleiffel => 300,
 #				   jade => 300,
 #				   atlas => 300,
 #				   glibc => 1000,
diff --git a/sbuild b/sbuild
index e9c32e3..7d7ebb5 100755
--- a/sbuild
+++ b/sbuild
@@ -117,6 +117,12 @@ exit 1 if !GetOptions ("arch=s" => \$main::user_arch,
 		       "a|add-depends=s" => sub {
 			   push( @main::manual_srcdeps, "a".$_[1] );
 		       },
+		       "C|check-depends-algorithm=s" => sub {
+			   die "Bad build dependency check alorithm\n"
+		       		if( ! ($_[1] eq "first_only" 
+				    || $_[1] eq "alternatives") );
+			   $conf::check_depends_algorithm = $_[1];
+		       },
 		       "b|batch" => \$main::batchmode,
 		       "make-binNMU=s" => sub {
 			   $main::binNMU = $_[1];
@@ -1331,6 +1337,7 @@ sub filter_dependencies {
 			}
 			if(!$installable) {
 			    print PLOG "no suitable version found. Skipping for now, maybe there are alternatives.\n";
+			    next if ($conf::check_depends_algorithm eq "alternatives");
 			}
 		    } else {
 			print PLOG "Using default version " . $policy{$name}->{defversion} . "\n";
diff --git a/sbuild.1.in b/sbuild.1.in
index 7ed2fcc..8e8d023 100644
--- a/sbuild.1.in
+++ b/sbuild.1.in
@@ -94,6 +94,12 @@ instead of \-B.
 Operate in batchmode, i.e. write a build-progress file during execution
 and files on shutdown to facilitate a clean restart.
 .TP
+.IR \-C , "\-\-check\-depends\-algorithm=<algorithm>"
+Selects the algorithm to check for build dependencies. The default algorithm 
+(\fIfirst_only\fP) just checks the first package, even if there are alternative
+dependencies available. The second algorithm (\fIalternatives\fP) also tries to
+satisfy the build dependencies using these alternatives.
+.TP
 .IR \-d , "\-\-distribution=<distribution>"
 Fetch source packages from specified distribution.
 .TP
diff --git a/sbuild.conf b/sbuild.conf
index 20cc489..6b5c8ee 100644
--- a/sbuild.conf
+++ b/sbuild.conf
@@ -24,10 +24,9 @@
 
 # Mail address where logs are sent to (mandatory, no default)
 #$mailto = "frankie";
-#$mailto = "";
 
 # Name of log sender
-#mailfrom = "Source Builder <sbuild>";
+#$mailfrom = "Source Builder <sbuild>";
 
 
 ##
@@ -96,16 +95,16 @@
 #
 # Most buildds run with clean chroots at the moment, so the default
 #list is now empty.
-#watches = ();
+#@watches = ();
 
 # Ignore watches on the following packages if the package doesn't have its own
 # build dependencies in the .dsc
-#ignore_watches_no_build_deps = qw();
+#@ignore_watches_no_build_deps = qw();
 
 # If a source dependency is an alternative that is provided by more than one
 # package, this list can select which one will be installed (if nothing is
 # defined, a random provider will be used)
-#alternatives = ("info-browser"			=> "info",
+#@alternatives = ("info-browser"			=> "info",
 #		 "httpd"			=> "apache",
 #		 "postscript-viewer"		=> "ghostview",
 #		 "postscript-preview"		=> "psutils",
@@ -135,11 +134,14 @@
 #		 "freetype2-dev"		=> "libttf-dev");
 
 # Packages which should not be upgraded automatically.
-#no_auto_upgrade = qw(dpkg apt bash libc6 libc6-dev dpkg-dev);
+#@no_auto_upgrade = qw(dpkg apt bash libc6 libc6-dev dpkg-dev);
 
 # Regular expressions identifying toolchain packages.
 #@toolchain_regex = ( 'binutils$', 'gcc-[\d.]+$', 'g\+\+-[\d.]+$', 'libstdc\+\+', 'libc[\d.]+-dev$', 'linux-kernel-headers$' );
 
+# Change algorithm for build dependency checks: possible values are 
+# "first_only" or "alternatives". Default: "first_only".
+#$check_depends_algorithm = "first_only";
 
 ##
 ## TIMEOUTS
@@ -150,11 +152,11 @@
 
 # Time (in minutes) of inactivity after which a build is terminated. Activity
 # is measured by output to the log file.
-#stalled_pkg_timeout = 150;
+#$stalled_pkg_timeout = 150;
 
 # Some packages may exceed the general timeout (e.g. redirecting output to
 # a file) and need a different timeout. Below are some examples.
-#individual_stalled_pkg_timeout = (smalleiffel => 300,
+#@individual_stalled_pkg_timeout = (smalleiffel => 300,
 #				   jade => 300,
 #				   atlas => 300,
 #				   glibc => 1000,
@@ -193,7 +195,7 @@
 ##
 
 # Program to mail log files.
-#mailprog = "/usr/sbin/sendmail";
+#$mailprog = "/usr/sbin/sendmail";
 # dpkg binary.
 #$dpkg = "/usr/bin/dpkg";
 # su binary.


More information about the Buildd-tools-devel mailing list