[elbe-devel] [PATCH 1/4] preseed.cfg: add support for pin and version attributes
Manuel Traut
manuel.traut at linutronix.de
Thu Dec 21 10:27:54 CET 2017
Hi John,
On Wed, Dec 20, 2017 at 11:15:26PM +0100, John Ogness wrote:
> 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
Why not check for the existence of the cdrom tag?
> + 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
>
> _______________________________________________
> elbe-devel mailing list
> elbe-devel at linutronix.de
> https://lists.linutronix.de/mailman/listinfo/elbe-devel
More information about the elbe-devel
mailing list