[elbe-devel] [PATCH v2 03/22] elbexml: add initvm parameter to create_apt_sources_list()
Torben Hohn
torben.hohn at linutronix.de
Tue Jul 2 12:55:25 CEST 2019
prepare create_apt_sources_list() to be used outside the initvm.
This requires, that LOCALMACHINE is replaced with "localhost" instead
of 10.0.2.2
Add replace_localmachine() function, and use it in
get_primary_mirror() and create_apt_sources_list()
there are more occurences of the LOCALMACHINE replace, but i currently
only need create_apt_sources_list()
Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
elbepack/elbexml.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/elbepack/elbexml.py b/elbepack/elbexml.py
index a5a4af90e..ce3371c2a 100644
--- a/elbepack/elbexml.py
+++ b/elbepack/elbexml.py
@@ -49,6 +49,14 @@ class ValidationMode(object):
CHECK_BINARIES = 2
CHECK_ALL = 0
+def replace_localmachine(mirror, initvm=True):
+ if initvm:
+ localmachine = "10.0.0.2"
+ else:
+ localmachine = "localhost"
+
+ return mirror.replace("LOCALMACHINE", localmachine)
+
class ElbeXML(object):
@@ -119,7 +127,7 @@ class ElbeXML(object):
return mirror.replace("LOCALMACHINE", "10.0.2.2")
- def get_primary_mirror(self, cdrompath):
+ def get_primary_mirror(self, cdrompath, initvm=True):
if self.prj.has("mirror/primary_host"):
m = self.prj.node("mirror")
@@ -130,10 +138,10 @@ class ElbeXML(object):
elif self.prj.has("mirror/cdrom") and cdrompath:
mirror = "file://%s" % cdrompath
- return mirror.replace("LOCALMACHINE", "10.0.2.2")
+ return replace_localmachine(mirror, initvm)
# XXX: maybe add cdrom path param ?
- def create_apt_sources_list(self, build_sources=False):
+ def create_apt_sources_list(self, build_sources=False, initvm=True):
if self.prj is None:
return "# No Project"
@@ -166,7 +174,7 @@ class ElbeXML(object):
mirror += "deb copy:///cdrom/targetrepo %s main added\n" % (
self.prj.text("suite"))
- return mirror.replace("LOCALMACHINE", "10.0.2.2")
+ return replace_localmachine(mirror, initvm)
def validate_repo(self, r):
try:
--
2.11.0
More information about the elbe-devel
mailing list