Bug#898356: git-buildpackage: Multiple --git-pbuilder-options do not stack

2018-05-17 Thread Guido Günther
On Thu, May 17, 2018 at 10:34:30PM +0200, Matthijs Kooijman wrote:
> Hi Guido,
> 
> >   --git-pbuilder-options-append="option1" 
> > --git-pbuilder-options-append="option2"
> > 
> > so you can decide on a per option basis if you want to append to the
> > currently set value. Each "--git-pbuilder-options" would reset the whole
> > thing and start over so:
> > 
> >   --git-pbuilder-options="foo" --git-pbuilder-options-append="option1" 
> > --git-pbuilder-options-append="option2"
> Ah, that is *exactly* what I meant. I just named the options differently
> and apparently failed to express my intent. Thanks for providing some
> clarifying examples :-)

...now we need patches to make this reality ;)
 -- Guido



Bug#898356: git-buildpackage: Multiple --git-pbuilder-options do not stack

2018-05-17 Thread Matthijs Kooijman
Hi Guido,

>   --git-pbuilder-options-append="option1" 
> --git-pbuilder-options-append="option2"
> 
> so you can decide on a per option basis if you want to append to the
> currently set value. Each "--git-pbuilder-options" would reset the whole
> thing and start over so:
> 
>   --git-pbuilder-options="foo" --git-pbuilder-options-append="option1" 
> --git-pbuilder-options-append="option2"
Ah, that is *exactly* what I meant. I just named the options differently
and apparently failed to express my intent. Thanks for providing some
clarifying examples :-)

Gr.

Matthijs


signature.asc
Description: PGP signature


Bug#898356: git-buildpackage: Multiple --git-pbuilder-options do not stack

2018-05-17 Thread Guido Günther
On Thu, May 17, 2018 at 07:47:58PM +0200, Matthijs Kooijman wrote:
> Hi Guido,
> 
> > > My suggestion of adding a --git-append-pbuilder-option could solve both
> > > usecases:
> > >  - you can use --git-pbuilder-options on the commandline to override all
> > >previously set options, including in gbp.conf
> > >  - you can use --git-append-pbuilder-option to extend any previously set
> > >options.
> > 
> > You would also need to define how option stack over the various gbp.conf
> > files. I don't think we want to go down that road.
> Hm? But isn't there some order defined already? Currently each time the
> option is given it overrides the previous value, so that is similarly
> dependent on the parse order (perhaps even more, since when you only use
> append, the order is irrelevant). Or am I misunderstanding what you mean
> by "stack"?

A --git-append-pbuilder-options would concatenate all options from all
config files and command line then? This would eliminate the usual
overriding of gbp.conf's. That IMHO makes not sense. What would make
sense is:

  --git-pbuilder-options-append="option1" 
--git-pbuilder-options-append="option2"

so you can decide on a per option basis if you want to append to the
currently set value. Each "--git-pbuilder-options" would reset the whole
thing and start over so:

  --git-pbuilder-options="foo" --git-pbuilder-options-append="option1" 
--git-pbuilder-options-append="option2"

would give

  "foo option1 option2"

where as

  --git-pbuilder-options="foo" --git-pbuilder-options-append="option1" 
--git-pbuilder-options-append="option2" \
  --git-pbuilder-options="bar" --git-pbuilder-options-append="option3"

would give

  "bar option3"

This would also work or gbp.conf. This would have clear overwrite
semantics on the command line and gbp.conf.
 -- Guido



Bug#898356: git-buildpackage: Multiple --git-pbuilder-options do not stack

2018-05-17 Thread Matthijs Kooijman
Hi Guido,

> > My suggestion of adding a --git-append-pbuilder-option could solve both
> > usecases:
> >  - you can use --git-pbuilder-options on the commandline to override all
> >previously set options, including in gbp.conf
> >  - you can use --git-append-pbuilder-option to extend any previously set
> >options.
> 
> You would also need to define how option stack over the various gbp.conf
> files. I don't think we want to go down that road.
Hm? But isn't there some order defined already? Currently each time the
option is given it overrides the previous value, so that is similarly
dependent on the parse order (perhaps even more, since when you only use
append, the order is irrelevant). Or am I misunderstanding what you mean
by "stack"?

Gr.

