From 1620dca5e38e24771fae9c45b5d5caeee3ac16fd Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Tue, 8 Oct 2024 12:41:05 +0200 Subject: add backports repo to SLE15 dockerfiles The backports repo provides some rust subpackages that are not available in the main SLE/LEAP repository. Allow adding arbitrary repos in the facts YAML for the target, even though including them in the build environment is supported for now only for zypper (and therefore only for OpenSUSE targets). Signed-off-by: Paolo Bonzini --- lcitool/facts/targets/opensuse-leap-15.yml | 2 ++ lcitool/formatters.py | 8 ++++++++ .../out/libvirt-go-xml-module-opensuse-leap-15.Dockerfile | 1 + .../data/formatters/out/libvirt-go-xml-module-opensuse-leap-15.sh | 1 + 4 files changed, 12 insertions(+) diff --git a/lcitool/facts/targets/opensuse-leap-15.yml b/lcitool/facts/targets/opensuse-leap-15.yml index c993767..8747d70 100644 --- a/lcitool/facts/targets/opensuse-leap-15.yml +++ b/lcitool/facts/targets/opensuse-leap-15.yml @@ -7,6 +7,8 @@ os: packaging: format: 'rpm' command: 'zypper' + repos: + - https://download.opensuse.org/update/leap/15.6/backports/openSUSE:Backports:SLE-15-SP6:Update.repo paths: bash: /bin/bash diff --git a/lcitool/formatters.py b/lcitool/formatters.py index 28f8f38..d1893f2 100644 --- a/lcitool/formatters.py +++ b/lcitool/formatters.py @@ -306,6 +306,14 @@ class BuildEnvFormatter(Formatter): "{nosync}{packaging_command} install -y epel-next-release", ]) + repos = facts["packaging"].get("repos", []) + if repos: + if osname == "OpenSUSE": + commands.extend(("{nosync}{packaging_command} addrepo -fc " + shlex.quote(x) + for x in repos)) + else: + raise FormatterError(f"packaging.repos not supported for {osname}") + commands.extend(["{nosync}{packaging_command} install -y {pkgs}"]) if self._pkgcleanup: diff --git a/tests/data/formatters/out/libvirt-go-xml-module-opensuse-leap-15.Dockerfile b/tests/data/formatters/out/libvirt-go-xml-module-opensuse-leap-15.Dockerfile index 16f76ec..be3a59b 100644 --- a/tests/data/formatters/out/libvirt-go-xml-module-opensuse-leap-15.Dockerfile +++ b/tests/data/formatters/out/libvirt-go-xml-module-opensuse-leap-15.Dockerfile @@ -1,6 +1,7 @@ FROM registry.opensuse.org/opensuse/leap:15.6 RUN zypper update -y && \ + zypper addrepo -fc https://download.opensuse.org/update/leap/15.6/backports/openSUSE:Backports:SLE-15-SP6:Update.repo && \ zypper install -y \ ca-certificates \ git \ diff --git a/tests/data/formatters/out/libvirt-go-xml-module-opensuse-leap-15.sh b/tests/data/formatters/out/libvirt-go-xml-module-opensuse-leap-15.sh index 907973a..a7777c9 100644 --- a/tests/data/formatters/out/libvirt-go-xml-module-opensuse-leap-15.sh +++ b/tests/data/formatters/out/libvirt-go-xml-module-opensuse-leap-15.sh @@ -1,5 +1,6 @@ function install_buildenv() { zypper update -y + zypper addrepo -fc https://download.opensuse.org/update/leap/15.6/backports/openSUSE:Backports:SLE-15-SP6:Update.repo zypper install -y \ ca-certificates \ git \ -- cgit v1.1