[elbe-devel] [PATCH v2 05/12] fetch_initvm_pkgs: final touches on cdrom build

Torben Hohn torben.hohn at linutronix.de
Mon Nov 12 17:43:06 CET 2018


Check for cdrom build, and only create the initvm Source Repo and
archive dir, but dont try adding source pkgs. They are not available
anyways.

the cdrom build is now triggered using the --cdrom-mount-path option,
since the source.xml found in /var/cache/elbe/source.xml does not
carry the modified cdrom mirror section.

When preseed_late is running, the cdrom is not mounted anymore.
mounting the cdrom from init-elbe.sh does not work because the
in-target command cleans up mounts, that happened in the target.

Add --cdrom-device option, so that "elbe buildrepo" can issue the mount
command itself. Also rename opt.cdrom to opt.cdrom_path to avoid
confusion.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
Signed-off-by: Manuel Traut <manut at linutronix.de>
Reviewed-by: Manuel Traut <manut at linutronix.de>
---
 elbepack/commands/fetch_initvm_pkgs.py | 28 ++++++++++++++++++++++++++--
 1 file changed, 26 insertions(+), 2 deletions(-)

diff --git a/elbepack/commands/fetch_initvm_pkgs.py b/elbepack/commands/fetch_initvm_pkgs.py
index edc1805e..4ca41de1 100644
--- a/elbepack/commands/fetch_initvm_pkgs.py
+++ b/elbepack/commands/fetch_initvm_pkgs.py
@@ -36,9 +36,12 @@ def run_command(argv):
                        dest="skip_validation", default=False,
                        help="Skip xml schema validation")
 
-    oparser.add_option("--cdrom-mount-path", dest="cdrom",
+    oparser.add_option("--cdrom-mount-path", dest="cdrom_path",
                        help="path where cdrom is mounted")
 
+    oparser.add_option("--cdrom-device", dest="cdrom_device",
+                       help="cdrom device, in case it has to be mounted")
+
     oparser.add_option("--apt-archive", dest="archive",
                        default="/var/cache/elbe/binaries/main",
                        help="path where binary packages are downloaded to.")
@@ -62,12 +65,24 @@ def run_command(argv):
         sys.exit(20)
 
     log = StdoutLog()
-    mirror = xml.get_initvm_primary_mirror(opt.cdrom)
+
+    if opt.cdrom_path:
+        if opt.cdrom_device:
+            log.do('mount "%s" "%s"' % (opt.cdrom_device, opt.cdrom_path))
+
+        # a cdrom build is identified by the cdrom option
+        # the xml file that is copied into the initvm
+        # by the initrd does not have the cdrom tags setup.
+        mirror = "file://%s" % opt.cdrom_path
+    else:
+        mirror = xml.get_initvm_primary_mirror(opt.cdrom_path)
+
     init_codename = xml.get_initvm_codename()
 
     # Binary Repo
     #
     repo = CdromInitRepo(init_codename, opt.binrepo, log, 0, mirror)
+
     hostfs.mkdir_p(opt.archive)
 
     pkglist = get_initvm_pkglist()
@@ -104,6 +119,15 @@ def run_command(argv):
     repo = CdromSrcRepo(init_codename, init_codename, opt.srcrepo, log, 0, mirror)
     hostfs.mkdir_p(opt.srcarchive)
 
+    # a cdrom build does not have sources
+    # skip adding packages to the source repo
+    #
+    # FIXME: we need a way to add source cdroms later on
+    if opt.cdrom_path:
+        if opt.cdrom_device:
+            log.do('umount "%s"' % opt.cdrom_device)
+        sys.exit(0)
+
     for pkg in pkglist:
         try:
             p = cache[pkg.name]
-- 
2.11.0




More information about the elbe-devel mailing list