diff options
author | Andrew Patterson <andrew.patterson@hpe.com> | 2016-07-06 13:40:16 -0600 |
---|---|---|
committer | David Kalnischkies <david@kalnischkies.de> | 2016-07-08 08:44:05 +0200 |
commit | 130176bcb6ce65c98d5692196c55cc18b4c210e0 (patch) | |
tree | 64dcd8fe4190dfe17ee94778ee729649fe5805d6 | |
parent | 4bdf29d39c401ac479f6486469328fa648f9feab (diff) |
Add kernels with "+" in the package name to APT::NeverAutoRemove
Escape "+" in kernel package names when generating APT::NeverAutoRemove
list so it is not treated as a regular expression meta-character.
[Changed by David Kalnischkies: let test actually test the change]
Closes: #830159
-rw-r--r-- | debian/apt.auto-removal.sh | 2 | ||||
-rwxr-xr-x | test/integration/test-kernel-helper-autoremove | 12 |
2 files changed, 10 insertions, 4 deletions
diff --git a/debian/apt.auto-removal.sh b/debian/apt.auto-removal.sh index e7e2ca025..608d950b5 100644 --- a/debian/apt.auto-removal.sh +++ b/debian/apt.auto-removal.sh @@ -38,7 +38,7 @@ $running_version $previous_version" | sort -u | sed -e '/^$/ d')" kernels="$( (echo "$1 $unamer"; for deb in $debkernels; do echo "$list" | awk "\$2 == \"$deb\" { print \$1; }"; done; ) \ - | sed -e 's#\.#\\.#g' -e '/^$/ d' | sort -u)" + | sed -e 's#\([\.\+]\)#\\\1#g' -e '/^$/ d' | sort -u)" generateconfig() { cat <<EOF diff --git a/test/integration/test-kernel-helper-autoremove b/test/integration/test-kernel-helper-autoremove index 2e8da1c1e..417dafd65 100755 --- a/test/integration/test-kernel-helper-autoremove +++ b/test/integration/test-kernel-helper-autoremove @@ -21,9 +21,11 @@ insertinstalledpackage 'linux-image-amd64' 'amd64' '200-1' insertinstalledpackage 'linux-image-686-pae' 'i386' '300-1' # ensure that the '.' is really a dot and not a wildcard insertinstalledpackage 'linux-headers-1000000-1-generic' 'amd64' '100.0.0-1' +# ensure that the '+' is really a plus and not a regexp quantifier +insertinstalledpackage "${CURRENTKERNEL}+variant" 'amd64' '5-1' testsuccess aptmark auto "$CURRENTKERNEL" "${CURRENTKERNEL}-dbg" "${CURRENTKERNEL}-686-pae:i386" "${CURRENTKERNEL}-rt" \ - 'linux-image-1.0.0-2-generic' 'linux-image-100.0.0-1-generic' 'linux-headers-1000000-1-generic' + 'linux-image-1.0.0-2-generic' 'linux-image-100.0.0-1-generic' 'linux-headers-1000000-1-generic' "${CURRENTKERNEL}+variant" testsuccess aptmark hold "${CURRENTKERNEL}-rt" testprotected() { @@ -65,6 +67,7 @@ The following packages were automatically installed and are no longer required: linux-image-1.0.0-2-generic (1.0.0-2) linux-image-100.0.0-1-generic (100.0.0-1) $CURRENTKERNEL (5-1) + ${CURRENTKERNEL}+variant (5-1) ${CURRENTKERNEL}-686-pae:i386 (5-1) ${CURRENTKERNEL}-dbg (5-1) Use '$AUTOREMOVE' to remove them. @@ -77,6 +80,7 @@ The following packages were automatically installed and are no longer required: linux-image-1.0.0-2-generic (1.0.0-2) linux-image-100.0.0-1-generic (100.0.0-1) $CURRENTKERNEL (5-1) + ${CURRENTKERNEL}+variant (5-1) ${CURRENTKERNEL}-686-pae:i386 (5-1) ${CURRENTKERNEL}-dbg (5-1) ${CURRENTKERNEL}-rt (5-1) @@ -85,7 +89,7 @@ Use '$AUTOREMOVE' to remove them. testequal "Reading package lists... Building dependency tree... Reading state information... -6 packages were automatically installed and are no longer required. +7 packages were automatically installed and are no longer required. Use '$AUTOREMOVE' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded." aptget install -s -o APT::Get::HideAutoRemove=small testequal "Reading package lists... @@ -96,13 +100,15 @@ The following packages will be REMOVED: linux-image-1.0.0-2-generic (1.0.0-2) linux-image-100.0.0-1-generic (100.0.0-1) $CURRENTKERNEL (5-1) + ${CURRENTKERNEL}+variant (5-1) ${CURRENTKERNEL}-686-pae:i386 (5-1) ${CURRENTKERNEL}-dbg (5-1) -0 upgraded, 0 newly installed, 6 to remove and 0 not upgraded. +0 upgraded, 0 newly installed, 7 to remove and 0 not upgraded. Remv linux-headers-1000000-1-generic [100.0.0-1] Remv linux-image-1.0.0-2-generic [1.0.0-2] Remv linux-image-100.0.0-1-generic [100.0.0-1] Remv $CURRENTKERNEL [5-1] +Remv ${CURRENTKERNEL}+variant [5-1] Remv ${CURRENTKERNEL}-686-pae:i386 [5-1] Remv ${CURRENTKERNEL}-dbg [5-1]" aptget autoremove -sV |