summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2018-12-18 14:50:25 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2019-02-01 17:51:35 +0100
commit8bb2a91a070170d7d8e71206d1c66a26809bdbc3 (patch)
tree049c96e291e2e2c11f09d984a7af91c60caa061a /test
parent4200469bb5a14c4659285917ed30c46a0b15c286 (diff)
Introduce experimental 'never' pinning for sources
This allows disabling a repository by pinning it to 'never', which is internally translated to a value of -32768 (or whatever the minimum of short is). This overrides any other pin for that repository. It can be used to make sure certain sources are never used; for example, in unattended-upgrades. To prevent semantic changes to existing files, we substitute min + 1 for every pin-priority: <min>. This is a temporary solution, as we are waiting for an ABI break. To add pins with that value, the special Pin-Priority "never" may be used for now. It's unclear if that will persist, or if the interface will change eventually.
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-policy-pinning65
1 files changed, 62 insertions, 3 deletions
diff --git a/test/integration/test-policy-pinning b/test/integration/test-policy-pinning
index 5676d1457..35e178871 100755
--- a/test/integration/test-policy-pinning
+++ b/test/integration/test-policy-pinning
@@ -315,15 +315,16 @@ testsuccessequal "coolstuff:
Installed: 2.0~bpo1
Candidate: $2
Version table:
- 2.0~bpo2 $1
- $1 file:${tmppath}/aptarchive backports/main all Packages
+ 2.0~bpo2 ${3:-$1}
+ ${3:-$1} file:${tmppath}/aptarchive backports/main all Packages
*** 2.0~bpo1 100
100 ${tmppath}/rootdir/var/lib/dpkg/status
1.0 500
500 file:${tmppath}/aptarchive stable/main all Packages" apt policy coolstuff
}
currentpin '32767' '2.0~bpo2'
-currentpin '-32768' '2.0~bpo1'
+currentpin '-32768' '2.0~bpo1' '-32767'
+currentpin '-32767' '2.0~bpo1' '-32767'
# Check for 0
echo "Package: coolstuff
@@ -359,3 +360,61 @@ testsuccessequal "coolstuff:
100 ${tmppath}/rootdir/var/lib/dpkg/status
1.0 500
500 file:${tmppath}/aptarchive stable/main all Packages" aptcache policy coolstuff
+
+
+# Check for override pins
+
+# Normal pins: First one wins
+echo "Package: coolstuff
+Pin: release n=backports
+Pin-Priority: 990
+
+Package: coolstuff
+Pin: release n=backports
+Pin-Priority: 991
+" > rootdir/etc/apt/preferences
+
+testsuccessequal "coolstuff:
+ Installed: 2.0~bpo1
+ Candidate: 2.0~bpo2
+ Version table:
+ 2.0~bpo2 990
+ 100 file:${tmppath}/aptarchive backports/main all Packages
+ *** 2.0~bpo1 100
+ 100 ${tmppath}/rootdir/var/lib/dpkg/status
+ 1.0 500
+ 500 file:${tmppath}/aptarchive stable/main all Packages" aptcache policy coolstuff
+
+
+echo "Package: coolstuff
+Pin: release n=backports
+Pin-Priority: 990
+
+Package: *
+Pin: release n=backports
+Pin-Priority: never
+" > rootdir/etc/apt/preferences
+
+testsuccessequal "coolstuff:
+ Installed: 2.0~bpo1
+ Candidate: 2.0~bpo1
+ Version table:
+ 2.0~bpo2 -32768
+ -32768 file:${tmppath}/aptarchive backports/main all Packages
+ *** 2.0~bpo1 100
+ 100 ${tmppath}/rootdir/var/lib/dpkg/status
+ 1.0 500
+ 500 file:${tmppath}/aptarchive stable/main all Packages" aptcache policy coolstuff
+
+
+
+
+# Check for 0
+echo "Package: coolstuff
+Pin: release n=backports
+Pin-Priority: never
+" > rootdir/etc/apt/preferences
+
+testfailureequal "Reading package lists...
+E: ${tmppath}/rootdir/etc/apt/preferences: The special 'Pin-Priority: never' can only be used for 'Package: *' records" \
+ aptget install -s coolstuff -o PinPriority=0