#869506 git-pbuilder: Please don't drop environment variables

#869506#5
Date:
2017-07-23 19:00:53 UTC
From:
To:
Hi,

Since version 0.8.17, git-pbuilder now unsets environment variables
DIST, BUILDER and ARCH (commit 021fe9d).

IMHO this is very wrong, since it's now impossible to pass DIST or ARCH
to pbuilder when it's supposed to rely on ~/.pbuilderrc to analyze those
environment variables to set BASETGZ and the like (which is supposed to
work since git-pbuilder provides a GIT_PBUILDER_AUTOCONF environment
variable precisely for this purpose).

If you really don't want to revert commit 021fe9d, please at least run
the unset_env function only when GIT_PBUILDER_AUTOCONF isn't set to "no".

That being said, maybe my workflow is completely broken.

Basically, here's what it does:

My ~/.gbp.conf has the "builder" option set to:

BUILDER=pbuilder GIT_PBUILDER_AUTOCONF=no /usr/bin/git-pbuilder

...and my ~/.pbuilderrc basically takes DIST and ARCH from the
environment, tries to guess DIST from the changelog if it's not defined,
and sets them to the host's values in last resort.

I really don't think this type of configuration is uncommon, since it's
heavily based on what you can find on Debian and Ubuntu wikis:

https://wiki.debian.org/PbuilderTricks#How_to_build_for_different_distributions
https://wiki.ubuntu.com/PbuilderHowto#Multiple_pbuilders

If you think there's something wrong in this workflow, or if there is a
way to create a ~/.pbuilderrc which would work for both plain pbuilder
(or pdebuild) and gbp with its new behavior, please let me know.

Regards,

#869506#10
Date:
2017-07-23 20:34:03 UTC
From:
To:
Hi,

I think this is a valid use case.

All of this was prompted by

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=865637

so not cleaning e.g. DIST and ARCH breaks builds and generic names like
this really shouldn't end up in the process's environment. We don't
clean things like

    GIT_PBUILDER_*

(see https://github.com/agx/git-buildpackage/blob/master/gbp/scripts/buildpackage.py#L488)
so all we'd need to do is teach pbuilder to read DIST, ARCH and BUILDER
with a GIT_PBUILDER_ prefix as well. What do you think? A patch would be
welcome.
Cheers,
 -- Guido

#869506#15
Date:
2017-07-23 21:43:02 UTC
From:
To:
Le 23/07/2017 à 22:34, Guido Günther a écrit :

After reading all of those links, I'm all the more convinced that
cleaning the environment should be pbuilder's job, and not gbp's. All
environment variables given by the user should be passed on to pbuilder
as-is, since the latter needs them to properly set its directories (I
guess most people follow one of those wikis when they install pbuilder
for the first time), but if a clean environment must be passed to the
chroot, IMHO it would be pbuilder's responsibility to do that.

Regards,

#869506#20
Date:
2017-08-11 13:45:54 UTC
From:
To:
Hi,

Russ, do you have an opinion on this one. The generic variable names are
imho calling for trouble (although they're very convenient to type). We
could still accept them in git-pbuilder but only pass on GIT_PBUILDER_
prefixed ones.
Only cleaning out these three variables in pbuilder itself looks special
cased either.

Cheers,
 -- Guido

#869506#25
Date:
2017-09-17 22:08:53 UTC
From:
To:
Guido Günther <agx@sigxcpu.org> writes:

The original thought process for the DIST and ARCH environment variables
was that there was otherwise no way to configure this from the command
line, and I wanted something short and easy to type.

Now that git-pbuilder has been more thoroughly integrated into
git-buildpackage and the --git-dist and --git-arch flags exist, I think it
makes a lot of sense to namespace these environment variables under
GIT_PBUILDER_ and stop using the very generic names that may get in the
way of other software.

There's a transition for people who are used to typing DIST=stable gbp
buildpackage instead of gbp buildpackage --git-dist=stable, but a note in
NEWS.Debian is probably sufficient.