[elbe-devel] [PATCH 3/3] init/initvm: add --ignore-pinning option

Manuel Traut manut at linutronix.de
Fri Sep 14 15:06:25 CEST 2018


If cd2aptly was used to generate a single repository containing all
packages, 'elbe init' needs to ignore the pinning (as done by
rebuilding from cdrom). Therefore a new parameter is added, that is
also enabled if --cdrom was given. Use this parameter in the makofile
instead of the heuristics on the XML file.

Signed-off-by: Manuel Traut <manut at linutronix.de>
---
 elbepack/commands/init.py      | 8 ++++++++
 elbepack/commands/initvm.py    | 4 ++++
 elbepack/init/preseed.cfg.mako | 2 +-
 elbepack/initvmaction.py       | 3 +++
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/elbepack/commands/init.py b/elbepack/commands/init.py
index 140d9e18..1fcd72dc 100644
--- a/elbepack/commands/init.py
+++ b/elbepack/commands/init.py
@@ -45,6 +45,13 @@ def run_command(argv):
         help="Use FILE as cdrom iso, and use that to build the initvm",
         metavar="FILE")
 
+    oparser.add_option(
+        "--ignore-pinning",
+        action="store_true",
+        dest="ignore_pinning",
+        default=False,
+        help="ignore pinning (this is automatically set if --cdrom is given")
+
     oparser.add_option("--proxy", dest="proxy",
                        help="Override the http Proxy")
 
@@ -126,6 +133,7 @@ def run_command(argv):
         mirror.clear()
         cdrom = mirror.ensure_child("cdrom")
         cdrom.set_text(os.path.abspath(opt.cdrom))
+        opt.ignore_pinning = True
 
     if not opt.directory:
         path = "./build"
diff --git a/elbepack/commands/initvm.py b/elbepack/commands/initvm.py
index c85d8a79..c436be3b 100644
--- a/elbepack/commands/initvm.py
+++ b/elbepack/commands/initvm.py
@@ -25,6 +25,10 @@ def run_command(argv):
     oparser.add_option("--cdrom", dest="cdrom", default=None,
                        help="iso image of Binary cdrom")
 
+    oparser.add_option("--ignore-pinning", dest="ignore_pinning",
+                       action="store_true", default=False,
+                       help="ignore pinning that might be used in the XML")
+
     oparser.add_option(
         "--devel",
         action="store_true",
diff --git a/elbepack/init/preseed.cfg.mako b/elbepack/init/preseed.cfg.mako
index 052be882..f13b107b 100644
--- a/elbepack/init/preseed.cfg.mako
+++ b/elbepack/init/preseed.cfg.mako
@@ -126,7 +126,7 @@ apt-mirror-setup apt-setup/use_mirror boolean false
 
         # for a cdrom build, the pkgrel is reset to None because the
         # cdrom does not have the release information anymore
-        if not prj.has("mirror/primary_host") and prj.node("mirror/cdrom"):
+        if opt.ignore_pinning:
             pkgrel = None
 
         if pkgrel is None:
diff --git a/elbepack/initvmaction.py b/elbepack/initvmaction.py
index f7526cb6..9da1e724 100644
--- a/elbepack/initvmaction.py
+++ b/elbepack/initvmaction.py
@@ -502,6 +502,9 @@ class CreateAction(InitVMAction):
             if opt.nesting:
                 init_opts += ' --nesting'
 
+            if opt.ignore_pinning:
+                init_opts += ' --ignore-pinning'
+
             if cdrom:
                 system('%s init %s --directory "%s" --cdrom "%s" "%s"' %
                        (elbe_exe, init_opts, initvmdir, cdrom, xmlfile))
-- 
2.19.0.rc2




More information about the elbe-devel mailing list