summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2019-02-04 12:44:08 +0000
committerJulian Andres Klode <jak@debian.org>2019-02-04 12:44:08 +0000
commit3a015964dd56edf897ee062b2eafa2cfc0584380 (patch)
treeb7c47f960d6281195ea7fd3f90a6404b939df134 /test
parentd5dcc2e9d3008b57c3fae0bcb5b1c2a197f5430c (diff)
parentc2b9b0489538fed4770515bd8853a960b13a2618 (diff)
Merge branch 'pu/dead-pin' into 'master'
A pin of -32768 overrides any other, disables repo See merge request apt-team/apt!40
Diffstat (limited to 'test')
-rwxr-xr-xtest/integration/test-packages-require-authorization61
-rwxr-xr-xtest/integration/test-policy-pinning65
2 files changed, 123 insertions, 3 deletions
diff --git a/test/integration/test-packages-require-authorization b/test/integration/test-packages-require-authorization
new file mode 100755
index 000000000..527497ce5
--- /dev/null
+++ b/test/integration/test-packages-require-authorization
@@ -0,0 +1,61 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+setupenvironment
+configarchitecture 'amd64'
+
+insertpackage 'unstable' 'cool' 'amd64' '1.0'
+
+export APT_DONT_SIGN='InRelease'
+setupaptarchive --no-update
+changetowebserver
+
+echo 'Packages-Require-Authorization: yes' >> aptarchive/dists/unstable/Release
+signreleasefiles
+
+testsuccess aptget update
+testsuccessequal "Package files:
+ 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status
+ release a=now
+-32768 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
+ release a=unstable,n=sid,c=main,b=amd64
+ origin localhost
+Pinned packages:" aptcache policy
+
+mkdir rootdir/etc/apt/auth.conf.d
+cat > rootdir/etc/apt/auth.conf.d/myauth.conf << EOF
+machine localhost
+login username
+password usersPassword
+EOF
+
+
+testsuccessequal "Package files:
+ 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status
+ release a=now
+ 500 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
+ release a=unstable,n=sid,c=main,b=amd64
+ origin localhost
+Pinned packages:" aptcache policy
+
+
+cat > rootdir/etc/apt/preferences.d/myauth.pref << EOF
+Package: *
+Pin: origin localhost
+Pin-Priority: 990
+
+Package: cool
+Pin: origin localhost
+Pin-Priority: 990
+EOF
+
+testsuccessequal "Package files:
+ 100 ${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status
+ release a=now
+ 990 http://localhost:${APTHTTPPORT} unstable/main amd64 Packages
+ release a=unstable,n=sid,c=main,b=amd64
+ origin localhost
+Pinned packages:
+ cool -> 1.0 with priority 990" aptcache policy
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