[elbe-devel] [PATCH 3/3] elbeproject: cope with incremental build without initvm node

Torben Hohn torben.hohn at linutronix.de
Tue Jul 21 14:46:13 CEST 2020


When elbe control set_xml is used for incremental builds,
it chokes on the missing initvm node, which is expected when
there is already a buildenv.

Isolate the copy_initvmnode() code, and fall back to that, when
no initvmnode exists in the incremental build code path.

There still remains a problem with missing debootstrap packages.
But this will actually make elbe-ci test this codepath.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/elbeproject.py | 42 +++++++++++++++++++++++------------------
 1 file changed, 24 insertions(+), 18 deletions(-)

diff --git a/elbepack/elbeproject.py b/elbepack/elbeproject.py
index 725942838..122399cd2 100644
--- a/elbepack/elbeproject.py
+++ b/elbepack/elbeproject.py
@@ -962,6 +962,24 @@ class ElbeProject (object):
                      "Report timestamp: %s", self.name,
                      datetime.datetime.now().strftime("%Y%m%d-%H%M%S"))
 
+    def copy_initvmnode(self):
+        source = self.xml
+        source_path = "/var/cache/elbe/source.xml"
+        try:
+            initxml = ElbeXML(source_path,
+                              skip_validate=self.skip_validate,
+                              url_validation=ValidationMode.NO_CHECK)
+            self.xml.get_initvmnode_from(initxml)
+        except ValidationError:
+            logging.exception("%s validation failed.  "
+                              "Will not copy initvm node", source_path)
+        except IOError:
+            logging.exception("%s not available.  "
+                              "Can not copy initvm node", source_path)
+        except NoInitvmNode:
+            logging.exception("%s is available.  But it does not "
+                              "contain an initvm node", source_path)
+
     def install_packages(self, target, buildenv=False):
 
         # pylint: disable=too-many-statements
@@ -981,22 +999,8 @@ class ElbeProject (object):
                                          self.get_rpcaptcache(env=target))
                     dump_initvmpkgs(self.xml)
                 target.need_dumpdebootstrap = False
-                source = self.xml
-                source_path = "/var/cache/elbe/source.xml"
-                try:
-                    initxml = ElbeXML(source_path,
-                                      skip_validate=self.skip_validate,
-                                      url_validation=ValidationMode.NO_CHECK)
-                    self.xml.get_initvmnode_from(initxml)
-                except ValidationError:
-                    logging.exception("%s validation failed.  "
-                                      "Will not copy initvm node", source_path)
-                except IOError:
-                    logging.exception("%s not available.  "
-                                      "Can not copy initvm node", source_path)
-                except NoInitvmNode:
-                    logging.exception("%s is available.  But it does not "
-                                      "contain an initvm node", source_path)
+
+                self.copy_initvmnode()
             else:
                 sourcepath = os.path.join(self.builddir, "source.xml")
                 source = ElbeXML(sourcepath,
@@ -1008,8 +1012,10 @@ class ElbeProject (object):
                 try:
                     self.xml.get_initvmnode_from(source)
                 except NoInitvmNode:
-                    logging.exception("source.xml is available.  "
-                                      "But it does not contain an initvm node")
+                    logging.warning("source.xml is available. "
+                                    "But it does not contain an initvm node")
+                    self.copy_initvmnode()
+
 
             # Seed /etc, we need /etc/hosts for hostname -f to work correctly
             if not buildenv:
-- 
2.20.1



More information about the elbe-devel mailing list