cbuild: Run gpg with a home directy in the tmpdir
PATCH 1/1 cbuild: Run gpg with a home directy in the tmpdir
From: Jason Gunthorpe <[email protected]>
To avoid interaction with the user's gpg home directory.
Signed-off-by Jason Gunthorpe <[email protected]>
Signed-off-by Leon Romanovsky <[email protected]>
--- buildlib/cbuild | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
buildlib/cbuild +5 -3
@@ -221,13 +221,15 @@ class APTEnvironment(Environment): # key for the toolchain ppa. Fetch it in the host and just import the # gpg data directly into the trusted keyring. kb = os.path.join(tmpdir,"%s.kb.gpg"%(keyid)); - subprocess.check_call(["gpg","--no-default-keyring","--keyring",kb,"--always-trust", - "--recv-key",keyid]); + env = {k:v for k,v in os.environ.items()}; + env["HOME"] = tmpdir; + subprocess.check_call(["gpg","--keyserver", "keyserver.ubuntu.com", "--no-default-keyring","--keyring",kb,"--always-trust", + "--recv-key",keyid],env=env); kr = os.path.join(gpgd,"%s.gpg"%(keyid)); with open(kr,"wb") as F: F.write(subprocess.check_output(["gpg","--no-default-keyring", "--keyring",kb, - "--export",keyid])); + "--export",keyid],env=env)); os.unlink(kb); self.add_source_list(tmpdir,keyid + ".list",srcline);
Signature · 1 line
2.20.1