[elbe-devel] [PATCH v2 2/2] gpg: use env_add to set GNUPGHOME where gpg is called via log.do()
Torben Hohn
torben.hohn at linutronix.de
Thu Apr 4 12:44:59 CEST 2019
gpg is called indirectly via reprepro or directly. all the time through
log.do() and it always uses the process wide environment.
Stop that, and pass GNUPGPHOME via env_add.
Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
elbepack/finetuning.py | 5 +++--
elbepack/repomanager.py | 11 ++++++-----
2 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/elbepack/finetuning.py b/elbepack/finetuning.py
index aeaa7399..97342862 100644
--- a/elbepack/finetuning.py
+++ b/elbepack/finetuning.py
@@ -436,8 +436,9 @@ class UpdatedAction(FinetuningAction):
target.mkdir_p("/var/cache/elbe/gnupg", mode=0o700)
with target:
- os.environ['GNUPGHOME'] = target.path + "/var/cache/elbe/gnupg"
- log.do("gpg --import " + target.path + "/pub.key")
+ env_add = {'GNUPGHOME': target.path + "/var/cache/elbe/gnupg"}
+ log.do("gpg --import " + target.path + "/pub.key",
+ env_add=env_add)
log.printo("generate base repo")
arch = target.xml.text("project/arch", key="arch")
diff --git a/elbepack/repomanager.py b/elbepack/repomanager.py
index 8898d4d2..a1b4f500 100644
--- a/elbepack/repomanager.py
+++ b/elbepack/repomanager.py
@@ -179,13 +179,13 @@ class RepoBase(object):
env_add={'GNUPGHOME': "/var/cache/elbe/gnupg"})
def finalize(self):
- os.environ['GNUPGHOME'] = "/var/cache/elbe/gnupg"
for att in self.attrs:
self.log.do(
'reprepro --basedir "' +
self.fs.path +
'" export ' +
- att.codename)
+ att.codename,
+ env_add={'GNUPGHOME': '/var/cache/elbe/gnupg'})
def _includedeb(self, path, codename, component):
if self.maxsize:
@@ -232,7 +232,8 @@ class RepoBase(object):
def _removedeb(self, pkgname, codename):
self.log.do(
"reprepro --basedir %s remove %s %s" %
- (self.fs.path, codename, pkgname))
+ (self.fs.path, codename, pkgname),
+ env_add={'GNUPGHOME': '/var/cache/elbe/gnupg'})
def removedeb(self, pkgname, component="main"):
self._removedeb(pkgname, self.repo_attr.codename)
@@ -240,7 +241,8 @@ class RepoBase(object):
def _removesrc(self, srcname, codename):
self.log.do(
"reprepro --basedir %s removesrc %s %s" %
- (self.fs.path, codename, srcname))
+ (self.fs.path, codename, srcname),
+ env_add={'GNUPGHOME': '/var/cache/elbe/gnupg'})
def removesrc(self, path, component="main"):
for p in Deb822.iter_paragraphs(file(path)):
@@ -248,7 +250,6 @@ class RepoBase(object):
self._removesrc(p['Source'], self.repo_attr.codename)
def _remove(self, path, codename, component):
- os.environ['GNUPGHOME'] = "/var/cache/elbe/gnupg"
for p in Deb822.iter_paragraphs(file(path)):
if 'Source' in p:
self._removesrc(p['Source'], codename)
--
2.11.0
More information about the elbe-devel
mailing list