[elbe-devel] [PATCH 00/20] dont set os.environ variables anymore

Torben Hohn torben.hohn at linutronix.de
Fri Oct 12 11:27:46 CEST 2018


Setting variables in os.environ is visible process wide.
This poses a risk of race conditions, when more than
one elbe build is running at once. And also posed problems
in the past, when proxy settings of earlier builds affected
later builds.

This patchqueue starts with patches, that allow passing
environment variables to the child processes we start.

Then the places where environment variables are used
are fixed. There are 3 usages:

1. GNUPGHOME setup (for gpgme and indirect for reprepro)
2. http proxy setup
3. debconf frontend setup

its ok to write the environment at process startup.
So we do that for RPCAptCache, but make that clearer.
And also for the directories module.

Last but not least, the proxy setup is consolidated into
a single place. 

This patchqueue has the Potential of breaking builds using proxies.
I plan to implement an "internet only via proxy" test into
the test-system, so that we can catch errors here.

Torben Hohn (20):
  shellhelper: add env_add parameter to allow setting environment
  shellhelper: add env_add keyword arg to shellhelper.system()
  asciidoclog: add env_add parameter to LogBase.do()
  asciidoclog: remove **args from LogBase.chroot()
  asciidoclog: instead of messing with os.environ in chroot(), use
    do(env_add=)
  asciidoclog: add env_add keyword parameter to LogBase.chroot()
  commands chroot: use env_add parameter instead of messing with
    os.environ
  directories: add comment to state why setting envvars is ok at that
    point
  rpcaptcache: set os.environ upon manager process startup
  rpcaptcache: fix typo DEBONF -> DEBCONF
  rpcaptcache: move setup of envvars from RPCAptCache into
    MyMan.setup_env()
  gpg: use set_engine_info to setup GNUPGHOME
  gpg: use env_add to set GNUPGHOME where gpg is called via log.do()
  elbexml: use urllib2.ProxyHandler() instead of environment variables
  debinstaller: move LOCALMACHINE replacement into get_primary_mirror()
  debinstaller elbexml: refactor proxy handling and urlopener
  elbexml: remove unused "import os"
  elbexml: make ElbeXML.validate_repo() a staticmethod
  rfs: use env_add feature in BuildEnv.debootstrap()
  rfs: use get_proxy_dict() for proxy_env variables

 elbepack/asciidoclog.py     |  18 ++++----
 elbepack/commands/chroot.py |  18 ++++----
 elbepack/commands/init.py   |  24 ++++-------
 elbepack/debinstaller.py    | 100 +++++++++++++++++++++++++++++++++++++-------
 elbepack/directories.py     |   3 ++
 elbepack/efilesystem.py     |   4 --
 elbepack/elbexml.py         |  44 ++++---------------
 elbepack/finetuning.py      |  17 +++++---
 elbepack/gpg.py             |  20 ++++++---
 elbepack/repomanager.py     |  17 ++++----
 elbepack/rfs.py             |  35 +++++++---------
 elbepack/rpcaptcache.py     |  18 ++++++--
 elbepack/shellhelper.py     |  42 +++++++++++++------
 13 files changed, 225 insertions(+), 135 deletions(-)

-- 
2.11.0




More information about the elbe-devel mailing list