Matthijs


signature.asc
Description: PGP signature


Bug#898356: git-buildpackage: Multiple --git-pbuilder-options do not stack

2018-05-10 Thread Guido Günther
On Thu, May 10, 2018 at 10:53:47PM +0200, Matthijs Kooijman wrote:
> Hi Guido,
> 
> > > When passing multiple options on the commandline, this is (for me)
> > > unexpected but easily fixed by passing all needed options into a single
> > > --git-pbuilder-options, but when a gbp.conf file also uses
> > > "pbuilder-options", these are also overriden by the commandline, which
> > > is harder to fix (which needs copying the options from the config file
> > > to the commandline).
> >
> > This in fact is intended since otherwise there'd be now way to override
> > what's in gbp.conf (or rather in the several gbp.conf's parsed).
> So you're suggesting to let multiple commandline options stack, but let
> any commandline options override the config file option? That would seem
> a bit confusing to me. Also, that would not allow using the commandline
> to add additional options.
> 
> My suggestion of adding a --git-append-pbuilder-option could solve both
> usecases:
>  - you can use --git-pbuilder-options on the commandline to override all
>previously set options, including in gbp.conf
>  - you can use --git-append-pbuilder-option to extend any previously set
>options.

You would also need to define how option stack over the various gbp.conf
files. I don't think we want to go down that road.
 -- Guido

> At the same time, it would also keep backward compatibility as a bonus.
> 
> (I used a singular, perhaps --git-append-pbuilder-options makes more
> sense, though I guess that depends on whether argument splitting is
> applied or not)
> 
> > There are several levels of quiting going on, gbp itself does not do
> > much but git-pbuilder and pbuilder do.
> Good call. I did a bit of digging, turns out it is cowbuilder that
> messes up, so this is entirely unrelated to this bug report. See
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=898366
> 
> Gr.
> 
> Matthijs



Bug#898356: git-buildpackage: Multiple --git-pbuilder-options do not stack

2018-05-10 Thread Matthijs Kooijman
Hi Guido,

> > When passing multiple options on the commandline, this is (for me)
> > unexpected but easily fixed by passing all needed options into a single
> > --git-pbuilder-options, but when a gbp.conf file also uses
> > "pbuilder-options", these are also overriden by the commandline, which
> > is harder to fix (which needs copying the options from the config file
> > to the commandline).
>
> This in fact is intended since otherwise there'd be now way to override
> what's in gbp.conf (or rather in the several gbp.conf's parsed).
So you're suggesting to let multiple commandline options stack, but let
any commandline options override the config file option? That would seem
a bit confusing to me. Also, that would not allow using the commandline
to add additional options.

My suggestion of adding a --git-append-pbuilder-option could solve both
usecases:
 - you can use --git-pbuilder-options on the commandline to override all
   previously set options, including in gbp.conf
 - you can use --git-append-pbuilder-option to extend any previously set
   options.

At the same time, it would also keep backward compatibility as a bonus.

(I used a singular, perhaps --git-append-pbuilder-options makes more
sense, though I guess that depends on whether argument splitting is
applied or not)

> There are several levels of quiting going on, gbp itself does not do
> much but git-pbuilder and pbuilder do.
Good call. I did a bit of digging, turns out it is cowbuilder that
messes up, so this is entirely unrelated to this bug report. See
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=898366

Gr.

Matthijs


signature.asc
Description: PGP signature


Bug#898356: git-buildpackage: Multiple --git-pbuilder-options do not stack

2018-05-10 Thread Guido Günther
On Thu, May 10, 2018 at 09:29:57PM +0200, Matthijs Kooijman wrote:
> Hi Guido,
> 
> I noticed one more related thing, also possibly a bug. It seems that the
> arguments to --git-pbuilder-options are further processed. I tried
> running this command:
> 
> gbp buildpackage --git-pbuilder-options=--extrapackage=/foo/a.deb\ 
> --extrapackage=/foo/b.deb\ --bindmounts=/foo
> 
> Which resulted in this pbuilder command:
> 
> I: forking: pbuilder build --debbuildopts  --debbuildopts
>   --bindmounts /foo --buildplace /var/cache/pbuilder/build/cow.31796 
> --buildresult /tmp
>   --extrapackages /foo/b.deb --no-targz --internal-chrootexec
>   'chroot /var/cache/pbuilder/build/cow.31796 cow-shell'
>   /tmp/openttd-opengfx_0.5.4-2.dsc
> 
> 
> Interesting is that the --bindmounts and --extrapackages are no longer
> adjacent, and that only the second --extrapackages is present. This
> behaviour is even more surprising to me, and I'd think this would
> certainly constitute a bug (at least the latter).

