[elbe-devel] [PATCH 1/3] pbuilder: split mirror_script_add_key() so that it accepts raw-key
Torben Hohn
torben.hohn at linutronix.de
Tue Jun 18 13:47:27 CEST 2019
prepare to handle <raw-key> tag, and create mirror_script_add_key_text()
which accepts the key as a string.
Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
elbepack/pbuilder.py | 18 +++++++++++-------
1 file changed, 11 insertions(+), 7 deletions(-)
diff --git a/elbepack/pbuilder.py b/elbepack/pbuilder.py
index c1f3a5efc..04684f11e 100644
--- a/elbepack/pbuilder.py
+++ b/elbepack/pbuilder.py
@@ -84,12 +84,7 @@ def pbuilder_write_apt_conf(builddir, xml):
fp.close()
-def mirror_script_add_key(mirror, key_url):
- key_url = key_url.replace("LOCALMACHINE", "10.0.2.2")
- key_conn = urllib2.urlopen(key_url, None, 10)
- key_text = key_conn.read()
- key_conn.close()
-
+def mirror_script_add_key_text(mirror, key_text):
mirror += "cat << EOF | apt-key add -\n"
mirror += key_text + "\n"
mirror += "EOF\n"
@@ -97,6 +92,15 @@ def mirror_script_add_key(mirror, key_url):
return mirror
+def mirror_script_add_key_url(mirror, key_url):
+ key_url = key_url.replace("LOCALMACHINE", "10.0.2.2")
+ key_conn = urllib2.urlopen(key_url, None, 10)
+ key_text = key_conn.read()
+ key_conn.close()
+
+ return mirror_script_add_key_text(mirror, key_text)
+
+
def pbuilder_write_repo_hook(builddir, xml):
pbuilder_hook_dir = os.path.join(builddir, "pbuilder", "hooks.d")
@@ -117,7 +121,7 @@ def pbuilder_write_repo_hook(builddir, xml):
mirror += 'echo "deb http://127.0.0.1:8080' + builddir + '/repo ' + \
xml.prj.text("suite") + ' main" > /etc/apt/sources.list\n'
- mirror = mirror_script_add_key(
+ mirror = mirror_script_add_key_url(
mirror,
'http://127.0.0.1:8080' +
builddir +
--
2.11.0
More information about the elbe-devel
mailing list