Package: sbuild
Severity: wishlist

I wish sbuild would allow me to extend its config settings in
.sbuildrc or .config/sbuild/config.pl, without having to re-state
the previous defaults.

As an example, I want to extend $unshare_mmdebstrap_extra_args with
some option. But I want to keep the existing defaults too!

This bug report is mostly here to escape the salsa comment mess;
the traces are 
https://salsa.debian.org/debian/sbuild/-/merge_requests/104#note_559900
and some previous bug report that figured out one can use $conf in
the config file.

In https://salsa.debian.org/debian/sbuild/-/merge_requests/104#note_559973
josch@ provided a draft patch to sbuild:

--- a/lib/Sbuild/ConfBase.pm
+++ b/lib/Sbuild/ConfBase.pm
@@ -502,7 +502,12 @@ sub read ($$$$) {
        next if $conf->_get_group($key) =~ m/^__/;
 
        my $varname = $conf->_get_varname($key);
-       $script .= "my \$$varname = undef;\n";
+        my $vardefault = $conf->_get_default($key);
+        if (defined $vardefault) {
+           $script .= "my " . Data::Dumper->Dump([$vardefault], [$varname]);
+        } else {
+            $script .= "my \$$varname = undef;\n";
+        }
     }
 
     # For compatibility only.  Non-scalars are deprecated.

But also stated:

> I would bet a lot on this breaking something. The problem are
> settings which have a GET function which is allowed to perform
> some magic. The GET function is called if the value behind a
> setting is requested but the user has set it to undef in their
> ~/.sbuildrc. If all values that have defaults are now set, then
> the GET function is not called anymore which I guess can have
> undesired consequences in some cases? Can you try this patch and
> see what happens?

Chris

Reply via email to