[elbe-devel] [PATCH 1/4] preseed.cfg: add support for pin and version attributes

John Ogness john.ogness at linutronix.de
Wed Dec 20 23:15:26 CET 2017


To specify packages with an alternate suite, the "pin" attribute
should be used. It may also be desirable for the "version"
attribute to be used. Currently neither of these attributes are
supported in the initvm xml packages.

Add support for both of these attributes for packages specified
in the initvm xml.

Signed-off-by: John Ogness <john.ogness at linutronix.de>
---
 elbepack/init/preseed.cfg.mako | 39 ++++++++++++++++++++++++++++++++++-----
 1 file changed, 34 insertions(+), 5 deletions(-)

diff --git a/elbepack/init/preseed.cfg.mako b/elbepack/init/preseed.cfg.mako
index 196f1d42..d62b6de6 100644
--- a/elbepack/init/preseed.cfg.mako
+++ b/elbepack/init/preseed.cfg.mako
@@ -102,17 +102,46 @@ apt-mirror-setup apt-setup/use_mirror boolean false
 %  endif
 % endif
 
+<%
+    def pkg2preseed (n):
+        # we have a set of old elbe files, which have pkgnames like:
+        #      pkgname/jessie-backports
+        # be backwards compatible and support them
+        pkgsplit = n.et.text.split ('/')
+
+        pkgname = pkgsplit[0]
+
+        if len (pkgsplit) > 1:
+            pkgrel = pkgsplit[1]
+        else:
+            pkgrel = None
+
+        # pkg pin attrib overrides /
+        if 'pin' in n.et.attrib:
+            pkgrel =  n.et.attrib['pin']
+
+        # pkg attrib version wins over all and it can also be
+        # used with cdrom build
+        if 'version' in n.et.attrib:
+            return pkgname + '=' + n.et.attrib['version']
+
+        # 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"):
+            pkgrel = None
+
+        if pkgrel is None:
+            return pkgname
+
+        return pkgname + '/' + pkgrel
+%>
 d-i finish-install/reboot_in_progress note
 d-i pkgsel/include string rng-tools btrfs-tools openssh-client \
 debathena-transform-lighttpd \
 elbe-soap python-elbe-buildenv qemu-elbe-user-static \
 % for n in pkgs:
 % if n.tag == "pkg":
-%   if prj.has("mirror/primary_host") or not prj.node("mirror/cdrom") or n.et.text.find('/') == -1:
-${n.et.text} \
-%   else:
-${n.et.text[:n.et.text.find('/')]} \
-%   endif
+ ${pkg2preseed (n)}\
 % endif
 % endfor
 
-- 
2.15.1



More information about the elbe-devel mailing list