There are several levels of quiting going on, gbp itself does not do
much but git-pbuilder and pbuilder do. You can set GIT_PBUILDER_DEBUG
env var to see how git-pbuilder passes arguments to pbuilder. Only then
can you tell who mixed up the arguments.
Cheers,
 -- Guido



Bug#898356: git-buildpackage: Multiple --git-pbuilder-options do not stack

2018-05-10 Thread Matthijs Kooijman
Hi Guido,

I noticed one more related thing, also possibly a bug. It seems that the
arguments to --git-pbuilder-options are further processed. I tried
running this command:

gbp buildpackage --git-pbuilder-options=--extrapackage=/foo/a.deb\ 
--extrapackage=/foo/b.deb\ --bindmounts=/foo

Which resulted in this pbuilder command:

I: forking: pbuilder build --debbuildopts  --debbuildopts
  --bindmounts /foo --buildplace /var/cache/pbuilder/build/cow.31796 
--buildresult /tmp
  --extrapackages /foo/b.deb --no-targz --internal-chrootexec
  'chroot /var/cache/pbuilder/build/cow.31796 cow-shell'
  /tmp/openttd-opengfx_0.5.4-2.dsc


Interesting is that the --bindmounts and --extrapackages are no longer
adjacent, and that only the second --extrapackages is present. This
behaviour is even more surprising to me, and I'd think this would
certainly constitute a bug (at least the latter).

Gr.

Matthijs


signature.asc
Description: PGP signature


Bug#898356: git-buildpackage: Multiple --git-pbuilder-options do not stack

2018-05-10 Thread Guido Günther
control: severity -1 wishlist

Hi Matthijs,
On Thu, May 10, 2018 at 08:06:58PM +0200, Matthijs Kooijman wrote:
> Package: git-buildpackage
> Version: 0.9.8
> Severity: normal
> 
> Hi Guido,
> 
> I was using the --git-pbuilder-options option to gbp-buildpackage today,
> and was surprised that multiple options do not stack. Instead, each
> --git-pbuilder-options passed overrides the previous one, so only the
> last one is effective.

Yes that's the current behaviour. I agree that having all --git-pbuilder
option appended and not overwritten would be nicer. I wouldn't worry
about backward compatibility here.

> 
> When passing multiple options on the commandline, this is (for me)
> unexpected but easily fixed by passing all needed options into a single
> --git-pbuilder-options, but when a gbp.conf file also uses
> "pbuilder-options", these are also overriden by the commandline, which
> is harder to fix (which needs copying the options from the config file
> to the commandline).

This in fact is intended since otherwise there'd be now way to override
what's in gbp.conf (or rather in the several gbp.conf's parsed).

Cheers,
 -- Guido



Bug#898356: git-buildpackage: Multiple --git-pbuilder-options do not stack

2018-05-10 Thread Matthijs Kooijman
Package: git-buildpackage
Version: 0.9.8
Severity: normal

Hi Guido,

I was using the --git-pbuilder-options option to gbp-buildpackage today,
and was surprised that multiple options do not stack. Instead, each
--git-pbuilder-options passed overrides the previous one, so only the
last one is effective.

When passing multiple options on the commandline, this is (for me)
unexpected but easily fixed by passing all needed options into a single
--git-pbuilder-options, but when a gbp.conf file also uses
"pbuilder-options", these are also overriden by the commandline, which
is harder to fix (which needs copying the options from the config file
to the commandline).

I'm not sure if this is really a bug, or more a feature request (since
it probably works as intended, except that that isn't quite ideal).

Ideally, multiple --git-pbuilder-options options would just be appended,
though I'm not sure if anyone would rely on the old behaviour. A
possible fix would be to add a --git-append-pbuilder-option flag, which
adds it argument to the value of --git-pbuilder-options.

Gr.

Matthijs