From 2dc3dc54a537b38d9512f8abb0d64bd2ea946b5a Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Tue, 26 Jun 2018 12:44:43 +0100 Subject: [PATCH 1/3] templates: opensuse: Drop support for EOL distributions All releases prior to 42.X have reached EOL so we can drop these codepaths in order to simplify the code. This also fixes an indentation issue. Signed-off-by: Markos Chandras --- templates/lxc-opensuse.in | 30 ++++++------------------------ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in index 96891c0..6ce5827 100644 --- a/templates/lxc-opensuse.in +++ b/templates/lxc-opensuse.in @@ -148,13 +148,9 @@ download_opensuse() fi zypper --quiet --root $cache/partial-$arch-packages --non-interactive ar "$oss_repo_url" repo-oss || return 1 - update_repo_url="http://download.opensuse.org/update/$DISTRO/repo/oss" # Leap update repos were rearranged - if [[ $DISTRO == "leap/4"* ]] || [[ $DISTRO == "leap/1"* ]]; then - update_repo_url="http://download.opensuse.org/update/$DISTRO/oss/" - fi - # tumbleweed has no update repo if [[ $DISTRO != "tumbleweed" ]]; then + update_repo_url="http://download.opensuse.org/update/$DISTRO/oss/" zypper --quiet --root $cache/partial-$arch-packages --non-interactive ar "$update_repo_url" update || return 1 fi @@ -181,31 +177,17 @@ Support: udev Support: netcfg Support: hwinfo insserv-compat module-init-tools openSUSE-release openssh Support: pwdutils sysconfig +Support: net-tools iproute2 Ignore: rpm:suse-build-key,build-key Ignore: systemd:systemd-presets-branding EOF - if [ $DISTRO = "13.2" ] - then - echo "Support: python3-base" >> $cache/partial-$arch-packages/opensuse.conf - fi - if [[ $DISTRO == "tumbleweed" ]]; then - echo "Preinstall: liblua5_3 libncurses6 libreadline7" >> $cache/partial-$arch-packages/opensuse.conf + echo "Preinstall: liblua5_3 libncurses6 libreadline7" >> $cache/partial-$arch-packages/opensuse.conf else - echo "Preinstall: liblua5_1 libncurses5 libreadline6" >> $cache/partial-$arch-packages/opensuse.conf - echo "Support: rpcbind" >> $cache/partial-$arch-packages/opensuse.conf - fi - - # dhcpcd is not in the default repos since Leap 42.1, neither in tumbleweed - if [[ $DISTRO != "leap/4"* ]] && [[ $DISTRO != "leap/1"* ]] && [[ $DISTRO != "tumbleweed" ]]; then - echo "Support: dhcpcd" >> $cache/partial-$arch-packages/opensuse.conf - fi - - # Leap and tumbleweed doesn't seem to have iproute2 utils installed - if [[ $DISTRO == "leap/4"* ]] || [[ $DISTRO == "leap/1"* ]] || [[ $DISTRO == "tumbleweed" ]]; then - echo "Support: net-tools iproute2" >> $cache/partial-$arch-packages/opensuse.conf + echo "Preinstall: liblua5_1 libncurses5 libreadline6" >> $cache/partial-$arch-packages/opensuse.conf + echo "Support: rpcbind" >> $cache/partial-$arch-packages/opensuse.conf fi if [ "$arch" = "i686" ]; then @@ -224,7 +206,7 @@ EOF repos=("--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/$arch" "--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/noarch") if [[ $DISTRO != "tumbleweed" ]]; then # tumbleweed has no update repo - repos+=("--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/update/$arch" "--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/update/noarch") + repos+=("--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/update/$arch" "--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/update/noarch") fi CLEAN_BUILD=1 BUILD_ARCH="$arch" BUILD_ROOT="$cache/partial-$arch" BUILD_DIST="$cache/partial-$arch-packages/opensuse.conf" PATH="$PATH:$BUILD_DIR" $BUILD_DIR/init_buildsystem --clean --configdir $BUILD_DIR/configs --cachedir $cache/partial-$arch-cache ${repos[*]} || return 1 From 39ba2322d8606acea4ff73b4b5e95043da7a60e7 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Tue, 26 Jun 2018 15:33:47 +0100 Subject: [PATCH 2/3] templates: lxc-opensuse.in: Ensure cache is fully populated We build our LXC rootfs based on a minimal openSUSE cache. However, since we are only using this cache to bootstrap the rootfs, we need to make sure that all packages are present there otherwise we see failures like the following one expanding package dependencies... expansion error nothing provides net-tools nothing provides iproute2 Failed to download 'opensuse base' Most of the needed packages are being pulled in indirectly as dependencies of other packages but we should be more explicit since dependencies could change in the future. Finally, we pass '--no-recommends' in order to have better control of what packages are being pulled into the cache. Signed-off-by: Markos Chandras --- templates/lxc-opensuse.in | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in index 6ce5827..24f2da7 100644 --- a/templates/lxc-opensuse.in +++ b/templates/lxc-opensuse.in @@ -154,8 +154,10 @@ download_opensuse() zypper --quiet --root $cache/partial-$arch-packages --non-interactive ar "$update_repo_url" update || return 1 fi + support_packages=(zypper patterns-openSUSE-base lxc ncurses-utils iputils udev netcfg hwinfo insserv-compat module-init-tools openSUSE-release openssh pwdutils sysconfig net-tools iproute2) + zypper --quiet --root $cache/partial-$arch-packages --non-interactive --gpg-auto-import-keys update || return 1 - zypper --root $cache/partial-$arch-packages --non-interactive in --auto-agree-with-licenses --download-only zypper lxc patterns-openSUSE-base bash iputils sed tar rsyslog || return 1 + zypper --root $cache/partial-$arch-packages --non-interactive in --no-recommends --auto-agree-with-licenses --download-only zypper lxc patterns-openSUSE-base bash iputils sed tar rsyslog ${support_packages[*]} || return 1 cat > $cache/partial-$arch-packages/opensuse.conf << EOF Preinstall: aaa_base bash coreutils diffutils @@ -168,16 +170,7 @@ Preinstall: libpcre1 RunScripts: aaa_base -Support: zypper -Support: patterns-openSUSE-base -Support: lxc -Support: ncurses-utils -Support: iputils -Support: udev -Support: netcfg -Support: hwinfo insserv-compat module-init-tools openSUSE-release openssh -Support: pwdutils sysconfig -Support: net-tools iproute2 +Support: ${support_packages[*]} Ignore: rpm:suse-build-key,build-key Ignore: systemd:systemd-presets-branding From 53ab98b87e8a51f04cc7d836a604defb8523bc69 Mon Sep 17 00:00:00 2001 From: Markos Chandras Date: Tue, 26 Jun 2018 16:30:45 +0100 Subject: [PATCH 3/3] templates: lxc-opensuse.in: Fix openSUSE Leap 15 cache url The repo layout has changed in Leap 15 so we need to adapt it. Moreover, the required packages for Leap 15 mimic those for Tumbleweed. Signed-off-by: Markos Chandras --- templates/lxc-opensuse.in | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/templates/lxc-opensuse.in b/templates/lxc-opensuse.in index 24f2da7..232e467 100644 --- a/templates/lxc-opensuse.in +++ b/templates/lxc-opensuse.in @@ -178,7 +178,9 @@ EOF if [[ $DISTRO == "tumbleweed" ]]; then echo "Preinstall: liblua5_3 libncurses6 libreadline7" >> $cache/partial-$arch-packages/opensuse.conf - else + elif [[ $DISTRO == "leap/1"* ]]; then + echo "Preinstall: liblua5_3-5 libncurses6 libreadline7" >> $cache/partial-$arch-packages/opensuse.conf + elif [[ $DISTRO == "leap/4"* ]]; then echo "Preinstall: liblua5_1 libncurses5 libreadline6" >> $cache/partial-$arch-packages/opensuse.conf echo "Support: rpcbind" >> $cache/partial-$arch-packages/opensuse.conf fi @@ -196,8 +198,12 @@ EOF # openSUSE 13.2 has no noarch directory in update [ -d $cache/partial-$arch-packages/var/cache/zypp/packages/update/noarch ] || mkdir -p $cache/partial-$arch-packages/var/cache/zypp/packages/update/noarch - - repos=("--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/$arch" "--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/noarch") + if [[ $DISTRO == "leap/4"* ]]; then + repos=("--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/$arch" "--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/suse/noarch") + else + # Leap 15 has a different repo structure compared to 42.3 + repos=("--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/$arch" "--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/repo-oss/noarch") + fi if [[ $DISTRO != "tumbleweed" ]]; then # tumbleweed has no update repo repos+=("--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/update/$arch" "--repository" "$cache/partial-$arch-packages/var/cache/zypp/packages/update/noarch") fi