From d917166a73897e333093942c2f3264924cc5ff02 Mon Sep 17 00:00:00 2001 From: "anthony.bellino" Date: Thu, 17 Oct 2019 03:01:24 +0000 Subject: [PATCH] apt: Add allow-downgrades option per package This change adds the ability to include the --allow-downgrades option per package install. Change-Id: I2e0c6f11a51c1b78994e77084e3b2046c179d888 --- divingbell/templates/bin/_apt.sh.tpl | 2 +- doc/source/index.rst | 1 + tools/gate/scripts/020-test-divingbell.sh | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/divingbell/templates/bin/_apt.sh.tpl b/divingbell/templates/bin/_apt.sh.tpl index c31b6f9..e9b69e9 100644 --- a/divingbell/templates/bin/_apt.sh.tpl +++ b/divingbell/templates/bin/_apt.sh.tpl @@ -106,7 +106,7 @@ dpkg --configure -a {{- $pkg_name := .name }} if [[ "${CURRENT_PACKAGES[{{ .name | squote }}]+isset}" != "isset"{{- if .version }} || "${CURRENT_PACKAGES[{{ .name | squote }}]}" != {{ .version }}{{- end }} ]]; then # Run this in case some package installation was interrupted - DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold{{- if .repo }} -t {{ .repo }}{{ end }} {{ .name -}} {{- if .version }}={{ .version }}{{ end }} + DEBIAN_FRONTEND=noninteractive apt-get install -y -o Dpkg::Options::=--force-confdef -o Dpkg::Options::=--force-confold {{- if .allow_downgrade }} "--allow-downgrades" {{ end }}{{- if .repo }} -t {{ .repo }}{{ end }} {{ .name -}} {{- if .version }}={{ .version }}{{ end }} INSTALLED_THIS_TIME="$INSTALLED_THIS_TIME {{ .name }}" fi REQUESTED_PACKAGES="$REQUESTED_PACKAGES {{ .name }}" diff --git a/doc/source/index.rst b/doc/source/index.rst index 33527e4..fc5faf2 100644 --- a/doc/source/index.rst +++ b/doc/source/index.rst @@ -121,6 +121,7 @@ Here is an example configuration for it:: packages: - name: version: + allow_downgrade: true - name: There is a possibility to blacklist packages, e.g. ``telnetd`` and ``nis``:: diff --git a/tools/gate/scripts/020-test-divingbell.sh b/tools/gate/scripts/020-test-divingbell.sh index 2e16707..97b9a28 100755 --- a/tools/gate/scripts/020-test-divingbell.sh +++ b/tools/gate/scripts/020-test-divingbell.sh @@ -1208,6 +1208,7 @@ test_apt(){ packages: - name: $APT_PACKAGE1 version: $APT_VERSION1 + allow_downgrade: true - name: $APT_PACKAGE2" > "${overrides_yaml}" install_base "--values=${overrides_yaml}" get_container_status apt