0s autopkgtest [23:59:29]: starting date and time: 2025-06-12 23:59:29+0000 0s autopkgtest [23:59:29]: git checkout: 9986aa8c Merge branch 'skia/fix_network_interface' into 'ubuntu/production' 0s autopkgtest [23:59:29]: host juju-7f2275-prod-proposed-migration-environment-9; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.z6ptra4b/out --timeout-copy=6000 --setup-commands 'ln -s /dev/null /etc/systemd/system/bluetooth.service; printf "http_proxy=http://squid.internal:3128\nhttps_proxy=http://squid.internal:3128\nno_proxy=127.0.0.1,127.0.1.1,localhost,localdomain,internal,login.ubuntu.com,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,keyserver.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com,radosgw.ps5.canonical.com\n" >> /etc/environment' --apt-pocket=proposed=src:systemd,src:dpdk --apt-upgrade apt --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 '--env=ADT_TEST_TRIGGERS=systemd/255.4-1ubuntu8.9 dpdk/23.11.4-0ubuntu0.24.04.1' -- lxd -r lxd-armhf-10.145.243.46 lxd-armhf-10.145.243.46:autopkgtest/ubuntu/noble/armhf 26s autopkgtest [23:59:55]: testbed dpkg architecture: armhf 28s autopkgtest [23:59:57]: testbed apt version: 2.8.3 31s autopkgtest [00:00:00]: @@@@@@@@@@@@@@@@@@@@ test bed setup 33s autopkgtest [00:00:02]: testbed release detected to be: None 41s autopkgtest [00:00:10]: updating testbed package index (apt update) 43s Get:1 http://ftpmaster.internal/ubuntu noble-proposed InRelease [265 kB] 43s Hit:2 http://ftpmaster.internal/ubuntu noble InRelease 43s Get:3 http://ftpmaster.internal/ubuntu noble-updates InRelease [126 kB] 44s Get:4 http://ftpmaster.internal/ubuntu noble-security InRelease [126 kB] 44s Get:5 http://ftpmaster.internal/ubuntu noble-proposed/universe Sources [67.0 kB] 44s Get:6 http://ftpmaster.internal/ubuntu noble-proposed/restricted Sources [32.2 kB] 44s Get:7 http://ftpmaster.internal/ubuntu noble-proposed/main Sources [63.2 kB] 44s Get:8 http://ftpmaster.internal/ubuntu noble-proposed/main armhf Packages [69.2 kB] 44s Get:9 http://ftpmaster.internal/ubuntu noble-proposed/main armhf c-n-f Metadata [2252 B] 44s Get:10 http://ftpmaster.internal/ubuntu noble-proposed/restricted armhf Packages [1888 B] 44s Get:11 http://ftpmaster.internal/ubuntu noble-proposed/restricted armhf c-n-f Metadata [116 B] 44s Get:12 http://ftpmaster.internal/ubuntu noble-proposed/universe armhf Packages [273 kB] 44s Get:13 http://ftpmaster.internal/ubuntu noble-proposed/universe armhf c-n-f Metadata [2608 B] 44s Get:14 http://ftpmaster.internal/ubuntu noble-proposed/multiverse armhf c-n-f Metadata [116 B] 44s Get:15 http://ftpmaster.internal/ubuntu noble-updates/restricted Sources [37.1 kB] 44s Get:16 http://ftpmaster.internal/ubuntu noble-updates/main Sources [415 kB] 44s Get:17 http://ftpmaster.internal/ubuntu noble-updates/main armhf Packages [584 kB] 45s Get:18 http://ftpmaster.internal/ubuntu noble-updates/restricted armhf Packages [5512 B] 45s Get:19 http://ftpmaster.internal/ubuntu noble-updates/universe armhf Packages [842 kB] 45s Get:20 http://ftpmaster.internal/ubuntu noble-security/main Sources [176 kB] 45s Get:21 http://ftpmaster.internal/ubuntu noble-security/main armhf Packages [352 kB] 45s Get:22 http://ftpmaster.internal/ubuntu noble-security/universe armhf Packages [627 kB] 47s Fetched 4066 kB in 3s (1425 kB/s) 48s Reading package lists... 54s autopkgtest [00:00:23]: upgrading testbed (apt dist-upgrade and autopurge) 56s Reading package lists... 56s Building dependency tree... 56s Reading state information... 57s Calculating upgrade...Starting pkgProblemResolver with broken count: 0 57s Starting 2 pkgProblemResolver with broken count: 0 57s Done 58s Entering ResolveByKeep 58s 59s The following packages will be upgraded: 59s apport apport-core-dump-handler libnss-systemd libpam-systemd 59s libsystemd-shared libsystemd0 libudev1 python3-apport python3-problem-report 59s systemd systemd-dev systemd-resolved systemd-sysv systemd-timesyncd udev 59s 15 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 59s Need to get 8978 kB of archives. 59s After this operation, 18.4 kB of additional disk space will be used. 59s Get:1 http://ftpmaster.internal/ubuntu noble-proposed/main armhf libnss-systemd armhf 255.4-1ubuntu8.9 [148 kB] 59s Get:2 http://ftpmaster.internal/ubuntu noble-proposed/main armhf systemd-dev all 255.4-1ubuntu8.9 [105 kB] 59s Get:3 http://ftpmaster.internal/ubuntu noble-proposed/main armhf systemd-timesyncd armhf 255.4-1ubuntu8.9 [36.0 kB] 59s Get:4 http://ftpmaster.internal/ubuntu noble-proposed/main armhf systemd-resolved armhf 255.4-1ubuntu8.9 [289 kB] 59s Get:5 http://ftpmaster.internal/ubuntu noble-proposed/main armhf libsystemd-shared armhf 255.4-1ubuntu8.9 [2012 kB] 59s Get:6 http://ftpmaster.internal/ubuntu noble-proposed/main armhf libsystemd0 armhf 255.4-1ubuntu8.9 [412 kB] 60s Get:7 http://ftpmaster.internal/ubuntu noble-proposed/main armhf systemd-sysv armhf 255.4-1ubuntu8.9 [11.9 kB] 60s Get:8 http://ftpmaster.internal/ubuntu noble-proposed/main armhf libpam-systemd armhf 255.4-1ubuntu8.9 [216 kB] 60s Get:9 http://ftpmaster.internal/ubuntu noble-proposed/main armhf systemd armhf 255.4-1ubuntu8.9 [3506 kB] 60s Get:10 http://ftpmaster.internal/ubuntu noble-proposed/main armhf udev armhf 255.4-1ubuntu8.9 [1852 kB] 60s Get:11 http://ftpmaster.internal/ubuntu noble-proposed/main armhf libudev1 armhf 255.4-1ubuntu8.9 [168 kB] 60s Get:12 http://ftpmaster.internal/ubuntu noble-updates/main armhf python3-problem-report all 2.28.1-0ubuntu3.7 [25.5 kB] 60s Get:13 http://ftpmaster.internal/ubuntu noble-updates/main armhf python3-apport all 2.28.1-0ubuntu3.7 [92.4 kB] 60s Get:14 http://ftpmaster.internal/ubuntu noble-updates/main armhf apport-core-dump-handler all 2.28.1-0ubuntu3.7 [18.5 kB] 60s Get:15 http://ftpmaster.internal/ubuntu noble-updates/main armhf apport all 2.28.1-0ubuntu3.7 [85.2 kB] 61s Fetched 8978 kB in 2s (5165 kB/s) 61s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 58040 files and directories currently installed.) 61s Preparing to unpack .../0-libnss-systemd_255.4-1ubuntu8.9_armhf.deb ... 61s Unpacking libnss-systemd:armhf (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 61s Preparing to unpack .../1-systemd-dev_255.4-1ubuntu8.9_all.deb ... 61s Unpacking systemd-dev (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 61s Preparing to unpack .../2-systemd-timesyncd_255.4-1ubuntu8.9_armhf.deb ... 61s Unpacking systemd-timesyncd (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 61s Preparing to unpack .../3-systemd-resolved_255.4-1ubuntu8.9_armhf.deb ... 61s Unpacking systemd-resolved (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 61s Preparing to unpack .../4-libsystemd-shared_255.4-1ubuntu8.9_armhf.deb ... 61s Unpacking libsystemd-shared:armhf (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 61s Preparing to unpack .../5-libsystemd0_255.4-1ubuntu8.9_armhf.deb ... 61s Unpacking libsystemd0:armhf (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 61s Setting up libsystemd0:armhf (255.4-1ubuntu8.9) ... 61s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 58040 files and directories currently installed.) 61s Preparing to unpack .../systemd-sysv_255.4-1ubuntu8.9_armhf.deb ... 61s Unpacking systemd-sysv (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 61s Preparing to unpack .../libpam-systemd_255.4-1ubuntu8.9_armhf.deb ... 61s Unpacking libpam-systemd:armhf (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 61s Preparing to unpack .../systemd_255.4-1ubuntu8.9_armhf.deb ... 61s Unpacking systemd (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 62s Preparing to unpack .../udev_255.4-1ubuntu8.9_armhf.deb ... 62s Unpacking udev (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 62s Preparing to unpack .../libudev1_255.4-1ubuntu8.9_armhf.deb ... 62s Unpacking libudev1:armhf (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 62s Setting up libudev1:armhf (255.4-1ubuntu8.9) ... 62s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 58040 files and directories currently installed.) 62s Preparing to unpack .../python3-problem-report_2.28.1-0ubuntu3.7_all.deb ... 62s Unpacking python3-problem-report (2.28.1-0ubuntu3.7) over (2.28.1-0ubuntu3.6) ... 62s Preparing to unpack .../python3-apport_2.28.1-0ubuntu3.7_all.deb ... 62s Unpacking python3-apport (2.28.1-0ubuntu3.7) over (2.28.1-0ubuntu3.6) ... 62s Preparing to unpack .../apport-core-dump-handler_2.28.1-0ubuntu3.7_all.deb ... 62s Unpacking apport-core-dump-handler (2.28.1-0ubuntu3.7) over (2.28.1-0ubuntu3.6) ... 62s Preparing to unpack .../apport_2.28.1-0ubuntu3.7_all.deb ... 62s Unpacking apport (2.28.1-0ubuntu3.7) over (2.28.1-0ubuntu3.6) ... 62s Setting up python3-problem-report (2.28.1-0ubuntu3.7) ... 62s Setting up systemd-dev (255.4-1ubuntu8.9) ... 62s Setting up python3-apport (2.28.1-0ubuntu3.7) ... 63s Setting up libsystemd-shared:armhf (255.4-1ubuntu8.9) ... 63s Setting up systemd (255.4-1ubuntu8.9) ... 63s Setting up systemd-timesyncd (255.4-1ubuntu8.9) ... 64s Setting up udev (255.4-1ubuntu8.9) ... 65s Setting up systemd-resolved (255.4-1ubuntu8.9) ... 65s Setting up systemd-sysv (255.4-1ubuntu8.9) ... 65s Setting up libnss-systemd:armhf (255.4-1ubuntu8.9) ... 65s Setting up libpam-systemd:armhf (255.4-1ubuntu8.9) ... 65s Setting up apport-core-dump-handler (2.28.1-0ubuntu3.7) ... 66s Setting up apport (2.28.1-0ubuntu3.7) ... 67s apport-autoreport.service is a disabled or a static unit not running, not starting it. 67s Processing triggers for dbus (1.14.10-4ubuntu4.1) ... 67s Processing triggers for initramfs-tools (0.142ubuntu25.5) ... 67s Processing triggers for libc-bin (2.39-0ubuntu8.4) ... 67s Processing triggers for man-db (2.12.0-4build2) ... 70s Reading package lists... 70s Building dependency tree... 70s Reading state information... 71s Starting pkgProblemResolver with broken count: 0 71s Starting 2 pkgProblemResolver with broken count: 0 71s Done 72s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 74s autopkgtest [00:00:43]: rebooting testbed after setup commands that affected boot 115s autopkgtest [00:01:24]: testbed running kernel: Linux 6.8.0-58-generic #60~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 28 14:48:37 UTC 2 141s autopkgtest [00:01:50]: @@@@@@@@@@@@@@@@@@@@ apt-source apt 177s Get:1 http://ftpmaster.internal/ubuntu noble-updates/main apt 2.8.3 (dsc) [2973 B] 177s Get:2 http://ftpmaster.internal/ubuntu noble-updates/main apt 2.8.3 (tar) [2355 kB] 177s gpgv: Signature made Wed Oct 23 15:00:18 2024 UTC 177s gpgv: using RSA key 4FB588A84C2DDE79A74C77876FA458DD1DB03F71 177s gpgv: issuer "jak@debian.org" 177s gpgv: Can't check signature: No public key 177s dpkg-source: warning: cannot verify inline signature for ./apt_2.8.3.dsc: no acceptable signature found 177s autopkgtest [00:02:26]: testing package apt version 2.8.3 180s autopkgtest [00:02:29]: build not needed 184s autopkgtest [00:02:33]: test pkg-config-test: preparing testbed 186s Reading package lists... 186s Building dependency tree... 186s Reading state information... 187s Starting pkgProblemResolver with broken count: 0 187s Starting 2 pkgProblemResolver with broken count: 0 187s Done 188s The following NEW packages will be installed: 188s cpp cpp-13 cpp-13-arm-linux-gnueabihf cpp-arm-linux-gnueabihf g++ g++-13 188s g++-13-arm-linux-gnueabihf g++-arm-linux-gnueabihf gcc gcc-13 188s gcc-13-arm-linux-gnueabihf gcc-13-base gcc-arm-linux-gnueabihf 188s libapt-pkg-dev libasan8 libatomic1 libc-dev-bin libc6-dev libcc1-0 188s libcrypt-dev libgcc-13-dev libgomp1 libisl23 libmpc3 libpkgconf3 188s libstdc++-13-dev libubsan1 linux-libc-dev pkg-config pkgconf pkgconf-bin 188s rpcsvc-proto 188s 0 upgraded, 32 newly installed, 0 to remove and 0 not upgraded. 188s Need to get 46.2 MB of archives. 188s After this operation, 137 MB of additional disk space will be used. 188s Get:1 http://ftpmaster.internal/ubuntu noble-updates/main armhf gcc-13-base armhf 13.3.0-6ubuntu2~24.04 [51.4 kB] 188s Get:2 http://ftpmaster.internal/ubuntu noble-updates/main armhf libisl23 armhf 0.26-3build1.1 [544 kB] 188s Get:3 http://ftpmaster.internal/ubuntu noble-updates/main armhf libmpc3 armhf 1.3.1-1build1.1 [46.8 kB] 188s Get:4 http://ftpmaster.internal/ubuntu noble-updates/main armhf cpp-13-arm-linux-gnueabihf armhf 13.3.0-6ubuntu2~24.04 [8259 kB] 189s Get:5 http://ftpmaster.internal/ubuntu noble-updates/main armhf cpp-13 armhf 13.3.0-6ubuntu2~24.04 [1038 B] 189s Get:6 http://ftpmaster.internal/ubuntu noble/main armhf cpp-arm-linux-gnueabihf armhf 4:13.2.0-7ubuntu1 [5320 B] 189s Get:7 http://ftpmaster.internal/ubuntu noble/main armhf cpp armhf 4:13.2.0-7ubuntu1 [22.4 kB] 189s Get:8 http://ftpmaster.internal/ubuntu noble-updates/main armhf libcc1-0 armhf 14.2.0-4ubuntu2~24.04 [43.4 kB] 189s Get:9 http://ftpmaster.internal/ubuntu noble-updates/main armhf libgomp1 armhf 14.2.0-4ubuntu2~24.04 [125 kB] 189s Get:10 http://ftpmaster.internal/ubuntu noble-updates/main armhf libatomic1 armhf 14.2.0-4ubuntu2~24.04 [7888 B] 189s Get:11 http://ftpmaster.internal/ubuntu noble-updates/main armhf libasan8 armhf 14.2.0-4ubuntu2~24.04 [2941 kB] 190s Get:12 http://ftpmaster.internal/ubuntu noble-updates/main armhf libubsan1 armhf 14.2.0-4ubuntu2~24.04 [1154 kB] 190s Get:13 http://ftpmaster.internal/ubuntu noble-updates/main armhf libgcc-13-dev armhf 13.3.0-6ubuntu2~24.04 [899 kB] 190s Get:14 http://ftpmaster.internal/ubuntu noble-updates/main armhf gcc-13-arm-linux-gnueabihf armhf 13.3.0-6ubuntu2~24.04 [16.1 MB] 191s Get:15 http://ftpmaster.internal/ubuntu noble-updates/main armhf gcc-13 armhf 13.3.0-6ubuntu2~24.04 [465 kB] 191s Get:16 http://ftpmaster.internal/ubuntu noble/main armhf gcc-arm-linux-gnueabihf armhf 4:13.2.0-7ubuntu1 [1220 B] 191s Get:17 http://ftpmaster.internal/ubuntu noble/main armhf gcc armhf 4:13.2.0-7ubuntu1 [5022 B] 191s Get:18 http://ftpmaster.internal/ubuntu noble-updates/main armhf libc-dev-bin armhf 2.39-0ubuntu8.4 [19.1 kB] 191s Get:19 http://ftpmaster.internal/ubuntu noble-updates/main armhf linux-libc-dev armhf 6.8.0-60.63 [1833 kB] 191s Get:20 http://ftpmaster.internal/ubuntu noble/main armhf libcrypt-dev armhf 1:4.4.36-4build1 [120 kB] 191s Get:21 http://ftpmaster.internal/ubuntu noble/main armhf rpcsvc-proto armhf 1.4.2-0ubuntu7 [62.2 kB] 191s Get:22 http://ftpmaster.internal/ubuntu noble-updates/main armhf libc6-dev armhf 2.39-0ubuntu8.4 [1351 kB] 191s Get:23 http://ftpmaster.internal/ubuntu noble-updates/main armhf libstdc++-13-dev armhf 13.3.0-6ubuntu2~24.04 [2509 kB] 191s Get:24 http://ftpmaster.internal/ubuntu noble-updates/main armhf g++-13-arm-linux-gnueabihf armhf 13.3.0-6ubuntu2~24.04 [9441 kB] 191s Get:25 http://ftpmaster.internal/ubuntu noble-updates/main armhf g++-13 armhf 13.3.0-6ubuntu2~24.04 [16.1 kB] 191s Get:26 http://ftpmaster.internal/ubuntu noble/main armhf g++-arm-linux-gnueabihf armhf 4:13.2.0-7ubuntu1 [966 B] 191s Get:27 http://ftpmaster.internal/ubuntu noble/main armhf g++ armhf 4:13.2.0-7ubuntu1 [1090 B] 191s Get:28 http://ftpmaster.internal/ubuntu noble-updates/main armhf libapt-pkg-dev armhf 2.8.3 [118 kB] 191s Get:29 http://ftpmaster.internal/ubuntu noble/main armhf libpkgconf3 armhf 1.8.1-2build1 [26.3 kB] 191s Get:30 http://ftpmaster.internal/ubuntu noble/main armhf pkgconf-bin armhf 1.8.1-2build1 [20.7 kB] 191s Get:31 http://ftpmaster.internal/ubuntu noble/main armhf pkgconf armhf 1.8.1-2build1 [16.8 kB] 191s Get:32 http://ftpmaster.internal/ubuntu noble/main armhf pkg-config armhf 1.8.1-2build1 [7264 B] 192s Fetched 46.2 MB in 3s (14.0 MB/s) 192s Selecting previously unselected package gcc-13-base:armhf. 192s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 58040 files and directories currently installed.) 192s Preparing to unpack .../00-gcc-13-base_13.3.0-6ubuntu2~24.04_armhf.deb ... 192s Unpacking gcc-13-base:armhf (13.3.0-6ubuntu2~24.04) ... 192s Selecting previously unselected package libisl23:armhf. 192s Preparing to unpack .../01-libisl23_0.26-3build1.1_armhf.deb ... 192s Unpacking libisl23:armhf (0.26-3build1.1) ... 192s Selecting previously unselected package libmpc3:armhf. 192s Preparing to unpack .../02-libmpc3_1.3.1-1build1.1_armhf.deb ... 192s Unpacking libmpc3:armhf (1.3.1-1build1.1) ... 192s Selecting previously unselected package cpp-13-arm-linux-gnueabihf. 192s Preparing to unpack .../03-cpp-13-arm-linux-gnueabihf_13.3.0-6ubuntu2~24.04_armhf.deb ... 192s Unpacking cpp-13-arm-linux-gnueabihf (13.3.0-6ubuntu2~24.04) ... 192s Selecting previously unselected package cpp-13. 192s Preparing to unpack .../04-cpp-13_13.3.0-6ubuntu2~24.04_armhf.deb ... 192s Unpacking cpp-13 (13.3.0-6ubuntu2~24.04) ... 192s Selecting previously unselected package cpp-arm-linux-gnueabihf. 192s Preparing to unpack .../05-cpp-arm-linux-gnueabihf_4%3a13.2.0-7ubuntu1_armhf.deb ... 192s Unpacking cpp-arm-linux-gnueabihf (4:13.2.0-7ubuntu1) ... 192s Selecting previously unselected package cpp. 192s Preparing to unpack .../06-cpp_4%3a13.2.0-7ubuntu1_armhf.deb ... 192s Unpacking cpp (4:13.2.0-7ubuntu1) ... 192s Selecting previously unselected package libcc1-0:armhf. 192s Preparing to unpack .../07-libcc1-0_14.2.0-4ubuntu2~24.04_armhf.deb ... 192s Unpacking libcc1-0:armhf (14.2.0-4ubuntu2~24.04) ... 192s Selecting previously unselected package libgomp1:armhf. 192s Preparing to unpack .../08-libgomp1_14.2.0-4ubuntu2~24.04_armhf.deb ... 192s Unpacking libgomp1:armhf (14.2.0-4ubuntu2~24.04) ... 192s Selecting previously unselected package libatomic1:armhf. 192s Preparing to unpack .../09-libatomic1_14.2.0-4ubuntu2~24.04_armhf.deb ... 192s Unpacking libatomic1:armhf (14.2.0-4ubuntu2~24.04) ... 192s Selecting previously unselected package libasan8:armhf. 192s Preparing to unpack .../10-libasan8_14.2.0-4ubuntu2~24.04_armhf.deb ... 192s Unpacking libasan8:armhf (14.2.0-4ubuntu2~24.04) ... 192s Selecting previously unselected package libubsan1:armhf. 192s Preparing to unpack .../11-libubsan1_14.2.0-4ubuntu2~24.04_armhf.deb ... 192s Unpacking libubsan1:armhf (14.2.0-4ubuntu2~24.04) ... 192s Selecting previously unselected package libgcc-13-dev:armhf. 192s Preparing to unpack .../12-libgcc-13-dev_13.3.0-6ubuntu2~24.04_armhf.deb ... 192s Unpacking libgcc-13-dev:armhf (13.3.0-6ubuntu2~24.04) ... 192s Selecting previously unselected package gcc-13-arm-linux-gnueabihf. 192s Preparing to unpack .../13-gcc-13-arm-linux-gnueabihf_13.3.0-6ubuntu2~24.04_armhf.deb ... 192s Unpacking gcc-13-arm-linux-gnueabihf (13.3.0-6ubuntu2~24.04) ... 193s Selecting previously unselected package gcc-13. 193s Preparing to unpack .../14-gcc-13_13.3.0-6ubuntu2~24.04_armhf.deb ... 193s Unpacking gcc-13 (13.3.0-6ubuntu2~24.04) ... 193s Selecting previously unselected package gcc-arm-linux-gnueabihf. 193s Preparing to unpack .../15-gcc-arm-linux-gnueabihf_4%3a13.2.0-7ubuntu1_armhf.deb ... 193s Unpacking gcc-arm-linux-gnueabihf (4:13.2.0-7ubuntu1) ... 193s Selecting previously unselected package gcc. 193s Preparing to unpack .../16-gcc_4%3a13.2.0-7ubuntu1_armhf.deb ... 193s Unpacking gcc (4:13.2.0-7ubuntu1) ... 193s Selecting previously unselected package libc-dev-bin. 193s Preparing to unpack .../17-libc-dev-bin_2.39-0ubuntu8.4_armhf.deb ... 193s Unpacking libc-dev-bin (2.39-0ubuntu8.4) ... 193s Selecting previously unselected package linux-libc-dev:armhf. 193s Preparing to unpack .../18-linux-libc-dev_6.8.0-60.63_armhf.deb ... 193s Unpacking linux-libc-dev:armhf (6.8.0-60.63) ... 193s Selecting previously unselected package libcrypt-dev:armhf. 193s Preparing to unpack .../19-libcrypt-dev_1%3a4.4.36-4build1_armhf.deb ... 193s Unpacking libcrypt-dev:armhf (1:4.4.36-4build1) ... 193s Selecting previously unselected package rpcsvc-proto. 193s Preparing to unpack .../20-rpcsvc-proto_1.4.2-0ubuntu7_armhf.deb ... 193s Unpacking rpcsvc-proto (1.4.2-0ubuntu7) ... 193s Selecting previously unselected package libc6-dev:armhf. 193s Preparing to unpack .../21-libc6-dev_2.39-0ubuntu8.4_armhf.deb ... 193s Unpacking libc6-dev:armhf (2.39-0ubuntu8.4) ... 193s Selecting previously unselected package libstdc++-13-dev:armhf. 193s Preparing to unpack .../22-libstdc++-13-dev_13.3.0-6ubuntu2~24.04_armhf.deb ... 193s Unpacking libstdc++-13-dev:armhf (13.3.0-6ubuntu2~24.04) ... 194s Selecting previously unselected package g++-13-arm-linux-gnueabihf. 194s Preparing to unpack .../23-g++-13-arm-linux-gnueabihf_13.3.0-6ubuntu2~24.04_armhf.deb ... 194s Unpacking g++-13-arm-linux-gnueabihf (13.3.0-6ubuntu2~24.04) ... 194s Selecting previously unselected package g++-13. 194s Preparing to unpack .../24-g++-13_13.3.0-6ubuntu2~24.04_armhf.deb ... 194s Unpacking g++-13 (13.3.0-6ubuntu2~24.04) ... 194s Selecting previously unselected package g++-arm-linux-gnueabihf. 194s Preparing to unpack .../25-g++-arm-linux-gnueabihf_4%3a13.2.0-7ubuntu1_armhf.deb ... 194s Unpacking g++-arm-linux-gnueabihf (4:13.2.0-7ubuntu1) ... 194s Selecting previously unselected package g++. 194s Preparing to unpack .../26-g++_4%3a13.2.0-7ubuntu1_armhf.deb ... 194s Unpacking g++ (4:13.2.0-7ubuntu1) ... 194s Selecting previously unselected package libapt-pkg-dev:armhf. 194s Preparing to unpack .../27-libapt-pkg-dev_2.8.3_armhf.deb ... 194s Unpacking libapt-pkg-dev:armhf (2.8.3) ... 194s Selecting previously unselected package libpkgconf3:armhf. 194s Preparing to unpack .../28-libpkgconf3_1.8.1-2build1_armhf.deb ... 194s Unpacking libpkgconf3:armhf (1.8.1-2build1) ... 194s Selecting previously unselected package pkgconf-bin. 194s Preparing to unpack .../29-pkgconf-bin_1.8.1-2build1_armhf.deb ... 194s Unpacking pkgconf-bin (1.8.1-2build1) ... 194s Selecting previously unselected package pkgconf:armhf. 194s Preparing to unpack .../30-pkgconf_1.8.1-2build1_armhf.deb ... 194s Unpacking pkgconf:armhf (1.8.1-2build1) ... 194s Selecting previously unselected package pkg-config:armhf. 194s Preparing to unpack .../31-pkg-config_1.8.1-2build1_armhf.deb ... 194s Unpacking pkg-config:armhf (1.8.1-2build1) ... 194s Setting up linux-libc-dev:armhf (6.8.0-60.63) ... 194s Setting up libapt-pkg-dev:armhf (2.8.3) ... 194s Setting up libgomp1:armhf (14.2.0-4ubuntu2~24.04) ... 194s Setting up libpkgconf3:armhf (1.8.1-2build1) ... 194s Setting up rpcsvc-proto (1.4.2-0ubuntu7) ... 194s Setting up gcc-13-base:armhf (13.3.0-6ubuntu2~24.04) ... 194s Setting up libmpc3:armhf (1.3.1-1build1.1) ... 194s Setting up libatomic1:armhf (14.2.0-4ubuntu2~24.04) ... 194s Setting up pkgconf-bin (1.8.1-2build1) ... 194s Setting up libubsan1:armhf (14.2.0-4ubuntu2~24.04) ... 194s Setting up libcrypt-dev:armhf (1:4.4.36-4build1) ... 194s Setting up libasan8:armhf (14.2.0-4ubuntu2~24.04) ... 194s Setting up libisl23:armhf (0.26-3build1.1) ... 194s Setting up libc-dev-bin (2.39-0ubuntu8.4) ... 194s Setting up libcc1-0:armhf (14.2.0-4ubuntu2~24.04) ... 194s Setting up cpp-13-arm-linux-gnueabihf (13.3.0-6ubuntu2~24.04) ... 194s Setting up pkgconf:armhf (1.8.1-2build1) ... 194s Setting up pkg-config:armhf (1.8.1-2build1) ... 194s Setting up libgcc-13-dev:armhf (13.3.0-6ubuntu2~24.04) ... 194s Setting up libc6-dev:armhf (2.39-0ubuntu8.4) ... 194s Setting up cpp-arm-linux-gnueabihf (4:13.2.0-7ubuntu1) ... 194s Setting up libstdc++-13-dev:armhf (13.3.0-6ubuntu2~24.04) ... 194s Setting up cpp-13 (13.3.0-6ubuntu2~24.04) ... 194s Setting up gcc-13-arm-linux-gnueabihf (13.3.0-6ubuntu2~24.04) ... 194s Setting up gcc-13 (13.3.0-6ubuntu2~24.04) ... 194s Setting up cpp (4:13.2.0-7ubuntu1) ... 194s Setting up gcc-arm-linux-gnueabihf (4:13.2.0-7ubuntu1) ... 194s Setting up g++-13-arm-linux-gnueabihf (13.3.0-6ubuntu2~24.04) ... 194s Setting up g++-arm-linux-gnueabihf (4:13.2.0-7ubuntu1) ... 194s Setting up g++-13 (13.3.0-6ubuntu2~24.04) ... 194s Setting up gcc (4:13.2.0-7ubuntu1) ... 194s Setting up g++ (4:13.2.0-7ubuntu1) ... 194s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 194s Processing triggers for man-db (2.12.0-4build2) ... 195s Processing triggers for libc-bin (2.39-0ubuntu8.4) ... 203s autopkgtest [00:02:52]: test pkg-config-test: [----------------------- 206s build: OK 206s APT Version: 2.8.3 206s run: OK 206s autopkgtest [00:02:55]: test pkg-config-test: -----------------------] 210s autopkgtest [00:02:59]: test pkg-config-test: - - - - - - - - - - results - - - - - - - - - - 210s pkg-config-test PASS (superficial) 214s autopkgtest [00:03:03]: test run-tests: preparing testbed 244s autopkgtest [00:03:33]: testbed dpkg architecture: armhf 246s autopkgtest [00:03:35]: testbed apt version: 2.8.3 250s autopkgtest [00:03:39]: @@@@@@@@@@@@@@@@@@@@ test bed setup 252s autopkgtest [00:03:41]: testbed release detected to be: noble 260s autopkgtest [00:03:49]: updating testbed package index (apt update) 262s Get:1 http://ftpmaster.internal/ubuntu noble-proposed InRelease [265 kB] 263s Hit:2 http://ftpmaster.internal/ubuntu noble InRelease 263s Get:3 http://ftpmaster.internal/ubuntu noble-updates InRelease [126 kB] 263s Get:4 http://ftpmaster.internal/ubuntu noble-security InRelease [126 kB] 263s Get:5 http://ftpmaster.internal/ubuntu noble-proposed/main Sources [63.2 kB] 263s Get:6 http://ftpmaster.internal/ubuntu noble-proposed/universe Sources [67.0 kB] 263s Get:7 http://ftpmaster.internal/ubuntu noble-proposed/restricted Sources [32.2 kB] 263s Get:8 http://ftpmaster.internal/ubuntu noble-proposed/main armhf Packages [69.2 kB] 263s Get:9 http://ftpmaster.internal/ubuntu noble-proposed/main armhf c-n-f Metadata [2252 B] 263s Get:10 http://ftpmaster.internal/ubuntu noble-proposed/restricted armhf Packages [1888 B] 263s Get:11 http://ftpmaster.internal/ubuntu noble-proposed/restricted armhf c-n-f Metadata [116 B] 263s Get:12 http://ftpmaster.internal/ubuntu noble-proposed/universe armhf Packages [273 kB] 263s Get:13 http://ftpmaster.internal/ubuntu noble-proposed/universe armhf c-n-f Metadata [2608 B] 263s Get:14 http://ftpmaster.internal/ubuntu noble-proposed/multiverse armhf c-n-f Metadata [116 B] 263s Get:15 http://ftpmaster.internal/ubuntu noble-updates/main Sources [415 kB] 264s Get:16 http://ftpmaster.internal/ubuntu noble-updates/restricted Sources [37.1 kB] 264s Get:17 http://ftpmaster.internal/ubuntu noble-updates/main armhf Packages [584 kB] 264s Get:18 http://ftpmaster.internal/ubuntu noble-updates/restricted armhf Packages [5512 B] 264s Get:19 http://ftpmaster.internal/ubuntu noble-updates/universe armhf Packages [842 kB] 264s Get:20 http://ftpmaster.internal/ubuntu noble-security/main Sources [176 kB] 264s Get:21 http://ftpmaster.internal/ubuntu noble-security/main armhf Packages [352 kB] 265s Get:22 http://ftpmaster.internal/ubuntu noble-security/universe armhf Packages [627 kB] 267s Fetched 4066 kB in 3s (1432 kB/s) 268s Reading package lists... 275s autopkgtest [00:04:04]: upgrading testbed (apt dist-upgrade and autopurge) 277s Reading package lists... 278s Building dependency tree... 278s Reading state information... 278s Calculating upgrade...Starting pkgProblemResolver with broken count: 0 278s Starting 2 pkgProblemResolver with broken count: 0 278s Done 279s Entering ResolveByKeep 280s 280s The following packages will be upgraded: 280s apport apport-core-dump-handler libnss-systemd libpam-systemd 280s libsystemd-shared libsystemd0 libudev1 python3-apport python3-problem-report 280s systemd systemd-dev systemd-resolved systemd-sysv systemd-timesyncd udev 280s 15 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 280s Need to get 8978 kB of archives. 280s After this operation, 18.4 kB of additional disk space will be used. 280s Get:1 http://ftpmaster.internal/ubuntu noble-proposed/main armhf libnss-systemd armhf 255.4-1ubuntu8.9 [148 kB] 281s Get:2 http://ftpmaster.internal/ubuntu noble-proposed/main armhf systemd-dev all 255.4-1ubuntu8.9 [105 kB] 281s Get:3 http://ftpmaster.internal/ubuntu noble-proposed/main armhf systemd-timesyncd armhf 255.4-1ubuntu8.9 [36.0 kB] 281s Get:4 http://ftpmaster.internal/ubuntu noble-proposed/main armhf systemd-resolved armhf 255.4-1ubuntu8.9 [289 kB] 281s Get:5 http://ftpmaster.internal/ubuntu noble-proposed/main armhf libsystemd-shared armhf 255.4-1ubuntu8.9 [2012 kB] 282s Get:6 http://ftpmaster.internal/ubuntu noble-proposed/main armhf libsystemd0 armhf 255.4-1ubuntu8.9 [412 kB] 282s Get:7 http://ftpmaster.internal/ubuntu noble-proposed/main armhf systemd-sysv armhf 255.4-1ubuntu8.9 [11.9 kB] 282s Get:8 http://ftpmaster.internal/ubuntu noble-proposed/main armhf libpam-systemd armhf 255.4-1ubuntu8.9 [216 kB] 282s Get:9 http://ftpmaster.internal/ubuntu noble-proposed/main armhf systemd armhf 255.4-1ubuntu8.9 [3506 kB] 282s Get:10 http://ftpmaster.internal/ubuntu noble-proposed/main armhf udev armhf 255.4-1ubuntu8.9 [1852 kB] 283s Get:11 http://ftpmaster.internal/ubuntu noble-proposed/main armhf libudev1 armhf 255.4-1ubuntu8.9 [168 kB] 283s Get:12 http://ftpmaster.internal/ubuntu noble-updates/main armhf python3-problem-report all 2.28.1-0ubuntu3.7 [25.5 kB] 283s Get:13 http://ftpmaster.internal/ubuntu noble-updates/main armhf python3-apport all 2.28.1-0ubuntu3.7 [92.4 kB] 283s Get:14 http://ftpmaster.internal/ubuntu noble-updates/main armhf apport-core-dump-handler all 2.28.1-0ubuntu3.7 [18.5 kB] 283s Get:15 http://ftpmaster.internal/ubuntu noble-updates/main armhf apport all 2.28.1-0ubuntu3.7 [85.2 kB] 283s Fetched 8978 kB in 2s (3596 kB/s) 283s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 58040 files and directories currently installed.) 283s Preparing to unpack .../0-libnss-systemd_255.4-1ubuntu8.9_armhf.deb ... 283s Unpacking libnss-systemd:armhf (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 283s Preparing to unpack .../1-systemd-dev_255.4-1ubuntu8.9_all.deb ... 283s Unpacking systemd-dev (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 283s Preparing to unpack .../2-systemd-timesyncd_255.4-1ubuntu8.9_armhf.deb ... 283s Unpacking systemd-timesyncd (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 283s Preparing to unpack .../3-systemd-resolved_255.4-1ubuntu8.9_armhf.deb ... 283s Unpacking systemd-resolved (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 283s Preparing to unpack .../4-libsystemd-shared_255.4-1ubuntu8.9_armhf.deb ... 283s Unpacking libsystemd-shared:armhf (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 284s Preparing to unpack .../5-libsystemd0_255.4-1ubuntu8.9_armhf.deb ... 284s Unpacking libsystemd0:armhf (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 284s Setting up libsystemd0:armhf (255.4-1ubuntu8.9) ... 284s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 58040 files and directories currently installed.) 284s Preparing to unpack .../systemd-sysv_255.4-1ubuntu8.9_armhf.deb ... 284s Unpacking systemd-sysv (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 284s Preparing to unpack .../libpam-systemd_255.4-1ubuntu8.9_armhf.deb ... 284s Unpacking libpam-systemd:armhf (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 284s Preparing to unpack .../systemd_255.4-1ubuntu8.9_armhf.deb ... 284s Unpacking systemd (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 284s Preparing to unpack .../udev_255.4-1ubuntu8.9_armhf.deb ... 284s Unpacking udev (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 284s Preparing to unpack .../libudev1_255.4-1ubuntu8.9_armhf.deb ... 284s Unpacking libudev1:armhf (255.4-1ubuntu8.9) over (255.4-1ubuntu8.6) ... 284s Setting up libudev1:armhf (255.4-1ubuntu8.9) ... 284s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 58040 files and directories currently installed.) 284s Preparing to unpack .../python3-problem-report_2.28.1-0ubuntu3.7_all.deb ... 284s Unpacking python3-problem-report (2.28.1-0ubuntu3.7) over (2.28.1-0ubuntu3.6) ... 284s Preparing to unpack .../python3-apport_2.28.1-0ubuntu3.7_all.deb ... 285s Unpacking python3-apport (2.28.1-0ubuntu3.7) over (2.28.1-0ubuntu3.6) ... 285s Preparing to unpack .../apport-core-dump-handler_2.28.1-0ubuntu3.7_all.deb ... 285s Unpacking apport-core-dump-handler (2.28.1-0ubuntu3.7) over (2.28.1-0ubuntu3.6) ... 285s Preparing to unpack .../apport_2.28.1-0ubuntu3.7_all.deb ... 285s Unpacking apport (2.28.1-0ubuntu3.7) over (2.28.1-0ubuntu3.6) ... 285s Setting up python3-problem-report (2.28.1-0ubuntu3.7) ... 285s Setting up systemd-dev (255.4-1ubuntu8.9) ... 285s Setting up python3-apport (2.28.1-0ubuntu3.7) ... 285s Setting up libsystemd-shared:armhf (255.4-1ubuntu8.9) ... 285s Setting up systemd (255.4-1ubuntu8.9) ... 286s Setting up systemd-timesyncd (255.4-1ubuntu8.9) ... 286s Setting up udev (255.4-1ubuntu8.9) ... 287s Setting up systemd-resolved (255.4-1ubuntu8.9) ... 288s Setting up systemd-sysv (255.4-1ubuntu8.9) ... 288s Setting up libnss-systemd:armhf (255.4-1ubuntu8.9) ... 288s Setting up libpam-systemd:armhf (255.4-1ubuntu8.9) ... 288s Setting up apport-core-dump-handler (2.28.1-0ubuntu3.7) ... 289s Setting up apport (2.28.1-0ubuntu3.7) ... 289s apport-autoreport.service is a disabled or a static unit not running, not starting it. 289s Processing triggers for dbus (1.14.10-4ubuntu4.1) ... 289s Processing triggers for initramfs-tools (0.142ubuntu25.5) ... 289s Processing triggers for libc-bin (2.39-0ubuntu8.4) ... 290s Processing triggers for man-db (2.12.0-4build2) ... 293s Reading package lists... 293s Building dependency tree... 293s Reading state information... 294s Starting pkgProblemResolver with broken count: 0 294s Starting 2 pkgProblemResolver with broken count: 0 294s Done 295s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 297s autopkgtest [00:04:26]: rebooting testbed after setup commands that affected boot 363s Reading package lists... 363s Building dependency tree... 363s Reading state information... 364s Starting pkgProblemResolver with broken count: 0 364s Starting 2 pkgProblemResolver with broken count: 0 364s Done 365s The following NEW packages will be installed: 365s apt-doc aptitude aptitude-common autoconf automake autopoint autotools-dev 365s build-essential cmake cmake-data cpp cpp-13 cpp-13-arm-linux-gnueabihf 365s cpp-arm-linux-gnueabihf db-util db5.3-util debhelper debugedit dh-autoreconf 365s dh-strip-nondeterminism docbook-xml docbook-xsl doxygen dwz fakeroot 365s fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono g++ g++-13 365s g++-13-arm-linux-gnueabihf g++-arm-linux-gnueabihf gcc gcc-13 365s gcc-13-arm-linux-gnueabihf gcc-13-base gcc-arm-linux-gnueabihf gdb gettext 365s gnupg1 googletest gpgv1 graphviz intltool-debian libaom3 libapt-pkg-dev 365s libapt-pkg-doc libarchive-zip-perl libasan8 libatomic1 libbabeltrace1 365s libboost-iostreams1.83.0 libbz2-dev libc-dev-bin libc6-dbg libc6-dev 365s libcairo2 libcc1-0 libcdt5 libcgraph6 libclang-cpp18 libclang1-18 365s libcrypt-dev libcwidget4 libdatrie1 libdb-dev libdb5.3-dev libde265-0 365s libdebhelper-perl libdebuginfod-common libdebuginfod1t64 libdeflate0 365s libdw1t64 libevent-2.1-7t64 libfakeroot libfile-fcntllock-perl 365s libfile-stripnondeterminism-perl libfmt9 libfontconfig1 libfreetype6 libgc1 365s libgcc-13-dev libgcrypt20-dev libgd3 libgmp-dev libgmpxx4ldbl 365s libgnutls-dane0t64 libgnutls-openssl27t64 libgnutls28-dev libgomp1 365s libgpg-error-dev libgraphite2-3 libgts-0.7-5t64 libgvc6 libgvpr2 365s libharfbuzz0b libheif-plugin-aomdec libheif-plugin-libde265 libheif1 libice6 365s libidn2-dev libisl23 libjbig0 libjpeg-turbo8 libjpeg8 libjsoncpp25 365s liblab-gamut1 liblerc4 libllvm18 libltdl7 liblz4-dev liblzma-dev libmpc3 365s libosp5 libp11-kit-dev libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 365s libpathplan4 libpixman-1-0 libpkgconf3 libpod-parser-perl libpython3.12t64 365s librhash0 libseccomp-dev libsgmls-perl libsharpyuv0 libsigc++-2.0-0v5 libsm6 365s libsource-highlight-common libsource-highlight4t64 libstdc++-13-dev 365s libsub-override-perl libsyntax-keyword-try-perl libsystemd-dev 365s libtasn1-6-dev libthai-data libthai0 libtiff6 libtool libubsan1 libudev-dev 365s libunbound8 libwebp7 libxapian30 libxaw7 libxcb-render0 libxcb-shm0 libxmu6 365s libxpm4 libxrender1 libxs-parse-keyword-perl libxslt1.1 libxt6t64 365s libxxhash-dev libyaml-tiny-perl libzstd-dev linux-libc-dev m4 nettle-dev 365s ninja-build opensp pkg-config pkgconf pkgconf-bin po-debconf po4a 365s rpcsvc-proto sgml-base sgml-data stunnel4 triehash valgrind w3m x11-common 365s xml-core xsltproc zlib1g-dev 365s 0 upgraded, 179 newly installed, 0 to remove and 0 not upgraded. 365s Need to get 163 MB of archives. 365s After this operation, 577 MB of additional disk space will be used. 365s Get:1 http://ftpmaster.internal/ubuntu noble-updates/main armhf libdebuginfod-common all 0.190-1.1ubuntu0.1 [14.6 kB] 365s Get:2 http://ftpmaster.internal/ubuntu noble/main armhf sgml-base all 1.31 [11.4 kB] 365s Get:3 http://ftpmaster.internal/ubuntu noble/universe armhf stunnel4 armhf 3:5.72-1build2 [208 kB] 365s Get:4 http://ftpmaster.internal/ubuntu noble-updates/main armhf apt-doc all 2.8.3 [256 kB] 365s Get:5 http://ftpmaster.internal/ubuntu noble/universe armhf aptitude-common all 0.8.13-5ubuntu5 [1800 kB] 366s Get:6 http://ftpmaster.internal/ubuntu noble-updates/main armhf libboost-iostreams1.83.0 armhf 1.83.0-2.1ubuntu3.1 [257 kB] 367s Get:7 http://ftpmaster.internal/ubuntu noble/main armhf libsigc++-2.0-0v5 armhf 2.12.1-2 [11.0 kB] 367s Get:8 http://ftpmaster.internal/ubuntu noble/universe armhf libcwidget4 armhf 0.5.18-6build1 [317 kB] 367s Get:9 http://ftpmaster.internal/ubuntu noble/universe armhf libxapian30 armhf 1.4.22-1build1 [690 kB] 367s Get:10 http://ftpmaster.internal/ubuntu noble/universe armhf aptitude armhf 0.8.13-5ubuntu5 [1322 kB] 367s Get:11 http://ftpmaster.internal/ubuntu noble/main armhf m4 armhf 1.4.19-4build1 [235 kB] 367s Get:12 http://ftpmaster.internal/ubuntu noble/main armhf autoconf all 2.71-3 [339 kB] 367s Get:13 http://ftpmaster.internal/ubuntu noble/main armhf autotools-dev all 20220109.1 [44.9 kB] 367s Get:14 http://ftpmaster.internal/ubuntu noble/main armhf automake all 1:1.16.5-1.3ubuntu1 [558 kB] 368s Get:15 http://ftpmaster.internal/ubuntu noble/main armhf autopoint all 0.21-14ubuntu2 [422 kB] 368s Get:16 http://ftpmaster.internal/ubuntu noble-updates/main armhf libc-dev-bin armhf 2.39-0ubuntu8.4 [19.1 kB] 368s Get:17 http://ftpmaster.internal/ubuntu noble-updates/main armhf linux-libc-dev armhf 6.8.0-60.63 [1833 kB] 368s Get:18 http://ftpmaster.internal/ubuntu noble/main armhf libcrypt-dev armhf 1:4.4.36-4build1 [120 kB] 368s Get:19 http://ftpmaster.internal/ubuntu noble/main armhf rpcsvc-proto armhf 1.4.2-0ubuntu7 [62.2 kB] 368s Get:20 http://ftpmaster.internal/ubuntu noble-updates/main armhf libc6-dev armhf 2.39-0ubuntu8.4 [1351 kB] 369s Get:21 http://ftpmaster.internal/ubuntu noble-updates/main armhf gcc-13-base armhf 13.3.0-6ubuntu2~24.04 [51.4 kB] 369s Get:22 http://ftpmaster.internal/ubuntu noble-updates/main armhf libisl23 armhf 0.26-3build1.1 [544 kB] 369s Get:23 http://ftpmaster.internal/ubuntu noble-updates/main armhf libmpc3 armhf 1.3.1-1build1.1 [46.8 kB] 369s Get:24 http://ftpmaster.internal/ubuntu noble-updates/main armhf cpp-13-arm-linux-gnueabihf armhf 13.3.0-6ubuntu2~24.04 [8259 kB] 373s Get:25 http://ftpmaster.internal/ubuntu noble-updates/main armhf cpp-13 armhf 13.3.0-6ubuntu2~24.04 [1038 B] 373s Get:26 http://ftpmaster.internal/ubuntu noble/main armhf cpp-arm-linux-gnueabihf armhf 4:13.2.0-7ubuntu1 [5320 B] 373s Get:27 http://ftpmaster.internal/ubuntu noble/main armhf cpp armhf 4:13.2.0-7ubuntu1 [22.4 kB] 373s Get:28 http://ftpmaster.internal/ubuntu noble-updates/main armhf libcc1-0 armhf 14.2.0-4ubuntu2~24.04 [43.4 kB] 373s Get:29 http://ftpmaster.internal/ubuntu noble-updates/main armhf libgomp1 armhf 14.2.0-4ubuntu2~24.04 [125 kB] 373s Get:30 http://ftpmaster.internal/ubuntu noble-updates/main armhf libatomic1 armhf 14.2.0-4ubuntu2~24.04 [7888 B] 373s Get:31 http://ftpmaster.internal/ubuntu noble-updates/main armhf libasan8 armhf 14.2.0-4ubuntu2~24.04 [2941 kB] 375s Get:32 http://ftpmaster.internal/ubuntu noble-updates/main armhf libubsan1 armhf 14.2.0-4ubuntu2~24.04 [1154 kB] 376s Get:33 http://ftpmaster.internal/ubuntu noble-updates/main armhf libgcc-13-dev armhf 13.3.0-6ubuntu2~24.04 [899 kB] 376s Get:34 http://ftpmaster.internal/ubuntu noble-updates/main armhf gcc-13-arm-linux-gnueabihf armhf 13.3.0-6ubuntu2~24.04 [16.1 MB] 384s Get:35 http://ftpmaster.internal/ubuntu noble-updates/main armhf gcc-13 armhf 13.3.0-6ubuntu2~24.04 [465 kB] 384s Get:36 http://ftpmaster.internal/ubuntu noble/main armhf gcc-arm-linux-gnueabihf armhf 4:13.2.0-7ubuntu1 [1220 B] 384s Get:37 http://ftpmaster.internal/ubuntu noble/main armhf gcc armhf 4:13.2.0-7ubuntu1 [5022 B] 384s Get:38 http://ftpmaster.internal/ubuntu noble-updates/main armhf libstdc++-13-dev armhf 13.3.0-6ubuntu2~24.04 [2509 kB] 385s Get:39 http://ftpmaster.internal/ubuntu noble-updates/main armhf g++-13-arm-linux-gnueabihf armhf 13.3.0-6ubuntu2~24.04 [9441 kB] 387s Get:40 http://ftpmaster.internal/ubuntu noble-updates/main armhf g++-13 armhf 13.3.0-6ubuntu2~24.04 [16.1 kB] 387s Get:41 http://ftpmaster.internal/ubuntu noble/main armhf g++-arm-linux-gnueabihf armhf 4:13.2.0-7ubuntu1 [966 B] 387s Get:42 http://ftpmaster.internal/ubuntu noble/main armhf g++ armhf 4:13.2.0-7ubuntu1 [1090 B] 387s Get:43 http://ftpmaster.internal/ubuntu noble/main armhf build-essential armhf 12.10ubuntu1 [4928 B] 387s Get:44 http://ftpmaster.internal/ubuntu noble/main armhf libjsoncpp25 armhf 1.9.5-6build1 [75.3 kB] 387s Get:45 http://ftpmaster.internal/ubuntu noble/main armhf librhash0 armhf 1.4.3-3build1 [143 kB] 388s Get:46 http://ftpmaster.internal/ubuntu noble/main armhf cmake-data all 3.28.3-1build7 [2155 kB] 388s Get:47 http://ftpmaster.internal/ubuntu noble/main armhf cmake armhf 3.28.3-1build7 [6049 kB] 391s Get:48 http://ftpmaster.internal/ubuntu noble/main armhf db5.3-util armhf 5.3.28+dfsg2-7 [70.6 kB] 391s Get:49 http://ftpmaster.internal/ubuntu noble/main armhf libdebhelper-perl all 13.14.1ubuntu5 [89.8 kB] 391s Get:50 http://ftpmaster.internal/ubuntu noble/main armhf libtool all 2.4.7-7build1 [166 kB] 391s Get:51 http://ftpmaster.internal/ubuntu noble/main armhf dh-autoreconf all 20 [16.1 kB] 391s Get:52 http://ftpmaster.internal/ubuntu noble/main armhf libarchive-zip-perl all 1.68-1 [90.2 kB] 391s Get:53 http://ftpmaster.internal/ubuntu noble/main armhf libsub-override-perl all 0.10-1 [10.0 kB] 391s Get:54 http://ftpmaster.internal/ubuntu noble/main armhf libfile-stripnondeterminism-perl all 1.13.1-1 [18.1 kB] 391s Get:55 http://ftpmaster.internal/ubuntu noble/main armhf dh-strip-nondeterminism all 1.13.1-1 [5362 B] 391s Get:56 http://ftpmaster.internal/ubuntu noble-updates/main armhf libdw1t64 armhf 0.190-1.1ubuntu0.1 [235 kB] 391s Get:57 http://ftpmaster.internal/ubuntu noble/main armhf debugedit armhf 1:5.0-5build2 [42.3 kB] 391s Get:58 http://ftpmaster.internal/ubuntu noble/main armhf dwz armhf 0.15-1build6 [116 kB] 391s Get:59 http://ftpmaster.internal/ubuntu noble/main armhf gettext armhf 0.21-14ubuntu2 [800 kB] 391s Get:60 http://ftpmaster.internal/ubuntu noble/main armhf intltool-debian all 0.35.0+20060710.6 [23.2 kB] 391s Get:61 http://ftpmaster.internal/ubuntu noble/main armhf po-debconf all 1.0.21+nmu1 [233 kB] 391s Get:62 http://ftpmaster.internal/ubuntu noble/main armhf debhelper all 13.14.1ubuntu5 [869 kB] 392s Get:63 http://ftpmaster.internal/ubuntu noble/main armhf xml-core all 0.19 [20.3 kB] 392s Get:64 http://ftpmaster.internal/ubuntu noble/main armhf sgml-data all 2.0.11+nmu1 [171 kB] 392s Get:65 http://ftpmaster.internal/ubuntu noble/main armhf docbook-xml all 4.5-12 [74.6 kB] 392s Get:66 http://ftpmaster.internal/ubuntu noble/universe armhf docbook-xsl all 1.79.2+dfsg-7 [1070 kB] 392s Get:67 http://ftpmaster.internal/ubuntu noble-updates/main armhf libllvm18 armhf 1:18.1.3-1ubuntu1 [26.7 MB] 404s Get:68 http://ftpmaster.internal/ubuntu noble-updates/main armhf libclang-cpp18 armhf 1:18.1.3-1ubuntu1 [12.8 MB] 410s Get:69 http://ftpmaster.internal/ubuntu noble-updates/main armhf libclang1-18 armhf 1:18.1.3-1ubuntu1 [7395 kB] 413s Get:70 http://ftpmaster.internal/ubuntu noble/universe armhf libfmt9 armhf 9.1.0+ds1-2 [55.2 kB] 413s Get:71 http://ftpmaster.internal/ubuntu noble/universe armhf doxygen armhf 1.9.8+ds-2build5 [4881 kB] 414s Get:72 http://ftpmaster.internal/ubuntu noble/main armhf libfakeroot armhf 1.33-1 [28.7 kB] 414s Get:73 http://ftpmaster.internal/ubuntu noble/main armhf fakeroot armhf 1.33-1 [68.6 kB] 414s Get:74 http://ftpmaster.internal/ubuntu noble/main armhf libfreetype6 armhf 2.13.2+dfsg-1build3 [331 kB] 415s Get:75 http://ftpmaster.internal/ubuntu noble/main armhf fonts-dejavu-mono all 2.37-8 [502 kB] 415s Get:76 http://ftpmaster.internal/ubuntu noble/main armhf fonts-dejavu-core all 2.37-8 [835 kB] 415s Get:77 http://ftpmaster.internal/ubuntu noble/main armhf fontconfig-config armhf 2.15.0-1.1ubuntu2 [37.4 kB] 415s Get:78 http://ftpmaster.internal/ubuntu noble/main armhf libfontconfig1 armhf 2.15.0-1.1ubuntu2 [113 kB] 415s Get:79 http://ftpmaster.internal/ubuntu noble/main armhf fontconfig armhf 2.15.0-1.1ubuntu2 [189 kB] 415s Get:80 http://ftpmaster.internal/ubuntu noble/main armhf libbabeltrace1 armhf 1.5.11-3build3 [154 kB] 415s Get:81 http://ftpmaster.internal/ubuntu noble-updates/main armhf libdebuginfod1t64 armhf 0.190-1.1ubuntu0.1 [15.8 kB] 415s Get:82 http://ftpmaster.internal/ubuntu noble-updates/main armhf libpython3.12t64 armhf 3.12.3-1ubuntu0.5 [2057 kB] 416s Get:83 http://ftpmaster.internal/ubuntu noble/main armhf libsource-highlight-common all 3.1.9-4.3build1 [64.2 kB] 416s Get:84 http://ftpmaster.internal/ubuntu noble/main armhf libsource-highlight4t64 armhf 3.1.9-4.3build1 [306 kB] 416s Get:85 http://ftpmaster.internal/ubuntu noble-updates/main armhf libc6-dbg armhf 2.39-0ubuntu8.4 [6011 kB] 418s Get:86 http://ftpmaster.internal/ubuntu noble/main armhf gdb armhf 15.0.50.20240403-0ubuntu1 [3852 kB] 418s Get:87 http://ftpmaster.internal/ubuntu noble/universe armhf gpgv1 armhf 1.4.23-2 [159 kB] 418s Get:88 http://ftpmaster.internal/ubuntu noble/universe armhf gnupg1 armhf 1.4.23-2 [547 kB] 418s Get:89 http://ftpmaster.internal/ubuntu noble/universe armhf googletest all 1.14.0-1 [521 kB] 419s Get:90 http://ftpmaster.internal/ubuntu noble-updates/universe armhf libcdt5 armhf 2.42.2-9ubuntu0.1 [18.9 kB] 419s Get:91 http://ftpmaster.internal/ubuntu noble-updates/universe armhf libcgraph6 armhf 2.42.2-9ubuntu0.1 [37.6 kB] 419s Get:92 http://ftpmaster.internal/ubuntu noble/main armhf libsharpyuv0 armhf 1.3.2-0.4build3 [13.6 kB] 419s Get:93 http://ftpmaster.internal/ubuntu noble-updates/main armhf libaom3 armhf 3.8.2-2ubuntu0.1 [1682 kB] 419s Get:94 http://ftpmaster.internal/ubuntu noble-updates/main armhf libheif-plugin-aomdec armhf 1.17.6-1ubuntu4.1 [10.0 kB] 419s Get:95 http://ftpmaster.internal/ubuntu noble/main armhf libde265-0 armhf 1.0.15-1build3 [158 kB] 419s Get:96 http://ftpmaster.internal/ubuntu noble-updates/main armhf libheif-plugin-libde265 armhf 1.17.6-1ubuntu4.1 [10.3 kB] 419s Get:97 http://ftpmaster.internal/ubuntu noble-updates/main armhf libheif1 armhf 1.17.6-1ubuntu4.1 [266 kB] 419s Get:98 http://ftpmaster.internal/ubuntu noble/main armhf libjpeg-turbo8 armhf 2.1.5-2ubuntu2 [125 kB] 419s Get:99 http://ftpmaster.internal/ubuntu noble/main armhf libjpeg8 armhf 8c-2ubuntu11 [2148 B] 419s Get:100 http://ftpmaster.internal/ubuntu noble-updates/main armhf libdeflate0 armhf 1.19-1build1.1 [41.5 kB] 419s Get:101 http://ftpmaster.internal/ubuntu noble/main armhf libjbig0 armhf 2.1-6.1ubuntu2 [24.9 kB] 419s Get:102 http://ftpmaster.internal/ubuntu noble/main armhf liblerc4 armhf 4.0.0+ds-4ubuntu2 [151 kB] 419s Get:103 http://ftpmaster.internal/ubuntu noble/main armhf libwebp7 armhf 1.3.2-0.4build3 [183 kB] 419s Get:104 http://ftpmaster.internal/ubuntu noble-updates/main armhf libtiff6 armhf 4.5.1+git230720-4ubuntu2.2 [178 kB] 419s Get:105 http://ftpmaster.internal/ubuntu noble/main armhf libxpm4 armhf 1:3.5.17-1build2 [30.1 kB] 419s Get:106 http://ftpmaster.internal/ubuntu noble/main armhf libgd3 armhf 2.3.3-9ubuntu5 [108 kB] 420s Get:107 http://ftpmaster.internal/ubuntu noble/universe armhf libgts-0.7-5t64 armhf 0.7.6+darcs121130-5.2build1 [139 kB] 420s Get:108 http://ftpmaster.internal/ubuntu noble/main armhf libpixman-1-0 armhf 0.42.2-1build1 [193 kB] 420s Get:109 http://ftpmaster.internal/ubuntu noble/main armhf libxcb-render0 armhf 1.15-1ubuntu2 [15.3 kB] 420s Get:110 http://ftpmaster.internal/ubuntu noble/main armhf libxcb-shm0 armhf 1.15-1ubuntu2 [5772 B] 420s Get:111 http://ftpmaster.internal/ubuntu noble/main armhf libxrender1 armhf 1:0.9.10-1.1build1 [16.0 kB] 420s Get:112 http://ftpmaster.internal/ubuntu noble/main armhf libcairo2 armhf 1.18.0-3build1 [482 kB] 420s Get:113 http://ftpmaster.internal/ubuntu noble/main armhf libltdl7 armhf 2.4.7-7build1 [37.6 kB] 420s Get:114 http://ftpmaster.internal/ubuntu noble/main armhf libgraphite2-3 armhf 1.3.14-2build1 [64.6 kB] 420s Get:115 http://ftpmaster.internal/ubuntu noble/main armhf libharfbuzz0b armhf 8.3.0-2build2 [446 kB] 420s Get:116 http://ftpmaster.internal/ubuntu noble/main armhf libthai-data all 0.1.29-2build1 [158 kB] 420s Get:117 http://ftpmaster.internal/ubuntu noble/main armhf libdatrie1 armhf 0.2.13-3build1 [15.7 kB] 420s Get:118 http://ftpmaster.internal/ubuntu noble/main armhf libthai0 armhf 0.1.29-2build1 [15.2 kB] 420s Get:119 http://ftpmaster.internal/ubuntu noble/main armhf libpango-1.0-0 armhf 1.52.1+ds-1build1 [207 kB] 420s Get:120 http://ftpmaster.internal/ubuntu noble/main armhf libpangoft2-1.0-0 armhf 1.52.1+ds-1build1 [36.5 kB] 420s Get:121 http://ftpmaster.internal/ubuntu noble/main armhf libpangocairo-1.0-0 armhf 1.52.1+ds-1build1 [25.0 kB] 420s Get:122 http://ftpmaster.internal/ubuntu noble-updates/universe armhf libpathplan4 armhf 2.42.2-9ubuntu0.1 [21.7 kB] 420s Get:123 http://ftpmaster.internal/ubuntu noble-updates/universe armhf libgvc6 armhf 2.42.2-9ubuntu0.1 [618 kB] 420s Get:124 http://ftpmaster.internal/ubuntu noble-updates/universe armhf libgvpr2 armhf 2.42.2-9ubuntu0.1 [158 kB] 420s Get:125 http://ftpmaster.internal/ubuntu noble-updates/universe armhf liblab-gamut1 armhf 2.42.2-9ubuntu0.1 [1870 kB] 420s Get:126 http://ftpmaster.internal/ubuntu noble/main armhf x11-common all 1:7.7+23ubuntu3 [21.7 kB] 420s Get:127 http://ftpmaster.internal/ubuntu noble/main armhf libice6 armhf 2:1.0.10-1build3 [35.4 kB] 420s Get:128 http://ftpmaster.internal/ubuntu noble/main armhf libsm6 armhf 2:1.2.3-1build3 [14.1 kB] 420s Get:129 http://ftpmaster.internal/ubuntu noble/main armhf libxt6t64 armhf 1:1.2.1-1.2build1 [145 kB] 420s Get:130 http://ftpmaster.internal/ubuntu noble/main armhf libxmu6 armhf 2:1.1.3-3build2 [40.4 kB] 420s Get:131 http://ftpmaster.internal/ubuntu noble/main armhf libxaw7 armhf 2:1.0.14-1build2 [153 kB] 420s Get:132 http://ftpmaster.internal/ubuntu noble-updates/universe armhf graphviz armhf 2.42.2-9ubuntu0.1 [539 kB] 421s Get:133 http://ftpmaster.internal/ubuntu noble-updates/main armhf libapt-pkg-dev armhf 2.8.3 [118 kB] 421s Get:134 http://ftpmaster.internal/ubuntu noble-updates/main armhf libapt-pkg-doc all 2.8.3 [926 kB] 421s Get:135 http://ftpmaster.internal/ubuntu noble-updates/main armhf libbz2-dev armhf 1.0.8-5.1build0.1 [30.5 kB] 421s Get:136 http://ftpmaster.internal/ubuntu noble/main armhf libevent-2.1-7t64 armhf 2.1.12-stable-9ubuntu2 [127 kB] 421s Get:137 http://ftpmaster.internal/ubuntu noble/main armhf libfile-fcntllock-perl armhf 0.22-4ubuntu5 [30.3 kB] 421s Get:138 http://ftpmaster.internal/ubuntu noble/main armhf libgc1 armhf 1:8.2.6-1build1 [80.8 kB] 421s Get:139 http://ftpmaster.internal/ubuntu noble-updates/main armhf libgpg-error-dev armhf 1.47-3build2.1 [119 kB] 421s Get:140 http://ftpmaster.internal/ubuntu noble/main armhf libgcrypt20-dev armhf 1.10.3-2build1 [524 kB] 421s Get:141 http://ftpmaster.internal/ubuntu noble-updates/main armhf libgmpxx4ldbl armhf 2:6.3.0+dfsg-2ubuntu6.1 [9044 B] 421s Get:142 http://ftpmaster.internal/ubuntu noble-updates/main armhf libgmp-dev armhf 2:6.3.0+dfsg-2ubuntu6.1 [289 kB] 421s Get:143 http://ftpmaster.internal/ubuntu noble-updates/main armhf libunbound8 armhf 1.19.2-1ubuntu3.4 [410 kB] 421s Get:144 http://ftpmaster.internal/ubuntu noble-updates/main armhf libgnutls-dane0t64 armhf 3.8.3-1.1ubuntu3.3 [33.3 kB] 421s Get:145 http://ftpmaster.internal/ubuntu noble-updates/main armhf libgnutls-openssl27t64 armhf 3.8.3-1.1ubuntu3.3 [33.5 kB] 421s Get:146 http://ftpmaster.internal/ubuntu noble-updates/main armhf libidn2-dev armhf 2.3.7-2build1.1 [115 kB] 421s Get:147 http://ftpmaster.internal/ubuntu noble-updates/main armhf libp11-kit-dev armhf 0.25.3-4ubuntu2.1 [22.7 kB] 421s Get:148 http://ftpmaster.internal/ubuntu noble-updates/main armhf libtasn1-6-dev armhf 4.19.0-3ubuntu0.24.04.1 [85.7 kB] 421s Get:149 http://ftpmaster.internal/ubuntu noble-updates/main armhf nettle-dev armhf 3.9.1-2.2build1.1 [1155 kB] 421s Get:150 http://ftpmaster.internal/ubuntu noble-updates/main armhf libgnutls28-dev armhf 3.8.3-1.1ubuntu3.3 [1005 kB] 421s Get:151 http://ftpmaster.internal/ubuntu noble/universe armhf libosp5 armhf 1.5.2-15ubuntu2 [645 kB] 421s Get:152 http://ftpmaster.internal/ubuntu noble/main armhf libpkgconf3 armhf 1.8.1-2build1 [26.3 kB] 421s Get:153 http://ftpmaster.internal/ubuntu noble/main armhf libpod-parser-perl all 1.67-1 [80.6 kB] 421s Get:154 http://ftpmaster.internal/ubuntu noble-updates/main armhf libseccomp-dev armhf 2.5.5-1ubuntu3.1 [87.1 kB] 421s Get:155 http://ftpmaster.internal/ubuntu noble/universe armhf libsgmls-perl all 1.03ii-38 [22.1 kB] 421s Get:156 http://ftpmaster.internal/ubuntu noble/main armhf libxs-parse-keyword-perl armhf 0.39-1build3 [52.0 kB] 421s Get:157 http://ftpmaster.internal/ubuntu noble/main armhf libsyntax-keyword-try-perl armhf 0.29-1build3 [23.8 kB] 421s Get:158 http://ftpmaster.internal/ubuntu noble-proposed/main armhf libsystemd-dev armhf 255.4-1ubuntu8.9 [1202 kB] 421s Get:159 http://ftpmaster.internal/ubuntu noble-proposed/main armhf libudev-dev armhf 255.4-1ubuntu8.9 [22.0 kB] 421s Get:160 http://ftpmaster.internal/ubuntu noble-updates/main armhf libxslt1.1 armhf 1.1.39-0exp1ubuntu0.24.04.2 [150 kB] 421s Get:161 http://ftpmaster.internal/ubuntu noble/main armhf libxxhash-dev armhf 0.8.2-2build1 [89.9 kB] 421s Get:162 http://ftpmaster.internal/ubuntu noble/main armhf libyaml-tiny-perl all 1.74-1 [25.3 kB] 421s Get:163 http://ftpmaster.internal/ubuntu noble-updates/main armhf libzstd-dev armhf 1.5.5+dfsg2-2build1.1 [329 kB] 421s Get:164 http://ftpmaster.internal/ubuntu noble/universe armhf ninja-build armhf 1.11.1-2 [130 kB] 421s Get:165 http://ftpmaster.internal/ubuntu noble/universe armhf opensp armhf 1.5.2-15ubuntu2 [139 kB] 421s Get:166 http://ftpmaster.internal/ubuntu noble/main armhf pkgconf-bin armhf 1.8.1-2build1 [20.7 kB] 421s Get:167 http://ftpmaster.internal/ubuntu noble/main armhf pkgconf armhf 1.8.1-2build1 [16.8 kB] 421s Get:168 http://ftpmaster.internal/ubuntu noble/main armhf pkg-config armhf 1.8.1-2build1 [7264 B] 421s Get:169 http://ftpmaster.internal/ubuntu noble/universe armhf po4a all 0.69-1 [2184 kB] 422s Get:170 http://ftpmaster.internal/ubuntu noble/universe armhf triehash all 0.3-3 [12.3 kB] 422s Get:171 http://ftpmaster.internal/ubuntu noble/main armhf valgrind armhf 1:3.22.0-0ubuntu3 [8907 kB] 422s Get:172 http://ftpmaster.internal/ubuntu noble/main armhf w3m armhf 0.5.3+git20230121-2ubuntu5 [1078 kB] 422s Get:173 http://ftpmaster.internal/ubuntu noble-updates/main armhf xsltproc armhf 1.1.39-0exp1ubuntu0.24.04.2 [15.1 kB] 422s Get:174 http://ftpmaster.internal/ubuntu noble-updates/main armhf zlib1g-dev armhf 1:1.3.dfsg-3.1ubuntu2.1 [880 kB] 422s Get:175 http://ftpmaster.internal/ubuntu noble/main armhf db-util all 1:5.3.21ubuntu2 [2412 B] 422s Get:176 http://ftpmaster.internal/ubuntu noble/main armhf libdb5.3-dev armhf 5.3.28+dfsg2-7 [775 kB] 422s Get:177 http://ftpmaster.internal/ubuntu noble/main armhf libdb-dev armhf 1:5.3.21ubuntu2 [1914 B] 422s Get:178 http://ftpmaster.internal/ubuntu noble-updates/main armhf liblz4-dev armhf 1.9.4-1build1.1 [79.4 kB] 422s Get:179 http://ftpmaster.internal/ubuntu noble-updates/main armhf liblzma-dev armhf 5.6.1+really5.4.5-1ubuntu0.2 [165 kB] 423s Preconfiguring packages ... 423s Fetched 163 MB in 58s (2828 kB/s) 423s Selecting previously unselected package libdebuginfod-common. 423s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 58040 files and directories currently installed.) 423s Preparing to unpack .../000-libdebuginfod-common_0.190-1.1ubuntu0.1_all.deb ... 423s Unpacking libdebuginfod-common (0.190-1.1ubuntu0.1) ... 423s Selecting previously unselected package sgml-base. 423s Preparing to unpack .../001-sgml-base_1.31_all.deb ... 423s Unpacking sgml-base (1.31) ... 423s Selecting previously unselected package stunnel4. 423s Preparing to unpack .../002-stunnel4_3%3a5.72-1build2_armhf.deb ... 423s Unpacking stunnel4 (3:5.72-1build2) ... 423s Selecting previously unselected package apt-doc. 423s Preparing to unpack .../003-apt-doc_2.8.3_all.deb ... 423s Unpacking apt-doc (2.8.3) ... 423s Selecting previously unselected package aptitude-common. 423s Preparing to unpack .../004-aptitude-common_0.8.13-5ubuntu5_all.deb ... 423s Unpacking aptitude-common (0.8.13-5ubuntu5) ... 424s Selecting previously unselected package libboost-iostreams1.83.0:armhf. 424s Preparing to unpack .../005-libboost-iostreams1.83.0_1.83.0-2.1ubuntu3.1_armhf.deb ... 424s Unpacking libboost-iostreams1.83.0:armhf (1.83.0-2.1ubuntu3.1) ... 424s Selecting previously unselected package libsigc++-2.0-0v5:armhf. 424s Preparing to unpack .../006-libsigc++-2.0-0v5_2.12.1-2_armhf.deb ... 424s Unpacking libsigc++-2.0-0v5:armhf (2.12.1-2) ... 424s Selecting previously unselected package libcwidget4:armhf. 424s Preparing to unpack .../007-libcwidget4_0.5.18-6build1_armhf.deb ... 424s Unpacking libcwidget4:armhf (0.5.18-6build1) ... 424s Selecting previously unselected package libxapian30:armhf. 424s Preparing to unpack .../008-libxapian30_1.4.22-1build1_armhf.deb ... 424s Unpacking libxapian30:armhf (1.4.22-1build1) ... 424s Selecting previously unselected package aptitude. 424s Preparing to unpack .../009-aptitude_0.8.13-5ubuntu5_armhf.deb ... 424s Unpacking aptitude (0.8.13-5ubuntu5) ... 424s Selecting previously unselected package m4. 424s Preparing to unpack .../010-m4_1.4.19-4build1_armhf.deb ... 424s Unpacking m4 (1.4.19-4build1) ... 424s Selecting previously unselected package autoconf. 424s Preparing to unpack .../011-autoconf_2.71-3_all.deb ... 424s Unpacking autoconf (2.71-3) ... 424s Selecting previously unselected package autotools-dev. 424s Preparing to unpack .../012-autotools-dev_20220109.1_all.deb ... 424s Unpacking autotools-dev (20220109.1) ... 424s Selecting previously unselected package automake. 424s Preparing to unpack .../013-automake_1%3a1.16.5-1.3ubuntu1_all.deb ... 424s Unpacking automake (1:1.16.5-1.3ubuntu1) ... 424s Selecting previously unselected package autopoint. 424s Preparing to unpack .../014-autopoint_0.21-14ubuntu2_all.deb ... 424s Unpacking autopoint (0.21-14ubuntu2) ... 424s Selecting previously unselected package libc-dev-bin. 424s Preparing to unpack .../015-libc-dev-bin_2.39-0ubuntu8.4_armhf.deb ... 424s Unpacking libc-dev-bin (2.39-0ubuntu8.4) ... 424s Selecting previously unselected package linux-libc-dev:armhf. 424s Preparing to unpack .../016-linux-libc-dev_6.8.0-60.63_armhf.deb ... 424s Unpacking linux-libc-dev:armhf (6.8.0-60.63) ... 424s Selecting previously unselected package libcrypt-dev:armhf. 424s Preparing to unpack .../017-libcrypt-dev_1%3a4.4.36-4build1_armhf.deb ... 424s Unpacking libcrypt-dev:armhf (1:4.4.36-4build1) ... 424s Selecting previously unselected package rpcsvc-proto. 424s Preparing to unpack .../018-rpcsvc-proto_1.4.2-0ubuntu7_armhf.deb ... 424s Unpacking rpcsvc-proto (1.4.2-0ubuntu7) ... 424s Selecting previously unselected package libc6-dev:armhf. 424s Preparing to unpack .../019-libc6-dev_2.39-0ubuntu8.4_armhf.deb ... 424s Unpacking libc6-dev:armhf (2.39-0ubuntu8.4) ... 425s Selecting previously unselected package gcc-13-base:armhf. 425s Preparing to unpack .../020-gcc-13-base_13.3.0-6ubuntu2~24.04_armhf.deb ... 425s Unpacking gcc-13-base:armhf (13.3.0-6ubuntu2~24.04) ... 425s Selecting previously unselected package libisl23:armhf. 425s Preparing to unpack .../021-libisl23_0.26-3build1.1_armhf.deb ... 425s Unpacking libisl23:armhf (0.26-3build1.1) ... 425s Selecting previously unselected package libmpc3:armhf. 425s Preparing to unpack .../022-libmpc3_1.3.1-1build1.1_armhf.deb ... 425s Unpacking libmpc3:armhf (1.3.1-1build1.1) ... 425s Selecting previously unselected package cpp-13-arm-linux-gnueabihf. 425s Preparing to unpack .../023-cpp-13-arm-linux-gnueabihf_13.3.0-6ubuntu2~24.04_armhf.deb ... 425s Unpacking cpp-13-arm-linux-gnueabihf (13.3.0-6ubuntu2~24.04) ... 425s Selecting previously unselected package cpp-13. 425s Preparing to unpack .../024-cpp-13_13.3.0-6ubuntu2~24.04_armhf.deb ... 425s Unpacking cpp-13 (13.3.0-6ubuntu2~24.04) ... 425s Selecting previously unselected package cpp-arm-linux-gnueabihf. 425s Preparing to unpack .../025-cpp-arm-linux-gnueabihf_4%3a13.2.0-7ubuntu1_armhf.deb ... 425s Unpacking cpp-arm-linux-gnueabihf (4:13.2.0-7ubuntu1) ... 425s Selecting previously unselected package cpp. 425s Preparing to unpack .../026-cpp_4%3a13.2.0-7ubuntu1_armhf.deb ... 425s Unpacking cpp (4:13.2.0-7ubuntu1) ... 425s Selecting previously unselected package libcc1-0:armhf. 425s Preparing to unpack .../027-libcc1-0_14.2.0-4ubuntu2~24.04_armhf.deb ... 425s Unpacking libcc1-0:armhf (14.2.0-4ubuntu2~24.04) ... 425s Selecting previously unselected package libgomp1:armhf. 425s Preparing to unpack .../028-libgomp1_14.2.0-4ubuntu2~24.04_armhf.deb ... 425s Unpacking libgomp1:armhf (14.2.0-4ubuntu2~24.04) ... 425s Selecting previously unselected package libatomic1:armhf. 425s Preparing to unpack .../029-libatomic1_14.2.0-4ubuntu2~24.04_armhf.deb ... 425s Unpacking libatomic1:armhf (14.2.0-4ubuntu2~24.04) ... 425s Selecting previously unselected package libasan8:armhf. 425s Preparing to unpack .../030-libasan8_14.2.0-4ubuntu2~24.04_armhf.deb ... 425s Unpacking libasan8:armhf (14.2.0-4ubuntu2~24.04) ... 425s Selecting previously unselected package libubsan1:armhf. 425s Preparing to unpack .../031-libubsan1_14.2.0-4ubuntu2~24.04_armhf.deb ... 425s Unpacking libubsan1:armhf (14.2.0-4ubuntu2~24.04) ... 425s Selecting previously unselected package libgcc-13-dev:armhf. 425s Preparing to unpack .../032-libgcc-13-dev_13.3.0-6ubuntu2~24.04_armhf.deb ... 425s Unpacking libgcc-13-dev:armhf (13.3.0-6ubuntu2~24.04) ... 425s Selecting previously unselected package gcc-13-arm-linux-gnueabihf. 425s Preparing to unpack .../033-gcc-13-arm-linux-gnueabihf_13.3.0-6ubuntu2~24.04_armhf.deb ... 425s Unpacking gcc-13-arm-linux-gnueabihf (13.3.0-6ubuntu2~24.04) ... 426s Selecting previously unselected package gcc-13. 426s Preparing to unpack .../034-gcc-13_13.3.0-6ubuntu2~24.04_armhf.deb ... 426s Unpacking gcc-13 (13.3.0-6ubuntu2~24.04) ... 426s Selecting previously unselected package gcc-arm-linux-gnueabihf. 426s Preparing to unpack .../035-gcc-arm-linux-gnueabihf_4%3a13.2.0-7ubuntu1_armhf.deb ... 426s Unpacking gcc-arm-linux-gnueabihf (4:13.2.0-7ubuntu1) ... 426s Selecting previously unselected package gcc. 426s Preparing to unpack .../036-gcc_4%3a13.2.0-7ubuntu1_armhf.deb ... 426s Unpacking gcc (4:13.2.0-7ubuntu1) ... 426s Selecting previously unselected package libstdc++-13-dev:armhf. 426s Preparing to unpack .../037-libstdc++-13-dev_13.3.0-6ubuntu2~24.04_armhf.deb ... 426s Unpacking libstdc++-13-dev:armhf (13.3.0-6ubuntu2~24.04) ... 426s Selecting previously unselected package g++-13-arm-linux-gnueabihf. 426s Preparing to unpack .../038-g++-13-arm-linux-gnueabihf_13.3.0-6ubuntu2~24.04_armhf.deb ... 426s Unpacking g++-13-arm-linux-gnueabihf (13.3.0-6ubuntu2~24.04) ... 426s Selecting previously unselected package g++-13. 426s Preparing to unpack .../039-g++-13_13.3.0-6ubuntu2~24.04_armhf.deb ... 426s Unpacking g++-13 (13.3.0-6ubuntu2~24.04) ... 426s Selecting previously unselected package g++-arm-linux-gnueabihf. 426s Preparing to unpack .../040-g++-arm-linux-gnueabihf_4%3a13.2.0-7ubuntu1_armhf.deb ... 426s Unpacking g++-arm-linux-gnueabihf (4:13.2.0-7ubuntu1) ... 426s Selecting previously unselected package g++. 426s Preparing to unpack .../041-g++_4%3a13.2.0-7ubuntu1_armhf.deb ... 426s Unpacking g++ (4:13.2.0-7ubuntu1) ... 426s Selecting previously unselected package build-essential. 426s Preparing to unpack .../042-build-essential_12.10ubuntu1_armhf.deb ... 426s Unpacking build-essential (12.10ubuntu1) ... 426s Selecting previously unselected package libjsoncpp25:armhf. 426s Preparing to unpack .../043-libjsoncpp25_1.9.5-6build1_armhf.deb ... 426s Unpacking libjsoncpp25:armhf (1.9.5-6build1) ... 427s Selecting previously unselected package librhash0:armhf. 427s Preparing to unpack .../044-librhash0_1.4.3-3build1_armhf.deb ... 427s Unpacking librhash0:armhf (1.4.3-3build1) ... 427s Selecting previously unselected package cmake-data. 427s Preparing to unpack .../045-cmake-data_3.28.3-1build7_all.deb ... 427s Unpacking cmake-data (3.28.3-1build7) ... 427s Selecting previously unselected package cmake. 427s Preparing to unpack .../046-cmake_3.28.3-1build7_armhf.deb ... 427s Unpacking cmake (3.28.3-1build7) ... 427s Selecting previously unselected package db5.3-util. 427s Preparing to unpack .../047-db5.3-util_5.3.28+dfsg2-7_armhf.deb ... 427s Unpacking db5.3-util (5.3.28+dfsg2-7) ... 427s Selecting previously unselected package libdebhelper-perl. 427s Preparing to unpack .../048-libdebhelper-perl_13.14.1ubuntu5_all.deb ... 427s Unpacking libdebhelper-perl (13.14.1ubuntu5) ... 427s Selecting previously unselected package libtool. 427s Preparing to unpack .../049-libtool_2.4.7-7build1_all.deb ... 427s Unpacking libtool (2.4.7-7build1) ... 428s Selecting previously unselected package dh-autoreconf. 428s Preparing to unpack .../050-dh-autoreconf_20_all.deb ... 428s Unpacking dh-autoreconf (20) ... 428s Selecting previously unselected package libarchive-zip-perl. 428s Preparing to unpack .../051-libarchive-zip-perl_1.68-1_all.deb ... 428s Unpacking libarchive-zip-perl (1.68-1) ... 428s Selecting previously unselected package libsub-override-perl. 428s Preparing to unpack .../052-libsub-override-perl_0.10-1_all.deb ... 428s Unpacking libsub-override-perl (0.10-1) ... 428s Selecting previously unselected package libfile-stripnondeterminism-perl. 428s Preparing to unpack .../053-libfile-stripnondeterminism-perl_1.13.1-1_all.deb ... 428s Unpacking libfile-stripnondeterminism-perl (1.13.1-1) ... 428s Selecting previously unselected package dh-strip-nondeterminism. 428s Preparing to unpack .../054-dh-strip-nondeterminism_1.13.1-1_all.deb ... 428s Unpacking dh-strip-nondeterminism (1.13.1-1) ... 428s Selecting previously unselected package libdw1t64:armhf. 428s Preparing to unpack .../055-libdw1t64_0.190-1.1ubuntu0.1_armhf.deb ... 428s Unpacking libdw1t64:armhf (0.190-1.1ubuntu0.1) ... 428s Selecting previously unselected package debugedit. 428s Preparing to unpack .../056-debugedit_1%3a5.0-5build2_armhf.deb ... 428s Unpacking debugedit (1:5.0-5build2) ... 428s Selecting previously unselected package dwz. 428s Preparing to unpack .../057-dwz_0.15-1build6_armhf.deb ... 428s Unpacking dwz (0.15-1build6) ... 428s Selecting previously unselected package gettext. 428s Preparing to unpack .../058-gettext_0.21-14ubuntu2_armhf.deb ... 428s Unpacking gettext (0.21-14ubuntu2) ... 428s Selecting previously unselected package intltool-debian. 428s Preparing to unpack .../059-intltool-debian_0.35.0+20060710.6_all.deb ... 428s Unpacking intltool-debian (0.35.0+20060710.6) ... 428s Selecting previously unselected package po-debconf. 428s Preparing to unpack .../060-po-debconf_1.0.21+nmu1_all.deb ... 428s Unpacking po-debconf (1.0.21+nmu1) ... 428s Selecting previously unselected package debhelper. 428s Preparing to unpack .../061-debhelper_13.14.1ubuntu5_all.deb ... 428s Unpacking debhelper (13.14.1ubuntu5) ... 428s Selecting previously unselected package xml-core. 428s Preparing to unpack .../062-xml-core_0.19_all.deb ... 428s Unpacking xml-core (0.19) ... 428s Selecting previously unselected package sgml-data. 428s Preparing to unpack .../063-sgml-data_2.0.11+nmu1_all.deb ... 428s Unpacking sgml-data (2.0.11+nmu1) ... 428s Selecting previously unselected package docbook-xml. 428s Preparing to unpack .../064-docbook-xml_4.5-12_all.deb ... 428s Unpacking docbook-xml (4.5-12) ... 428s Selecting previously unselected package docbook-xsl. 428s Preparing to unpack .../065-docbook-xsl_1.79.2+dfsg-7_all.deb ... 428s Unpacking docbook-xsl (1.79.2+dfsg-7) ... 428s Selecting previously unselected package libllvm18:armhf. 428s Preparing to unpack .../066-libllvm18_1%3a18.1.3-1ubuntu1_armhf.deb ... 428s Unpacking libllvm18:armhf (1:18.1.3-1ubuntu1) ... 429s Selecting previously unselected package libclang-cpp18. 429s Preparing to unpack .../067-libclang-cpp18_1%3a18.1.3-1ubuntu1_armhf.deb ... 429s Unpacking libclang-cpp18 (1:18.1.3-1ubuntu1) ... 430s Selecting previously unselected package libclang1-18. 430s Preparing to unpack .../068-libclang1-18_1%3a18.1.3-1ubuntu1_armhf.deb ... 430s Unpacking libclang1-18 (1:18.1.3-1ubuntu1) ... 430s Selecting previously unselected package libfmt9:armhf. 430s Preparing to unpack .../069-libfmt9_9.1.0+ds1-2_armhf.deb ... 430s Unpacking libfmt9:armhf (9.1.0+ds1-2) ... 430s Selecting previously unselected package doxygen. 430s Preparing to unpack .../070-doxygen_1.9.8+ds-2build5_armhf.deb ... 430s Unpacking doxygen (1.9.8+ds-2build5) ... 430s Selecting previously unselected package libfakeroot:armhf. 430s Preparing to unpack .../071-libfakeroot_1.33-1_armhf.deb ... 430s Unpacking libfakeroot:armhf (1.33-1) ... 430s Selecting previously unselected package fakeroot. 430s Preparing to unpack .../072-fakeroot_1.33-1_armhf.deb ... 430s Unpacking fakeroot (1.33-1) ... 430s Selecting previously unselected package libfreetype6:armhf. 430s Preparing to unpack .../073-libfreetype6_2.13.2+dfsg-1build3_armhf.deb ... 430s Unpacking libfreetype6:armhf (2.13.2+dfsg-1build3) ... 430s Selecting previously unselected package fonts-dejavu-mono. 430s Preparing to unpack .../074-fonts-dejavu-mono_2.37-8_all.deb ... 430s Unpacking fonts-dejavu-mono (2.37-8) ... 430s Selecting previously unselected package fonts-dejavu-core. 430s Preparing to unpack .../075-fonts-dejavu-core_2.37-8_all.deb ... 430s Unpacking fonts-dejavu-core (2.37-8) ... 430s Selecting previously unselected package fontconfig-config. 430s Preparing to unpack .../076-fontconfig-config_2.15.0-1.1ubuntu2_armhf.deb ... 431s Unpacking fontconfig-config (2.15.0-1.1ubuntu2) ... 431s Selecting previously unselected package libfontconfig1:armhf. 431s Preparing to unpack .../077-libfontconfig1_2.15.0-1.1ubuntu2_armhf.deb ... 431s Unpacking libfontconfig1:armhf (2.15.0-1.1ubuntu2) ... 431s Selecting previously unselected package fontconfig. 431s Preparing to unpack .../078-fontconfig_2.15.0-1.1ubuntu2_armhf.deb ... 431s Unpacking fontconfig (2.15.0-1.1ubuntu2) ... 431s Selecting previously unselected package libbabeltrace1:armhf. 431s Preparing to unpack .../079-libbabeltrace1_1.5.11-3build3_armhf.deb ... 431s Unpacking libbabeltrace1:armhf (1.5.11-3build3) ... 431s Selecting previously unselected package libdebuginfod1t64:armhf. 431s Preparing to unpack .../080-libdebuginfod1t64_0.190-1.1ubuntu0.1_armhf.deb ... 431s Unpacking libdebuginfod1t64:armhf (0.190-1.1ubuntu0.1) ... 431s Selecting previously unselected package libpython3.12t64:armhf. 431s Preparing to unpack .../081-libpython3.12t64_3.12.3-1ubuntu0.5_armhf.deb ... 431s Unpacking libpython3.12t64:armhf (3.12.3-1ubuntu0.5) ... 431s Selecting previously unselected package libsource-highlight-common. 431s Preparing to unpack .../082-libsource-highlight-common_3.1.9-4.3build1_all.deb ... 431s Unpacking libsource-highlight-common (3.1.9-4.3build1) ... 431s Selecting previously unselected package libsource-highlight4t64:armhf. 431s Preparing to unpack .../083-libsource-highlight4t64_3.1.9-4.3build1_armhf.deb ... 431s Unpacking libsource-highlight4t64:armhf (3.1.9-4.3build1) ... 431s Selecting previously unselected package libc6-dbg:armhf. 431s Preparing to unpack .../084-libc6-dbg_2.39-0ubuntu8.4_armhf.deb ... 431s Unpacking libc6-dbg:armhf (2.39-0ubuntu8.4) ... 431s Selecting previously unselected package gdb. 431s Preparing to unpack .../085-gdb_15.0.50.20240403-0ubuntu1_armhf.deb ... 431s Unpacking gdb (15.0.50.20240403-0ubuntu1) ... 432s Selecting previously unselected package gpgv1. 432s Preparing to unpack .../086-gpgv1_1.4.23-2_armhf.deb ... 432s Unpacking gpgv1 (1.4.23-2) ... 432s Selecting previously unselected package gnupg1. 432s Preparing to unpack .../087-gnupg1_1.4.23-2_armhf.deb ... 432s Unpacking gnupg1 (1.4.23-2) ... 432s Selecting previously unselected package googletest. 432s Preparing to unpack .../088-googletest_1.14.0-1_all.deb ... 432s Unpacking googletest (1.14.0-1) ... 432s Selecting previously unselected package libcdt5:armhf. 432s Preparing to unpack .../089-libcdt5_2.42.2-9ubuntu0.1_armhf.deb ... 432s Unpacking libcdt5:armhf (2.42.2-9ubuntu0.1) ... 432s Selecting previously unselected package libcgraph6:armhf. 432s Preparing to unpack .../090-libcgraph6_2.42.2-9ubuntu0.1_armhf.deb ... 432s Unpacking libcgraph6:armhf (2.42.2-9ubuntu0.1) ... 432s Selecting previously unselected package libsharpyuv0:armhf. 432s Preparing to unpack .../091-libsharpyuv0_1.3.2-0.4build3_armhf.deb ... 432s Unpacking libsharpyuv0:armhf (1.3.2-0.4build3) ... 432s Selecting previously unselected package libaom3:armhf. 432s Preparing to unpack .../092-libaom3_3.8.2-2ubuntu0.1_armhf.deb ... 432s Unpacking libaom3:armhf (3.8.2-2ubuntu0.1) ... 432s Selecting previously unselected package libheif-plugin-aomdec:armhf. 432s Preparing to unpack .../093-libheif-plugin-aomdec_1.17.6-1ubuntu4.1_armhf.deb ... 432s Unpacking libheif-plugin-aomdec:armhf (1.17.6-1ubuntu4.1) ... 432s Selecting previously unselected package libde265-0:armhf. 432s Preparing to unpack .../094-libde265-0_1.0.15-1build3_armhf.deb ... 432s Unpacking libde265-0:armhf (1.0.15-1build3) ... 432s Selecting previously unselected package libheif-plugin-libde265:armhf. 432s Preparing to unpack .../095-libheif-plugin-libde265_1.17.6-1ubuntu4.1_armhf.deb ... 432s Unpacking libheif-plugin-libde265:armhf (1.17.6-1ubuntu4.1) ... 432s Selecting previously unselected package libheif1:armhf. 432s Preparing to unpack .../096-libheif1_1.17.6-1ubuntu4.1_armhf.deb ... 432s Unpacking libheif1:armhf (1.17.6-1ubuntu4.1) ... 432s Selecting previously unselected package libjpeg-turbo8:armhf. 432s Preparing to unpack .../097-libjpeg-turbo8_2.1.5-2ubuntu2_armhf.deb ... 432s Unpacking libjpeg-turbo8:armhf (2.1.5-2ubuntu2) ... 432s Selecting previously unselected package libjpeg8:armhf. 432s Preparing to unpack .../098-libjpeg8_8c-2ubuntu11_armhf.deb ... 432s Unpacking libjpeg8:armhf (8c-2ubuntu11) ... 432s Selecting previously unselected package libdeflate0:armhf. 432s Preparing to unpack .../099-libdeflate0_1.19-1build1.1_armhf.deb ... 432s Unpacking libdeflate0:armhf (1.19-1build1.1) ... 432s Selecting previously unselected package libjbig0:armhf. 432s Preparing to unpack .../100-libjbig0_2.1-6.1ubuntu2_armhf.deb ... 432s Unpacking libjbig0:armhf (2.1-6.1ubuntu2) ... 432s Selecting previously unselected package liblerc4:armhf. 432s Preparing to unpack .../101-liblerc4_4.0.0+ds-4ubuntu2_armhf.deb ... 432s Unpacking liblerc4:armhf (4.0.0+ds-4ubuntu2) ... 432s Selecting previously unselected package libwebp7:armhf. 432s Preparing to unpack .../102-libwebp7_1.3.2-0.4build3_armhf.deb ... 432s Unpacking libwebp7:armhf (1.3.2-0.4build3) ... 432s Selecting previously unselected package libtiff6:armhf. 432s Preparing to unpack .../103-libtiff6_4.5.1+git230720-4ubuntu2.2_armhf.deb ... 432s Unpacking libtiff6:armhf (4.5.1+git230720-4ubuntu2.2) ... 432s Selecting previously unselected package libxpm4:armhf. 432s Preparing to unpack .../104-libxpm4_1%3a3.5.17-1build2_armhf.deb ... 432s Unpacking libxpm4:armhf (1:3.5.17-1build2) ... 432s Selecting previously unselected package libgd3:armhf. 432s Preparing to unpack .../105-libgd3_2.3.3-9ubuntu5_armhf.deb ... 432s Unpacking libgd3:armhf (2.3.3-9ubuntu5) ... 432s Selecting previously unselected package libgts-0.7-5t64:armhf. 432s Preparing to unpack .../106-libgts-0.7-5t64_0.7.6+darcs121130-5.2build1_armhf.deb ... 432s Unpacking libgts-0.7-5t64:armhf (0.7.6+darcs121130-5.2build1) ... 433s Selecting previously unselected package libpixman-1-0:armhf. 433s Preparing to unpack .../107-libpixman-1-0_0.42.2-1build1_armhf.deb ... 433s Unpacking libpixman-1-0:armhf (0.42.2-1build1) ... 433s Selecting previously unselected package libxcb-render0:armhf. 433s Preparing to unpack .../108-libxcb-render0_1.15-1ubuntu2_armhf.deb ... 433s Unpacking libxcb-render0:armhf (1.15-1ubuntu2) ... 433s Selecting previously unselected package libxcb-shm0:armhf. 433s Preparing to unpack .../109-libxcb-shm0_1.15-1ubuntu2_armhf.deb ... 433s Unpacking libxcb-shm0:armhf (1.15-1ubuntu2) ... 433s Selecting previously unselected package libxrender1:armhf. 433s Preparing to unpack .../110-libxrender1_1%3a0.9.10-1.1build1_armhf.deb ... 433s Unpacking libxrender1:armhf (1:0.9.10-1.1build1) ... 433s Selecting previously unselected package libcairo2:armhf. 433s Preparing to unpack .../111-libcairo2_1.18.0-3build1_armhf.deb ... 433s Unpacking libcairo2:armhf (1.18.0-3build1) ... 433s Selecting previously unselected package libltdl7:armhf. 433s Preparing to unpack .../112-libltdl7_2.4.7-7build1_armhf.deb ... 433s Unpacking libltdl7:armhf (2.4.7-7build1) ... 433s Selecting previously unselected package libgraphite2-3:armhf. 433s Preparing to unpack .../113-libgraphite2-3_1.3.14-2build1_armhf.deb ... 433s Unpacking libgraphite2-3:armhf (1.3.14-2build1) ... 433s Selecting previously unselected package libharfbuzz0b:armhf. 433s Preparing to unpack .../114-libharfbuzz0b_8.3.0-2build2_armhf.deb ... 433s Unpacking libharfbuzz0b:armhf (8.3.0-2build2) ... 433s Selecting previously unselected package libthai-data. 433s Preparing to unpack .../115-libthai-data_0.1.29-2build1_all.deb ... 433s Unpacking libthai-data (0.1.29-2build1) ... 433s Selecting previously unselected package libdatrie1:armhf. 433s Preparing to unpack .../116-libdatrie1_0.2.13-3build1_armhf.deb ... 433s Unpacking libdatrie1:armhf (0.2.13-3build1) ... 433s Selecting previously unselected package libthai0:armhf. 433s Preparing to unpack .../117-libthai0_0.1.29-2build1_armhf.deb ... 433s Unpacking libthai0:armhf (0.1.29-2build1) ... 433s Selecting previously unselected package libpango-1.0-0:armhf. 433s Preparing to unpack .../118-libpango-1.0-0_1.52.1+ds-1build1_armhf.deb ... 433s Unpacking libpango-1.0-0:armhf (1.52.1+ds-1build1) ... 433s Selecting previously unselected package libpangoft2-1.0-0:armhf. 433s Preparing to unpack .../119-libpangoft2-1.0-0_1.52.1+ds-1build1_armhf.deb ... 433s Unpacking libpangoft2-1.0-0:armhf (1.52.1+ds-1build1) ... 433s Selecting previously unselected package libpangocairo-1.0-0:armhf. 433s Preparing to unpack .../120-libpangocairo-1.0-0_1.52.1+ds-1build1_armhf.deb ... 433s Unpacking libpangocairo-1.0-0:armhf (1.52.1+ds-1build1) ... 433s Selecting previously unselected package libpathplan4:armhf. 433s Preparing to unpack .../121-libpathplan4_2.42.2-9ubuntu0.1_armhf.deb ... 433s Unpacking libpathplan4:armhf (2.42.2-9ubuntu0.1) ... 433s Selecting previously unselected package libgvc6. 433s Preparing to unpack .../122-libgvc6_2.42.2-9ubuntu0.1_armhf.deb ... 433s Unpacking libgvc6 (2.42.2-9ubuntu0.1) ... 433s Selecting previously unselected package libgvpr2:armhf. 433s Preparing to unpack .../123-libgvpr2_2.42.2-9ubuntu0.1_armhf.deb ... 433s Unpacking libgvpr2:armhf (2.42.2-9ubuntu0.1) ... 433s Selecting previously unselected package liblab-gamut1:armhf. 433s Preparing to unpack .../124-liblab-gamut1_2.42.2-9ubuntu0.1_armhf.deb ... 433s Unpacking liblab-gamut1:armhf (2.42.2-9ubuntu0.1) ... 433s Selecting previously unselected package x11-common. 433s Preparing to unpack .../125-x11-common_1%3a7.7+23ubuntu3_all.deb ... 433s Unpacking x11-common (1:7.7+23ubuntu3) ... 433s Selecting previously unselected package libice6:armhf. 433s Preparing to unpack .../126-libice6_2%3a1.0.10-1build3_armhf.deb ... 433s Unpacking libice6:armhf (2:1.0.10-1build3) ... 434s Selecting previously unselected package libsm6:armhf. 434s Preparing to unpack .../127-libsm6_2%3a1.2.3-1build3_armhf.deb ... 434s Unpacking libsm6:armhf (2:1.2.3-1build3) ... 434s Selecting previously unselected package libxt6t64:armhf. 434s Preparing to unpack .../128-libxt6t64_1%3a1.2.1-1.2build1_armhf.deb ... 434s Unpacking libxt6t64:armhf (1:1.2.1-1.2build1) ... 434s Selecting previously unselected package libxmu6:armhf. 434s Preparing to unpack .../129-libxmu6_2%3a1.1.3-3build2_armhf.deb ... 434s Unpacking libxmu6:armhf (2:1.1.3-3build2) ... 434s Selecting previously unselected package libxaw7:armhf. 434s Preparing to unpack .../130-libxaw7_2%3a1.0.14-1build2_armhf.deb ... 434s Unpacking libxaw7:armhf (2:1.0.14-1build2) ... 434s Selecting previously unselected package graphviz. 434s Preparing to unpack .../131-graphviz_2.42.2-9ubuntu0.1_armhf.deb ... 434s Unpacking graphviz (2.42.2-9ubuntu0.1) ... 434s Selecting previously unselected package libapt-pkg-dev:armhf. 434s Preparing to unpack .../132-libapt-pkg-dev_2.8.3_armhf.deb ... 434s Unpacking libapt-pkg-dev:armhf (2.8.3) ... 434s Selecting previously unselected package libapt-pkg-doc. 434s Preparing to unpack .../133-libapt-pkg-doc_2.8.3_all.deb ... 434s Unpacking libapt-pkg-doc (2.8.3) ... 434s Selecting previously unselected package libbz2-dev:armhf. 434s Preparing to unpack .../134-libbz2-dev_1.0.8-5.1build0.1_armhf.deb ... 434s Unpacking libbz2-dev:armhf (1.0.8-5.1build0.1) ... 434s Selecting previously unselected package libevent-2.1-7t64:armhf. 434s Preparing to unpack .../135-libevent-2.1-7t64_2.1.12-stable-9ubuntu2_armhf.deb ... 434s Unpacking libevent-2.1-7t64:armhf (2.1.12-stable-9ubuntu2) ... 434s Selecting previously unselected package libfile-fcntllock-perl. 434s Preparing to unpack .../136-libfile-fcntllock-perl_0.22-4ubuntu5_armhf.deb ... 434s Unpacking libfile-fcntllock-perl (0.22-4ubuntu5) ... 434s Selecting previously unselected package libgc1:armhf. 434s Preparing to unpack .../137-libgc1_1%3a8.2.6-1build1_armhf.deb ... 434s Unpacking libgc1:armhf (1:8.2.6-1build1) ... 434s Selecting previously unselected package libgpg-error-dev. 434s Preparing to unpack .../138-libgpg-error-dev_1.47-3build2.1_armhf.deb ... 434s Unpacking libgpg-error-dev (1.47-3build2.1) ... 434s Selecting previously unselected package libgcrypt20-dev. 434s Preparing to unpack .../139-libgcrypt20-dev_1.10.3-2build1_armhf.deb ... 434s Unpacking libgcrypt20-dev (1.10.3-2build1) ... 435s Selecting previously unselected package libgmpxx4ldbl:armhf. 435s Preparing to unpack .../140-libgmpxx4ldbl_2%3a6.3.0+dfsg-2ubuntu6.1_armhf.deb ... 435s Unpacking libgmpxx4ldbl:armhf (2:6.3.0+dfsg-2ubuntu6.1) ... 435s Selecting previously unselected package libgmp-dev:armhf. 435s Preparing to unpack .../141-libgmp-dev_2%3a6.3.0+dfsg-2ubuntu6.1_armhf.deb ... 435s Unpacking libgmp-dev:armhf (2:6.3.0+dfsg-2ubuntu6.1) ... 435s Selecting previously unselected package libunbound8:armhf. 435s Preparing to unpack .../142-libunbound8_1.19.2-1ubuntu3.4_armhf.deb ... 435s Unpacking libunbound8:armhf (1.19.2-1ubuntu3.4) ... 435s Selecting previously unselected package libgnutls-dane0t64:armhf. 435s Preparing to unpack .../143-libgnutls-dane0t64_3.8.3-1.1ubuntu3.3_armhf.deb ... 435s Unpacking libgnutls-dane0t64:armhf (3.8.3-1.1ubuntu3.3) ... 435s Selecting previously unselected package libgnutls-openssl27t64:armhf. 435s Preparing to unpack .../144-libgnutls-openssl27t64_3.8.3-1.1ubuntu3.3_armhf.deb ... 435s Unpacking libgnutls-openssl27t64:armhf (3.8.3-1.1ubuntu3.3) ... 435s Selecting previously unselected package libidn2-dev:armhf. 435s Preparing to unpack .../145-libidn2-dev_2.3.7-2build1.1_armhf.deb ... 435s Unpacking libidn2-dev:armhf (2.3.7-2build1.1) ... 435s Selecting previously unselected package libp11-kit-dev:armhf. 435s Preparing to unpack .../146-libp11-kit-dev_0.25.3-4ubuntu2.1_armhf.deb ... 435s Unpacking libp11-kit-dev:armhf (0.25.3-4ubuntu2.1) ... 435s Selecting previously unselected package libtasn1-6-dev:armhf. 435s Preparing to unpack .../147-libtasn1-6-dev_4.19.0-3ubuntu0.24.04.1_armhf.deb ... 435s Unpacking libtasn1-6-dev:armhf (4.19.0-3ubuntu0.24.04.1) ... 435s Selecting previously unselected package nettle-dev:armhf. 435s Preparing to unpack .../148-nettle-dev_3.9.1-2.2build1.1_armhf.deb ... 435s Unpacking nettle-dev:armhf (3.9.1-2.2build1.1) ... 435s Selecting previously unselected package libgnutls28-dev:armhf. 435s Preparing to unpack .../149-libgnutls28-dev_3.8.3-1.1ubuntu3.3_armhf.deb ... 435s Unpacking libgnutls28-dev:armhf (3.8.3-1.1ubuntu3.3) ... 435s Selecting previously unselected package libosp5. 435s Preparing to unpack .../150-libosp5_1.5.2-15ubuntu2_armhf.deb ... 435s Unpacking libosp5 (1.5.2-15ubuntu2) ... 435s Selecting previously unselected package libpkgconf3:armhf. 435s Preparing to unpack .../151-libpkgconf3_1.8.1-2build1_armhf.deb ... 435s Unpacking libpkgconf3:armhf (1.8.1-2build1) ... 435s Selecting previously unselected package libpod-parser-perl. 435s Preparing to unpack .../152-libpod-parser-perl_1.67-1_all.deb ... 435s Adding 'diversion of /usr/bin/podselect to /usr/bin/podselect.bundled by libpod-parser-perl' 435s Adding 'diversion of /usr/share/man/man1/podselect.1.gz to /usr/share/man/man1/podselect.bundled.1.gz by libpod-parser-perl' 435s Unpacking libpod-parser-perl (1.67-1) ... 435s Selecting previously unselected package libseccomp-dev:armhf. 435s Preparing to unpack .../153-libseccomp-dev_2.5.5-1ubuntu3.1_armhf.deb ... 435s Unpacking libseccomp-dev:armhf (2.5.5-1ubuntu3.1) ... 435s Selecting previously unselected package libsgmls-perl. 435s Preparing to unpack .../154-libsgmls-perl_1.03ii-38_all.deb ... 435s Unpacking libsgmls-perl (1.03ii-38) ... 435s Selecting previously unselected package libxs-parse-keyword-perl. 435s Preparing to unpack .../155-libxs-parse-keyword-perl_0.39-1build3_armhf.deb ... 435s Unpacking libxs-parse-keyword-perl (0.39-1build3) ... 435s Selecting previously unselected package libsyntax-keyword-try-perl. 435s Preparing to unpack .../156-libsyntax-keyword-try-perl_0.29-1build3_armhf.deb ... 435s Unpacking libsyntax-keyword-try-perl (0.29-1build3) ... 435s Selecting previously unselected package libsystemd-dev:armhf. 435s Preparing to unpack .../157-libsystemd-dev_255.4-1ubuntu8.9_armhf.deb ... 435s Unpacking libsystemd-dev:armhf (255.4-1ubuntu8.9) ... 435s Selecting previously unselected package libudev-dev:armhf. 435s Preparing to unpack .../158-libudev-dev_255.4-1ubuntu8.9_armhf.deb ... 435s Unpacking libudev-dev:armhf (255.4-1ubuntu8.9) ... 436s Selecting previously unselected package libxslt1.1:armhf. 436s Preparing to unpack .../159-libxslt1.1_1.1.39-0exp1ubuntu0.24.04.2_armhf.deb ... 436s Unpacking libxslt1.1:armhf (1.1.39-0exp1ubuntu0.24.04.2) ... 436s Selecting previously unselected package libxxhash-dev:armhf. 436s Preparing to unpack .../160-libxxhash-dev_0.8.2-2build1_armhf.deb ... 436s Unpacking libxxhash-dev:armhf (0.8.2-2build1) ... 436s Selecting previously unselected package libyaml-tiny-perl. 436s Preparing to unpack .../161-libyaml-tiny-perl_1.74-1_all.deb ... 436s Unpacking libyaml-tiny-perl (1.74-1) ... 436s Selecting previously unselected package libzstd-dev:armhf. 436s Preparing to unpack .../162-libzstd-dev_1.5.5+dfsg2-2build1.1_armhf.deb ... 436s Unpacking libzstd-dev:armhf (1.5.5+dfsg2-2build1.1) ... 436s Selecting previously unselected package ninja-build. 436s Preparing to unpack .../163-ninja-build_1.11.1-2_armhf.deb ... 436s Unpacking ninja-build (1.11.1-2) ... 436s Selecting previously unselected package opensp. 436s Preparing to unpack .../164-opensp_1.5.2-15ubuntu2_armhf.deb ... 436s Unpacking opensp (1.5.2-15ubuntu2) ... 436s Selecting previously unselected package pkgconf-bin. 436s Preparing to unpack .../165-pkgconf-bin_1.8.1-2build1_armhf.deb ... 436s Unpacking pkgconf-bin (1.8.1-2build1) ... 436s Selecting previously unselected package pkgconf:armhf. 436s Preparing to unpack .../166-pkgconf_1.8.1-2build1_armhf.deb ... 436s Unpacking pkgconf:armhf (1.8.1-2build1) ... 436s Selecting previously unselected package pkg-config:armhf. 436s Preparing to unpack .../167-pkg-config_1.8.1-2build1_armhf.deb ... 436s Unpacking pkg-config:armhf (1.8.1-2build1) ... 436s Selecting previously unselected package po4a. 436s Preparing to unpack .../168-po4a_0.69-1_all.deb ... 436s Unpacking po4a (0.69-1) ... 436s Selecting previously unselected package triehash. 436s Preparing to unpack .../169-triehash_0.3-3_all.deb ... 436s Unpacking triehash (0.3-3) ... 436s Selecting previously unselected package valgrind. 436s Preparing to unpack .../170-valgrind_1%3a3.22.0-0ubuntu3_armhf.deb ... 436s Unpacking valgrind (1:3.22.0-0ubuntu3) ... 437s Selecting previously unselected package w3m. 437s Preparing to unpack .../171-w3m_0.5.3+git20230121-2ubuntu5_armhf.deb ... 437s Unpacking w3m (0.5.3+git20230121-2ubuntu5) ... 437s Selecting previously unselected package xsltproc. 437s Preparing to unpack .../172-xsltproc_1.1.39-0exp1ubuntu0.24.04.2_armhf.deb ... 437s Unpacking xsltproc (1.1.39-0exp1ubuntu0.24.04.2) ... 437s Selecting previously unselected package zlib1g-dev:armhf. 437s Preparing to unpack .../173-zlib1g-dev_1%3a1.3.dfsg-3.1ubuntu2.1_armhf.deb ... 437s Unpacking zlib1g-dev:armhf (1:1.3.dfsg-3.1ubuntu2.1) ... 437s Selecting previously unselected package db-util. 437s Preparing to unpack .../174-db-util_1%3a5.3.21ubuntu2_all.deb ... 437s Unpacking db-util (1:5.3.21ubuntu2) ... 437s Selecting previously unselected package libdb5.3-dev. 437s Preparing to unpack .../175-libdb5.3-dev_5.3.28+dfsg2-7_armhf.deb ... 437s Unpacking libdb5.3-dev (5.3.28+dfsg2-7) ... 437s Selecting previously unselected package libdb-dev:armhf. 437s Preparing to unpack .../176-libdb-dev_1%3a5.3.21ubuntu2_armhf.deb ... 437s Unpacking libdb-dev:armhf (1:5.3.21ubuntu2) ... 437s Selecting previously unselected package liblz4-dev:armhf. 437s Preparing to unpack .../177-liblz4-dev_1.9.4-1build1.1_armhf.deb ... 437s Unpacking liblz4-dev:armhf (1.9.4-1build1.1) ... 437s Selecting previously unselected package liblzma-dev:armhf. 437s Preparing to unpack .../178-liblzma-dev_5.6.1+really5.4.5-1ubuntu0.2_armhf.deb ... 437s Unpacking liblzma-dev:armhf (5.6.1+really5.4.5-1ubuntu0.2) ... 437s Setting up libgraphite2-3:armhf (1.3.14-2build1) ... 437s Setting up libgnutls-openssl27t64:armhf (3.8.3-1.1ubuntu3.3) ... 437s Setting up libpixman-1-0:armhf (0.42.2-1build1) ... 437s Setting up libxapian30:armhf (1.4.22-1build1) ... 437s Setting up libsharpyuv0:armhf (1.3.2-0.4build3) ... 437s Setting up libaom3:armhf (3.8.2-2ubuntu0.1) ... 437s Setting up stunnel4 (3:5.72-1build2) ... 437s Creating group 'stunnel4' with GID 988. 437s Creating user 'stunnel4' (stunnel service system account) with UID 988 and GID 988. 438s Created symlink /etc/systemd/system/multi-user.target.wants/stunnel.target → /usr/lib/systemd/system/stunnel.target. 438s Setting up libseccomp-dev:armhf (2.5.5-1ubuntu3.1) ... 438s Setting up libsgmls-perl (1.03ii-38) ... 438s Setting up apt-doc (2.8.3) ... 438s Setting up liblerc4:armhf (4.0.0+ds-4ubuntu2) ... 438s Setting up libzstd-dev:armhf (1.5.5+dfsg2-2build1.1) ... 438s Setting up libxpm4:armhf (1:3.5.17-1build2) ... 438s Setting up libxrender1:armhf (1:0.9.10-1.1build1) ... 438s Setting up libdatrie1:armhf (0.2.13-3build1) ... 438s Setting up libdebuginfod-common (0.190-1.1ubuntu0.1) ... 438s Setting up libfile-fcntllock-perl (0.22-4ubuntu5) ... 438s Setting up libxcb-render0:armhf (1.15-1ubuntu2) ... 438s Setting up libarchive-zip-perl (1.68-1) ... 438s Setting up libdebhelper-perl (13.14.1ubuntu5) ... 438s Setting up liblab-gamut1:armhf (2.42.2-9ubuntu0.1) ... 438s Setting up gnupg1 (1.4.23-2) ... 438s Setting up x11-common (1:7.7+23ubuntu3) ... 438s Setting up libdeflate0:armhf (1.19-1build1.1) ... 438s Setting up linux-libc-dev:armhf (6.8.0-60.63) ... 438s Setting up m4 (1.4.19-4build1) ... 438s Setting up libevent-2.1-7t64:armhf (2.1.12-stable-9ubuntu2) ... 438s Setting up libxcb-shm0:armhf (1.15-1ubuntu2) ... 438s Setting up libapt-pkg-dev:armhf (2.8.3) ... 438s Setting up libgomp1:armhf (14.2.0-4ubuntu2~24.04) ... 438s Setting up googletest (1.14.0-1) ... 438s Setting up libyaml-tiny-perl (1.74-1) ... 438s Setting up libjbig0:armhf (2.1-6.1ubuntu2) ... 438s Setting up libsource-highlight-common (3.1.9-4.3build1) ... 438s Setting up libfakeroot:armhf (1.33-1) ... 438s Setting up ninja-build (1.11.1-2) ... 438s Setting up libc6-dbg:armhf (2.39-0ubuntu8.4) ... 438s Setting up libdw1t64:armhf (0.190-1.1ubuntu0.1) ... 438s Setting up libosp5 (1.5.2-15ubuntu2) ... 438s Setting up fakeroot (1.33-1) ... 438s update-alternatives: using /usr/bin/fakeroot-sysv to provide /usr/bin/fakeroot (fakeroot) in auto mode 438s Setting up libpython3.12t64:armhf (3.12.3-1ubuntu0.5) ... 438s Setting up autotools-dev (20220109.1) ... 438s Setting up libxs-parse-keyword-perl (0.39-1build3) ... 438s Setting up libunbound8:armhf (1.19.2-1ubuntu3.4) ... 438s Setting up libpkgconf3:armhf (1.8.1-2build1) ... 438s Setting up libgmpxx4ldbl:armhf (2:6.3.0+dfsg-2ubuntu6.1) ... 438s Setting up rpcsvc-proto (1.4.2-0ubuntu7) ... 438s Setting up gcc-13-base:armhf (13.3.0-6ubuntu2~24.04) ... 438s Setting up libgnutls-dane0t64:armhf (3.8.3-1.1ubuntu3.3) ... 438s Setting up libfreetype6:armhf (2.13.2+dfsg-1build3) ... 438s Setting up libgpg-error-dev (1.47-3build2.1) ... 438s Setting up libboost-iostreams1.83.0:armhf (1.83.0-2.1ubuntu3.1) ... 438s Setting up libsigc++-2.0-0v5:armhf (2.12.1-2) ... 438s Setting up aptitude-common (0.8.13-5ubuntu5) ... 438s Setting up libpathplan4:armhf (2.42.2-9ubuntu0.1) ... 438s Setting up fonts-dejavu-mono (2.37-8) ... 438s Setting up libmpc3:armhf (1.3.1-1build1.1) ... 438s Setting up libatomic1:armhf (14.2.0-4ubuntu2~24.04) ... 438s Setting up db5.3-util (5.3.28+dfsg2-7) ... 438s Setting up libpod-parser-perl (1.67-1) ... 438s Setting up autopoint (0.21-14ubuntu2) ... 438s Setting up libjsoncpp25:armhf (1.9.5-6build1) ... 438s Setting up liblz4-dev:armhf (1.9.4-1build1.1) ... 438s Setting up fonts-dejavu-core (2.37-8) ... 438s Setting up gpgv1 (1.4.23-2) ... 438s Setting up libudev-dev:armhf (255.4-1ubuntu8.9) ... 438s Setting up pkgconf-bin (1.8.1-2build1) ... 438s Setting up libjpeg-turbo8:armhf (2.1.5-2ubuntu2) ... 438s Setting up libgc1:armhf (1:8.2.6-1build1) ... 438s Setting up libltdl7:armhf (2.4.7-7build1) ... 438s Setting up libidn2-dev:armhf (2.3.7-2build1.1) ... 438s Setting up libbabeltrace1:armhf (1.5.11-3build3) ... 438s Setting up autoconf (2.71-3) ... 438s Setting up libxxhash-dev:armhf (0.8.2-2build1) ... 438s Setting up libwebp7:armhf (1.3.2-0.4build3) ... 438s Setting up libfmt9:armhf (9.1.0+ds1-2) ... 438s Setting up liblzma-dev:armhf (5.6.1+really5.4.5-1ubuntu0.2) ... 438s Setting up libubsan1:armhf (14.2.0-4ubuntu2~24.04) ... 438s Setting up libsyntax-keyword-try-perl (0.29-1build3) ... 438s Setting up libapt-pkg-doc (2.8.3) ... 438s Setting up dwz (0.15-1build6) ... 438s Setting up librhash0:armhf (1.4.3-3build1) ... 438s Setting up libdb5.3-dev (5.3.28+dfsg2-7) ... 438s Setting up libcrypt-dev:armhf (1:4.4.36-4build1) ... 438s Setting up libasan8:armhf (14.2.0-4ubuntu2~24.04) ... 438s Setting up libxslt1.1:armhf (1.1.39-0exp1ubuntu0.24.04.2) ... 438s Setting up debugedit (1:5.0-5build2) ... 438s Setting up libsub-override-perl (0.10-1) ... 438s Setting up libharfbuzz0b:armhf (8.3.0-2build2) ... 438s Setting up libthai-data (0.1.29-2build1) ... 438s Setting up libgts-0.7-5t64:armhf (0.7.6+darcs121130-5.2build1) ... 438s Setting up sgml-base (1.31) ... 438s Setting up cmake-data (3.28.3-1build7) ... 438s Setting up libcdt5:armhf (2.42.2-9ubuntu0.1) ... 438s Setting up libcgraph6:armhf (2.42.2-9ubuntu0.1) ... 438s Setting up libisl23:armhf (0.26-3build1.1) ... 438s Setting up libde265-0:armhf (1.0.15-1build3) ... 438s Setting up libc-dev-bin (2.39-0ubuntu8.4) ... 438s Setting up valgrind (1:3.22.0-0ubuntu3) ... 438s Setting up libtasn1-6-dev:armhf (4.19.0-3ubuntu0.24.04.1) ... 438s Setting up triehash (0.3-3) ... 438s Setting up libcc1-0:armhf (14.2.0-4ubuntu2~24.04) ... 438s Setting up libsystemd-dev:armhf (255.4-1ubuntu8.9) ... 438s Setting up libp11-kit-dev:armhf (0.25.3-4ubuntu2.1) ... 438s Setting up libllvm18:armhf (1:18.1.3-1ubuntu1) ... 438s Setting up libjpeg8:armhf (8c-2ubuntu11) ... 438s Setting up automake (1:1.16.5-1.3ubuntu1) ... 439s update-alternatives: using /usr/bin/automake-1.16 to provide /usr/bin/automake (automake) in auto mode 439s Setting up libfile-stripnondeterminism-perl (1.13.1-1) ... 439s Setting up libclang1-18 (1:18.1.3-1ubuntu1) ... 439s Setting up libdebuginfod1t64:armhf (0.190-1.1ubuntu0.1) ... 439s Setting up libice6:armhf (2:1.0.10-1build3) ... 439s Setting up gettext (0.21-14ubuntu2) ... 439s Setting up libgmp-dev:armhf (2:6.3.0+dfsg-2ubuntu6.1) ... 439s Setting up nettle-dev:armhf (3.9.1-2.2build1.1) ... 439s Setting up db-util (1:5.3.21ubuntu2) ... 439s Setting up cpp-13-arm-linux-gnueabihf (13.3.0-6ubuntu2~24.04) ... 439s Setting up fontconfig-config (2.15.0-1.1ubuntu2) ... 439s Setting up xsltproc (1.1.39-0exp1ubuntu0.24.04.2) ... 439s Setting up libsource-highlight4t64:armhf (3.1.9-4.3build1) ... 439s Setting up opensp (1.5.2-15ubuntu2) ... 439s Setting up pkgconf:armhf (1.8.1-2build1) ... 439s Setting up intltool-debian (0.35.0+20060710.6) ... 439s Setting up libthai0:armhf (0.1.29-2build1) ... 439s Setting up gdb (15.0.50.20240403-0ubuntu1) ... 439s Setting up libcwidget4:armhf (0.5.18-6build1) ... 439s Setting up w3m (0.5.3+git20230121-2ubuntu5) ... 439s Setting up libdb-dev:armhf (1:5.3.21ubuntu2) ... 439s Setting up pkg-config:armhf (1.8.1-2build1) ... 439s Setting up aptitude (0.8.13-5ubuntu5) ... 439s update-alternatives: using /usr/bin/aptitude-curses to provide /usr/bin/aptitude (aptitude) in auto mode 439s Setting up dh-strip-nondeterminism (1.13.1-1) ... 439s Setting up libgvpr2:armhf (2.42.2-9ubuntu0.1) ... 439s Setting up libgcc-13-dev:armhf (13.3.0-6ubuntu2~24.04) ... 439s Setting up libtiff6:armhf (4.5.1+git230720-4ubuntu2.2) ... 439s Setting up xml-core (0.19) ... 439s Setting up cmake (3.28.3-1build7) ... 439s Setting up libc6-dev:armhf (2.39-0ubuntu8.4) ... 439s Setting up libfontconfig1:armhf (2.15.0-1.1ubuntu2) ... 439s Setting up libclang-cpp18 (1:18.1.3-1ubuntu1) ... 439s Setting up libsm6:armhf (2:1.2.3-1build3) ... 439s Setting up cpp-arm-linux-gnueabihf (4:13.2.0-7ubuntu1) ... 439s Setting up libstdc++-13-dev:armhf (13.3.0-6ubuntu2~24.04) ... 439s Setting up libbz2-dev:armhf (1.0.8-5.1build0.1) ... 439s Setting up libgnutls28-dev:armhf (3.8.3-1.1ubuntu3.3) ... 439s Setting up fontconfig (2.15.0-1.1ubuntu2) ... 441s Regenerating fonts cache... done. 441s Setting up po4a (0.69-1) ... 441s Setting up cpp-13 (13.3.0-6ubuntu2~24.04) ... 441s Setting up po-debconf (1.0.21+nmu1) ... 441s Setting up libpango-1.0-0:armhf (1.52.1+ds-1build1) ... 441s Setting up libcairo2:armhf (1.18.0-3build1) ... 441s Setting up gcc-13-arm-linux-gnueabihf (13.3.0-6ubuntu2~24.04) ... 441s Setting up doxygen (1.9.8+ds-2build5) ... 441s Setting up libgcrypt20-dev (1.10.3-2build1) ... 441s Setting up libxt6t64:armhf (1:1.2.1-1.2build1) ... 441s Setting up gcc-13 (13.3.0-6ubuntu2~24.04) ... 441s Setting up zlib1g-dev:armhf (1:1.3.dfsg-3.1ubuntu2.1) ... 441s Setting up cpp (4:13.2.0-7ubuntu1) ... 441s Setting up libpangoft2-1.0-0:armhf (1.52.1+ds-1build1) ... 441s Setting up libpangocairo-1.0-0:armhf (1.52.1+ds-1build1) ... 441s Setting up gcc-arm-linux-gnueabihf (4:13.2.0-7ubuntu1) ... 441s Setting up g++-13-arm-linux-gnueabihf (13.3.0-6ubuntu2~24.04) ... 441s Setting up g++-arm-linux-gnueabihf (4:13.2.0-7ubuntu1) ... 441s Setting up g++-13 (13.3.0-6ubuntu2~24.04) ... 441s Setting up libxmu6:armhf (2:1.1.3-3build2) ... 441s Setting up libtool (2.4.7-7build1) ... 441s Setting up libxaw7:armhf (2:1.0.14-1build2) ... 441s Setting up gcc (4:13.2.0-7ubuntu1) ... 441s Setting up dh-autoreconf (20) ... 441s Setting up g++ (4:13.2.0-7ubuntu1) ... 441s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 441s Setting up build-essential (12.10ubuntu1) ... 441s Setting up debhelper (13.14.1ubuntu5) ... 441s Setting up libheif-plugin-aomdec:armhf (1.17.6-1ubuntu4.1) ... 441s Setting up libheif-plugin-libde265:armhf (1.17.6-1ubuntu4.1) ... 441s Setting up libheif1:armhf (1.17.6-1ubuntu4.1) ... 441s Setting up libgd3:armhf (2.3.3-9ubuntu5) ... 441s Setting up libgvc6 (2.42.2-9ubuntu0.1) ... 441s Setting up graphviz (2.42.2-9ubuntu0.1) ... 441s Processing triggers for libc-bin (2.39-0ubuntu8.4) ... 441s Processing triggers for man-db (2.12.0-4build2) ... 443s Processing triggers for install-info (7.1-3build2) ... 443s Processing triggers for sgml-base (1.31) ... 443s Setting up docbook-xsl (1.79.2+dfsg-7) ... 443s Setting up sgml-data (2.0.11+nmu1) ... 444s Processing triggers for sgml-base (1.31) ... 444s Setting up docbook-xml (4.5-12) ... 446s Processing triggers for sgml-base (1.31) ... 463s Reading package lists... 464s Building dependency tree... 464s Reading state information... 464s Starting pkgProblemResolver with broken count: 0 464s Starting 2 pkgProblemResolver with broken count: 0 464s Done 465s The following NEW packages will be installed: 465s apt-transport-https 465s 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. 465s Need to get 3970 B of archives. 465s After this operation, 36.9 kB of additional disk space will be used. 465s Get:1 http://ftpmaster.internal/ubuntu noble-updates/universe armhf apt-transport-https all 2.8.3 [3970 B] 466s Fetched 3970 B in 0s (26.8 kB/s) 466s Selecting previously unselected package apt-transport-https. 466s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 73056 files and directories currently installed.) 466s Preparing to unpack .../apt-transport-https_2.8.3_all.deb ... 466s Unpacking apt-transport-https (2.8.3) ... 466s Setting up apt-transport-https (2.8.3) ... 482s autopkgtest [00:07:31]: test run-tests: [----------------------- 484s -- The C compiler identification is GNU 13.3.0 484s -- The CXX compiler identification is GNU 13.3.0 484s -- Detecting C compiler ABI info 484s -- Detecting C compiler ABI info - done 484s -- Check for working C compiler: /usr/bin/cc - skipped 484s -- Detecting C compile features 484s -- Detecting C compile features - done 484s -- Detecting CXX compiler ABI info 484s -- Detecting CXX compiler ABI info - done 484s -- Check for working CXX compiler: /usr/bin/c++ - skipped 484s -- Detecting CXX compile features 484s -- Detecting CXX compile features - done 484s -- Performing Test CMAKE_HAVE_LIBC_PTHREAD 485s -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success 485s -- Found Threads: TRUE 485s -- Looking for native LFS support 485s -- Looking for native LFS support - found 485s -- Found LFS: TRUE 485s -- Looking for iconv_open 485s -- Looking for iconv_open - found 485s -- Found Iconv: /usr/include 485s -- Found Perl: /usr/bin/perl (found version "5.38.2") 485s -- Performing Test have-compiler-flag:-Wall 485s -- Performing Test have-compiler-flag:-Wall - Success 485s -- Performing Test have-compiler-flag:-Wextra 485s -- Performing Test have-compiler-flag:-Wextra - Success 485s -- Performing Test have-compiler-flag:-Wcast-align 485s -- Performing Test have-compiler-flag:-Wcast-align - Success 485s -- Performing Test have-compiler-flag:-Wlogical-op 485s -- Performing Test have-compiler-flag:-Wlogical-op - Success 485s -- Performing Test have-compiler-flag:-Wredundant-decls 486s -- Performing Test have-compiler-flag:-Wredundant-decls - Success 486s -- Performing Test have-compiler-flag:-Wmissing-declarations 486s -- Performing Test have-compiler-flag:-Wmissing-declarations - Success 486s -- Performing Test have-compiler-flag:-Wunsafe-loop-optimizations 486s -- Performing Test have-compiler-flag:-Wunsafe-loop-optimizations - Success 486s -- Performing Test have-compiler-flag:-Wctor-dtor-privacy 486s -- Performing Test have-compiler-flag:-Wctor-dtor-privacy - Success 486s -- Performing Test have-compiler-flag:-Wdisabled-optimization 486s -- Performing Test have-compiler-flag:-Wdisabled-optimization - Success 486s -- Performing Test have-compiler-flag:-Winit-self 486s -- Performing Test have-compiler-flag:-Winit-self - Success 486s -- Performing Test have-compiler-flag:-Wmissing-include-dirs 487s -- Performing Test have-compiler-flag:-Wmissing-include-dirs - Success 487s -- Performing Test have-compiler-flag:-Wnoexcept 487s -- Performing Test have-compiler-flag:-Wnoexcept - Success 487s -- Performing Test have-compiler-flag:-Wsign-promo 487s -- Performing Test have-compiler-flag:-Wsign-promo - Success 487s -- Performing Test have-compiler-flag:-Wundef 487s -- Performing Test have-compiler-flag:-Wundef - Success 487s -- Performing Test have-compiler-flag:-Wdouble-promotion 487s -- Performing Test have-compiler-flag:-Wdouble-promotion - Success 487s -- Performing Test have-compiler-flag:-Wsuggest-override 487s -- Performing Test have-compiler-flag:-Wsuggest-override - Success 487s -- Performing Test have-compiler-flag:-Werror=suggest-override 487s -- Performing Test have-compiler-flag:-Werror=suggest-override - Success 487s -- Performing Test have-compiler-flag:-Werror=return-type 488s -- Performing Test have-compiler-flag:-Werror=return-type - Success 488s -- Found Berkeley: /usr/include 488s -- Found GnuTLS: /usr/lib/arm-linux-gnueabihf/libgnutls.so (found version "3.8.3") 488s -- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found version "1.3") 488s -- Found BZip2: /usr/lib/arm-linux-gnueabihf/libbz2.so (found version "1.0.8") 488s -- Looking for BZ2_bzCompressInit 488s -- Looking for BZ2_bzCompressInit - found 488s -- Found PkgConfig: /usr/bin/pkg-config (found version "1.8.1") 488s -- Checking for module 'liblzma' 488s -- Found liblzma, version 5.4.5 488s -- Found LZMA: /usr/include 488s -- Checking for module 'liblz4' 488s -- Found liblz4, version 1.9.4 488s -- Found LZ4: /usr/include 488s -- Checking for module 'libzstd' 488s -- Found libzstd, version 1.5.5 488s -- Found ZSTD: /usr/include 488s -- Checking for module 'libudev' 488s -- Found libudev, version 255 488s -- Found Udev: /usr/include 488s -- Checking for module 'libsystemd' 488s -- Found libsystemd, version 255 488s -- Found Systemd: /usr/include 488s -- Checking for module 'libseccomp' 488s -- Found libseccomp, version 2.5.5 488s -- Found SECCOMP: /usr/include 488s -- Checking for module 'libgcrypt' 488s -- Found libgcrypt, version 1.10.3 488s -- Found GCRYPT: /usr/include 488s -- Checking for module 'libxxhash' 488s -- Found libxxhash, version 0.8.2 488s -- Found XXHASH: /usr/include 488s -- Looking for statfs 488s -- Looking for statfs - found 488s -- Looking for include file sys/params.h 489s -- Looking for include file sys/params.h - not found 489s -- Looking for statfs 489s -- Looking for statfs - not found 489s -- Looking for statvfs 489s -- Looking for statvfs - found 489s -- Performing Test HAVE_STRUCT_STATFS_F_TYPE 489s -- Performing Test HAVE_STRUCT_STATFS_F_TYPE - Success 489s -- Looking for getresuid 489s -- Looking for getresuid - found 489s -- Looking for getresgid 489s -- Looking for getresgid - found 489s -- Looking for setresuid 489s -- Looking for setresuid - found 489s -- Looking for setresgid 489s -- Looking for setresgid - found 489s -- Looking for ptsname_r 490s -- Looking for ptsname_r - found 490s -- Looking for timegm 490s -- Looking for timegm - found 490s -- Looking for include file machine/endian.h 490s -- Looking for include file machine/endian.h - not found 490s -- Looking for include file sys/endian.h 490s -- Looking for include file sys/endian.h - not found 490s -- Looking for include file endian.h 490s -- Looking for include file endian.h - found 490s -- Looking for C++ include sys/types.h 490s -- Looking for C++ include sys/types.h - found 490s -- Looking for C++ include stdint.h 490s -- Looking for C++ include stdint.h - found 490s -- Looking for C++ include stddef.h 490s -- Looking for C++ include stddef.h - found 490s -- Check size of sig_t 491s -- Check size of sig_t - done 491s -- Check size of sighandler_t 491s -- Check size of sighandler_t - done 491s -- Looking for res_ninit 491s -- Looking for res_ninit - not found 491s -- Found dpkg data dir: /usr/share/dpkg 491s -- Found root group: root 491s -- Detected vendor: ubuntu 491s -- Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR GTEST_MAIN_LIBRARY) 491s -- Found GTest at /usr/src/googletest/googletest, headers at /usr/src/googletest/googletest/include 491s -- Performing Test have-compiler-flag:-Wno-undef 491s -- Performing Test have-compiler-flag:-Wno-undef - Success 491s -- Performing Test have-compiler-flag:-Wno-ctor-dtor-privacy 492s -- Performing Test have-compiler-flag:-Wno-ctor-dtor-privacy - Success 492s -- Performing Test have-compiler-flag:-Wno-suggest-override 492s -- Performing Test have-compiler-flag:-Wno-suggest-override - Success 492s -- Configuring done (7.9s) 492s -- Generating done (0.1s) 492s -- Build files have been written to: /tmp/autopkgtest.5jqyde/autopkgtest_tmp 492s make: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp/test/interactive-helper' 492s make[1]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 492s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 492s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 492s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 492s [ 6%] Building CXX object test/interactive-helper/CMakeFiles/mthdcat.dir/mthdcat.cc.o 492s [ 12%] Linking CXX executable mthdcat 492s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 492s [ 12%] Built target mthdcat 492s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 492s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 492s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 492s [ 12%] Building CXX object test/interactive-helper/CMakeFiles/testdeb.dir/testdeb.cc.o 493s [ 18%] Linking CXX executable testdeb 493s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 493s [ 18%] Built target testdeb 493s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 493s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 493s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 493s [ 25%] Building CXX object test/interactive-helper/CMakeFiles/testkeep.dir/testkeep.cc.o 494s [ 31%] Linking CXX executable testkeep 494s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 494s [ 31%] Built target testkeep 494s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 494s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 494s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 494s [ 37%] Building CXX object test/interactive-helper/CMakeFiles/extract-control.dir/extract-control.cc.o 494s [ 37%] Linking CXX executable extract-control 495s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 495s [ 37%] Built target extract-control 495s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 495s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 495s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 495s [ 43%] Building CXX object test/interactive-helper/CMakeFiles/aptwebserver.dir/aptwebserver.cc.o 495s /tmp/autopkgtest.5jqyde/build.ScX/src/test/interactive-helper/aptwebserver.cc: In function ‘void* handleClient(int, size_t)’: 495s /tmp/autopkgtest.5jqyde/build.ScX/src/test/interactive-helper/aptwebserver.cc:681:43: warning: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘unsigned int’ [-Wformat=] 495s 681 | strprintf(logfilepath, "%s.client-%lu.log", logfilepath.c_str(), id); 495s | ~~^ ~~ 495s | | | 495s | long unsigned int unsigned int 495s | %u 496s [ 43%] Linking CXX executable aptwebserver 496s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 496s [ 43%] Built target aptwebserver 496s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 496s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 496s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 496s [ 50%] Building CXX object test/interactive-helper/CMakeFiles/aptdropprivs.dir/aptdropprivs.cc.o 497s [ 56%] Linking CXX executable aptdropprivs 497s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 497s [ 56%] Built target aptdropprivs 497s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 497s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 497s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 497s [ 62%] Building CXX object test/interactive-helper/CMakeFiles/test_fileutl.dir/test_fileutl.cc.o 497s [ 68%] Linking CXX executable test_fileutl 497s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 497s /tmp/autopkgtest.5jqyde/build.ScX/src/test/interactive-helper/createdeb-cve-2020-27350.cc: In function ‘void createdeb_test(int)’: 497s /tmp/autopkgtest.5jqyde/build.ScX/src/test/interactive-helper/createdeb-cve-2020-27350.cc:285:40: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 4 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=] 497s 285 | snprintf(h.Size, sizeof(h.Size), "%ld", (size_t)512 + 512); 497s | ~~^ ~~~~~~~~~~~~~~~~~ 497s | | | 497s | long int size_t {aka unsigned int} 497s | %d 497s /tmp/autopkgtest.5jqyde/build.ScX/src/test/interactive-helper/createdeb-cve-2020-27350.cc:293:46: warning: format ‘%lo’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘size_t’ {aka ‘unsigned int’} [-Wformat=] 497s 293 | snprintf(tar->Size, sizeof(tar->Size), "%lo", strlen(control)); 497s | ~~^ ~~~~~~~~~~~~~~~ 497s | | | 497s | | size_t {aka unsigned int} 497s | long unsigned int 497s | %o 497s [ 68%] Built target test_fileutl 497s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 497s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 497s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 497s [ 75%] Building CXX object test/interactive-helper/CMakeFiles/createdeb-cve-2020-27350.dir/createdeb-cve-2020-27350.cc.o 498s [ 81%] Linking CXX executable createdeb-cve-2020-27350 498s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 498s [ 81%] Built target createdeb-cve-2020-27350 498s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 498s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 498s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 498s [ 87%] Building CXX object test/interactive-helper/CMakeFiles/longest-dependency-chain.dir/longest-dependency-chain.cc.o 498s In file included from /tmp/autopkgtest.5jqyde/build.ScX/src/apt-pkg/depcache.h:42, 498s from /tmp/autopkgtest.5jqyde/build.ScX/src/apt-pkg/cachefile.h:21, 498s from /tmp/autopkgtest.5jqyde/build.ScX/src/test/interactive-helper/longest-dependency-chain.cc:3: 498s /tmp/autopkgtest.5jqyde/build.ScX/src/apt-pkg/pkgcache.h: In member function ‘APT::StringView pkgCache::ViewString(map_stringitem_t) const’: 498s /tmp/autopkgtest.5jqyde/build.ScX/src/apt-pkg/pkgcache.h:257:23: warning: cast from ‘char*’ to ‘const uint16_t*’ {aka ‘const short unsigned int*’} increases required alignment of target type [-Wcast-align] 498s 257 | uint16_t len = *reinterpret_cast(name - sizeof(uint16_t)); 498s | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 498s [ 93%] Linking CXX executable longest-dependency-chain 498s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 498s [ 93%] Built target longest-dependency-chain 498s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 498s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 498s make[2]: Entering directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 499s [100%] Building C object test/interactive-helper/CMakeFiles/noprofile.dir/libnoprofile.c.o 499s cc1: warning: command-line option ‘-Wctor-dtor-privacy’ is valid for C++/ObjC++ but not for C 499s cc1: warning: command-line option ‘-Wnoexcept’ is valid for C++/ObjC++ but not for C 499s cc1: warning: command-line option ‘-Wsign-promo’ is valid for C++/ObjC++ but not for C 499s cc1: warning: command-line option ‘-Wsuggest-override’ is valid for C++/ObjC++ but not for C 499s cc1: warning: ‘-Werror=’ argument ‘-Werror=suggest-override’ is not valid for C 499s [100%] Linking C shared library libnoprofile.so 499s make[2]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 499s [100%] Built target noprofile 499s make[1]: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp' 499s make: Leaving directory '/tmp/autopkgtest.5jqyde/autopkgtest_tmp/test/interactive-helper' 501s (1/302) Testcase test-00-commands-have-help: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 507s (2/302) Testcase test-acquire-binary-all: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 636s (3/302) Testcase test-acquire-same-file-multiple-times: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 636s Redirect leads first URI to the second URI … Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 636s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 636s Configured access method http 636s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 636s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 636s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 636s Configured access method http 636s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 636s -> http:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpk 636s Test for successful execution of cmp /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework ./downloaded/foo1 … #### Complete file: /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework #### 636s #### Complete file: ./downloaded/foo1 #### 636s #### cmp output #### 636s 636s Test for successful execution of cmp ./downloaded/foo1 ./downloaded/foo2 … #### Complete file: ./downloaded/foo1 #### 636s #### Complete file: ./downloaded/foo2 #### 636s #### cmp output #### 636s P Pg=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 636s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo2%0aFilename:%20./downloaded/foo1%0a%0a 636s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo%0aFilename:%20./downloaded/foo2%0a%0a 636s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20http://localhost:44339/foo2 636s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 636s GET /foo2 HTTP/1.1 636s Host: localhost:44339 636s Accept: text/* 636s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 636s 636s <- 636s http:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 636s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo2 636s Answer for: http://localhost:44339/foo2 636s HTTP/1.1 301 Moved Permanently 636s Content-Length: 357 636s Location: https://localhost:44339/foo 636s Content-Type: text/html; charset=utf-8 636s Server: APT webserver 636s Accept-Ranges: bytes 636s Date: Fri, 13 Jun 2025 00:07:58 GMT 636s 636s <- GET /foo HTTP/1.1 636s Host: localhost:44339 636s Accept: text/* 636s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 636s 636s http 636s :103%20Redirect%0aNew-URI:%20https://localhost:44339/foo%0aURI:%20http://localhost:44339/foo2 636s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 636s Answer for: http://localhost:44339/foo 636s HTTP/1.1 200 OK 636s Content-Length: 77417 636s Last-Modified: Fri, 13 Jun 2025 00:07:57 GMT 636s Server: APT webserver 636s Accept-Ranges: bytes 636s Date: Fri, 13 Jun 2025 00:07:58 GMT 636s 636s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 636s Configured access method https 636s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 636s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 636s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 636s Configured access method https 636s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 636s -> https:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpkg=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 636s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 636s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo 636s <- http:200%20URI%20Start%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aURI:%20http://localhost:44339/foo 636s Get:2 http://localhost:44339/foo [77.4 kB] 636s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20https://localhost:44339/foo 636s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 636s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 636s <- http:201%20URI%20Done%0aChecksum-FileSize-Hash:%2077417%0aSHA512-Hash:%2099758b98725ee45110a374044902230c8b056c97567d3ec249dc4add195e13a8d07d7d5d5081938286c2c21ec0841528b6cee8986d16a3a9d0abd4c570dd7dce%0aSHA256-Hash:%2072d18d223dc239300d7548396ef9409ee2e4ff5163d55557a87d9852c098e15e%0aSHA1-Hash:%20357fe7a44e62f7a01e1b4c96ee33675f03223500%0aMD5Sum-Hash:%20582a51e7590162e00495e35c882c4b44%0aMD5-Hash:%20582a51e7590162e00495e35c882c4b44%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aFilename:%20./downloaded/foo2%0aURI:%20http://localhost:44339/foo 636s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 636s Ign:1 http://localhost:44339/foo2 636s Could not wait for server fd - select (11: Resource temporarily unavailable) 636s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 636s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 636s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 636s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 636s Ign:1 http://localhost:44339/foo2 636s Could not wait for server fd - select (11: Resource temporarily unavailable) 636s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 636s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 636s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 636s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 636s Ign:1 http://localhost:44339/foo2 636s Could not wait for server fd - select (11: Resource temporarily unavailable) 636s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 636s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 636s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 636s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 636s Err:1 http://localhost:44339/foo2 636s Could not wait for server fd - select (11: Resource temporarily unavailable) 636s E: Failed to fetch https://localhost:44339/foo Could not wait for server fd - select (11: Resource temporarily unavailable) 636s E: Download Failed 636s FAIL: exitcode 100 636s 636s #!/bin/sh -- # no runable script, just for vi 636s 636s EXIT_CODE=0 636s 636s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 636s if [ "$1" = "-q" ]; then 636s export MSGLEVEL=2 636s elif [ "$1" = "-qq" ]; then 636s export MSGLEVEL=1 636s elif [ "$1" = "-v" ]; then 636s export MSGLEVEL=4 636s elif [ "$1" = '--color=no' ]; then 636s export MSGCOLOR='NO' 636s elif [ "$1" = '--color=yes' ]; then 636s export MSGCOLOR='YES' 636s elif [ "$1" = '--color' ]; then 636s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 636s shift 636s elif [ "$1" = '--level' ]; then 636s export MSGLEVEL=$2 636s shift 636s else 636s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 636s fi 636s shift 636s done 636s export MSGLEVEL="${MSGLEVEL:-3}" 636s 636s # we all like colorful messages 636s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 636s if [ ! -t 1 ]; then # but check that we output to a terminal 636s export MSGCOLOR='NO' 636s fi 636s fi 636s 636s if [ "$MSGCOLOR" != 'NO' ]; then 636s CERROR="\033[1;31m" # red 636s CWARNING="\033[1;33m" # yellow 636s CMSG="\033[1;32m" # green 636s CINFO="\033[1;96m" # light blue 636s CDEBUG="\033[1;94m" # blue 636s CNORMAL="\033[0;39m" # default system console color 636s CDONE="\033[1;32m" # green 636s CPASS="\033[1;32m" # green 636s CFAIL="\033[1;31m" # red 636s CCMD="\033[1;35m" # pink 636s fi 636s 636s msgprintf() { 636s local START="$1" 636s local MIDDLE="$2" 636s local END="$3" 636s shift 3 636s if [ -n "$1" ]; then 636s printf "$START " "$1" 636s shift 636s while [ -n "$1" ]; do 636s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 636s shift 636s done 636s fi 636s printf "${END}" 636s } 636s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 636s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 636s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 636s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 636s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 636s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 636s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 636s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 636s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 636s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 636s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 636s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 636s msgreportheader() { 636s if [ -n "$MSGTEST_MSG" ]; then 636s test "$1" != 'msgfailoutput' || echo 636s if [ -n "$MSGTEST_MSGMSG" ]; then 636s echo "$MSGTEST_MSGMSG" 636s fi 636s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 636s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 636s fi 636s echo -n "$MSGTEST_MSG" 636s unset MSGTEST_MSG 636s fi 636s } 636s msgskip() { 636s msgreportheader 'msgskip' 636s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 636s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 636s } 636s msgfail() { 636s msgreportheader 'msgfail' 636s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 636s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 636s if [ -n "$APT_DEBUG_TESTS" ]; then 636s runapt $SHELL 636s fi 636s EXIT_CODE=$((EXIT_CODE+1)); 636s } 636s MSGGROUP_LEVEL=0 636s msggroup() { 636s if [ -n "$1" ]; then 636s if [ $MSGGROUP_LEVEL = 0 ]; then 636s MSGTEST_GRP='NEXT' 636s fi 636s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 636s else 636s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 636s if [ $MSGGROUP_LEVEL = 0 ]; then 636s unset MSGTEST_GRP 636s fi 636s fi 636s } 636s 636s # enable / disable Debugging 636s if [ $MSGLEVEL -le 0 ]; then 636s msgdie() { true; } 636s fi 636s if [ $MSGLEVEL -le 1 ]; then 636s msgwarn() { true; } 636s msgnwarn() { true; } 636s fi 636s if [ $MSGLEVEL -le 2 ]; then 636s msgmsg() { 636s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 636s } 636s msgnmsg() { true; } 636s msgtest() { 636s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 636s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 636s MSGTEST_GRP="$MSGTEST_MSG" 636s fi 636s } 636s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 636s fi 636s if [ $MSGLEVEL -le 3 ]; then 636s msginfo() { true; } 636s msgninfo() { true; } 636s fi 636s if [ $MSGLEVEL -le 4 ]; then 636s msgdebug() { true; } 636s msgndebug() { true; } 636s fi 636s if [ $MSGLEVEL -le 1 ]; then 636s msgpass() { true; } 636s fi 636s msgdone() { 636s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 636s [ "$1" = "info" -a $MSGLEVEL -le 3 ] || 636s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 636s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 636s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 636s true; 636s else 636s printf "${CDONE}DONE${CNORMAL}\n"; 636s fi 636s } 636s getaptconfig() { 636s if [ -f ./aptconfig.conf ]; then 636s echo "$(readlink -f ./aptconfig.conf)" 636s elif [ -f ../aptconfig.conf ]; then 636s echo "$(readlink -f ../aptconfig.conf)" 636s elif [ -f ../../aptconfig.conf ]; then 636s echo "$(readlink -f ../../aptconfig.conf)" 636s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 636s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 636s fi 636s } 636s runapt() { 636s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 636s local CMD="$1" 636s shift 636s case "$CMD" in 636s sh|aptitude|*/*|command) ;; 636s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 636s esac 636s if [ "$CMD" = 'aptitude' ]; then 636s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 636s else 636s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 636s fi 636s } 636s runpython3() { runapt command python3 "$@"; } 636s aptconfig() { runapt apt-config "$@"; } 636s aptcache() { runapt apt-cache "$@"; } 636s aptcdrom() { runapt apt-cdrom "$@"; } 636s aptget() { runapt apt-get "$@"; } 636s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 636s aptkey() { runapt apt-key "$@"; } 636s aptmark() { runapt apt-mark "$@"; } 636s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 636s apt() { runapt apt "$@"; } 636s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 636s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 636s aptitude() { runapt aptitude "$@"; } 636s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 636s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 636s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 636s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 636s 636s dpkg() { 636s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 636s } 636s dpkgquery() { 636s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 636s } 636s dpkg_version() { 636s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 636s } 636s dpkgcheckbuilddeps() { 636s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 636s } 636s gdb() { 636s local CMD 636s case "$1" in 636s aptget) CMD="apt-get";; 636s aptcache) CMD="apt-cache";; 636s aptcdrom) CMD="apt-cdrom";; 636s aptconfig) CMD="apt-config";; 636s aptmark) CMD="apt-mark";; 636s apthelper) CMD="apt-helper";; 636s aptftparchive) CMD="apt-ftparchive";; 636s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 636s *) CMD="$1";; 636s esac 636s shift 636s if [ "${CMD##*/}" = "$CMD" ]; then 636s CMD="${APTCMDLINEBINDIR}/${CMD}" 636s fi 636s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 636s } 636s 636s valgrind() { 636s local CMD 636s case "$1" in 636s aptget) CMD="apt-get";; 636s aptcache) CMD="apt-cache";; 636s aptcdrom) CMD="apt-cdrom";; 636s aptconfig) CMD="apt-config";; 636s aptmark) CMD="apt-mark";; 636s apthelper) CMD="apt-helper";; 636s aptftparchive) CMD="apt-ftparchive";; 636s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 636s *) CMD="$1";; 636s esac 636s shift 636s if [ "$CMD" = "apt-ftparchive" ]; then 636s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 636s fi 636s if [ "${CMD##*/}" = "$CMD" ]; then 636s CMD="${APTCMDLINEBINDIR}/${CMD}" 636s fi 636s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 636s } 636s 636s lastmodification() { 636s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 636s } 636s releasefiledate() { 636s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 636s } 636s 636s exitwithstatus() { 636s # error if we about to overflow, but ... 636s # "255 failures ought to be enough for everybody" 636s if [ $EXIT_CODE -gt 255 ]; then 636s msgdie "Total failure count $EXIT_CODE too big" 636s fi 636s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 636s } 636s 636s shellsetedetector() { 636s local exit_status=$? 636s if [ "$exit_status" != '0' ]; then 636s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 636s if [ "$EXIT_CODE" = '0' ]; then 636s EXIT_CODE="$exit_status" 636s fi 636s fi 636s } 636s 636s addtrap() { 636s if [ "$1" = 'prefix' ]; then 636s CURRENTTRAP="$2 $CURRENTTRAP" 636s else 636s CURRENTTRAP="$CURRENTTRAP $1" 636s fi 636s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 636s } 636s 636s escape_shell() { 636s echo "$@" | sed -e "s#'#'\"'\"'#g" 636s } 636s 636s find_project_binary_dir() { 636s if [ -z "$PROJECT_BINARY_DIR" ]; then 636s PROJECT_BINARY_DIR= 636s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 636s test -e "$dir/CMakeCache.txt" || continue 636s if [ -z "$PROJECT_BINARY_DIR" ] || 636s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 636s PROJECT_BINARY_DIR="$dir" 636s fi 636s done 636s if [ -z "$PROJECT_BINARY_DIR" ]; then 636s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 636s exit 1 636s fi 636s export PROJECT_BINARY_DIR 636s fi 636s } 636s _removetmpworkingdirectory() { 636s cd / 636s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 636s rm -rf "$TMPWORKINGDIRECTORY" 636s fi 636s TMPWORKINGDIRECTORY='' 636s } 636s setupenvironment() { 636s # cleanup the environment a bit 636s export LC_ALL=C 636s unset LANGUAGE COLUMNS NLSPATH 636s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 636s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 636s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 636s unset GREP_OPTIONS POSIXLY_CORRECT 636s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 636s export GCOV_ERROR_FILE=/dev/null 636s 636s # Next check needs a gnu stat, let's figure that out early. 636s stat=stat 636s if command -v gnustat >/dev/null 2>&1; then 636s stat=gnustat 636s fi 636s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 636s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 636s unset TMPDIR 636s fi 636s if [ -z "$TMPWORKINGDIRECTORY" ]; then 636s addtrap '_removetmpworkingdirectory;' 636s TMPWORKINGDIRECTORY="$(mktemp -d)" 636s fi 636s if [ -n "$TMPDIR_ADD" ]; then 636s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 636s mkdir -p "$TMPWORKINGDIRECTORY" 636s unset TMPDIR_ADD 636s export TMPDIR="$TMPWORKINGDIRECTORY" 636s fi 636s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 636s 636s # Setup coreutils on BSD systems 636s mkdir "${TMPWORKINGDIRECTORY}/bin" 636s for prefix in gnu g; do 636s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 636s if command -v $prefix$command 2>/dev/null >/dev/null; then 636s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 636s fi 636s done 636s done 636s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 636s 636s if [ -z "$TESTDIRECTORY" ]; then 636s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 636s fi 636s cd "$TMPWORKINGDIRECTORY" 636s 636s mkdir -m 700 'downloaded' 636s if [ "$(id -u)" = '0' ]; then 636s # relax permissions so that running as root with user switching works 636s umask 022 636s chmod 711 "$TMPWORKINGDIRECTORY" 636s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 636s fi 636s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 636s 636s _setupprojectenvironment 636s 636s # create some files in /tmp and look at user/group to get what this means 636s TEST_DEFAULT_USER="$(id -un)" 636s touch "${TMPWORKINGDIRECTORY}/test-file" 636s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 636s 636s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 636s . "${TESTDIRECTORY}/extra-environment" 636s fi 636s 636s msgdone "info" 636s } 636s _setupprojectenvironment() { 636s # allow overriding the default BUILDDIR locations 636s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 636s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 636s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 636s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 636s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 636s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 636s APTFTP PARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 636s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 636s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 636s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 636s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 636s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 636s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 636s 636s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 636s mkdir aptarchive keys 636s cd rootdir 636s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 636s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 636s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 636s touch var/lib/dpkg/available var/lib/dpkg/lock 636s echo '1' > var/lib/dpkg/info/format 636s ln -s "${METHODSDIR}" usr/lib/apt/methods 636s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 636s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 636s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 636s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 636s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 636s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 636s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 636s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 636s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 636s else 636s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 636s fi 636s cd .. 636s local BASENAME="${0##*/}" 636s local PACKAGESFILE="Packages-${BASENAME#*-}" 636s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 636s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 636s fi 636s local SOURCESSFILE="Sources-${BASENAME#*-}" 636s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 636s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 636s fi 636s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 636s chmod 644 keys/* 636s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 636s 636s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 636s echo "Dir::Etc \"etc\";" >> aptconfig.conf 636s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 636s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 636s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 636s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 636s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 636s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 636s # either store apt-key were we can access it, even if we run it as a different user 636s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 636s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 636s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 636s # destroys coverage reporting though, so we disable changing user for the calling gpgv 636s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 636s if [ "$(id -u)" = '0' ]; then 636s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 636s # same for the solver executables 636s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 636s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 636s fi 636s 636s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 636s EXEC='' 636s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 636s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 636s restoredpkgstatus() { 636s if [ -n "\$BACKUP" ]; then 636s if [ -e "\$BACKUP" ]; then 636s mv -f "\$BACKUP" "\$ORIGINAL" 636s else 636s rm -f "\$ORIGINAL" 636s fi 636s BACKUP='' 636s fi 636s } 636s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 636s if [ -e "\$ORIGINAL" ]; then 636s cp -a "\$ORIGINAL" "\$BACKUP" 636s fi 636s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 636s 636s Package: dpkg 636s Architecture: all 636s Version: ${DPKG_VERSION}+fake 636s Status: install ok installed 636s Maintainer: Joe Sixpack 636s Installed-Size: 42 636s Description: tells dpkg it supports what we need 636s Some versions of dpkg check its own version from the status file 636s to know if it supports multi-arch and stuff in --assert-*. 636s 636s EOS 636s fi 636s EOF 636s fi 636s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 636s 636s { 636s echo 'quiet "0";' 636s echo 'quiet::NoUpdate "true";' 636s echo 'quiet::NoStatistic "true";' 636s # too distracting for users, but helpful to detect changes 636s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 636s echo 'Acquire::Progress::Diffpercent "true";' 636s # in testcases, it can appear as if localhost has a rotation setup, 636s # hide this as we can't really deal with it properly 636s echo 'Acquire::Failure::ShowIP "false";' 636s # randomess and tests don't play well together 636s echo 'Acquire::IndexTargets::Randomized "false";' 636s # fakeroot can't fake everything, so disabled in production but good for tests 636s echo 'APT::Sandbox::Verify "true";' 636s } >> aptconfig.conf 636s 636s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 636s if [ "$(id -u)" = '0' ]; then 636s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 636s fi 636s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 636s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 636s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 636s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 636s # Allow release files to be 10 hours in the future, rather than 10 seconds 636s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 636s 636s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 636s 636s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 636s confighashes 'SHA256' # these are tests, not security best-practices 636s 636s # Make dpkg inherit testing path 636s echo 'DPkg::Path "";' >> aptconfig.conf 636s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 636s 636s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 636s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 636s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 636s fi 636s 636s # most tests just need one signed Release file, not both 636s export APT_DONT_SIGN='Release.gpg' 636s 636s # prefer our apt binaries over the system apt binaries 636s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 636s } 636s 636s getarchitecture() { 636s if [ "$1" = "native" -o -z "$1" ]; then 636s eval `aptconfig shell ARCH APT::Architecture` 636s if [ -n "$ARCH" ]; then 636s echo $ARCH 636s else 636s dpkg --print-architecture 636s fi 636s else 636s echo $1 636s fi 636s } 636s 636s getarchitectures() { 636s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 636s } 636s 636s getarchitecturesfromcommalist() { 636s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 636s } 636s 636s configarchitecture() { 636s { 636s echo "APT::Architecture \"$(getarchitecture $1)\";" 636s while [ -n "$1" ]; do 636s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 636s shift 636s done 636s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 636s configdpkg 636s } 636s 636s configdpkg() { 636s if [ ! -e rootdir/var/lib/dpkg/status ]; then 636s local BASENAME="${0##*/}" 636s local STATUSFILE="status-${BASENAME#*-}" 636s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 636s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 636s # Add an empty line to the end if there is none 636s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 636s echo >> rootdir/var/lib/dpkg/status 636s fi 636s fi 636s fi 636s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 636s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 636s local ARCHS="$(getarchitectures)" 636s local DPKGARCH="$(dpkg --print-architecture)" 636s # this ensures that even if multi-arch isn't active in the view 636s # of apt, given that dpkg can't be told which arch is native 636s # the arch apt treats as native might be foreign for dpkg 636s for ARCH in ${ARCHS}; do 636s if [ "${ARCH}" != "${DPKGARCH}" ]; then 636s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 636s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 636s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 636s else 636s # old-style used e.g. in Ubuntu-P – and as it seems travis 636s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 636s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 636s fi 636s fi 636s fi 636s done 636s else 636s # test multiarch before dpkg is ready for it… 636s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 636s fi 636s } 636s 636s configdpkgnoopchroot() { 636s # create a library to noop chroot() and rewrite maintainer script executions 636s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 636s # chroot directory dpkg could chroot into to execute the maintainer scripts 636s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 636s cat > noopchroot.c << EOF 636s #define _GNU_SOURCE 636s #include 636s #include 636s #include 636s #include 636s 636s static char * chrootdir = NULL; 636s 636s int chroot(const char *path) { 636s printf("WARNING: CHROOTing to %s was ignored!\n", path); 636s free(chrootdir); 636s chrootdir = strdup(path); 636s return 0; 636s } 636s int execvp(const char *file, char *const argv[]) { 636s static int (*func_execvp) (const char *, char * const []) = NULL; 636s if (func_execvp == NULL) 636s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 636s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 636s return func_execvp(file, argv); 636s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 636s char *newfile; 636s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 636s perror("asprintf"); 636s return -1; 636s } 636s char const * const baseadmindir = "/var/lib/dpkg"; 636s char *admindir; 636s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 636s perror("asprintf"); 636s return -1; 636s } 636s setenv("DPKG_ADMINDIR", admindir, 1); 636s return func_execvp(newfile, argv); 636s } 636s EOF 636s if cc -ldl 2>&1 | grep -q dl; then 636s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 636s else 636s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 636s fi 636s } 636s configcompression() { 636s if [ "$1" = 'ALL' ]; then 636s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 636s return 636s fi 636s local CMD='apthelper cat-file -C' 636s while [ -n "$1" ]; do 636s case "$1" in 636s '.') printf ".\t.\tcat\n";; 636s 'gz') printf "gzip\tgz\t$CMD $1\n";; 636s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 636s 'zst') printf "zstd\tzst\t$CMD $1\n";; 636s *) printf "$1\t$1\t$CMD $1\n";; 636s esac 636s shift 636s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 636s } 636s confighashes() { 636s { 636s echo 'APT::FTPArchive {' 636s { 636s while [ -n "$1" ]; do 636s printf "$1" | tr 'a-z' 'A-Z' 636s printf "\t\"true\";\n" 636s shift 636s done 636s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 636s printf "$h\t\"false\";\n" 636s done 636s } | awk '!x[$1]++' 636s echo '};' 636s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 636s } 636s forcecompressor() { 636s COMPRESSOR="$1" 636s COMPRESS="$1" 636s COMPRESSOR_CMD="apthelper cat-file -C $1" 636s case $COMPRESSOR in 636s gzip) COMPRESS='gz';; 636s bzip2) COMPRESS='bz2';; 636s zstd) COMPRESS='zst';; 636s esac 636s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 636s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 636s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 636s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 636s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 636s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 636s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 636s done 636s } 636s 636s _setupsimplenativepackage() { 636s local NAME="$1" 636s local ARCH="$2" 636s local VERSION="$3" 636s local RELEASE="${4:-unstable}" 636s local DEPENDENCIES="$5" 636s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 636s If you find such a package installed on your system, 636s something went horribly wrong! They are autogenerated 636s and used only by testcases and serve no other purpose…}" 636s 636s local SECTION="${7:-others}" 636s local PRIORITY="${8:-optional}" 636s local FILE_TREE="$9" 636s local COMPRESS_TYPE="${10:-gzip}" 636s local DISTSECTION 636s if [ "$SECTION" = "${SECTION#*/}" ]; then 636s DISTSECTION="main" 636s else 636s DISTSECTION="${SECTION%/*}" 636s fi 636s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 636s 636s mkdir -p "$BUILDDIR/debian/source" 636s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 636s echo "#!/bin/sh 636s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 636s 636s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 636s echo "$NAME ($VERSION) $RELEASE; urgency=low 636s 636s * Initial release 636s 636s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 636s { 636s echo "Source: $NAME 636s Priority: $PRIORITY 636s Maintainer: Joe Sixpack 636s Standards-Version: 4.3.1 636s Rules-Requires-Root: no" 636s if [ "$SECTION" != '' ]; then 636s echo "Section: $SECTION" 636s fi 636s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 636s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 636s echo " 636s Package: $NAME" 636s 636s if [ "$ARCH" = 'all' ]; then 636s echo "Architecture: all" 636s else 636s echo "Architecture: any" 636s fi 636s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 636s test -z "$DEPS" || echo "$DEPS" 636s printf "%b\n" "Description: $DESCRIPTION" 636s } > "${BUILDDIR}/debian/control" 636s 636s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 636s } 636s 636s make_tiny_rules() { 636s local OUT="$1" 636s if command -v gmake >/dev/null 2>&1; then 636s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 636s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 636s else 636s echo '#!/usr/bin/make -f' > "$OUT" 636s fi 636s echo '%:' >> "$OUT" 636s echo ' dh $@' >> "$OUT" 636s } 636s 636s setupsimplenativepackage() { 636s _setupsimplenativepackage "$@" 636s local NAME="$1" 636s local VERSION="$3" 636s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 636s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 636s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 636s } 636s 636s buildsimplenativepackage() { 636s local NAME="$1" 636s local ARCH="$2" 636s local VERSION="$3" 636s local RELEASE="${4:-unstable}" 636s local DEPENDENCIES="$5" 636s local DESCRIPTION="$6" 636s local SECTION="${7:-others}" 636s local PRIORITY="${8:-optional}" 636s local FILE_TREE="$9" 636s local COMPRESS_TYPE="${10:-gzip}" 636s local DISTSECTION 636s if [ "$SECTION" = "${SECTION#*/}" ]; then 636s DISTSECTION="main" 636s else 636s DISTSECTION="${SECTION%/*}" 636s fi 636s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 636s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 636s _setupsimplenativepackage "$@" 636s cd "${BUILDDIR}/.." 636s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 636s cd - >/dev/null 636s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 636s | while read SRC; do 636s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 636s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 636s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 636s # adv --yes --default-key 'Joe Sixpack' \ 636s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 636s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 636s # fi 636s done 636s 636s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 636s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 636s rm -rf "${BUILDDIR}/debian/tmp" 636s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 636s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 636s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 636s if [ -n "$FILE_TREE" ]; then 636s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 636s fi 636s 636s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 636s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 636s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 636s # ensure the right permissions as dpkg-deb insists 636s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 636s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 636s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 636s done 636s 636s local NM 636s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 636s NM="$(echo "$NAME" | cut -c 1-4)" 636s else 636s NM="$(echo "$NAME" | cut -c 1)" 636s fi 636s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 636s mkdir -p "$CHANGEPATH" 636s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 636s rm -rf "${BUILDDIR}" 636s msgdone "info" 636s } 636s 636s buildpackage() { 636s local BUILDDIR=$1 636s local RELEASE=$2 636s local SECTION=$3 636s local ARCH=$(getarchitecture $4) 636s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 636s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 636s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 636s cd "$BUILDDIR" 636s if [ "$ARCH" = "all" ]; then 636s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 636s fi 636s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 636s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 636s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 636s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 636s cd - > /dev/null 636s for PKG in $PKGS; do 636s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 636s done 636s for SRC in $SRCS; do 636s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 636s done 636s } 636s 636s buildaptarchive() { 636s if [ -d incoming ]; then 636s buildaptarchivefromincoming "$@" 636s else 636s buildaptarchivefromfiles "$@" 636s fi 636s } 636s 636s createaptftparchiveconfig() { 636s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 636s local COMPRESSORS="${COMPRESSORS%* }" 636s local ARCHS="$(getarchitectures)" 636s cat > ftparchive.conf <> ftparchive.conf 636s } 636s 636s buildaptftparchivedirectorystructure() { 636s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 636s for DIST in $DISTS; do 636s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 636s for SECTION in $SECTIONS; do 636s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 636s for ARCH in $ARCHS; do 636s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 636s done 636s mkdir -p "dists/${DIST}/${SECTION}/source" 636s mkdir -p "dists/${DIST}/${SECTION}/i18n" 636s done 636s done 636s } 636s 636s insertpackage() { 636s local RELEASES="$1" 636s local NAME="$2" 636s local ARCH="$3" 636s local VERSION="$4" 636s local DEPENDENCIES="$5" 636s local PRIORITY="${6:-optional}" 636s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 636s If you find such a package installed on your system, 636s something went horribly wrong! They are autogenerated 636s and used only by testcases and serve no other purpose…}" 636s local SECTION="${8:-other}" 636s 636s if [ "$SECTION" = "${SECTION#*/}" ]; then 636s DISTSECTION="main" 636s else 636s DISTSECTION="${SECTION%/*}" 636s fi 636s local ARCHS="" 636s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 636s if [ "$RELEASE" = 'installed' ]; then 636s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 636s continue 636s fi 636s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 636s if [ "$arch" = 'none' ]; then 636s ARCHS="$(getarchitectures)" 636s else 636s ARCHS="$arch" 636s fi 636s for BUILDARCH in $ARCHS; do 636s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 636s mkdir -p "$PPATH" 636s { 636s echo "Package: $NAME 636s Priority: $PRIORITY 636s Section: $SECTION 636s Installed-Size: 42 636s Size: 42" 636s if echo "$DEPENDENCIES" | grep -q SHA256:; then 636s : 636s else 636s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 636s fi 636s echo "Maintainer: Joe Sixpack " 636s test "$arch" = 'none' || echo "Architecture: $arch" 636s echo "Version: $VERSION 636s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 636s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 636s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 636s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 636s echo 636s } >> "${PPATH}/Packages" 636s done 636s done 636s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 636s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 636s echo "Package: $NAME 636s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 636s Description-en: $DESCRIPTION 636s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 636s done 636s } 636s 636s insertsource() { 636s local RELEASES="$1" 636s local NAME="$2" 636s local ARCH="$3" 636s local VERSION="$4" 636s local DEPENDENCIES="$5" 636s local BINARY="${6:-$NAME}" 636s local ARCHS="" 636s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 636s local SPATH="aptarchive/dists/${RELEASE}/main/source" 636s mkdir -p $SPATH 636s local FILE="${SPATH}/Sources" 636s local DSCFILE="${NAME}_${VERSION}.dsc" 636s local TARFILE="${NAME}_${VERSION}.tar.gz" 636s echo "Package: $NAME 636s Binary: $BINARY 636s Version: $VERSION 636s Maintainer: Joe Sixpack 636s Architecture: $ARCH" >> $FILE 636s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 636s echo "Files: 636s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 636s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 636s Checksums-Sha256: 636s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 636s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 636s " >> "$FILE" 636s done 636s } 636s 636s insertinstalledpackage() { 636s local NAME="$1" 636s local ARCH="$2" 636s local VERSION="$3" 636s local DEPENDENCIES="$4" 636s local PRIORITY="${5:-optional}" 636s local STATUS="${6:-install ok installed}" 636s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 636s If you find such a package installed on your system, 636s something went horribly wrong! They are autogenerated 636s and used only by testcases and serve no other purpose…}" 636s local SECTION="${8:-other}" 636s 636s local FILE='rootdir/var/lib/dpkg/status' 636s local INFO='rootdir/var/lib/dpkg/info' 636s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 636s echo "Package: $NAME 636s Status: $STATUS 636s Priority: $PRIORITY 636s Section: $SECTION 636s Installed-Size: 42 636s Maintainer: Joe Sixpack 636s Version: $VERSION" >> "$FILE" 636s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 636s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 636s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 636s echo >> "$FILE" 636s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 636s echo -n > "${INFO}/${NAME}:${arch}.list" 636s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 636s else 636s echo -n > "${INFO}/${NAME}.list" 636s echo -n > "${INFO}/${NAME}.md5sums" 636s fi 636s done 636s } 636s 636s 636s buildaptarchivefromincoming() { 636s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 636s cd aptarchive 636s [ -e pool ] || ln -s ../incoming pool 636s [ -e ftparchive.conf ] || createaptftparchiveconfig 636s [ -e dists ] || buildaptftparchivedirectorystructure 636s msgninfo "\tGenerate Packages, Sources and Contents files… " 636s testsuccess aptftparchive generate ftparchive.conf 636s cd - > /dev/null 636s msgdone "info" 636s generatereleasefiles "$@" 636s } 636s 636s buildaptarchivefromfiles() { 636s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 636s local DIR='aptarchive' 636s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 636s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 636s msgninfo "\t${line} file… " 636s compressfile "$line" "$1" 636s msgdone "info" 636s done 636s generatereleasefiles "$@" 636s } 636s 636s compressfile() { 636s while read compressor extension command; do 636s if [ "$compressor" = '.' ]; then 636s if [ -n "$2" ]; then 636s touch -d "$2" "$1" 636s fi 636s continue 636s fi 636s cat "$1" | $command > "${1}.${extension}" 636s if [ -n "$2" ]; then 636s touch -d "$2" "${1}.${extension}" 636s fi 636s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 636s } 636s 636s # can be overridden by testcases for their pleasure 636s getcodenamefromsuite() { 636s case "$1" in 636s unstable) echo 'sid';; 636s *) echo -n "$1";; 636s esac 636s } 636s getreleaseversionfromsuite() { true; } 636s getlabelfromsuite() { true; } 636s getoriginfromsuite() { true; } 636s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 636s getnotautomaticfromsuite() { 636s case "$1" in 636s experimental|experimental2) echo "yes";; 636s esac 636s } 636s getbutautomaticupgradesfromsuite() { true; } 636s 636s aptftparchiverelease() { 636s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 636s } 636s generatereleasefiles() { 636s # $1 is the Date header and $2 is the ValidUntil header to be set 636s # both should be given in notation date/touch can understand 636s local DATE="$1" 636s local VALIDUNTIL="$2" 636s if [ -e aptarchive/dists ]; then 636s msgninfo "\tGenerate Release files for dists… " 636s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 636s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 636s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 636s local CODENAME="$(getcodenamefromsuite $SUITE)" 636s local VERSION="$(getreleaseversionfromsuite $SUITE)" 636s local LABEL="$(getlabelfromsuite $SUITE)" 636s local ORIGIN="$(getoriginfromsuite $SUITE)" 636s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 636s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 636s aptftparchiverelease "$dir" \ 636s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 636s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 636s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 636s -o APT::FTPArchive::Release::Label="${LABEL}" \ 636s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 636s -o APT::FTPArchive::Release::Version="${VERSION}" \ 636s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 636s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 636s > "$dir/Release" 636s done 636s else 636s msgninfo "\tGenerate Release files for flat… " 636s aptftparchiverelease ./aptarchive > aptarchive/Release 636s fi 636s if [ -n "$VALIDUNTIL" ]; then 636s sed -i "/^Date: / a\ 636s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 636s fi 636s if [ -n "$DATE" -a "$DATE" != "now" ]; then 636s for release in $(find ./aptarchive -name 'Release'); do 636s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 636s touch -d "$DATE" "$release" 636s done 636s fi 636s msgdone "info" 636s } 636s 636s setupdistsaptarchive() { 636s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 636s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 636s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 636s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 636s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 636s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 636s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 636s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 636s msgdone "info" 636s done 636s } 636s 636s setupflataptarchive() { 636s local APTARCHIVE="$(readlink -f ./aptarchive)" 636s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 636s if [ -f "${APTARCHIVE}/Packages" ]; then 636s msgninfo "\tadd deb sources.list line… " 636s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 636s msgdone 'info' 636s else 636s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 636s fi 636s if [ -f "${APTARCHIVE}/Sources" ]; then 636s msgninfo "\tadd deb-src sources.list line… " 636s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 636s msgdone 'info' 636s else 636s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 636s fi 636s } 636s 636s setupaptarchive() { 636s local NOUPDATE=0 636s if [ "$1" = '--no-update' ]; then 636s NOUPDATE=1 636s shift 636s fi 636s buildaptarchive "$@" 636s if [ -e aptarchive/dists ]; then 636s setupdistsaptarchive 636s else 636s setupflataptarchive 636s fi 636s signreleasefiles 'Joe Sixpack' 636s if [ "1" != "$NOUPDATE" ]; then 636s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 636s fi 636s } 636s 636s killgpgagent() { 636s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 636s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 636s if [ ! -e "${GPGHOME}" ]; then return; fi 636s # ensure the agent dies quickly as different versions have different suicide heuristics 636s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 636s rm -rf "$GPGHOME" 636s } 636s dosigning() { 636s local KEY="$1" 636s shift 636s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 636s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 636s GPGHOME="$APT_TEST_SIGNINGHOME" 636s else 636s if [ ! -e "$GPGHOME" ]; then 636s mkdir -p --mode=700 "${GPGHOME}" 636s addtrap 'prefix' 'killgpgagent;' 636s fi 636s fi 636s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 636s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 636s "$@" 636s } 636s signreleasefiles() { 636s local SIGNERS="${1:-Joe Sixpack}" 636s local REPODIR="${2:-aptarchive}" 636s if [ -n "$1" ]; then shift; fi 636s if [ -n "$1" ]; then shift; fi 636s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 636s msgninfo "\tSign archive with $SIGNERS key $KEY… " 636s local REXKEY='keys/rexexpired' 636s local SECEXPIREBAK="${REXKEY}.sec.bak" 636s local PUBEXPIREBAK="${REXKEY}.pub.bak" 636s local SIGUSERS="" 636s while [ -n "${SIGNERS%%,*}" ]; do 636s local SIGNER="${SIGNERS%%,*}" 636s if [ "${SIGNERS}" = "${SIGNER}" ]; then 636s SIGNERS="" 636s fi 636s SIGNERS="${SIGNERS#*,}" 636s # FIXME: This should be the full name, but we can't encode the space properly currently 636s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 636s if [ "${SIGNER}" = 'Rex Expired' ]; then 636s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 636s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 636s # therefore we 'temporary' make the key not expired and restore a backup after signing 636s cp "${REXKEY}.sec" "$SECEXPIREBAK" 636s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 636s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 636s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 636s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 636s cp "$SECUNEXPIRED" "${REXKEY}.sec" 636s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 636s else 636s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 636s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 636s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 636s cat setexpire.gpg 636s exit 1 636s fi 636s cp "${REXKEY}.sec" "$SECUNEXPIRED" 636s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 636s fi 636s fi 636s if [ ! -e "${KEY}.pub" ]; then 636s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 636s cat "${K}.pub" >> "${KEY}.new.pub" 636s cat "${K}.sec" >> "${KEY}.new.sec" 636s fi 636s done 636s if [ ! -e "${KEY}.pub" ]; then 636s mv "${KEY}.new.pub" "${KEY}.pub" 636s mv "${KEY}.new.sec" "${KEY}.sec" 636s fi 636s for RELEASE in $(find "${REPODIR}/" -name Release); do 636s # we might have set a specific date for the Release file, so copy it 636s local DATE="$(stat --format "%y" "${RELEASE}")" 636s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 636s rm -f "${RELEASE}.gpg" 636s else 636s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 636s touch -d "$DATE" "${RELEASE}.gpg" 636s fi 636s local INRELEASE="${RELEASE%/*}/InRelease" 636s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 636s rm -f "$INRELEASE" 636s else 636s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 636s touch -d "$DATE" "${INRELEASE}" 636s fi 636s done 636s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 636s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 636s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 636s fi 636s msgdone 'info' 636s } 636s 636s redatereleasefiles() { 636s local DATE="$(date -u -d "$1" -R)" 636s for release in $(find aptarchive/ -name 'Release'); do 636s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 636s touch -d "$DATE" "$release" 636s done 636s signreleasefiles "${2:-Joe Sixpack}" 636s } 636s 636s webserverconfig() { 636s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 636s local NOCHECK=false 636s if [ "$1" = '--no-check' ]; then 636s NOCHECK=true 636s shift 636s fi 636s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 636s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 636s rm -f "$STATUS" "$DOWNLOG" 636s local URI 636s if [ -n "$2" ]; then 636s msgtest "Set webserver config option '${1}' to" "$2" 636s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 636s else 636s msgtest 'Clear webserver config option' "${1}" 636s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 636s fi 636s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 636s msgpass 636s else 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 636s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 636s msgfailoutput '' "$OUTPUT" 636s fi 636s $NOCHECK || testwebserverlaststatuscode '200' 636s } 636s 636s rewritesourceslist() { 636s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 636s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 636s sed -i $LIST \ 636s -e "s#file://$APTARCHIVE#${1}#" \ 636s -e "s#file:$APTARCHIVE#${1}#" \ 636s -e "s#copy://$APTARCHIVE#${1}#" \ 636s -e "s#copy:$APTARCHIVE#${1}#" \ 636s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 636s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 636s done 636s } 636s 636s # wait for up to 10s for a pid file to appear to avoid possible race 636s # when a helper is started and doesn't write the PID quick enough 636s waitforpidfile() { 636s local PIDFILE="$1" 636s for i in $(seq 10); do 636s if test -s "$PIDFILE"; then 636s return 0 636s fi 636s sleep 1 636s done 636s msgdie "waiting for $PIDFILE failed" 636s return 1 636s } 636s 636s changetowebserver() { 636s local REWRITE='yes' 636s if [ "$1" = '--no-rewrite' ]; then 636s REWRITE='no' 636s shift 636s fi 636s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 636s cd aptarchive 636s local LOG="webserver.log" 636s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 636s cat "$LOG" 636s false 636s fi 636s waitforpidfile aptwebserver.pid 636s local PID="$(cat aptwebserver.pid)" 636s if [ -z "$PID" ]; then 636s msgdie 'Could not fork aptwebserver successfully' 636s fi 636s addtrap "kill $PID;" 636s waitforpidfile aptwebserver.port 636s APTHTTPPORT="$(cat aptwebserver.port)" 636s if [ -z "$APTHTTPPORT" ]; then 636s msgdie 'Could not get port for aptwebserver successfully' 636s fi 636s cd - > /dev/null 636s else 636s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 636s fi 636s if [ "$REWRITE" != 'no' ]; then 636s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 636s fi 636s } 636s 636s changetohttpswebserver() { 636s local REWRITE='yes' 636s if [ "$1" = '--no-rewrite' ]; then 636s REWRITE='no' 636s shift 636s fi 636s local stunnel4 636s if command -v stunnel4 >/dev/null 2>&1; then 636s stunnel4=stunnel4 636s elif command -v stunnel >/dev/null 2>&1; then 636s stunnel4=stunnel 636s else 636s msgdie 'You need to install stunnel4 for https testcases' 636s fi 636s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 636s changetowebserver --no-rewrite "$@" 636s fi 636s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 636s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 636s output = /dev/null 636s 636s [https] 636s accept = 127.0.0.1:0 636s connect = $APTHTTPPORT 636s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 636s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 636s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 636s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 636s if [ -z "$PID" ]; then 636s msgdie 'Could not fork $stunnel4 successfully' 636s fi 636s addtrap 'prefix' "kill ${PID};" 636s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 636s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 636s if [ "$REWRITE" != 'no' ]; then 636s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 636s fi 636s } 636s 636s changetocdrom() { 636s mkdir -p rootdir/media/cdrom/.disk 636s local CD="$(readlink -f rootdir/media/cdrom)" 636s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 636s if [ ! -d aptarchive/dists ]; then 636s msgdie 'Flat file archive cdroms can not be created currently' 636s return 1 636s fi 636s mv aptarchive/dists "$CD" 636s ln -s "$(readlink -f ./incoming)" "$CD/pool" 636s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 636s # start with an unmounted disk 636s mv "${CD}" "${CD}-unmounted" 636s # we don't want the disk to be modifiable 636s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 636s chmod -R 555 rootdir/media/cdrom-unmounted/dists 636s } 636s 636s downloadfile() { 636s local PROTO="${1%%:*}" 636s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 636s download-file "$1" "$2" "$3" 2>&1 ; then 636s return 1 636s fi 636s # only if the file exists the download was successful 636s if [ -r "$2" ]; then 636s return 0 636s else 636s return 1 636s fi 636s } 636s 636s cleanup_output() { 636s cat "$1" | sed \ 636s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 636s -e '/^profiling:/ d' \ 636s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 636s >"$2" 636s } 636s 636s checkdiff() { 636s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 636s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 636s touch "$TMPFILE1" "$TMPFILE2" 636s 636s cleanup_output "$1" "$TMPFILE1" 636s cleanup_output "$2" "$TMPFILE2" 636s 636s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 636s if [ -n "$DIFFTEXT" ]; then 636s echo >&2 636s echo >&2 "$DIFFTEXT" 636s return 1 636s else 636s return 0 636s fi 636s } 636s 636s testoutputequal() { 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 636s local COMPAREFILE="$1" 636s shift 636s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 636s msgpass 636s else 636s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 636s cat "$COMPAREFILE" >>"${OUTPUT}" 636s msgfailoutput '' "$OUTPUT" "$@" 636s fi 636s } 636s 636s testfileequal() { 636s msggroup 'testfileequal' 636s local MSG='Test for correctness of file' 636s if [ "$1" = '--nomsg' ]; then 636s MSG='' 636s shift 636s fi 636s local FILE="$1" 636s shift 636s if [ -n "$MSG" ]; then 636s msgtest "$MSG" "$FILE" 636s fi 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 636s if [ -z "$*" ]; then 636s testoutputequal "$FILE" echo -n '' 636s else 636s testoutputequal "$FILE" echo "$*" 636s fi 636s msggroup 636s } 636s 636s testempty() { 636s msggroup 'testempty' 636s if [ "$1" = '--nomsg' ]; then 636s shift 636s else 636s msgtest "Test for no output of" "$*" 636s fi 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 636s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 636s msgpass 636s else 636s msgfailoutput '' "$COMPAREFILE" "$@" 636s fi 636s aptautotest 'testempty' "$@" 636s msggroup 636s } 636s testwarningempty() { 636s testwarning "$@" 636s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 636s } 636s testnotempty() { 636s msggroup 'testnotempty' 636s msgtest "Test for some output of" "$*" 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 636s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 636s msgpass 636s else 636s msgfailoutput '' "$COMPAREFILE" "$@" 636s fi 636s aptautotest 'testnotempty' "$@" 636s msggroup 636s } 636s 636s testequal() { 636s msggroup 'testequal' 636s local MSG='Test of equality of' 636s if [ "$1" = '--nomsg' ]; then 636s MSG='' 636s shift 636s fi 636s 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 636s echo "$1" > "$COMPAREFILE" 636s shift 636s 636s if [ -n "$MSG" ]; then 636s msgtest "$MSG" "$*" 636s fi 636s testoutputequal "$COMPAREFILE" "$@" 636s aptautotest 'testequal' "$@" 636s msggroup 636s } 636s 636s testequalor2() { 636s msggroup 'testequalor2' 636s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 636s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 636s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 636s echo "$1" > "$COMPAREFILE1" 636s echo "$2" > "$COMPAREFILE2" 636s shift 2 636s msgtest "Test for equality OR of" "$*" 636s "$@" >"$COMPAREAGAINST" 2>&1 || true 636s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 636s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 636s then 636s msgpass 636s else 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 636s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 636s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 636s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 636s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 636s msgfailoutput '' "$OUTPUT" 636s fi 636s aptautotest 'testequalor2' "$@" 636s msggroup 636s } 636s 636s testshowvirtual() { 636s msggroup 'testshowvirtual' 636s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 636s local PACKAGE="$1" 636s shift 636s while [ -n "$1" ]; do 636s VIRTUAL="${VIRTUAL} 636s N: Can't select versions from package '$1' as it is purely virtual" 636s PACKAGE="${PACKAGE} $1" 636s shift 636s done 636s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 636s VIRTUAL="${VIRTUAL} 636s N: No packages found" 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 636s local ARCH="$(getarchitecture 'native')" 636s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 636s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 636s msggroup 636s } 636s 636s testnopackage() { 636s msggroup 'testnopackage' 636s msgtest "Test for non-existent packages" "apt-cache show $*" 636s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 636s if [ -n "$SHOWPKG" ]; then 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 636s echo "$SHOWPKG" >"$OUTPUT" 636s msgfailoutput '' "$OUTPUT" 636s else 636s msgpass 636s fi 636s msggroup 636s } 636s testnosrcpackage() { 636s msggroup 'testnosrcpackage' 636s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 636s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 636s if [ -n "$SHOWPKG" ]; then 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 636s echo "$SHOWPKG" >"$OUTPUT" 636s msgfailoutput '' "$OUTPUT" 636s else 636s msgpass 636s fi 636s msggroup 636s } 636s 636s testdpkgstatus() { 636s msggroup 'testdpkgstatus' 636s local STATE="$1" 636s local NR="$2" 636s shift 2 636s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 636s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 636s if [ "$PKGS" != $NR ]; then 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 636s echo "$PKGS" >"$OUTPUT" 636s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 636s msgfailoutput '' "$OUTPUT" 636s else 636s msgpass 636s fi 636s msggroup 636s } 636s 636s testdpkginstalled() { 636s msggroup 'testdpkginstalled' 636s testdpkgstatus 'ii' "$#" "$@" 636s msggroup 636s } 636s 636s testdpkgnotinstalled() { 636s msggroup 'testdpkgnotinstalled' 636s testdpkgstatus 'ii' '0' "$@" 636s msggroup 636s } 636s 636s testmarkedauto() { 636s msggroup 'testmarkedauto' 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 636s if [ -n "$1" ]; then 636s msgtest 'Test for correctly marked as auto-installed' "$*" 636s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 636s else 636s msgtest 'Test for correctly marked as auto-installed' 'no package' 636s echo -n > "$COMPAREFILE" 636s fi 636s testoutputequal "$COMPAREFILE" aptmark showauto 636s msggroup 636s } 636s testmarkedmanual() { 636s msggroup 'testmarkedmanual' 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 636s if [ -n "$1" ]; then 636s msgtest 'Test for correctly marked as manually installed' "$*" 636s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 636s else 636s msgtest 'Test for correctly marked as manually installed' 'no package' 636s echo -n > "$COMPAREFILE" 636s fi 636s testoutputequal "$COMPAREFILE" aptmark showmanual 636s msggroup 636s } 636s 636s catfile() { 636s if [ "${1##*.}" = 'deb' ]; then 636s stat >&2 "$1" || true 636s file >&2 "$1" || true 636s else 636s cat >&2 "$1" || true 636s fi 636s } 636s msgfailoutput() { 636s msgreportheader 'msgfailoutput' 636s local MSG="$1" 636s local OUTPUT="$2" 636s shift 2 636s local CMD="$1" 636s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 636s echo >&2 636s while [ -n "$2" ]; do shift; done 636s echo "#### Complete file: $1 ####" 636s catfile "$1" 636s echo "#### $CMD output ####" 636s elif [ "$1" = 'test' ]; then 636s echo >&2 636s # doesn't support ! or non-file flags 636s msgfailoutputstatfile() { 636s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 636s if expr match "$1" "$FILEFLAGS" >/dev/null; then 636s echo "#### stat(2) of file: $2 ####" 636s stat "$2" || true 636s if test -d "$2"; then 636s echo "#### The directory contains: $2 ####" 636s ls >&2 "$2" || true 636s elif test -e "$2"; then 636s echo "#### Complete file: $2 ####" 636s catfile "$2" 636s fi 636s fi 636s } 636s msgfailoutputstatfile "$2" "$3" 636s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 636s shift 3 636s msgfailoutputstatfile "$2" "$3" 636s done 636s echo '#### test output ####' 636s elif [ "$1" = 'cmp' ]; then 636s echo >&2 636s while [ -n "$2" ]; do 636s echo "#### Complete file: $2 ####" 636s catfile "$2" 636s shift 636s done 636s echo '#### cmp output ####' 636s elif [ "$1" = 'rm' ]; then 636s echo "#### Directory listing of: $(pwd) ####" 636s ls -l 636s fi 636s catfile "$OUTPUT" 636s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 636s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 636s local COREEXE='' 636s for CORENAME in 'core' 'core.pid'; do 636s if [ -s "$CORENAME" ]; then 636s cp -a ${CORENAME} "$COREDUMP" 636s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 636s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 636s else 636s continue 636s fi 636s break 636s done 636s if [ -s "$COREDUMP" ]; then 636s true # found already as a file 636s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 636s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 636s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 636s else 636s echo '### core dump not found ###' 636s cat /proc/sys/kernel/core_pattern 636s fi 636s if [ -s "$COREDUMP" ]; then 636s if [ -z "$COREEXE" ]; then 636s case "$CMD" in 636s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 636s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 636s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 636s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 636s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 636s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 636s esac 636s fi 636s 636s if [ -d "${ARTIFACTSDIR}" ]; then 636s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 636s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 636s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 636s fi 636s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 636s echo "#### gdb backtrace ####" 636s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 636s fi 636s fi 636s rm -f "$COREDUMP" 636s fi 636s msgfail "$MSG" 636s } 636s 636s testsuccesswithglobalerror() { 636s local TYPE="$1" 636s local ERRORS="$2" 636s shift 2 636s msggroup "$TYPE" 636s if [ "$1" = '--nomsg' ]; then 636s shift 636s else 636s msgtest 'Test for successful execution of' "$*" 636s fi 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 636s if "$@" >"${OUTPUT}" 2>&1; then 636s if expr match "$1" '^apt.*' >/dev/null; then 636s if grep -q -E ' runtime error: ' "$OUTPUT"; then 636s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 636s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 636s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 636s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 636s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 636s msgpass 636s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 636s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 636s msgpass 636s else 636s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 636s fi 636s else 636s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 636s fi 636s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 636s if grep -q -E "^N: " "$OUTPUT"; then 636s msgpass 636s else 636s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 636s fi 636s else 636s msgpass 636s fi 636s else 636s msgpass 636s fi 636s else 636s local EXITCODE=$? 636s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 636s fi 636s aptautotest "$TYPE" "$@" 636s msggroup 636s } 636s testsuccesswithnotice() { 636s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 636s } 636s testsuccess() { 636s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 636s } 636s testwarning() { 636s msggroup 'testwarning' 636s if [ "$1" = '--nomsg' ]; then 636s shift 636s else 636s msgtest 'Test for successful execution with warnings of' "$*" 636s fi 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 636s if "$@" >"${OUTPUT}" 2>&1; then 636s if expr match "$1" '^apt.*' >/dev/null; then 636s if grep -q -E ' runtime error: ' "$OUTPUT"; then 636s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 636s elif grep -q -E '^E: ' "$OUTPUT"; then 636s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 636s elif ! grep -q -E '^W: ' "$OUTPUT"; then 636s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 636s else 636s msgpass 636s fi 636s else 636s msgpass 636s fi 636s else 636s local EXITCODE=$? 636s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 636s fi 636s aptautotest 'testwarning' "$@" 636s msggroup 636s } 636s testfailure() { 636s msggroup 'testfailure' 636s if [ "$1" = '--nomsg' ]; then 636s shift 636s else 636s msgtest 'Test for failure in execution of' "$*" 636s fi 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 636s if "$@" >"${OUTPUT}" 2>&1; then 636s local EXITCODE=$? 636s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 636s else 636s local EXITCODE=$? 636s if expr match "$1" '^apt.*' >/dev/null; then 636s if [ "$1" = 'aptkey' ]; then 636s if grep -q " Can't check signature: 636s BAD signature from 636s signature could not be verified" "$OUTPUT"; then 636s msgpass 636s else 636s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 636s fi 636s else 636s if grep -q -E ' runtime error: ' "$OUTPUT"; then 636s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 636s elif grep -q -E '==ERROR' "$OUTPUT"; then 636s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 636s elif ! grep -q -E '^E: ' "$OUTPUT"; then 636s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 636s else 636s msgpass 636s fi 636s fi 636s else 636s msgpass 636s fi 636s fi 636s aptautotest 'testfailure' "$@" 636s msggroup 636s } 636s 636s testreturnstateequal() { 636s local STATE="$1" 636s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 636s local STATE="$2" 636s local TYPE="$3" 636s shift 3 636s msggroup "${STATE}equal" 636s if [ "$1" != '--nomsg' ]; then 636s local CMP="$1" 636s shift 636s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 636s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 636s else 636s local CMP="$2" 636s shift 2 636s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 636s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 636s fi 636s else 636s msggroup "${STATE}equal" 636s if [ "$2" != '--nomsg' ]; then 636s local CMP="$2" 636s shift 2 636s "$STATE" "$@" 636s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 636s else 636s local CMP="$3" 636s shift 3 636s "$STATE" --nomsg "$@" 636s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 636s fi 636s fi 636s msggroup 636s } 636s testsuccessequal() { 636s # we compare output, so we know perfectly well about N: 636s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 636s } 636s testwarningequal() { 636s testreturnstateequal 'testwarning' "$@" 636s } 636s testfailureequal() { 636s testreturnstateequal 'testfailure' "$@" 636s } 636s 636s testfailuremsg() { 636s msggroup 'testfailuremsg' 636s local CMP="$1" 636s shift 636s testfailure "$@" 636s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 636s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 636s testoutputequal "$COMPAREFILE" echo "$CMP" 636s msggroup 636s } 636s testwarningmsg() { 636s msggroup 'testwarningmsg' 636s local CMP="$1" 636s shift 636s testwarning "$@" 636s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 636s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 636s testoutputequal "$COMPAREFILE" echo "$CMP" 636s msggroup 636s } 636s 636s testfilestats() { 636s msggroup 'testfilestats' 636s msgtest "Test that file $1 has $2 $3" "$4" 636s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 636s msgpass 636s else 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 636s { 636s echo 636s ls -ld "$1" || true 636s echo -n "stat(1) reports for $2: " 636s stat --format "$2" "$1" || true 636s } >"$OUTPUT" 2>&1 636s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 636s fi 636s msggroup 636s } 636s testaccessrights() { 636s msggroup 'testaccessrights' 636s testfilestats "$1" '%a' '=' "$2" 636s msggroup 636s } 636s 636s testwebserverlaststatuscode() { 636s msggroup 'testwebserverlaststatuscode' 636s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 636s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 636s rm -f "$DOWNLOG" "$STATUS" 636s msgtest 'Test last status code from the webserver was' "$1" 636s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 636s msgpass 636s else 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 636s { 636s if [ -n "$2" ]; then 636s shift 636s echo >&2 '#### Additionally provided output files contain:' 636s cat >&2 "$@" 636s fi 636s echo >&2 '#### Download log of the status code:' 636s cat >&2 "$DOWNLOG" 636s } >"$OUTPUT" 2>&1 636s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 636s fi 636s msggroup 636s } 636s 636s mapkeynametokeyid() { 636s while [ -n "$1" ]; do 636s case "$1" in 636s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 636s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 636s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 636s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 636s oldarchive) echo 'FDD2DB85F68C85A3';; 636s *) echo 'UNKNOWN KEY';; 636s esac 636s shift 636s done 636s } 636s testaptkeys() { 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 636s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 636s echo -n > "$OUTPUT" 636s fi 636s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 636s } 636s 636s pause() { 636s echo "STOPPED execution. Press enter to continue" 636s local IGNORE 636s read IGNORE 636s } 636s 636s logcurrentarchivedirectory() { 636s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 636s stat --format '%U:%G:%a:%n' "$line" 636s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 636s } 636s listcurrentlistsdirectory() { 636s { 636s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 636s stat --format '%U:%G:%a:%n' "$line" 636s done 636s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 636s stat --format '%U:%G:%a:%s:%y:%n' "$line" 636s done 636s } | sort 636s } 636s forallsupportedcompressors() { 636s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 636s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 636s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 636s "$@" "$COMP" 636s done 636s } 636s 636s breakfiles() { 636s while [ -n "$1" ]; do 636s mv -f "${1}" "${1}.bak" 636s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 636s shift 636s done 636s } 636s unbreakfiles() { 636s while [ -n "$1" ]; do 636s mv -f "${1}.bak" "${1}" 636s shift 636s done 636s } 636s 636s ### convenience hacks ### 636s mkdir() { 636s # creating some directories by hand is a tedious task, so make it look simple 636s local PARAMS="$*" 636s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 636s # only the last directory created by mkdir is effected by the -m ! 636s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 636s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 636s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 636s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 636s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 636s if [ "$(id -u)" = '0' ]; then 636s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 636s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 636s fi 636s else 636s command mkdir "$@" 636s fi 636s } 636s 636s ### The following tests are run by most test methods automatically to check 636s ### general things about commands executed without writing the test every time. 636s 636s aptautotest() { 636s if [ $# -lt 3 ]; then return; fi 636s local TESTCALL="$1" 636s local CMD="$2" 636s local FIRSTOPT="$3" 636s shift 2 636s for i in "$@"; do 636s if ! expr match "$i" '^-' >/dev/null 2>&1; then 636s FIRSTOPT="$i" 636s break 636s fi 636s done 636s shift 636s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 636s if command -v $AUTOTEST >/dev/null; then 636s # save and restore the *.output files from other tests 636s # as we might otherwise override them in these automatic tests 636s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 636s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 636s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 636s $AUTOTEST "$TESTCALL" "$@" 636s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 636s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 636s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 636s fi 636s } 636s 636s cdfind() { 636s ( cd /; find "$@" ) 636s } 636s aptautotest_aptget_update() { 636s local TESTCALL="$1" 636s while [ -n "$2" ]; do 636s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 636s shift 636s done 636s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 636s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 636s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 636s # all copied files are properly chmodded 636s local backupIFS="$IFS" 636s IFS="$(printf "\n\b")" 636s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 636s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 636s done 636s IFS="$backupIFS" 636s if [ "$TESTCALL" = 'testsuccess' ]; then 636s # failure cases can retain partial files and such 636s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 636s fi 636s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 636s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 636s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 636s fi 636s } 636s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 636s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 636s 636s testaptautotestnodpkgwarning() { 636s local TESTCALL="$1" 636s while [ -n "$2" ]; do 636s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 636s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 636s shift 636s done 636s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 636s } 636s 636s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 636s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 636s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 636s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 636s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 636s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 636s 636s testaptmarknodefaultsections() { 636s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 636s } 636s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 636s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 636s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 636s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 636s cat: ./downloaded/foo1: No such file or directory 636s cmp: ./downloaded/foo1: No such file or directory 636s FAIL: exitcode 2 636s 636s cat: ./downloaded/foo1: No such file or directory 636s #!/bin/sh -- # no runable script, just for vi 636s 636s EXIT_CODE=0 636s 636s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 636s if [ "$1" = "-q" ]; then 636s export MSGLEVEL=2 636s elif [ "$1" = "-qq" ]; then 636s export MSGLEVEL=1 636s elif [ "$1" = "-v" ]; then 636s export MSGLEVEL=4 636s elif [ "$1" = '--color=no' ]; then 636s export MSGCOLOR='NO' 636s elif [ "$1" = '--color=yes' ]; then 636s export MSGCOLOR='YES' 636s elif [ "$1" = '--color' ]; then 636s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 636s shift 636s elif [ "$1" = '--level' ]; then 636s export MSGLEVEL=$2 636s shift 636s else 636s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 636s fi 636s shift 636s done 636s export MSGLEVEL="${MSGLEVEL:-3}" 636s 636s # we all like colorful messages 636s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 636s if [ ! -t 1 ]; then # but check that we output to a terminal 636s export MSGCOLOR='NO' 636s fi 636s fi 636s 636s if [ "$MSGCOLOR" != 'NO' ]; then 636s CERROR="\033[1;31m" # red 636s CWARNING="\033[1;33m" # yellow 636s CMSG="\033[1;32m" # green 636s CINFO="\033[1;96m" # light blue 636s CDEBUG="\033[1;94m" # blue 636s CNORMAL="\033[0;39m" # default system console color 636s CDONE="\033[1;32m" # green 636s CPASS="\033[1;32m" # green 636s CFAIL="\033[1;31m" # red 636s CCMD="\033[1;35m" # pink 636s fi 636s 636s msgprintf() { 636s local START="$1" 636s local MIDDLE="$2" 636s local END="$3" 636s shift 3 636s if [ -n "$1" ]; then 636s printf "$START " "$1" 636s shift 636s while [ -n "$1" ]; do 636s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 636s shift 636s done 636s fi 636s printf "${END}" 636s } 636s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 636s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 636s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 636s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 636s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 636s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 636s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 636s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 636s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 636s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 636s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 636s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 636s msgreportheader() { 636s if [ -n "$MSGTEST_MSG" ]; then 636s test "$1" != 'msgfailoutput' || echo 636s if [ -n "$MSGTEST_MSGMSG" ]; then 636s echo "$MSGTEST_MSGMSG" 636s fi 636s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 636s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 636s fi 636s echo -n "$MSGTEST_MSG" 636s unset MSGTEST_MSG 636s fi 636s } 636s msgskip() { 636s msgreportheader 'msgskip' 636s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 636s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 636s } 636s msgfail() { 636s msgreportheader 'msgfail' 636s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 636s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 636s if [ -n "$APT_DEBUG_TESTS" ]; then 636s runapt $SHELL 636s fi 636s EXIT_CODE=$((EXIT_CODE+1)); 636s } 636s MSGGROUP_LEVEL=0 636s msggroup() { 636s if [ -n "$1" ]; then 636s if [ $MSGGROUP_LEVEL = 0 ]; then 636s MSGTEST_GRP='NEXT' 636s fi 636s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 636s else 636s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 636s if [ $MSGGROUP_LEVEL = 0 ]; then 636s unset MSGTEST_GRP 636s fi 636s fi 636s } 636s 636s # enable / disable Debugging 636s if [ $MSGLEVEL -le 0 ]; then 636s msgdie() { true; } 636s fi 636s if [ $MSGLEVEL -le 1 ]; then 636s msgwarn() { true; } 636s msgnwarn() { true; } 636s fi 636s if [ $MSGLEVEL -le 2 ]; then 636s msgmsg() { 636s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 636s } 636s msgnmsg() { true; } 636s msgtest() { 636s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 636s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 636s MSGTEST_GRP="$MSGTEST_MSG" 636s fi 636s } 636s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 636s fi 636s if [ $MSGLEVEL -le 3 ]; then 636s msginfo() { true; } 636s msgninfo() { true; } 636s fi 636s if [ $MSGLEVEL -le 4 ]; then 636s msgdebug() { true; } 636s msgndebug() { true; } 636s fi 636s if [ $MSGLEVEL -le 1 ]; then 636s msgpass() { true; } 636s fi 636s msgdone() { 636s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 636s [ "$1" = "info" -a $MSGLEVEL -le 3 ] || 636s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 636s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 636s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 636s true; 636s else 636s printf "${CDONE}DONE${CNORMAL}\n"; 636s fi 636s } 636s getaptconfig() { 636s if [ -f ./aptconfig.conf ]; then 636s echo "$(readlink -f ./aptconfig.conf)" 636s elif [ -f ../aptconfig.conf ]; then 636s echo "$(readlink -f ../aptconfig.conf)" 636s elif [ -f ../../aptconfig.conf ]; then 636s echo "$(readlink -f ../../aptconfig.conf)" 636s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 636s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 636s fi 636s } 636s runapt() { 636s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 636s local CMD="$1" 636s shift 636s case "$CMD" in 636s sh|aptitude|*/*|command) ;; 636s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 636s esac 636s if [ "$CMD" = 'aptitude' ]; then 636s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 636s else 636s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 636s fi 636s } 636s runpython3() { runapt command python3 "$@"; } 636s aptconfig() { runapt apt-config "$@"; } 636s aptcache() { runapt apt-cache "$@"; } 636s aptcdrom() { runapt apt-cdrom "$@"; } 636s aptget() { runapt apt-get "$@"; } 636s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 636s aptkey() { runapt apt-key "$@"; } 636s aptmark() { runapt apt-mark "$@"; } 636s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 636s apt() { runapt apt "$@"; } 636s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 636s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 636s aptitude() { runapt aptitude "$@"; } 636s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 636s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 636s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 636s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 636s 636s dpkg() { 636s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 636s } 636s dpkgquery() { 636s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 636s } 636s dpkg_version() { 636s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 636s } 636s dpkgcheckbuilddeps() { 636s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 636s } 636s gdb() { 636s local CMD 636s case "$1" in 636s aptget) CMD="apt-get";; 636s aptcache) CMD="apt-cache";; 636s aptcdrom) CMD="apt-cdrom";; 636s aptconfig) CMD="apt-config";; 636s aptmark) CMD="apt-mark";; 636s apthelper) CMD="apt-helper";; 636s aptftparchive) CMD="apt-ftparchive";; 636s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 636s *) CMD="$1";; 636s esac 636s shift 636s if [ "${CMD##*/}" = "$CMD" ]; then 636s CMD="${APTCMDLINEBINDIR}/${CMD}" 636s fi 636s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 636s } 636s 636s valgrind() { 636s local CMD 636s case "$1" in 636s aptget) CMD="apt-get";; 636s aptcache) CMD="apt-cache";; 636s aptcdrom) CMD="apt-cdrom";; 636s aptconfig) CMD="apt-config";; 636s aptmark) CMD="apt-mark";; 636s apthelper) CMD="apt-helper";; 636s aptftparchive) CMD="apt-ftparchive";; 636s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 636s *) CMD="$1";; 636s esac 636s shift 636s if [ "$CMD" = "apt-ftparchive" ]; then 636s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 636s fi 636s if [ "${CMD##*/}" = "$CMD" ]; then 636s CMD="${APTCMDLINEBINDIR}/${CMD}" 636s fi 636s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 636s } 636s 636s lastmodification() { 636s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 636s } 636s releasefiledate() { 636s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 636s } 636s 636s exitwithstatus() { 636s # error if we about to overflow, but ... 636s # "255 failures ought to be enough for everybody" 636s if [ $EXIT_CODE -gt 255 ]; then 636s msgdie "Total failure count $EXIT_CODE too big" 636s fi 636s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 636s } 636s 636s shellsetedetector() { 636s local exit_status=$? 636s if [ "$exit_status" != '0' ]; then 636s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 636s if [ "$EXIT_CODE" = '0' ]; then 636s EXIT_CODE="$exit_status" 636s fi 636s fi 636s } 636s 636s addtrap() { 636s if [ "$1" = 'prefix' ]; then 636s CURRENTTRAP="$2 $CURRENTTRAP" 636s else 636s CURRENTTRAP="$CURRENTTRAP $1" 636s fi 636s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 636s } 636s 636s escape_shell() { 636s echo "$@" | sed -e "s#'#'\"'\"'#g" 636s } 636s 636s find_project_binary_dir() { 636s if [ -z "$PROJECT_BINARY_DIR" ]; then 636s PROJECT_BINARY_DIR= 636s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 636s test -e "$dir/CMakeCache.txt" || continue 636s if [ -z "$PROJECT_BINARY_DIR" ] || 636s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 636s PROJECT_BINARY_DIR="$dir" 636s fi 636s done 636s if [ -z "$PROJECT_BINARY_DIR" ]; then 636s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 636s exit 1 636s fi 636s export PROJECT_BINARY_DIR 636s fi 636s } 636s _removetmpworkingdirectory() { 636s cd / 636s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 636s rm -rf "$TMPWORKINGDIRECTORY" 636s fi 636s TMPWORKINGDIRECTORY='' 636s } 636s setupenvironment() { 636s # cleanup the environment a bit 636s export LC_ALL=C 636s unset LANGUAGE COLUMNS NLSPATH 636s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 636s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 636s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 636s unset GREP_OPTIONS POSIXLY_CORRECT 636s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 636s export GCOV_ERROR_FILE=/dev/null 636s 636s # Next check needs a gnu stat, let's figure that out early. 636s stat=stat 636s if command -v gnustat >/dev/null 2>&1; then 636s stat=gnustat 636s fi 636s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 636s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 636s unset TMPDIR 636s fi 636s if [ -z "$TMPWORKINGDIRECTORY" ]; then 636s addtrap '_removetmpworkingdirectory;' 636s TMPWORKINGDIRECTORY="$(mktemp -d)" 636s fi 636s if [ -n "$TMPDIR_ADD" ]; then 636s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 636s mkdir -p "$TMPWORKINGDIRECTORY" 636s unset TMPDIR_ADD 636s export TMPDIR="$TMPWORKINGDIRECTORY" 636s fi 636s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 636s 636s # Setup coreutils on BSD systems 636s mkdir "${TMPWORKINGDIRECTORY}/bin" 636s for prefix in gnu g; do 636s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 636s if command -v $prefix$command 2>/dev/null >/dev/null; then 636s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 636s fi 636s done 636s done 636s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 636s 636s if [ -z "$TESTDIRECTORY" ]; then 636s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 636s fi 636s cd "$TMPWORKINGDIRECTORY" 636s 636s mkdir -m 700 'downloaded' 636s if [ "$(id -u)" = '0' ]; then 636s # relax permissions so that running as root with user switching works 636s umask 022 636s chmod 711 "$TMPWORKINGDIRECTORY" 636s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 636s fi 636s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 636s 636s _setupprojectenvironment 636s 636s # create some files in /tmp and look at user/group to get what this means 636s TEST_DEFAULT_USER="$(id -un)" 636s touch "${TMPWORKINGDIRECTORY}/test-file" 636s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 636s 636s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 636s . "${TESTDIRECTORY}/extra-environment" 636s fi 636s 636s msgdone "info" 636s } 636s _setupprojectenvironment() { 636s # allow overriding the default BUILDDIR locations 636s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 636s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 636s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 636s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 636s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 636s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 636s APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 636s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 636s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 636s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 636s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 636s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 636s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 636s 636s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 636s mkdir aptarchive keys 636s cd rootdir 636s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 636s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 636s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 636s touch var/lib/dpkg/available var/lib/dpkg/lock 636s echo '1' > var/lib/dpkg/info/format 636s ln -s "${METHODSDIR}" usr/lib/apt/methods 636s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 636s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 636s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 636s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 636s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 636s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 636s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 636s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 636s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 636s else 636s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 636s fi 636s cd .. 636s local BASENAME="${0##*/}" 636s local PACKAGESFILE="Packages-${BASENAME#*-}" 636s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 636s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 636s fi 636s local SOURCESSFILE="Sources-${BASENAME#*-}" 636s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 636s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 636s fi 636s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 636s chmod 644 keys/* 636s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 636s 636s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 636s echo "Dir::Etc \"etc\";" >> aptconfig.conf 636s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 636s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 636s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 636s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 636s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 636s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 636s # either store apt-key were we can access it, even if we run it as a different user 636s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 636s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 636s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 636s # destroys coverage reporting though, so we disable changing user for the calling gpgv 636s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 636s if [ "$(id -u)" = '0' ]; then 636s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 636s # same for the solver executables 636s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 636s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 636s fi 636s 636s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 636s EXEC='' 636s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 636s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 636s restoredpkgstatus() { 636s if [ -n "\$BACKUP" ]; then 636s if [ -e "\$BACKUP" ]; then 636s mv -f "\$BACKUP" "\$ORIGINAL" 636s else 636s rm -f "\$ORIGINAL" 636s fi 636s BACKUP='' 636s fi 636s } 636s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 636s if [ -e "\$ORIGINAL" ]; then 636s cp -a "\$ORIGINAL" "\$BACKUP" 636s fi 636s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 636s 636s Package: dpkg 636s Architecture: all 636s Version: ${DPKG_VERSION}+fake 636s Status: install ok installed 636s Maintainer: Joe Sixpack 636s Installed-Size: 42 636s Description: tells dpkg it supports what we need 636s Some versions of dpkg check its own version from the status file 636s to know if it supports multi-arch and stuff in --assert-*. 636s 636s EOS 636s fi 636s EOF 636s fi 636s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 636s 636s { 636s echo 'quiet "0";' 636s echo 'quiet::NoUpdate "true";' 636s echo 'quiet::NoStatistic "true";' 636s # too distracting for users, but helpful to detect changes 636s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 636s echo 'Acquire::Progress::Diffpercent "true";' 636s # in testcases, it can appear as if localhost has a rotation setup, 636s # hide this as we can't really deal with it properly 636s echo 'Acquire::Failure::ShowIP "false";' 636s # randomess and tests don't play well together 636s echo 'Acquire::IndexTargets::Randomized "false";' 636s # fakeroot can't fake everything, so disabled in production but good for tests 636s echo 'APT::Sandbox::Verify "true";' 636s } >> aptconfig.conf 636s 636s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 636s if [ "$(id -u)" = '0' ]; then 636s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 636s fi 636s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 636s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 636s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 636s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 636s # Allow release files to be 10 hours in the future, rather than 10 seconds 636s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 636s 636s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 636s 636s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 636s confighashes 'SHA256' # these are tests, not security best-practices 636s 636s # Make dpkg inherit testing path 636s echo 'DPkg::Path "";' >> aptconfig.conf 636s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 636s 636s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 636s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 636s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 636s fi 636s 636s # most tests just need one signed Release file, not both 636s export APT_DONT_SIGN='Release.gpg' 636s 636s # prefer our apt binaries over the system apt binaries 636s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 636s } 636s 636s getarchitecture() { 636s if [ "$1" = "native" -o -z "$1" ]; then 636s eval `aptconfig shell ARCH APT::Architecture` 636s if [ -n "$ARCH" ]; then 636s echo $ARCH 636s else 636s dpkg --print-architecture 636s fi 636s else 636s echo $1 636s fi 636s } 636s 636s getarchitectures() { 636s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 636s } 636s 636s getarchitecturesfromcommalist() { 636s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 636s } 636s 636s configarchitecture() { 636s { 636s echo "APT::Architecture \"$(getarchitecture $1)\";" 636s while [ -n "$1" ]; do 636s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 636s shift 636s done 636s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 636s configdpkg 636s } 636s 636s configdpkg() { 636s if [ ! -e rootdir/var/lib/dpkg/status ]; then 636s local BASENAME="${0##*/}" 636s local STATUSFILE="status-${BASENAME#*-}" 636s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 636s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 636s # Add an empty line to the end if there is none 636s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 636s echo >> rootdir/var/lib/dpkg/status 636s fi 636s fi 636s fi 636s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 636s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 636s local ARCHS="$(getarchitectures)" 636s local DPKGARCH="$(dpkg --print-architecture)" 636s # this ensures that even if multi-arch isn't active in the view 636s # of apt, given that dpkg can't be told which arch is native 636s # the arch apt treats as native might be foreign for dpkg 636s for ARCH in ${ARCHS}; do 636s if [ "${ARCH}" != "${DPKGARCH}" ]; then 636s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 636s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 636s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 636s else 636s # old-style used e.g. in Ubuntu-P – and as it seems travis 636s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 636s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 636s fi 636s fi 636s fi 636s done 636s else 636s # test multiarch before dpkg is ready for it… 636s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 636s fi 636s } 636s 636s configdpkgnoopchroot() { 636s # create a library to noop chroot() and rewrite maintainer script executions 636s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 636s # chroot directory dpkg could chroot into to execute the maintainer scripts 636s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 636s cat > noopchroot.c << EOF 636s #define _GNU_SOURCE 636s #include 636s #include 636s #include 636s #include 636s 636s static char * chrootdir = NULL; 636s 636s int chroot(const char *path) { 636s printf("WARNING: CHROOTing to %s was ignored!\n", path); 636s free(chrootdir); 636s chrootdir = strdup(path); 636s return 0; 636s } 636s int execvp(const char *file, char *const argv[]) { 636s static int (*func_execvp) (const char *, char * const []) = NULL; 636s if (func_execvp == NULL) 636s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 636s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 636s return func_execvp(file, argv); 636s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 636s char *newfile; 636s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 636s perror("asprintf"); 636s return -1; 636s } 636s char const * const baseadmindir = "/var/lib/dpkg"; 636s char *admindir; 636s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 636s perror("asprintf"); 636s return -1; 636s } 636s setenv("DPKG_ADMINDIR", admindir, 1); 636s return func_execvp(newfile, argv); 636s } 636s EOF 636s if cc -ldl 2>&1 | grep -q dl; then 636s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 636s else 636s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 636s fi 636s } 636s configcompression() { 636s if [ "$1" = 'ALL' ]; then 636s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 636s return 636s fi 636s local CMD='apthelper cat-file -C' 636s while [ -n "$1" ]; do 636s case "$1" in 636s '.') printf ".\t.\tcat\n";; 636s 'gz') printf "gzip\tgz\t$CMD $1\n";; 636s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 636s 'zst') printf "zstd\tzst\t$CMD $1\n";; 636s *) printf "$1\t$1\t$CMD $1\n";; 636s esac 636s shift 636s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 636s } 636s confighashes() { 636s { 636s echo 'APT::FTPArchive {' 636s { 636s while [ -n "$1" ]; do 636s printf "$1" | tr 'a-z' 'A-Z' 636s printf "\t\"true\";\n" 636s shift 636s done 636s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 636s printf "$h\t\"false\";\n" 636s done 636s } | awk '!x[$1]++' 636s echo '};' 636s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 636s } 636s forcecompressor() { 636s COMPRESSOR="$1" 636s COMPRESS="$1" 636s COMPRESSOR_CMD="apthelper cat-file -C $1" 636s case $COMPRESSOR in 636s gzip) COMPRESS='gz';; 636s bzip2) COMPRESS='bz2';; 636s zstd) COMPRESS='zst';; 636s esac 636s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 636s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 636s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 636s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 636s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 636s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 636s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 636s done 636s } 636s 636s _setupsimplenativepackage() { 636s local NAME="$1" 636s local ARCH="$2" 636s local VERSION="$3" 636s local RELEASE="${4:-unstable}" 636s local DEPENDENCIES="$5" 636s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 636s If you find such a package installed on your system, 636s something went horribly wrong! They are autogenerated 636s and used only by testcases and serve no other purpose…}" 636s 636s local SECTION="${7:-others}" 636s local PRIORITY="${8:-optional}" 636s local FILE_TREE="$9" 636s local COMPRESS_TYPE="${10:-gzip}" 636s local DISTSECTION 636s if [ "$SECTION" = "${SECTION#*/}" ]; then 636s DISTSECTION="main" 636s else 636s DISTSECTION="${SECTION%/*}" 636s fi 636s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 636s 636s mkdir -p "$BUILDDIR/debian/source" 636s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 636s echo "#!/bin/sh 636s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 636s 636s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 636s echo "$NAME ($VERSION) $RELEASE; urgency=low 636s 636s * Initial release 636s 636s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 636s { 636s echo "Source: $NAME 636s Priority: $PRIORITY 636s Maintainer: Joe Sixpack 636s Standards-Version: 4.3.1 636s Rules-Requires-Root: no" 636s if [ "$SECTION" != '' ]; then 636s echo "Section: $SECTION" 636s fi 636s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 636s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 636s echo " 636s Package: $NAME" 636s 636s if [ "$ARCH" = 'all' ]; then 636s echo "Architecture: all" 636s else 636s echo "Architecture: any" 636s fi 636s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 636s test -z "$DEPS" || echo "$DEPS" 636s printf "%b\n" "Description: $DESCRIPTION" 636s } > "${BUILDDIR}/debian/control" 636s 636s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 636s } 636s 636s make_tiny_rules() { 636s local OUT="$1" 636s if command -v gmake >/dev/null 2>&1; then 636s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 636s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 636s else 636s echo '#!/usr/bin/make -f' > "$OUT" 636s fi 636s echo '%:' >> "$OUT" 636s echo ' dh $@' >> "$OUT" 636s } 636s 636s setupsimplenativepackage() { 636s _setupsimplenativepackage "$@" 636s local NAME="$1" 636s local VERSION="$3" 636s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 636s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 636s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 636s } 636s 636s buildsimplenativepackage() { 636s local NAME="$1" 636s local ARCH="$2" 636s local VERSION="$3" 636s local RELEASE="${4:-unstable}" 636s local DEPENDENCIES="$5" 636s local DESCRIPTION="$6" 636s local SECTION="${7:-others}" 636s local PRIORITY="${8:-optional}" 636s local FILE_TREE="$9" 636s local COMPRESS_TYPE="${10:-gzip}" 636s local DISTSECTION 636s if [ "$SECTION" = "${SECTION#*/}" ]; then 636s DISTSECTION="main" 636s else 636s DISTSECTION="${SECTION%/*}" 636s fi 636s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 636s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 636s _setupsimplenativepackage "$@" 636s cd "${BUILDDIR}/.." 636s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 636s cd - >/dev/null 636s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 636s | while read SRC; do 636s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 636s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 636s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 636s # adv --yes --default-key 'Joe Sixpack' \ 636s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 636s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 636s # fi 636s done 636s 636s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 636s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 636s rm -rf "${BUILDDIR}/debian/tmp" 636s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 636s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 636s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 636s if [ -n "$FILE_TREE" ]; then 636s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 636s fi 636s 636s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 636s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 636s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 636s # ensure the right permissions as dpkg-deb insists 636s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 636s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 636s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 636s done 636s 636s local NM 636s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 636s NM="$(echo "$NAME" | cut -c 1-4)" 636s else 636s NM="$(echo "$NAME" | cut -c 1)" 636s fi 636s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 636s mkdir -p "$CHANGEPATH" 636s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 636s rm -rf "${BUILDDIR}" 636s msgdone "info" 636s } 636s 636s buildpackage() { 636s local BUILDDIR=$1 636s local RELEASE=$2 636s local SECTION=$3 636s local ARCH=$(getarchitecture $4) 636s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 636s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 636s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 636s cd "$BUILDDIR" 636s if [ "$ARCH" = "all" ]; then 636s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 636s fi 636s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 636s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 636s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 636s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 636s cd - > /dev/null 636s for PKG in $PKGS; do 636s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 636s done 636s for SRC in $SRCS; do 636s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 636s done 636s } 636s 636s buildaptarchive() { 636s if [ -d incoming ]; then 636s buildaptarchivefromincoming "$@" 636s else 636s buildaptarchivefromfiles "$@" 636s fi 636s } 636s 636s createaptftparchiveconfig() { 636s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 636s local COMPRESSORS="${COMPRESSORS%* }" 636s local ARCHS="$(getarchitectures)" 636s cat > ftparchive.conf <> ftparchive.conf 636s } 636s 636s buildaptftparchivedirectorystructure() { 636s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 636s for DIST in $DISTS; do 636s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 636s for SECTION in $SECTIONS; do 636s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 636s for ARCH in $ARCHS; do 636s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 636s done 636s mkdir -p "dists/${DIST}/${SECTION}/source" 636s mkdir -p "dists/${DIST}/${SECTION}/i18n" 636s done 636s done 636s } 636s 636s insertpackage() { 636s local RELEASES="$1" 636s local NAME="$2" 636s local ARCH="$3" 636s local VERSION="$4" 636s local DEPENDENCIES="$5" 636s local PRIORITY="${6:-optional}" 636s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 636s If you find such a package installed on your system, 636s something went horribly wrong! They are autogenerated 636s and used only by testcases and serve no other purpose…}" 636s local SECTION="${8:-other}" 636s 636s if [ "$SECTION" = "${SECTION#*/}" ]; then 636s DISTSECTION="main" 636s else 636s DISTSECTION="${SECTION%/*}" 636s fi 636s local ARCHS="" 636s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 636s if [ "$RELEASE" = 'installed' ]; then 636s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 636s continue 636s fi 636s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 636s if [ "$arch" = 'none' ]; then 636s ARCHS="$(getarchitectures)" 636s else 636s ARCHS="$arch" 636s fi 636s for BUILDARCH in $ARCHS; do 636s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 636s mkdir -p "$PPATH" 636s { 636s echo "Package: $NAME 636s Priority: $PRIORITY 636s Section: $SECTION 636s Installed-Size: 42 636s Size: 42" 636s if echo "$DEPENDENCIES" | grep -q SHA256:; then 636s : 636s else 636s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 636s fi 636s echo "Maintainer: Joe Sixpack " 636s test "$arch" = 'none' || echo "Architecture: $arch" 636s echo "Version: $VERSION 636s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 636s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 636s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 636s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 636s echo 636s } >> "${PPATH}/Packages" 636s done 636s done 636s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 636s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 636s echo "Package: $NAME 636s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 636s Description-en: $DESCRIPTION 636s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 636s done 636s } 636s 636s insertsource() { 636s local RELEASES="$1" 636s local NAME="$2" 636s local ARCH="$3" 636s local VERSION="$4" 636s local DEPENDENCIES="$5" 636s local BINARY="${6:-$NAME}" 636s local ARCHS="" 636s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 636s local SPATH="aptarchive/dists/${RELEASE}/main/source" 636s mkdir -p $SPATH 636s local FILE="${SPATH}/Sources" 636s local DSCFILE="${NAME}_${VERSION}.dsc" 636s local TARFILE="${NAME}_${VERSION}.tar.gz" 636s echo "Package: $NAME 636s Binary: $BINARY 636s Version: $VERSION 636s Maintainer: Joe Sixpack 636s Architecture: $ARCH" >> $FILE 636s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 636s echo "Files: 636s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 636s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 636s Checksums-Sha256: 636s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 636s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 636s " >> "$FILE" 636s done 636s } 636s 636s insertinstalledpackage() { 636s local NAME="$1" 636s local ARCH="$2" 636s local VERSION="$3" 636s local DEPENDENCIES="$4" 636s local PRIORITY="${5:-optional}" 636s local STATUS="${6:-install ok installed}" 636s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 636s If you find such a package installed on your system, 636s something went horribly wrong! They are autogenerated 636s and used only by testcases and serve no other purpose…}" 636s local SECTION="${8:-other}" 636s 636s local FILE='rootdir/var/lib/dpkg/status' 636s local INFO='rootdir/var/lib/dpkg/info' 636s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 636s echo "Package: $NAME 636s Status: $STATUS 636s Priority: $PRIORITY 636s Section: $SECTION 636s Installed-Size: 42 636s Maintainer: Joe Sixpack 636s Version: $VERSION" >> "$FILE" 636s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 636s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 636s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 636s echo >> "$FILE" 636s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 636s echo -n > "${INFO}/${NAME}:${arch}.list" 636s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 636s else 636s echo -n > "${INFO}/${NAME}.list" 636s echo -n > "${INFO}/${NAME}.md5sums" 636s fi 636s done 636s } 636s 636s 636s buildaptarchivefromincoming() { 636s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 636s cd aptarchive 636s [ -e pool ] || ln -s ../incoming pool 636s [ -e ftparchive.conf ] || createaptftparchiveconfig 636s [ -e dists ] || buildaptftparchivedirectorystructure 636s msgninfo "\tGenerate Packages, Sources and Contents files… " 636s testsuccess aptftparchive generate ftparchive.conf 636s cd - > /dev/null 636s msgdone "info" 636s generatereleasefiles "$@" 636s } 636s 636s buildaptarchivefromfiles() { 636s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 636s local DIR='aptarchive' 636s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 636s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 636s msgninfo "\t${line} file… " 636s compressfile "$line" "$1" 636s msgdone "info" 636s done 636s generatereleasefiles "$@" 636s } 636s 636s compressfile() { 636s while read compressor extension command; do 636s if [ "$compressor" = '.' ]; then 636s if [ -n "$2" ]; then 636s touch -d "$2" "$1" 636s fi 636s continue 636s fi 636s cat "$1" | $command > "${1}.${extension}" 636s if [ -n "$2" ]; then 636s touch -d "$2" "${1}.${extension}" 636s fi 636s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 636s } 636s 636s # can be overridden by testcases for their pleasure 636s getcodenamefromsuite() { 636s case "$1" in 636s unstable) echo 'sid';; 636s *) echo -n "$1";; 636s esac 636s } 636s getreleaseversionfromsuite() { true; } 636s getlabelfromsuite() { true; } 636s getoriginfromsuite() { true; } 636s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 636s getnotautomaticfromsuite() { 636s case "$1" in 636s experimental|experimental2) echo "yes";; 636s esac 636s } 636s getbutautomaticupgradesfromsuite() { true; } 636s 636s aptftparchiverelease() { 636s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 636s } 636s generatereleasefiles() { 636s # $1 is the Date header and $2 is the ValidUntil header to be set 636s # both should be given in notation date/touch can understand 636s local DATE="$1" 636s local VALIDUNTIL="$2" 636s if [ -e aptarchive/dists ]; then 636s msgninfo "\tGenerate Release files for dists… " 636s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 636s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 636s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 636s local CODENAME="$(getcodenamefromsuite $SUITE)" 636s local VERSION="$(getreleaseversionfromsuite $SUITE)" 636s local LABEL="$(getlabelfromsuite $SUITE)" 636s local ORIGIN="$(getoriginfromsuite $SUITE)" 636s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 636s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 636s aptftparchiverelease "$dir" \ 636s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 636s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 636s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 636s -o APT::FTPArchive::Release::Label="${LABEL}" \ 636s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 636s -o APT::FTPArchive::Release::Version="${VERSION}" \ 636s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 636s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 636s > "$dir/Release" 636s done 636s else 636s msgninfo "\tGenerate Release files for flat… " 636s aptftparchiverelease ./aptarchive > aptarchive/Release 636s fi 636s if [ -n "$VALIDUNTIL" ]; then 636s sed -i "/^Date: / a\ 636s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 636s fi 636s if [ -n "$DATE" -a "$DATE" != "now" ]; then 636s for release in $(find ./aptarchive -name 'Release'); do 636s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 636s touch -d "$DATE" "$release" 636s done 636s fi 636s msgdone "info" 636s } 636s 636s setupdistsaptarchive() { 636s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 636s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 636s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 636s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 636s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 636s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 636s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 636s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 636s msgdone "info" 636s done 636s } 636s 636s setupflataptarchive() { 636s local APTARCHIVE="$(readlink -f ./aptarchive)" 636s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 636s if [ -f "${APTARCHIVE}/Packages" ]; then 636s msgninfo "\tadd deb sources.list line… " 636s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 636s msgdone 'info' 636s else 636s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 636s fi 636s if [ -f "${APTARCHIVE}/Sources" ]; then 636s msgninfo "\tadd deb-src sources.list line… " 636s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 636s msgdone 'info' 636s else 636s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 636s fi 636s } 636s 636s setupaptarchive() { 636s local NOUPDATE=0 636s if [ "$1" = '--no-update' ]; then 636s NOUPDATE=1 636s shift 636s fi 636s buildaptarchive "$@" 636s if [ -e aptarchive/dists ]; then 636s setupdistsaptarchive 636s else 636s setupflataptarchive 636s fi 636s signreleasefiles 'Joe Sixpack' 636s if [ "1" != "$NOUPDATE" ]; then 636s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 636s fi 636s } 636s 636s killgpgagent() { 636s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 636s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 636s if [ ! -e "${GPGHOME}" ]; then return; fi 636s # ensure the agent dies quickly as different versions have different suicide heuristics 636s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 636s rm -rf "$GPGHOME" 636s } 636s dosigning() { 636s local KEY="$1" 636s shift 636s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 636s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 636s GPGHOME="$APT_TEST_SIGNINGHOME" 636s else 636s if [ ! -e "$GPGHOME" ]; then 636s mkdir -p --mode=700 "${GPGHOME}" 636s addtrap 'prefix' 'killgpgagent;' 636s fi 636s fi 636s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 636s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 636s "$@" 636s } 636s signreleasefiles() { 636s local SIGNERS="${1:-Joe Sixpack}" 636s local REPODIR="${2:-aptarchive}" 636s if [ -n "$1" ]; then shift; fi 636s if [ -n "$1" ]; then shift; fi 636s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 636s msgninfo "\tSign archive with $SIGNERS key $KEY… " 636s local REXKEY='keys/rexexpired' 636s local SECEXPIREBAK="${REXKEY}.sec.bak" 636s local PUBEXPIREBAK="${REXKEY}.pub.bak" 636s local SIGUSERS="" 636s while [ -n "${SIGNERS%%,*}" ]; do 636s local SIGNER="${SIGNERS%%,*}" 636s if [ "${SIGNERS}" = "${SIGNER}" ]; then 636s SIGNERS="" 636s fi 636s SIGNERS="${SIGNERS#*,}" 636s # FIXME: This should be the full name, but we can't encode the space properly currently 636s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 636s if [ "${SIGNER}" = 'Rex Expired' ]; then 636s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 636s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 636s # therefore we 'temporary' make the key not expired and restore a backup after signing 636s cp "${REXKEY}.sec" "$SECEXPIREBAK" 636s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 636s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 636s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 636s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 636s cp "$SECUNEXPIRED" "${REXKEY}.sec" 636s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 636s else 636s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 636s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 636s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 636s cat setexpire.gpg 636s exit 1 636s fi 636s cp "${REXKEY}.sec" "$SECUNEXPIRED" 636s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 636s fi 636s fi 636s if [ ! -e "${KEY}.pub" ]; then 636s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 636s cat "${K}.pub" >> "${KEY}.new.pub" 636s cat "${K}.sec" >> "${KEY}.new.sec" 636s fi 636s done 636s if [ ! -e "${KEY}.pub" ]; then 636s mv "${KEY}.new.pub" "${KEY}.pub" 636s mv "${KEY}.new.sec" "${KEY}.sec" 636s fi 636s for RELEASE in $(find "${REPODIR}/" -name Release); do 636s # we might have set a specific date for the Release file, so copy it 636s local DATE="$(stat --format "%y" "${RELEASE}")" 636s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 636s rm -f "${RELEASE}.gpg" 636s else 636s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 636s touch -d "$DATE" "${RELEASE}.gpg" 636s fi 636s local INRELEASE="${RELEASE%/*}/InRelease" 636s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 636s rm -f "$INRELEASE" 636s else 636s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 636s touch -d "$DATE" "${INRELEASE}" 636s fi 636s done 636s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 636s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 636s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 636s fi 636s msgdone 'info' 636s } 636s 636s redatereleasefiles() { 636s local DATE="$(date -u -d "$1" -R)" 636s for release in $(find aptarchive/ -name 'Release'); do 636s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 636s touch -d "$DATE" "$release" 636s done 636s signreleasefiles "${2:-Joe Sixpack}" 636s } 636s 636s webserverconfig() { 636s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 636s local NOCHECK=false 636s if [ "$1" = '--no-check' ]; then 636s NOCHECK=true 636s shift 636s fi 636s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 636s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 636s rm -f "$STATUS" "$DOWNLOG" 636s local URI 636s if [ -n "$2" ]; then 636s msgtest "Set webserver config option '${1}' to" "$2" 636s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 636s else 636s msgtest 'Clear webserver config option' "${1}" 636s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 636s fi 636s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 636s msgpass 636s else 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 636s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 636s msgfailoutput '' "$OUTPUT" 636s fi 636s $NOCHECK || testwebserverlaststatuscode '200' 636s } 636s 636s rewritesourceslist() { 636s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 636s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 636s sed -i $LIST \ 636s -e "s#file://$APTARCHIVE#${1}#" \ 636s -e "s#file:$APTARCHIVE#${1}#" \ 636s -e "s#copy://$APTARCHIVE#${1}#" \ 636s -e "s#copy:$APTARCHIVE#${1}#" \ 636s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 636s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 636s done 636s } 636s 636s # wait for up to 10s for a pid file to appear to avoid possible race 636s # when a helper is started and doesn't write the PID quick enough 636s waitforpidfile() { 636s local PIDFILE="$1" 636s for i in $(seq 10); do 636s if test -s "$PIDFILE"; then 636s return 0 636s fi 636s sleep 1 636s done 636s msgdie "waiting for $PIDFILE failed" 636s return 1 636s } 636s 636s changetowebserver() { 636s local REWRITE='yes' 636s if [ "$1" = '--no-rewrite' ]; then 636s REWRITE='no' 636s shift 636s fi 636s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 636s cd aptarchive 636s local LOG="webserver.log" 636s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 636s cat "$LOG" 636s false 636s fi 636s waitforpidfile aptwebserver.pid 636s local PID="$(cat aptwebserver.pid)" 636s if [ -z "$PID" ]; then 636s msgdie 'Could not fork aptwebserver successfully' 636s fi 636s addtrap "kill $PID;" 636s waitforpidfile aptwebserver.port 636s APTHTTPPORT="$(cat aptwebserver.port)" 636s if [ -z "$APTHTTPPORT" ]; then 636s msgdie 'Could not get port for aptwebserver successfully' 636s fi 636s cd - > /dev/null 636s else 636s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 636s fi 636s if [ "$REWRITE" != 'no' ]; then 636s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 636s fi 636s } 636s 636s changetohttpswebserver() { 636s local REWRITE='yes' 636s if [ "$1" = '--no-rewrite' ]; then 636s REWRITE='no' 636s shift 636s fi 636s local stunnel4 636s if command -v stunnel4 >/dev/null 2>&1; then 636s stunnel4=stunnel4 636s elif command -v stunnel >/dev/null 2>&1; then 636s stunnel4=stunnel 636s else 636s msgdie 'You need to install stunnel4 for https testcases' 636s fi 636s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 636s changetowebserver --no-rewrite "$@" 636s fi 636s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 636s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 636s output = /dev/null 636s 636s [https] 636s accept = 127.0.0.1:0 636s connect = $APTHTTPPORT 636s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 636s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 636s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 636s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 636s if [ -z "$PID" ]; then 636s msgdie 'Could not fork $stunnel4 successfully' 636s fi 636s addtrap 'prefix' "kill ${PID};" 636s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 636s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 636s if [ "$REWRITE" != 'no' ]; then 636s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 636s fi 636s } 636s 636s changetocdrom() { 636s mkdir -p rootdir/media/cdrom/.disk 636s local CD="$(readlink -f rootdir/media/cdrom)" 636s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 636s if [ ! -d aptarchive/dists ]; then 636s msgdie 'Flat file archive cdroms can not be created currently' 636s return 1 636s fi 636s mv aptarchive/dists "$CD" 636s ln -s "$(readlink -f ./incoming)" "$CD/pool" 636s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 636s # start with an unmounted disk 636s mv "${CD}" "${CD}-unmounted" 636s # we don't want the disk to be modifiable 636s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 636s chmod -R 555 rootdir/media/cdrom-unmounted/dists 636s } 636s 636s downloadfile() { 636s local PROTO="${1%%:*}" 636s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 636s download-file "$1" "$2" "$3" 2>&1 ; then 636s return 1 636s fi 636s # only if the file exists the download was successful 636s if [ -r "$2" ]; then 636s return 0 636s else 636s return 1 636s fi 636s } 636s 636s cleanup_output() { 636s cat "$1" | sed \ 636s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 636s -e '/^profiling:/ d' \ 636s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 636s >"$2" 636s } 636s 636s checkdiff() { 636s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 636s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 636s touch "$TMPFILE1" "$TMPFILE2" 636s 636s cleanup_output "$1" "$TMPFILE1" 636s cleanup_output "$2" "$TMPFILE2" 636s 636s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 636s if [ -n "$DIFFTEXT" ]; then 636s echo >&2 636s echo >&2 "$DIFFTEXT" 636s return 1 636s else 636s return 0 636s fi 636s } 636s 636s testoutputequal() { 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 636s local COMPAREFILE="$1" 636s shift 636s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 636s msgpass 636s else 636s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 636s cat "$COMPAREFILE" >>"${OUTPUT}" 636s msgfailoutput '' "$OUTPUT" "$@" 636s fi 636s } 636s 636s testfileequal() { 636s msggroup 'testfileequal' 636s local MSG='Test for correctness of file' 636s if [ "$1" = '--nomsg' ]; then 636s MSG='' 636s shift 636s fi 636s local FILE="$1" 636s shift 636s if [ -n "$MSG" ]; then 636s msgtest "$MSG" "$FILE" 636s fi 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 636s if [ -z "$*" ]; then 636s testoutputequal "$FILE" echo -n '' 636s else 636s testoutputequal "$FILE" echo "$*" 636s fi 636s msggroup 636s } 636s 636s testempty() { 636s msggroup 'testempty' 636s if [ "$1" = '--nomsg' ]; then 636s shift 636s else 636s msgtest "Test for no output of" "$*" 636s fi 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 636s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 636s msgpass 636s else 636s msgfailoutput '' "$COMPAREFILE" "$@" 636s fi 636s aptautotest 'testempty' "$@" 636s msggroup 636s } 636s testwarningempty() { 636s testwarning "$@" 636s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 636s } 636s testnotempty() { 636s msggroup 'testnotempty' 636s msgtest "Test for some output of" "$*" 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 636s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 636s msgpass 636s else 636s msgfailoutput '' "$COMPAREFILE" "$@" 636s fi 636s aptautotest 'testnotempty' "$@" 636s msggroup 636s } 636s 636s testequal() { 636s msggroup 'testequal' 636s local MSG='Test of equality of' 636s if [ "$1" = '--nomsg' ]; then 636s MSG='' 636s shift 636s fi 636s 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 636s echo "$1" > "$COMPAREFILE" 636s shift 636s 636s if [ -n "$MSG" ]; then 636s msgtest "$MSG" "$*" 636s fi 636s testoutputequal "$COMPAREFILE" "$@" 636s aptautotest 'testequal' "$@" 636s msggroup 636s } 636s 636s testequalor2() { 636s msggroup 'testequalor2' 636s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 636s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 636s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 636s echo "$1" > "$COMPAREFILE1" 636s echo "$2" > "$COMPAREFILE2" 636s shift 2 636s msgtest "Test for equality OR of" "$*" 636s "$@" >"$COMPAREAGAINST" 2>&1 || true 636s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 636s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 636s then 636s msgpass 636s else 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 636s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 636s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 636s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 636s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 636s msgfailoutput '' "$OUTPUT" 636s fi 636s aptautotest 'testequalor2' "$@" 636s msggroup 636s } 636s 636s testshowvirtual() { 636s msggroup 'testshowvirtual' 636s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 636s local PACKAGE="$1" 636s shift 636s while [ -n "$1" ]; do 636s VIRTUAL="${VIRTUAL} 636s N: Can't select versions from package '$1' as it is purely virtual" 636s PACKAGE="${PACKAGE} $1" 636s shift 636s done 636s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 636s VIRTUAL="${VIRTUAL} 636s N: No packages found" 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 636s local ARCH="$(getarchitecture 'native')" 636s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 636s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 636s msggroup 636s } 636s 636s testnopackage() { 636s msggroup 'testnopackage' 636s msgtest "Test for non-existent packages" "apt-cache show $*" 636s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 636s if [ -n "$SHOWPKG" ]; then 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 636s echo "$SHOWPKG" >"$OUTPUT" 636s msgfailoutput '' "$OUTPUT" 636s else 636s msgpass 636s fi 636s msggroup 636s } 636s testnosrcpackage() { 636s msggroup 'testnosrcpackage' 636s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 636s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 636s if [ -n "$SHOWPKG" ]; then 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 636s echo "$SHOWPKG" >"$OUTPUT" 636s msgfailoutput '' "$OUTPUT" 636s else 636s msgpass 636s fi 636s msggroup 636s } 636s 636s testdpkgstatus() { 636s msggroup 'testdpkgstatus' 636s local STATE="$1" 636s local NR="$2" 636s shift 2 636s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 636s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 636s if [ "$PKGS" != $NR ]; then 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 636s echo "$PKGS" >"$OUTPUT" 636s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 636s msgfailoutput '' "$OUTPUT" 636s else 636s msgpass 636s fi 636s msggroup 636s } 636s 636s testdpkginstalled() { 636s msggroup 'testdpkginstalled' 636s testdpkgstatus 'ii' "$#" "$@" 636s msggroup 636s } 636s 636s testdpkgnotinstalled() { 636s msggroup 'testdpkgnotinstalled' 636s testdpkgstatus 'ii' '0' "$@" 636s msggroup 636s } 636s 636s testmarkedauto() { 636s msggroup 'testmarkedauto' 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 636s if [ -n "$1" ]; then 636s msgtest 'Test for correctly marked as auto-installed' "$*" 636s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 636s else 636s msgtest 'Test for correctly marked as auto-installed' 'no package' 636s echo -n > "$COMPAREFILE" 636s fi 636s testoutputequal "$COMPAREFILE" aptmark showauto 636s msggroup 636s } 636s testmarkedmanual() { 636s msggroup 'testmarkedmanual' 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 636s if [ -n "$1" ]; then 636s msgtest 'Test for correctly marked as manually installed' "$*" 636s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 636s else 636s msgtest 'Test for correctly marked as manually installed' 'no package' 636s echo -n > "$COMPAREFILE" 636s fi 636s testoutputequal "$COMPAREFILE" aptmark showmanual 636s msggroup 636s } 636s 636s catfile() { 636s if [ "${1##*.}" = 'deb' ]; then 636s stat >&2 "$1" || true 636s file >&2 "$1" || true 636s else 636s cat >&2 "$1" || true 636s fi 636s } 636s msgfailoutput() { 636s msgreportheader 'msgfailoutput' 636s local MSG="$1" 636s local OUTPUT="$2" 636s shift 2 636s local CMD="$1" 636s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 636s echo >&2 636s while [ -n "$2" ]; do shift; done 636s echo "#### Complete file: $1 ####" 636s catfile "$1" 636s echo "#### $CMD output ####" 636s elif [ "$1" = 'test' ]; then 636s echo >&2 636s # doesn't support ! or non-file flags 636s msgfailoutputstatfile() { 636s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 636s if expr match "$1" "$FILEFLAGS" >/dev/null; then 636s echo "#### stat(2) of file: $2 ####" 636s stat "$2" || true 636s if test -d "$2"; then 636s echo "#### The directory contains: $2 ####" 636s ls >&2 "$2" || true 636s elif test -e "$2"; then 636s echo "#### Complete file: $2 ####" 636s catfile "$2" 636s fi 636s fi 636s } 636s msgfailoutputstatfile "$2" "$3" 636s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 636s shift 3 636s msgfailoutputstatfile "$2" "$3" 636s done 636s echo '#### test output ####' 636s elif [ "$1" = 'cmp' ]; then 636s echo >&2 636s while [ -n "$2" ]; do 636s echo "#### Complete file: $2 ####" 636s catfile "$2" 636s shift 636s done 636s echo '#### cmp output ####' 636s elif [ "$1" = 'rm' ]; then 636s echo "#### Directory listing of: $(pwd) ####" 636s ls -l 636s fi 636s catfile "$OUTPUT" 636s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 636s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 636s local COREEXE='' 636s for CORENAME in 'core' 'core.pid'; do 636s if [ -s "$CORENAME" ]; then 636s cp -a ${CORENAME} "$COREDUMP" 636s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 636s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 636s else 636s continue 636s fi 636s break 636s done 636s if [ -s "$COREDUMP" ]; then 636s true # found already as a file 636s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 636s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 636s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 636s else 636s echo '### core dump not found ###' 636s cat /proc/sys/kernel/core_pattern 636s fi 636s if [ -s "$COREDUMP" ]; then 636s if [ -z "$COREEXE" ]; then 636s case "$CMD" in 636s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 636s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 636s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 636s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 636s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 636s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 636s esac 636s fi 636s 636s if [ -d "${ARTIFACTSDIR}" ]; then 636s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 636s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 636s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 636s fi 636s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 636s echo "#### gdb backtrace ####" 636s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 636s fi 636s fi 636s rm -f "$COREDUMP" 636s fi 636s msgfail "$MSG" 636s } 636s 636s testsuccesswithglobalerror() { 636s local TYPE="$1" 636s local ERRORS="$2" 636s shift 2 636s msggroup "$TYPE" 636s if [ "$1" = '--nomsg' ]; then 636s shift 636s else 636s msgtest 'Test for successful execution of' "$*" 636s fi 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 636s if "$@" >"${OUTPUT}" 2>&1; then 636s if expr match "$1" '^apt.*' >/dev/null; then 636s if grep -q -E ' runtime error: ' "$OUTPUT"; then 636s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 636s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 636s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 636s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 636s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 636s msgpass 636s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 636s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 636s msgpass 636s else 636s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 636s fi 636s else 636s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 636s fi 636s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 636s if grep -q -E "^N: " "$OUTPUT"; then 636s msgpass 636s else 636s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 636s fi 636s else 636s msgpass 636s fi 636s else 636s msgpass 636s fi 636s else 636s local EXITCODE=$? 636s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 636s fi 636s aptautotest "$TYPE" "$@" 636s msggroup 636s } 636s testsuccesswithnotice() { 636s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 636s } 636s testsuccess() { 636s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 636s } 636s testwarning() { 636s msggroup 'testwarning' 636s if [ "$1" = '--nomsg' ]; then 636s shift 636s else 636s msgtest 'Test for successful execution with warnings of' "$*" 636s fi 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 636s if "$@" >"${OUTPUT}" 2>&1; then 636s if expr match "$1" '^apt.*' >/dev/null; then 636s if grep -q -E ' runtime error: ' "$OUTPUT"; then 636s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 636s elif grep -q -E '^E: ' "$OUTPUT"; then 636s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 636s elif ! grep -q -E '^W: ' "$OUTPUT"; then 636s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 636s else 636s msgpass 636s fi 636s else 636s msgpass 636s fi 636s else 636s local EXITCODE=$? 636s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 636s fi 636s aptautotest 'testwarning' "$@" 636s msggroup 636s } 636s testfailure() { 636s msggroup 'testfailure' 636s if [ "$1" = '--nomsg' ]; then 636s shift 636s else 636s msgtest 'Test for failure in execution of' "$*" 636s fi 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 636s if "$@" >"${OUTPUT}" 2>&1; then 636s local EXITCODE=$? 636s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 636s else 636s local EXITCODE=$? 636s if expr match "$1" '^apt.*' >/dev/null; then 636s if [ "$1" = 'aptkey' ]; then 636s if grep -q " Can't check signature: 636s BAD signature from 636s signature could not be verified" "$OUTPUT"; then 636s msgpass 636s else 636s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 636s fi 636s else 636s if grep -q -E ' runtime error: ' "$OUTPUT"; then 636s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 636s elif grep -q -E '==ERROR' "$OUTPUT"; then 636s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 636s elif ! grep -q -E '^E: ' "$OUTPUT"; then 636s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 636s else 636s msgpass 636s fi 636s fi 636s else 636s msgpass 636s fi 636s fi 636s aptautotest 'testfailure' "$@" 636s msggroup 636s } 636s 636s testreturnstateequal() { 636s local STATE="$1" 636s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 636s local STATE="$2" 636s local TYPE="$3" 636s shift 3 636s msggroup "${STATE}equal" 636s if [ "$1" != '--nomsg' ]; then 636s local CMP="$1" 636s shift 636s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 636s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 636s else 636s local CMP="$2" 636s shift 2 636s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 636s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 636s fi 636s else 636s msggroup "${STATE}equal" 636s if [ "$2" != '--nomsg' ]; then 636s local CMP="$2" 636s shift 2 636s "$STATE" "$@" 636s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 636s else 636s local CMP="$3" 636s shift 3 636s "$STATE" --nomsg "$@" 636s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 636s fi 636s fi 636s msggroup 636s } 636s testsuccessequal() { 636s # we compare output, so we know perfectly well about N: 636s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 636s } 636s testwarningequal() { 636s testreturnstateequal 'testwarning' "$@" 636s } 636s testfailureequal() { 636s testreturnstateequal 'testfailure' "$@" 636s } 636s 636s testfailuremsg() { 636s msggroup 'testfailuremsg' 636s local CMP="$1" 636s shift 636s testfailure "$@" 636s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 636s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 636s testoutputequal "$COMPAREFILE" echo "$CMP" 636s msggroup 636s } 636s testwarningmsg() { 636s msggroup 'testwarningmsg' 636s local CMP="$1" 636s shift 636s testwarning "$@" 636s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 636s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 636s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 636s testoutputequal "$COMPAREFILE" echo "$CMP" 636s msggroup 636s } 636s 636s testfilestats() { 636s msggroup 'testfilestats' 636s msgtest "Test that file $1 has $2 $3" "$4" 636s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 636s msgpass 636s else 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 636s { 636s echo 636s ls -ld "$1" || true 636s echo -n "stat(1) reports for $2: " 636s stat --format "$2" "$1" || true 636s } >"$OUTPUT" 2>&1 636s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 636s fi 636s msggroup 636s } 636s testaccessrights() { 636s msggroup 'testaccessrights' 636s testfilestats "$1" '%a' '=' "$2" 636s msggroup 636s } 636s 636s testwebserverlaststatuscode() { 636s msggroup 'testwebserverlaststatuscode' 636s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 636s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 636s rm -f "$DOWNLOG" "$STATUS" 636s msgtest 'Test last status code from the webserver was' "$1" 636s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 636s msgpass 636s else 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 636s { 636s if [ -n "$2" ]; then 636s shift 636s echo >&2 '#### Additionally provided output files contain:' 636s cat >&2 "$@" 636s fi 636s echo >&2 '#### Download log of the status code:' 636s cat >&2 "$DOWNLOG" 636s } >"$OUTPUT" 2>&1 636s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 636s fi 636s msggroup 636s } 636s 636s mapkeynametokeyid() { 636s while [ -n "$1" ]; do 636s case "$1" in 636s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 636s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 636s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 636s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 636s oldarchive) echo 'FDD2DB85F68C85A3';; 636s *) echo 'UNKNOWN KEY';; 636s esac 636s shift 636s done 636s } 636s testaptkeys() { 636s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 636s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 636s echo -n > "$OUTPUT" 636s fi 636s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 636s } 636s 636s pause() { 636s echo "STOPPED execution. Press enter to continue" 636s local IGNORE 636s read IGNORE 636s } 636s 636s logcurrentarchivedirectory() { 636s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 636s stat --format '%U:%G:%a:%n' "$line" 636s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 636s } 636s listcurrentlistsdirectory() { 636s { 636s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 636s stat --format '%U:%G:%a:%n' "$line" 636s done 636s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 636s stat --format '%U:%G:%a:%s:%y:%n' "$line" 636s done 636s } | sort 636s } 636s forallsupportedcompressors() { 636s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 636s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 636s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 636s "$@" "$COMP" 636s done 636s } 636s 636s breakfiles() { 636s while [ -n "$1" ]; do 636s mv -f "${1}" "${1}.bak" 636s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 636s shift 636s done 636s } 636s unbreakfiles() { 636s while [ -n "$1" ]; do 636s mv -f "${1}.bak" "${1}" 636s shift 636s done 636s } 636s 636s ### convenience hacks ### 636s mkdir() { 636s # creating some directories by hand is a tedious task, so make it look simple 636s local PARAMS="$*" 636s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 636s # only the last directory created by mkdir is effected by the -m ! 636s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 636s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 636s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 636s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 636s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 636s if [ "$(id -u)" = '0' ]; then 636s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 636s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 636s fi 636s else 636s command mkdir "$@" 636s fi 636s } 636s 636s ### The following tests are run by most test methods automatically to check 636s ### general things about commands executed without writing the test every time. 636s 636s aptautotest() { 636s if [ $# -lt 3 ]; then return; fi 636s local TESTCALL="$1" 636s local CMD="$2" 636s local FIRSTOPT="$3" 636s shift 2 636s for i in "$@"; do 636s if ! expr match "$i" '^-' >/dev/null 2>&1; then 636s FIRSTOPT="$i" 636s break 636s fi 636s done 636s shift 636s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 636s if command -v $AUTOTEST >/dev/null; then 636s # save and restore the *.output files from other tests 636s # as we might otherwise override them in these automatic tests 636s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 636s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 636s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 636s $AUTOTEST "$TESTCALL" "$@" 636s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 636s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 636s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 636s fi 636s } 636s 636s cdfind() { 636s ( cd /; find "$@" ) 636s } 636s aptautotest_aptget_update() { 636s local TESTCALL="$1" 636s while [ -n "$2" ]; do 636s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 636s shift 636s done 636s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 636s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 636s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 636s # all copied files are properly chmodded 636s local backupIFS="$IFS" 636s IFS="$(printf "\n\b")" 636s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 636s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 636s done 636s IFS="$backupIFS" 636s if [ "$TESTCALL" = 'testsuccess' ]; then 636s # failure cases can retain partial files and such 636s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 636s fi 636s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 636s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 636s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 636s fi 636s } 636s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 636s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 636s 636s testaptautotestnodpkgwarning() { 636s local TESTCALL="$1" 636s while [ -n "$2" ]; do 636s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 636s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 636s shift 636s done 636s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 636s } 636s 636s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 636s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 636s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 636s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 636s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 636s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 636s 636s testaptmarknodefaultsections() { 636s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 636s } 636s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 636s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 636s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 636s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 636s cmp: ./downloaded/foo1: No such file or directory 636s FAIL: exitcode 2 763s 763s Redirect leads first URI to the second URI … Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 763s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 763s Configured access method http 763s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 763s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 763s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 763s Configured access method http 763s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 763s -> http:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpk 763s Test for successful execution of cmp /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework ./downloaded/foo1 … #### Complete file: /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework #### 763s #### Complete file: ./downloaded/foo1 #### 763s #### cmp output #### 763s 763s Test for successful execution of cmp ./downloaded/foo1 ./downloaded/foo2 … #### Complete file: ./downloaded/foo1 #### 763s #### Complete file: ./downloaded/foo2 #### 763s #### cmp output #### 763s g=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 763s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo2%0aFilename:%20./downloaded/foo1%0a%0a 763s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo%0aFilename:%20./downloaded/foo2%0a%0a 763s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20http://localhost:44339/foo2 763s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 763s GET /foo2 HTTP/1.1 763s Host: localhost:44339 763s Accept: text/* 763s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 763s 763s 763s <- http:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 763s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo2 763s Answer for: http://localhost:44339/foo2 763s HTTP/1.1 301 Moved Permanently 763s Content-Length: 357 763s Location: https://localhost:44339/foo 763s Content-Type: text/html; charset=utf-8 763s Server: APT webserver 763s Accept-Ranges: bytes 763s Date: Fri, 13 Jun 2025 00:10:05 GMT 763s 763s <- GET /foo HTTP/1.1 763s Host: localhost:44339 763s Accept: text/* 763s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 763s 763s http 763s :103%20Redirect%0aNew-URI:%20https://localhost:44339/foo%0aURI:%20http://localhost:44339/foo2 763s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 763s Answer for: http://localhost:44339/foo 763s HTTP/1.1 200 OK 763s Content-Length: 77417 763s Last-Modified: Fri, 13 Jun 2025 00:07:57 GMT 763s Server: APT webserver 763s Accept-Ranges: bytes 763s Date: Fri, 13 Jun 2025 00:10:05 GMT 763s 763s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 763s Configured access method https 763s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 763s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 763s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 763s Configured access method https 763s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 763s -> https:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpkg=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 763s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 763s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo 763s <- http:200%20URI%20Start%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aURI:%20http://localhost:44339/foo 763s Get:2 http://localhost:44339/foo [77.4 kB] 763s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20https://localhost:44339/foo 763s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 763s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 763s <- http:201%20URI%20Done%0aChecksum-FileSize-Hash:%2077417%0aSHA512-Hash:%2099758b98725ee45110a374044902230c8b056c97567d3ec249dc4add195e13a8d07d7d5d5081938286c2c21ec0841528b6cee8986d16a3a9d0abd4c570dd7dce%0aSHA256-Hash:%2072d18d223dc239300d7548396ef9409ee2e4ff5163d55557a87d9852c098e15e%0aSHA1-Hash:%20357fe7a44e62f7a01e1b4c96ee33675f03223500%0aMD5Sum-Hash:%20582a51e7590162e00495e35c882c4b44%0aMD5-Hash:%20582a51e7590162e00495e35c882c4b44%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aFilename:%20./downloaded/foo2%0aURI:%20http://localhost:44339/foo 763s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 763s Ign:1 http://localhost:44339/foo2 763s Could not wait for server fd - select (11: Resource temporarily unavailable) 763s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 763s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 763s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 763s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 763s Ign:1 http://localhost:44339/foo2 763s Could not wait for server fd - select (11: Resource temporarily unavailable) 763s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 763s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 763s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 763s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 763s Ign:1 http://localhost:44339/foo2 763s Could not wait for server fd - select (11: Resource temporarily unavailable) 763s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 763s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 763s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 763s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 763s Err:1 http://localhost:44339/foo2 763s Could not wait for server fd - select (11: Resource temporarily unavailable) 763s E: Failed to fetch https://localhost:44339/foo Could not wait for server fd - select (11: Resource temporarily unavailable) 763s E: Download Failed 763s FAIL: exitcode 100 763s 763s #!/bin/sh -- # no runable script, just for vi 763s 763s EXIT_CODE=0 763s 763s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 763s if [ "$1" = "-q" ]; then 763s export MSGLEVEL=2 763s elif [ "$1" = "-qq" ]; then 763s export MSGLEVEL=1 763s elif [ "$1" = "-v" ]; then 763s export MSGLEVEL=4 763s elif [ "$1" = '--color=no' ]; then 763s export MSGCOLOR='NO' 763s elif [ "$1" = '--color=yes' ]; then 763s export MSGCOLOR='YES' 763s elif [ "$1" = '--color' ]; then 763s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 763s shift 763s elif [ "$1" = '--level' ]; then 763s export MSGLEVEL=$2 763s shift 763s else 763s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 763s fi 763s shift 763s done 763s export MSGLEVEL="${MSGLEVEL:-3}" 763s 763s # we all like colorful messages 763s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 763s if [ ! -t 1 ]; then # but check that we output to a terminal 763s export MSGCOLOR='NO' 763s fi 763s fi 763s 763s if [ "$MSGCOLOR" != 'NO' ]; then 763s CERROR="\033[1;31m" # red 763s CWARNING="\033[1;33m" # yellow 763s CMSG="\033[1;32m" # green 763s CINFO="\033[1;96m" # light blue 763s CDEBUG="\033[1;94m" # blue 763s CNORMAL="\033[0;39m" # default system console color 763s CDONE="\033[1;32m" # green 763s CPASS="\033[1;32m" # green 763s CFAIL="\033[1;31m" # red 763s CCMD="\033[1;35m" # pink 763s fi 763s 763s msgprintf() { 763s local START="$1" 763s local MIDDLE="$2" 763s local END="$3" 763s shift 3 763s if [ -n "$1" ]; then 763s printf "$START " "$1" 763s shift 763s while [ -n "$1" ]; do 763s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 763s shift 763s done 763s fi 763s printf "${END}" 763s } 763s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 763s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 763s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 763s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 763s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 763s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 763s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 763s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 763s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 763s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 763s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 763s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 763s msgreportheader() { 763s if [ -n "$MSGTEST_MSG" ]; then 763s test "$1" != 'msgfailoutput' || echo 763s if [ -n "$MSGTEST_MSGMSG" ]; then 763s echo "$MSGTEST_MSGMSG" 763s fi 763s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 763s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 763s fi 763s echo -n "$MSGTEST_MSG" 763s unset MSGTEST_MSG 763s fi 763s } 763s msgskip() { 763s msgreportheader 'msgskip' 763s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 763s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 763s } 763s msgfail() { 763s msgreportheader 'msgfail' 763s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 763s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 763s if [ -n "$APT_DEBUG_TESTS" ]; then 763s runapt $SHELL 763s fi 763s EXIT_CODE=$((EXIT_CODE+1)); 763s } 763s MSGGROUP_LEVEL=0 763s msggroup() { 763s if [ -n "$1" ]; then 763s if [ $MSGGROUP_LEVEL = 0 ]; then 763s MSGTEST_GRP='NEXT' 763s fi 763s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 763s else 763s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 763s if [ $MSGGROUP_LEVEL = 0 ]; then 763s unset MSGTEST_GRP 763s fi 763s fi 763s } 763s 763s # enable / disable Debugging 763s if [ $MSGLEVEL -le 0 ]; then 763s msgdie() { true; } 763s fi 763s if [ $MSGLEVEL -le 1 ]; then 763s msgwarn() { true; } 763s msgnwarn() { true; } 763s fi 763s if [ $MSGLEVEL -le 2 ]; then 763s msgmsg() { 763s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 763s } 763s msgnmsg() { true; } 763s msgtest() { 763s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 763s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 763s MSGTEST_GRP="$MSGTEST_MSG" 763s fi 763s } 763s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 763s fi 763s if [ $MSGLEVEL -le 3 ]; then 763s msginfo() { true; } 763s msgninfo() { true; } 763s fi 763s if [ $MSGLEVEL -le 4 ]; then 763s msgdebug() { true; } 763s msgndebug() { true; } 763s fi 763s if [ $MSGLEVEL -le 1 ]; then 763s msgpass() { true; } 763s fi 763s msgdone() { 763s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 764s [ "$1" = "info" -a $MSGLEVEL P P-le 3 ] || 764s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 764s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 764s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 764s true; 764s else 764s printf "${CDONE}DONE${CNORMAL}\n"; 764s fi 764s } 764s getaptconfig() { 764s if [ -f ./aptconfig.conf ]; then 764s echo "$(readlink -f ./aptconfig.conf)" 764s elif [ -f ../aptconfig.conf ]; then 764s echo "$(readlink -f ../aptconfig.conf)" 764s elif [ -f ../../aptconfig.conf ]; then 764s echo "$(readlink -f ../../aptconfig.conf)" 764s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 764s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 764s fi 764s } 764s runapt() { 764s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 764s local CMD="$1" 764s shift 764s case "$CMD" in 764s sh|aptitude|*/*|command) ;; 764s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 764s esac 764s if [ "$CMD" = 'aptitude' ]; then 764s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 764s else 764s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 764s fi 764s } 764s runpython3() { runapt command python3 "$@"; } 764s aptconfig() { runapt apt-config "$@"; } 764s aptcache() { runapt apt-cache "$@"; } 764s aptcdrom() { runapt apt-cdrom "$@"; } 764s aptget() { runapt apt-get "$@"; } 764s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 764s aptkey() { runapt apt-key "$@"; } 764s aptmark() { runapt apt-mark "$@"; } 764s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 764s apt() { runapt apt "$@"; } 764s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 764s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 764s aptitude() { runapt aptitude "$@"; } 764s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 764s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 764s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 764s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 764s 764s dpkg() { 764s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 764s } 764s dpkgquery() { 764s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 764s } 764s dpkg_version() { 764s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 764s } 764s dpkgcheckbuilddeps() { 764s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 764s } 764s gdb() { 764s local CMD 764s case "$1" in 764s aptget) CMD="apt-get";; 764s aptcache) CMD="apt-cache";; 764s aptcdrom) CMD="apt-cdrom";; 764s aptconfig) CMD="apt-config";; 764s aptmark) CMD="apt-mark";; 764s apthelper) CMD="apt-helper";; 764s aptftparchive) CMD="apt-ftparchive";; 764s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 764s *) CMD="$1";; 764s esac 764s shift 764s if [ "${CMD##*/}" = "$CMD" ]; then 764s CMD="${APTCMDLINEBINDIR}/${CMD}" 764s fi 764s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 764s } 764s 764s valgrind() { 764s local CMD 764s case "$1" in 764s aptget) CMD="apt-get";; 764s aptcache) CMD="apt-cache";; 764s aptcdrom) CMD="apt-cdrom";; 764s aptconfig) CMD="apt-config";; 764s aptmark) CMD="apt-mark";; 764s apthelper) CMD="apt-helper";; 764s aptftparchive) CMD="apt-ftparchive";; 764s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 764s *) CMD="$1";; 764s esac 764s shift 764s if [ "$CMD" = "apt-ftparchive" ]; then 764s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 764s fi 764s if [ "${CMD##*/}" = "$CMD" ]; then 764s CMD="${APTCMDLINEBINDIR}/${CMD}" 764s fi 764s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 764s } 764s 764s lastmodification() { 764s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 764s } 764s releasefiledate() { 764s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 764s } 764s 764s exitwithstatus() { 764s # error if we about to overflow, but ... 764s # "255 failures ought to be enough for everybody" 764s if [ $EXIT_CODE -gt 255 ]; then 764s msgdie "Total failure count $EXIT_CODE too big" 764s fi 764s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 764s } 764s 764s shellsetedetector() { 764s local exit_status=$? 764s if [ "$exit_status" != '0' ]; then 764s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 764s if [ "$EXIT_CODE" = '0' ]; then 764s EXIT_CODE="$exit_status" 764s fi 764s fi 764s } 764s 764s addtrap() { 764s if [ "$1" = 'prefix' ]; then 764s CURRENTTRAP="$2 $CURRENTTRAP" 764s else 764s CURRENTTRAP="$CURRENTTRAP $1" 764s fi 764s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 764s } 764s 764s escape_shell() { 764s echo "$@" | sed -e "s#'#'\"'\"'#g" 764s } 764s 764s find_project_binary_dir() { 764s if [ -z "$PROJECT_BINARY_DIR" ]; then 764s PROJECT_BINARY_DIR= 764s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 764s test -e "$dir/CMakeCache.txt" || continue 764s if [ -z "$PROJECT_BINARY_DIR" ] || 764s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 764s PROJECT_BINARY_DIR="$dir" 764s fi 764s done 764s if [ -z "$PROJECT_BINARY_DIR" ]; then 764s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 764s exit 1 764s fi 764s export PROJECT_BINARY_DIR 764s fi 764s } 764s _removetmpworkingdirectory() { 764s cd / 764s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 764s rm -rf "$TMPWORKINGDIRECTORY" 764s fi 764s TMPWORKINGDIRECTORY='' 764s } 764s setupenvironment() { 764s # cleanup the environment a bit 764s export LC_ALL=C 764s unset LANGUAGE COLUMNS NLSPATH 764s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 764s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 764s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 764s unset GREP_OPTIONS POSIXLY_CORRECT 764s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 764s export GCOV_ERROR_FILE=/dev/null 764s 764s # Next check needs a gnu stat, let's figure that out early. 764s stat=stat 764s if command -v gnustat >/dev/null 2>&1; then 764s stat=gnustat 764s fi 764s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 764s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 764s unset TMPDIR 764s fi 764s if [ -z "$TMPWORKINGDIRECTORY" ]; then 764s addtrap '_removetmpworkingdirectory;' 764s TMPWORKINGDIRECTORY="$(mktemp -d)" 764s fi 764s if [ -n "$TMPDIR_ADD" ]; then 764s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 764s mkdir -p "$TMPWORKINGDIRECTORY" 764s unset TMPDIR_ADD 764s export TMPDIR="$TMPWORKINGDIRECTORY" 764s fi 764s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 764s 764s # Setup coreutils on BSD systems 764s mkdir "${TMPWORKINGDIRECTORY}/bin" 764s for prefix in gnu g; do 764s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 764s if command -v $prefix$command 2>/dev/null >/dev/null; then 764s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 764s fi 764s done 764s done 764s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 764s 764s if [ -z "$TESTDIRECTORY" ]; then 764s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 764s fi 764s cd "$TMPWORKINGDIRECTORY" 764s 764s mkdir -m 700 'downloaded' 764s if [ "$(id -u)" = '0' ]; then 764s # relax permissions so that running as root with user switching works 764s umask 022 764s chmod 711 "$TMPWORKINGDIRECTORY" 764s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 764s fi 764s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 764s 764s _setupprojectenvironment 764s 764s # create some files in /tmp and look at user/group to get what this means 764s TEST_DEFAULT_USER="$(id -un)" 764s touch "${TMPWORKINGDIRECTORY}/test-file" 764s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 764s 764s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 764s . "${TESTDIRECTORY}/extra-environment" 764s fi 764s 764s msgdone "info" 764s } 764s _setupprojectenvironment() { 764s # allow overriding the default BUILDDIR locations 764s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 764s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 764s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 764s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 764s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 764s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 764s APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 764s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 764s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 764s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 764s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 764s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 764s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 764s 764s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 764s mkdir aptarchive keys 764s cd rootdir 764s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 764s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 764s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 764s touch var/lib/dpkg/available var/lib/dpkg/lock 764s echo '1' > var/lib/dpkg/info/format 764s ln -s "${METHODSDIR}" usr/lib/apt/methods 764s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 764s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 764s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 764s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 764s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 764s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 764s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 764s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 764s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 764s else 764s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 764s fi 764s cd .. 764s local BASENAME="${0##*/}" 764s local PACKAGESFILE="Packages-${BASENAME#*-}" 764s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 764s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 764s fi 764s local SOURCESSFILE="Sources-${BASENAME#*-}" 764s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 764s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 764s fi 764s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 764s chmod 644 keys/* 764s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 764s 764s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 764s echo "Dir::Etc \"etc\";" >> aptconfig.conf 764s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 764s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 764s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 764s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 764s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 764s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 764s # either store apt-key were we can access it, even if we run it as a different user 764s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 764s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 764s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 764s # destroys coverage reporting though, so we disable changing user for the calling gpgv 764s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 764s if [ "$(id -u)" = '0' ]; then 764s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 764s # same for the solver executables 764s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 764s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 764s fi 764s 764s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 764s EXEC='' 764s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 764s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 764s restoredpkgstatus() { 764s if [ -n "\$BACKUP" ]; then 764s if [ -e "\$BACKUP" ]; then 764s mv -f "\$BACKUP" "\$ORIGINAL" 764s else 764s rm -f "\$ORIGINAL" 764s fi 764s BACKUP='' 764s fi 764s } 764s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 764s if [ -e "\$ORIGINAL" ]; then 764s cp -a "\$ORIGINAL" "\$BACKUP" 764s fi 764s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 764s 764s Package: dpkg 764s Architecture: all 764s Version: ${DPKG_VERSION}+fake 764s Status: install ok installed 764s Maintainer: Joe Sixpack 764s Installed-Size: 42 764s Description: tells dpkg it supports what we need 764s Some versions of dpkg check its own version from the status file 764s to know if it supports multi-arch and stuff in --assert-*. 764s 764s EOS 764s fi 764s EOF 764s fi 764s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 764s 764s { 764s echo 'quiet "0";' 764s echo 'quiet::NoUpdate "true";' 764s echo 'quiet::NoStatistic "true";' 764s # too distracting for users, but helpful to detect changes 764s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 764s echo 'Acquire::Progress::Diffpercent "true";' 764s # in testcases, it can appear as if localhost has a rotation setup, 764s # hide this as we can't really deal with it properly 764s echo 'Acquire::Failure::ShowIP "false";' 764s # randomess and tests don't play well together 764s echo 'Acquire::IndexTargets::Randomized "false";' 764s # fakeroot can't fake everything, so disabled in production but good for tests 764s echo 'APT::Sandbox::Verify "true";' 764s } >> aptconfig.conf 764s 764s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 764s if [ "$(id -u)" = '0' ]; then 764s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 764s fi 764s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 764s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 764s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 764s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 764s # Allow release files to be 10 hours in the future, rather than 10 seconds 764s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 764s 764s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 764s 764s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 764s confighashes 'SHA256' # these are tests, not security best-practices 764s 764s # Make dpkg inherit testing path 764s echo 'DPkg::Path "";' >> aptconfig.conf 764s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 764s 764s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 764s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 764s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 764s fi 764s 764s # most tests just need one signed Release file, not both 764s export APT_DONT_SIGN='Release.gpg' 764s 764s # prefer our apt binaries over the system apt binaries 764s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 764s } 764s 764s getarchitecture() { 764s if [ "$1" = "native" -o -z "$1" ]; then 764s eval `aptconfig shell ARCH APT::Architecture` 764s if [ -n "$ARCH" ]; then 764s echo $ARCH 764s else 764s dpkg --print-architecture 764s fi 764s else 764s echo $1 764s fi 764s } 764s 764s getarchitectures() { 764s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 764s } 764s 764s getarchitecturesfromcommalist() { 764s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 764s } 764s 764s configarchitecture() { 764s { 764s echo "APT::Architecture \"$(getarchitecture $1)\";" 764s while [ -n "$1" ]; do 764s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 764s shift 764s done 764s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 764s configdpkg 764s } 764s 764s configdpkg() { 764s if [ ! -e rootdir/var/lib/dpkg/status ]; then 764s local BASENAME="${0##*/}" 764s local STATUSFILE="status-${BASENAME#*-}" 764s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 764s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 764s # Add an empty line to the end if there is none 764s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 764s echo >> rootdir/var/lib/dpkg/status 764s fi 764s fi 764s fi 764s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 764s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 764s local ARCHS="$(getarchitectures)" 764s local DPKGARCH="$(dpkg --print-architecture)" 764s # this ensures that even if multi-arch isn't active in the view 764s # of apt, given that dpkg can't be told which arch is native 764s # the arch apt treats as native might be foreign for dpkg 764s for ARCH in ${ARCHS}; do 764s if [ "${ARCH}" != "${DPKGARCH}" ]; then 764s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 764s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 764s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 764s else 764s # old-style used e.g. in Ubuntu-P – and as it seems travis 764s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 764s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 764s fi 764s fi 764s fi 764s done 764s else 764s # test multiarch before dpkg is ready for it… 764s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 764s fi 764s } 764s 764s configdpkgnoopchroot() { 764s # create a library to noop chroot() and rewrite maintainer script executions 764s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 764s # chroot directory dpkg could chroot into to execute the maintainer scripts 764s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 764s cat > noopchroot.c << EOF 764s #define _GNU_SOURCE 764s #include 764s #include 764s #include 764s #include 764s 764s static char * chrootdir = NULL; 764s 764s int chroot(const char *path) { 764s printf("WARNING: CHROOTing to %s was ignored!\n", path); 764s free(chrootdir); 764s chrootdir = strdup(path); 764s return 0; 764s } 764s int execvp(const char *file, char *const argv[]) { 764s static int (*func_execvp) (const char *, char * const []) = NULL; 764s if (func_execvp == NULL) 764s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 764s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 764s return func_execvp(file, argv); 764s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 764s char *newfile; 764s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 764s perror("asprintf"); 764s return -1; 764s } 764s char const * const baseadmindir = "/var/lib/dpkg"; 764s char *admindir; 764s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 764s perror("asprintf"); 764s return -1; 764s } 764s setenv("DPKG_ADMINDIR", admindir, 1); 764s return func_execvp(newfile, argv); 764s } 764s EOF 764s if cc -ldl 2>&1 | grep -q dl; then 764s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 764s else 764s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 764s fi 764s } 764s configcompression() { 764s if [ "$1" = 'ALL' ]; then 764s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 764s return 764s fi 764s local CMD='apthelper cat-file -C' 764s while [ -n "$1" ]; do 764s case "$1" in 764s '.') printf ".\t.\tcat\n";; 764s 'gz') printf "gzip\tgz\t$CMD $1\n";; 764s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 764s 'zst') printf "zstd\tzst\t$CMD $1\n";; 764s *) printf "$1\t$1\t$CMD $1\n";; 764s esac 764s shift 764s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 764s } 764s confighashes() { 764s { 764s echo 'APT::FTPArchive {' 764s { 764s while [ -n "$1" ]; do 764s printf "$1" | tr 'a-z' 'A-Z' 764s printf "\t\"true\";\n" 764s shift 764s done 764s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 764s printf "$h\t\"false\";\n" 764s done 764s } | awk '!x[$1]++' 764s echo '};' 764s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 764s } 764s forcecompressor() { 764s COMPRESSOR="$1" 764s COMPRESS="$1" 764s COMPRESSOR_CMD="apthelper cat-file -C $1" 764s case $COMPRESSOR in 764s gzip) COMPRESS='gz';; 764s bzip2) COMPRESS='bz2';; 764s zstd) COMPRESS='zst';; 764s esac 764s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 764s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 764s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 764s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 764s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 764s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 764s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 764s done 764s } 764s 764s _setupsimplenativepackage() { 764s local NAME="$1" 764s local ARCH="$2" 764s local VERSION="$3" 764s local RELEASE="${4:-unstable}" 764s local DEPENDENCIES="$5" 764s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 764s If you find such a package installed on your system, 764s something went horribly wrong! They are autogenerated 764s and used only by testcases and serve no other purpose…}" 764s 764s local SECTION="${7:-others}" 764s local PRIORITY="${8:-optional}" 764s local FILE_TREE="$9" 764s local COMPRESS_TYPE="${10:-gzip}" 764s local DISTSECTION 764s if [ "$SECTION" = "${SECTION#*/}" ]; then 764s DISTSECTION="main" 764s else 764s DISTSECTION="${SECTION%/*}" 764s fi 764s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 764s 764s mkdir -p "$BUILDDIR/debian/source" 764s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 764s echo "#!/bin/sh 764s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 764s 764s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 764s echo "$NAME ($VERSION) $RELEASE; urgency=low 764s 764s * Initial release 764s 764s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 764s { 764s echo "Source: $NAME 764s Priority: $PRIORITY 764s Maintainer: Joe Sixpack 764s Standards-Version: 4.3.1 764s Rules-Requires-Root: no" 764s if [ "$SECTION" != '' ]; then 764s echo "Section: $SECTION" 764s fi 764s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 764s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 764s echo " 764s Package: $NAME" 764s 764s if [ "$ARCH" = 'all' ]; then 764s echo "Architecture: all" 764s else 764s echo "Architecture: any" 764s fi 764s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 764s test -z "$DEPS" || echo "$DEPS" 764s printf "%b\n" "Description: $DESCRIPTION" 764s } > "${BUILDDIR}/debian/control" 764s 764s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 764s } 764s 764s make_tiny_rules() { 764s local OUT="$1" 764s if command -v gmake >/dev/null 2>&1; then 764s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 764s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 764s else 764s echo '#!/usr/bin/make -f' > "$OUT" 764s fi 764s echo '%:' >> "$OUT" 764s echo ' dh $@' >> "$OUT" 764s } 764s 764s setupsimplenativepackage() { 764s _setupsimplenativepackage "$@" 764s local NAME="$1" 764s local VERSION="$3" 764s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 764s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 764s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 764s } 764s 764s buildsimplenativepackage() { 764s local NAME="$1" 764s local ARCH="$2" 764s local VERSION="$3" 764s local RELEASE="${4:-unstable}" 764s local DEPENDENCIES="$5" 764s local DESCRIPTION="$6" 764s local SECTION="${7:-others}" 764s local PRIORITY="${8:-optional}" 764s local FILE_TREE="$9" 764s local COMPRESS_TYPE="${10:-gzip}" 764s local DISTSECTION 764s if [ "$SECTION" = "${SECTION#*/}" ]; then 764s DISTSECTION="main" 764s else 764s DISTSECTION="${SECTION%/*}" 764s fi 764s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 764s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 764s _setupsimplenativepackage "$@" 764s cd "${BUILDDIR}/.." 764s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 764s cd - >/dev/null 764s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 764s | while read SRC; do 764s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 764s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 764s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 764s # adv --yes --default-key 'Joe Sixpack' \ 764s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 764s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 764s # fi 764s done 764s 764s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 764s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 764s rm -rf "${BUILDDIR}/debian/tmp" 764s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 764s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 764s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 764s if [ -n "$FILE_TREE" ]; then 764s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 764s fi 764s 764s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 764s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 764s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 764s # ensure the right permissions as dpkg-deb insists 764s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 764s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 764s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 764s done 764s 764s local NM 764s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 764s NM="$(echo "$NAME" | cut -c 1-4)" 764s else 764s NM="$(echo "$NAME" | cut -c 1)" 764s fi 764s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 764s mkdir -p "$CHANGEPATH" 764s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 764s rm -rf "${BUILDDIR}" 764s msgdone "info" 764s } 764s 764s buildpackage() { 764s local BUILDDIR=$1 764s local RELEASE=$2 764s local SECTION=$3 764s local ARCH=$(getarchitecture $4) 764s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 764s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 764s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 764s cd "$BUILDDIR" 764s if [ "$ARCH" = "all" ]; then 764s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 764s fi 764s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 764s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 764s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 764s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 764s cd - > /dev/null 764s for PKG in $PKGS; do 764s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 764s done 764s for SRC in $SRCS; do 764s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 764s done 764s } 764s 764s buildaptarchive() { 764s if [ -d incoming ]; then 764s buildaptarchivefromincoming "$@" 764s else 764s buildaptarchivefromfiles "$@" 764s fi 764s } 764s 764s createaptftparchiveconfig() { 764s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 764s local COMPRESSORS="${COMPRESSORS%* }" 764s local ARCHS="$(getarchitectures)" 764s cat > ftparchive.conf <> ftparchive.conf 764s } 764s 764s buildaptftparchivedirectorystructure() { 764s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 764s for DIST in $DISTS; do 764s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 764s for SECTION in $SECTIONS; do 764s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 764s for ARCH in $ARCHS; do 764s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 764s done 764s mkdir -p "dists/${DIST}/${SECTION}/source" 764s mkdir -p "dists/${DIST}/${SECTION}/i18n" 764s done 764s done 764s } 764s 764s insertpackage() { 764s local RELEASES="$1" 764s local NAME="$2" 764s local ARCH="$3" 764s local VERSION="$4" 764s local DEPENDENCIES="$5" 764s local PRIORITY="${6:-optional}" 764s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 764s If you find such a package installed on your system, 764s something went horribly wrong! They are autogenerated 764s and used only by testcases and serve no other purpose…}" 764s local SECTION="${8:-other}" 764s 764s if [ "$SECTION" = "${SECTION#*/}" ]; then 764s DISTSECTION="main" 764s else 764s DISTSECTION="${SECTION%/*}" 764s fi 764s local ARCHS="" 764s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 764s if [ "$RELEASE" = 'installed' ]; then 764s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 764s continue 764s fi 764s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 764s if [ "$arch" = 'none' ]; then 764s ARCHS="$(getarchitectures)" 764s else 764s ARCHS="$arch" 764s fi 764s for BUILDARCH in $ARCHS; do 764s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 764s mkdir -p "$PPATH" 764s { 764s echo "Package: $NAME 764s Priority: $PRIORITY 764s Section: $SECTION 764s Installed-Size: 42 764s Size: 42" 764s if echo "$DEPENDENCIES" | grep -q SHA256:; then 764s : 764s else 764s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 764s fi 764s echo "Maintainer: Joe Sixpack " 764s test "$arch" = 'none' || echo "Architecture: $arch" 764s echo "Version: $VERSION 764s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 764s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 764s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 764s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 764s echo 764s } >> "${PPATH}/Packages" 764s done 764s done 764s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 764s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 764s echo "Package: $NAME 764s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 764s Description-en: $DESCRIPTION 764s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 764s done 764s } 764s 764s insertsource() { 764s local RELEASES="$1" 764s local NAME="$2" 764s local ARCH="$3" 764s local VERSION="$4" 764s local DEPENDENCIES="$5" 764s local BINARY="${6:-$NAME}" 764s local ARCHS="" 764s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 764s local SPATH="aptarchive/dists/${RELEASE}/main/source" 764s mkdir -p $SPATH 764s local FILE="${SPATH}/Sources" 764s local DSCFILE="${NAME}_${VERSION}.dsc" 764s local TARFILE="${NAME}_${VERSION}.tar.gz" 764s echo "Package: $NAME 764s Binary: $BINARY 764s Version: $VERSION 764s Maintainer: Joe Sixpack 764s Architecture: $ARCH" >> $FILE 764s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 764s echo "Files: 764s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 764s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 764s Checksums-Sha256: 764s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 764s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 764s " >> "$FILE" 764s done 764s } 764s 764s insertinstalledpackage() { 764s local NAME="$1" 764s local ARCH="$2" 764s local VERSION="$3" 764s local DEPENDENCIES="$4" 764s local PRIORITY="${5:-optional}" 764s local STATUS="${6:-install ok installed}" 764s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 764s If you find such a package installed on your system, 764s something went horribly wrong! They are autogenerated 764s and used only by testcases and serve no other purpose…}" 764s local SECTION="${8:-other}" 764s 764s local FILE='rootdir/var/lib/dpkg/status' 764s local INFO='rootdir/var/lib/dpkg/info' 764s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 764s echo "Package: $NAME 764s Status: $STATUS 764s Priority: $PRIORITY 764s Section: $SECTION 764s Installed-Size: 42 764s Maintainer: Joe Sixpack 764s Version: $VERSION" >> "$FILE" 764s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 764s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 764s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 764s echo >> "$FILE" 764s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 764s echo -n > "${INFO}/${NAME}:${arch}.list" 764s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 764s else 764s echo -n > "${INFO}/${NAME}.list" 764s echo -n > "${INFO}/${NAME}.md5sums" 764s fi 764s done 764s } 764s 764s 764s buildaptarchivefromincoming() { 764s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 764s cd aptarchive 764s [ -e pool ] || ln -s ../incoming pool 764s [ -e ftparchive.conf ] || createaptftparchiveconfig 764s [ -e dists ] || buildaptftparchivedirectorystructure 764s msgninfo "\tGenerate Packages, Sources and Contents files… " 764s testsuccess aptftparchive generate ftparchive.conf 764s cd - > /dev/null 764s msgdone "info" 764s generatereleasefiles "$@" 764s } 764s 764s buildaptarchivefromfiles() { 764s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 764s local DIR='aptarchive' 764s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 764s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 764s msgninfo "\t${line} file… " 764s compressfile "$line" "$1" 764s msgdone "info" 764s done 764s generatereleasefiles "$@" 764s } 764s 764s compressfile() { 764s while read compressor extension command; do 764s if [ "$compressor" = '.' ]; then 764s if [ -n "$2" ]; then 764s touch -d "$2" "$1" 764s fi 764s continue 764s fi 764s cat "$1" | $command > "${1}.${extension}" 764s if [ -n "$2" ]; then 764s touch -d "$2" "${1}.${extension}" 764s fi 764s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 764s } 764s 764s # can be overridden by testcases for their pleasure 764s getcodenamefromsuite() { 764s case "$1" in 764s unstable) echo 'sid';; 764s *) echo -n "$1";; 764s esac 764s } 764s getreleaseversionfromsuite() { true; } 764s getlabelfromsuite() { true; } 764s getoriginfromsuite() { true; } 764s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 764s getnotautomaticfromsuite() { 764s case "$1" in 764s experimental|experimental2) echo "yes";; 764s esac 764s } 764s getbutautomaticupgradesfromsuite() { true; } 764s 764s aptftparchiverelease() { 764s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 764s } 764s generatereleasefiles() { 764s # $1 is the Date header and $2 is the ValidUntil header to be set 764s # both should be given in notation date/touch can understand 764s local DATE="$1" 764s local VALIDUNTIL="$2" 764s if [ -e aptarchive/dists ]; then 764s msgninfo "\tGenerate Release files for dists… " 764s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 764s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 764s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 764s local CODENAME="$(getcodenamefromsuite $SUITE)" 764s local VERSION="$(getreleaseversionfromsuite $SUITE)" 764s local LABEL="$(getlabelfromsuite $SUITE)" 764s local ORIGIN="$(getoriginfromsuite $SUITE)" 764s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 764s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 764s aptftparchiverelease "$dir" \ 764s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 764s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 764s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 764s -o APT::FTPArchive::Release::Label="${LABEL}" \ 764s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 764s -o APT::FTPArchive::Release::Version="${VERSION}" \ 764s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 764s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 764s > "$dir/Release" 764s done 764s else 764s msgninfo "\tGenerate Release files for flat… " 764s aptftparchiverelease ./aptarchive > aptarchive/Release 764s fi 764s if [ -n "$VALIDUNTIL" ]; then 764s sed -i "/^Date: / a\ 764s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 764s fi 764s if [ -n "$DATE" -a "$DATE" != "now" ]; then 764s for release in $(find ./aptarchive -name 'Release'); do 764s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 764s touch -d "$DATE" "$release" 764s done 764s fi 764s msgdone "info" 764s } 764s 764s setupdistsaptarchive() { 764s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 764s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 764s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 764s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 764s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 764s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 764s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 764s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 764s msgdone "info" 764s done 764s } 764s 764s setupflataptarchive() { 764s local APTARCHIVE="$(readlink -f ./aptarchive)" 764s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 764s if [ -f "${APTARCHIVE}/Packages" ]; then 764s msgninfo "\tadd deb sources.list line… " 764s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 764s msgdone 'info' 764s else 764s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 764s fi 764s if [ -f "${APTARCHIVE}/Sources" ]; then 764s msgninfo "\tadd deb-src sources.list line… " 764s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 764s msgdone 'info' 764s else 764s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 764s fi 764s } 764s 764s setupaptarchive() { 764s local NOUPDATE=0 764s if [ "$1" = '--no-update' ]; then 764s NOUPDATE=1 764s shift 764s fi 764s buildaptarchive "$@" 764s if [ -e aptarchive/dists ]; then 764s setupdistsaptarchive 764s else 764s setupflataptarchive 764s fi 764s signreleasefiles 'Joe Sixpack' 764s if [ "1" != "$NOUPDATE" ]; then 764s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 764s fi 764s } 764s 764s killgpgagent() { 764s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 764s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 764s if [ ! -e "${GPGHOME}" ]; then return; fi 764s # ensure the agent dies quickly as different versions have different suicide heuristics 764s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 764s rm -rf "$GPGHOME" 764s } 764s dosigning() { 764s local KEY="$1" 764s shift 764s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 764s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 764s GPGHOME="$APT_TEST_SIGNINGHOME" 764s else 764s if [ ! -e "$GPGHOME" ]; then 764s mkdir -p --mode=700 "${GPGHOME}" 764s addtrap 'prefix' 'killgpgagent;' 764s fi 764s fi 764s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 764s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 764s "$@" 764s } 764s signreleasefiles() { 764s local SIGNERS="${1:-Joe Sixpack}" 764s local REPODIR="${2:-aptarchive}" 764s if [ -n "$1" ]; then shift; fi 764s if [ -n "$1" ]; then shift; fi 764s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 764s msgninfo "\tSign archive with $SIGNERS key $KEY… " 764s local REXKEY='keys/rexexpired' 764s local SECEXPIREBAK="${REXKEY}.sec.bak" 764s local PUBEXPIREBAK="${REXKEY}.pub.bak" 764s local SIGUSERS="" 764s while [ -n "${SIGNERS%%,*}" ]; do 764s local SIGNER="${SIGNERS%%,*}" 764s if [ "${SIGNERS}" = "${SIGNER}" ]; then 764s SIGNERS="" 764s fi 764s SIGNERS="${SIGNERS#*,}" 764s # FIXME: This should be the full name, but we can't encode the space properly currently 764s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 764s if [ "${SIGNER}" = 'Rex Expired' ]; then 764s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 764s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 764s # therefore we 'temporary' make the key not expired and restore a backup after signing 764s cp "${REXKEY}.sec" "$SECEXPIREBAK" 764s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 764s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 764s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 764s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 764s cp "$SECUNEXPIRED" "${REXKEY}.sec" 764s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 764s else 764s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 764s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 764s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 764s cat setexpire.gpg 764s exit 1 764s fi 764s cp "${REXKEY}.sec" "$SECUNEXPIRED" 764s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 764s fi 764s fi 764s if [ ! -e "${KEY}.pub" ]; then 764s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 764s cat "${K}.pub" >> "${KEY}.new.pub" 764s cat "${K}.sec" >> "${KEY}.new.sec" 764s fi 764s done 764s if [ ! -e "${KEY}.pub" ]; then 764s mv "${KEY}.new.pub" "${KEY}.pub" 764s mv "${KEY}.new.sec" "${KEY}.sec" 764s fi 764s for RELEASE in $(find "${REPODIR}/" -name Release); do 764s # we might have set a specific date for the Release file, so copy it 764s local DATE="$(stat --format "%y" "${RELEASE}")" 764s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 764s rm -f "${RELEASE}.gpg" 764s else 764s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 764s touch -d "$DATE" "${RELEASE}.gpg" 764s fi 764s local INRELEASE="${RELEASE%/*}/InRelease" 764s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 764s rm -f "$INRELEASE" 764s else 764s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 764s touch -d "$DATE" "${INRELEASE}" 764s fi 764s done 764s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 764s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 764s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 764s fi 764s msgdone 'info' 764s } 764s 764s redatereleasefiles() { 764s local DATE="$(date -u -d "$1" -R)" 764s for release in $(find aptarchive/ -name 'Release'); do 764s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 764s touch -d "$DATE" "$release" 764s done 764s signreleasefiles "${2:-Joe Sixpack}" 764s } 764s 764s webserverconfig() { 764s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 764s local NOCHECK=false 764s if [ "$1" = '--no-check' ]; then 764s NOCHECK=true 764s shift 764s fi 764s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 764s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 764s rm -f "$STATUS" "$DOWNLOG" 764s local URI 764s if [ -n "$2" ]; then 764s msgtest "Set webserver config option '${1}' to" "$2" 764s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 764s else 764s msgtest 'Clear webserver config option' "${1}" 764s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 764s fi 764s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 764s msgpass 764s else 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 764s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 764s msgfailoutput '' "$OUTPUT" 764s fi 764s $NOCHECK || testwebserverlaststatuscode '200' 764s } 764s 764s rewritesourceslist() { 764s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 764s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 764s sed -i $LIST \ 764s -e "s#file://$APTARCHIVE#${1}#" \ 764s -e "s#file:$APTARCHIVE#${1}#" \ 764s -e "s#copy://$APTARCHIVE#${1}#" \ 764s -e "s#copy:$APTARCHIVE#${1}#" \ 764s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 764s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 764s done 764s } 764s 764s # wait for up to 10s for a pid file to appear to avoid possible race 764s # when a helper is started and doesn't write the PID quick enough 764s waitforpidfile() { 764s local PIDFILE="$1" 764s for i in $(seq 10); do 764s if test -s "$PIDFILE"; then 764s return 0 764s fi 764s sleep 1 764s done 764s msgdie "waiting for $PIDFILE failed" 764s return 1 764s } 764s 764s changetowebserver() { 764s local REWRITE='yes' 764s if [ "$1" = '--no-rewrite' ]; then 764s REWRITE='no' 764s shift 764s fi 764s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 764s cd aptarchive 764s local LOG="webserver.log" 764s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 764s cat "$LOG" 764s false 764s fi 764s waitforpidfile aptwebserver.pid 764s local PID="$(cat aptwebserver.pid)" 764s if [ -z "$PID" ]; then 764s msgdie 'Could not fork aptwebserver successfully' 764s fi 764s addtrap "kill $PID;" 764s waitforpidfile aptwebserver.port 764s APTHTTPPORT="$(cat aptwebserver.port)" 764s if [ -z "$APTHTTPPORT" ]; then 764s msgdie 'Could not get port for aptwebserver successfully' 764s fi 764s cd - > /dev/null 764s else 764s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 764s fi 764s if [ "$REWRITE" != 'no' ]; then 764s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 764s fi 764s } 764s 764s changetohttpswebserver() { 764s local REWRITE='yes' 764s if [ "$1" = '--no-rewrite' ]; then 764s REWRITE='no' 764s shift 764s fi 764s local stunnel4 764s if command -v stunnel4 >/dev/null 2>&1; then 764s stunnel4=stunnel4 764s elif command -v stunnel >/dev/null 2>&1; then 764s stunnel4=stunnel 764s else 764s msgdie 'You need to install stunnel4 for https testcases' 764s fi 764s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 764s changetowebserver --no-rewrite "$@" 764s fi 764s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 764s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 764s output = /dev/null 764s 764s [https] 764s accept = 127.0.0.1:0 764s connect = $APTHTTPPORT 764s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 764s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 764s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 764s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 764s if [ -z "$PID" ]; then 764s msgdie 'Could not fork $stunnel4 successfully' 764s fi 764s addtrap 'prefix' "kill ${PID};" 764s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 764s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 764s if [ "$REWRITE" != 'no' ]; then 764s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 764s fi 764s } 764s 764s changetocdrom() { 764s mkdir -p rootdir/media/cdrom/.disk 764s local CD="$(readlink -f rootdir/media/cdrom)" 764s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 764s if [ ! -d aptarchive/dists ]; then 764s msgdie 'Flat file archive cdroms can not be created currently' 764s return 1 764s fi 764s mv aptarchive/dists "$CD" 764s ln -s "$(readlink -f ./incoming)" "$CD/pool" 764s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 764s # start with an unmounted disk 764s mv "${CD}" "${CD}-unmounted" 764s # we don't want the disk to be modifiable 764s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 764s chmod -R 555 rootdir/media/cdrom-unmounted/dists 764s } 764s 764s downloadfile() { 764s local PROTO="${1%%:*}" 764s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 764s download-file "$1" "$2" "$3" 2>&1 ; then 764s return 1 764s fi 764s # only if the file exists the download was successful 764s if [ -r "$2" ]; then 764s return 0 764s else 764s return 1 764s fi 764s } 764s 764s cleanup_output() { 764s cat "$1" | sed \ 764s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 764s -e '/^profiling:/ d' \ 764s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 764s >"$2" 764s } 764s 764s checkdiff() { 764s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 764s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 764s touch "$TMPFILE1" "$TMPFILE2" 764s 764s cleanup_output "$1" "$TMPFILE1" 764s cleanup_output "$2" "$TMPFILE2" 764s 764s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 764s if [ -n "$DIFFTEXT" ]; then 764s echo >&2 764s echo >&2 "$DIFFTEXT" 764s return 1 764s else 764s return 0 764s fi 764s } 764s 764s testoutputequal() { 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 764s local COMPAREFILE="$1" 764s shift 764s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 764s msgpass 764s else 764s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 764s cat "$COMPAREFILE" >>"${OUTPUT}" 764s msgfailoutput '' "$OUTPUT" "$@" 764s fi 764s } 764s 764s testfileequal() { 764s msggroup 'testfileequal' 764s local MSG='Test for correctness of file' 764s if [ "$1" = '--nomsg' ]; then 764s MSG='' 764s shift 764s fi 764s local FILE="$1" 764s shift 764s if [ -n "$MSG" ]; then 764s msgtest "$MSG" "$FILE" 764s fi 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 764s if [ -z "$*" ]; then 764s testoutputequal "$FILE" echo -n '' 764s else 764s testoutputequal "$FILE" echo "$*" 764s fi 764s msggroup 764s } 764s 764s testempty() { 764s msggroup 'testempty' 764s if [ "$1" = '--nomsg' ]; then 764s shift 764s else 764s msgtest "Test for no output of" "$*" 764s fi 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 764s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 764s msgpass 764s else 764s msgfailoutput '' "$COMPAREFILE" "$@" 764s fi 764s aptautotest 'testempty' "$@" 764s msggroup 764s } 764s testwarningempty() { 764s testwarning "$@" 764s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 764s } 764s testnotempty() { 764s msggroup 'testnotempty' 764s msgtest "Test for some output of" "$*" 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 764s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 764s msgpass 764s else 764s msgfailoutput '' "$COMPAREFILE" "$@" 764s fi 764s aptautotest 'testnotempty' "$@" 764s msggroup 764s } 764s 764s testequal() { 764s msggroup 'testequal' 764s local MSG='Test of equality of' 764s if [ "$1" = '--nomsg' ]; then 764s MSG='' 764s shift 764s fi 764s 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 764s echo "$1" > "$COMPAREFILE" 764s shift 764s 764s if [ -n "$MSG" ]; then 764s msgtest "$MSG" "$*" 764s fi 764s testoutputequal "$COMPAREFILE" "$@" 764s aptautotest 'testequal' "$@" 764s msggroup 764s } 764s 764s testequalor2() { 764s msggroup 'testequalor2' 764s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 764s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 764s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 764s echo "$1" > "$COMPAREFILE1" 764s echo "$2" > "$COMPAREFILE2" 764s shift 2 764s msgtest "Test for equality OR of" "$*" 764s "$@" >"$COMPAREAGAINST" 2>&1 || true 764s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 764s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 764s then 764s msgpass 764s else 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 764s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 764s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 764s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 764s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 764s msgfailoutput '' "$OUTPUT" 764s fi 764s aptautotest 'testequalor2' "$@" 764s msggroup 764s } 764s 764s testshowvirtual() { 764s msggroup 'testshowvirtual' 764s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 764s local PACKAGE="$1" 764s shift 764s while [ -n "$1" ]; do 764s VIRTUAL="${VIRTUAL} 764s N: Can't select versions from package '$1' as it is purely virtual" 764s PACKAGE="${PACKAGE} $1" 764s shift 764s done 764s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 764s VIRTUAL="${VIRTUAL} 764s N: No packages found" 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 764s local ARCH="$(getarchitecture 'native')" 764s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 764s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 764s msggroup 764s } 764s 764s testnopackage() { 764s msggroup 'testnopackage' 764s msgtest "Test for non-existent packages" "apt-cache show $*" 764s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 764s if [ -n "$SHOWPKG" ]; then 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 764s echo "$SHOWPKG" >"$OUTPUT" 764s msgfailoutput '' "$OUTPUT" 764s else 764s msgpass 764s fi 764s msggroup 764s } 764s testnosrcpackage() { 764s msggroup 'testnosrcpackage' 764s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 764s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 764s if [ -n "$SHOWPKG" ]; then 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 764s echo "$SHOWPKG" >"$OUTPUT" 764s msgfailoutput '' "$OUTPUT" 764s else 764s msgpass 764s fi 764s msggroup 764s } 764s 764s testdpkgstatus() { 764s msggroup 'testdpkgstatus' 764s local STATE="$1" 764s local NR="$2" 764s shift 2 764s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 764s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 764s if [ "$PKGS" != $NR ]; then 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 764s echo "$PKGS" >"$OUTPUT" 764s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 764s msgfailoutput '' "$OUTPUT" 764s else 764s msgpass 764s fi 764s msggroup 764s } 764s 764s testdpkginstalled() { 764s msggroup 'testdpkginstalled' 764s testdpkgstatus 'ii' "$#" "$@" 764s msggroup 764s } 764s 764s testdpkgnotinstalled() { 764s msggroup 'testdpkgnotinstalled' 764s testdpkgstatus 'ii' '0' "$@" 764s msggroup 764s } 764s 764s testmarkedauto() { 764s msggroup 'testmarkedauto' 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 764s if [ -n "$1" ]; then 764s msgtest 'Test for correctly marked as auto-installed' "$*" 764s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 764s else 764s msgtest 'Test for correctly marked as auto-installed' 'no package' 764s echo -n > "$COMPAREFILE" 764s fi 764s testoutputequal "$COMPAREFILE" aptmark showauto 764s msggroup 764s } 764s testmarkedmanual() { 764s msggroup 'testmarkedmanual' 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 764s if [ -n "$1" ]; then 764s msgtest 'Test for correctly marked as manually installed' "$*" 764s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 764s else 764s msgtest 'Test for correctly marked as manually installed' 'no package' 764s echo -n > "$COMPAREFILE" 764s fi 764s testoutputequal "$COMPAREFILE" aptmark showmanual 764s msggroup 764s } 764s 764s catfile() { 764s if [ "${1##*.}" = 'deb' ]; then 764s stat >&2 "$1" || true 764s file >&2 "$1" || true 764s else 764s cat >&2 "$1" || true 764s fi 764s } 764s msgfailoutput() { 764s msgreportheader 'msgfailoutput' 764s local MSG="$1" 764s local OUTPUT="$2" 764s shift 2 764s local CMD="$1" 764s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 764s echo >&2 764s while [ -n "$2" ]; do shift; done 764s echo "#### Complete file: $1 ####" 764s catfile "$1" 764s echo "#### $CMD output ####" 764s elif [ "$1" = 'test' ]; then 764s echo >&2 764s # doesn't support ! or non-file flags 764s msgfailoutputstatfile() { 764s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 764s if expr match "$1" "$FILEFLAGS" >/dev/null; then 764s echo "#### stat(2) of file: $2 ####" 764s stat "$2" || true 764s if test -d "$2"; then 764s echo "#### The directory contains: $2 ####" 764s ls >&2 "$2" || true 764s elif test -e "$2"; then 764s echo "#### Complete file: $2 ####" 764s catfile "$2" 764s fi 764s fi 764s } 764s msgfailoutputstatfile "$2" "$3" 764s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 764s shift 3 764s msgfailoutputstatfile "$2" "$3" 764s done 764s echo '#### test output ####' 764s elif [ "$1" = 'cmp' ]; then 764s echo >&2 764s while [ -n "$2" ]; do 764s echo "#### Complete file: $2 ####" 764s catfile "$2" 764s shift 764s done 764s echo '#### cmp output ####' 764s elif [ "$1" = 'rm' ]; then 764s echo "#### Directory listing of: $(pwd) ####" 764s ls -l 764s fi 764s catfile "$OUTPUT" 764s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 764s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 764s local COREEXE='' 764s for CORENAME in 'core' 'core.pid'; do 764s if [ -s "$CORENAME" ]; then 764s cp -a ${CORENAME} "$COREDUMP" 764s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 764s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 764s else 764s continue 764s fi 764s break 764s done 764s if [ -s "$COREDUMP" ]; then 764s true # found already as a file 764s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 764s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 764s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 764s else 764s echo '### core dump not found ###' 764s cat /proc/sys/kernel/core_pattern 764s fi 764s if [ -s "$COREDUMP" ]; then 764s if [ -z "$COREEXE" ]; then 764s case "$CMD" in 764s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 764s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 764s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 764s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 764s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 764s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 764s esac 764s fi 764s 764s if [ -d "${ARTIFACTSDIR}" ]; then 764s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 764s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 764s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 764s fi 764s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 764s echo "#### gdb backtrace ####" 764s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 764s fi 764s fi 764s rm -f "$COREDUMP" 764s fi 764s msgfail "$MSG" 764s } 764s 764s testsuccesswithglobalerror() { 764s local TYPE="$1" 764s local ERRORS="$2" 764s shift 2 764s msggroup "$TYPE" 764s if [ "$1" = '--nomsg' ]; then 764s shift 764s else 764s msgtest 'Test for successful execution of' "$*" 764s fi 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 764s if "$@" >"${OUTPUT}" 2>&1; then 764s if expr match "$1" '^apt.*' >/dev/null; then 764s if grep -q -E ' runtime error: ' "$OUTPUT"; then 764s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 764s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 764s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 764s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 764s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 764s msgpass 764s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 764s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 764s msgpass 764s else 764s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 764s fi 764s else 764s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 764s fi 764s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 764s if grep -q -E "^N: " "$OUTPUT"; then 764s msgpass 764s else 764s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 764s fi 764s else 764s msgpass 764s fi 764s else 764s msgpass 764s fi 764s else 764s local EXITCODE=$? 764s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 764s fi 764s aptautotest "$TYPE" "$@" 764s msggroup 764s } 764s testsuccesswithnotice() { 764s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 764s } 764s testsuccess() { 764s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 764s } 764s testwarning() { 764s msggroup 'testwarning' 764s if [ "$1" = '--nomsg' ]; then 764s shift 764s else 764s msgtest 'Test for successful execution with warnings of' "$*" 764s fi 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 764s if "$@" >"${OUTPUT}" 2>&1; then 764s if expr match "$1" '^apt.*' >/dev/null; then 764s if grep -q -E ' runtime error: ' "$OUTPUT"; then 764s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 764s elif grep -q -E '^E: ' "$OUTPUT"; then 764s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 764s elif ! grep -q -E '^W: ' "$OUTPUT"; then 764s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 764s else 764s msgpass 764s fi 764s else 764s msgpass 764s fi 764s else 764s local EXITCODE=$? 764s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 764s fi 764s aptautotest 'testwarning' "$@" 764s msggroup 764s } 764s testfailure() { 764s msggroup 'testfailure' 764s if [ "$1" = '--nomsg' ]; then 764s shift 764s else 764s msgtest 'Test for failure in execution of' "$*" 764s fi 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 764s if "$@" >"${OUTPUT}" 2>&1; then 764s local EXITCODE=$? 764s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 764s else 764s local EXITCODE=$? 764s if expr match "$1" '^apt.*' >/dev/null; then 764s if [ "$1" = 'aptkey' ]; then 764s if grep -q " Can't check signature: 764s BAD signature from 764s signature could not be verified" "$OUTPUT"; then 764s msgpass 764s else 764s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 764s fi 764s else 764s if grep -q -E ' runtime error: ' "$OUTPUT"; then 764s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 764s elif grep -q -E '==ERROR' "$OUTPUT"; then 764s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 764s elif ! grep -q -E '^E: ' "$OUTPUT"; then 764s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 764s else 764s msgpass 764s fi 764s fi 764s else 764s msgpass 764s fi 764s fi 764s aptautotest 'testfailure' "$@" 764s msggroup 764s } 764s 764s testreturnstateequal() { 764s local STATE="$1" 764s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 764s local STATE="$2" 764s local TYPE="$3" 764s shift 3 764s msggroup "${STATE}equal" 764s if [ "$1" != '--nomsg' ]; then 764s local CMP="$1" 764s shift 764s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 764s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 764s else 764s local CMP="$2" 764s shift 2 764s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 764s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 764s fi 764s else 764s msggroup "${STATE}equal" 764s if [ "$2" != '--nomsg' ]; then 764s local CMP="$2" 764s shift 2 764s "$STATE" "$@" 764s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 764s else 764s local CMP="$3" 764s shift 3 764s "$STATE" --nomsg "$@" 764s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 764s fi 764s fi 764s msggroup 764s } 764s testsuccessequal() { 764s # we compare output, so we know perfectly well about N: 764s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 764s } 764s testwarningequal() { 764s testreturnstateequal 'testwarning' "$@" 764s } 764s testfailureequal() { 764s testreturnstateequal 'testfailure' "$@" 764s } 764s 764s testfailuremsg() { 764s msggroup 'testfailuremsg' 764s local CMP="$1" 764s shift 764s testfailure "$@" 764s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 764s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 764s testoutputequal "$COMPAREFILE" echo "$CMP" 764s msggroup 764s } 764s testwarningmsg() { 764s msggroup 'testwarningmsg' 764s local CMP="$1" 764s shift 764s testwarning "$@" 764s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 764s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 764s testoutputequal "$COMPAREFILE" echo "$CMP" 764s msggroup 764s } 764s 764s testfilestats() { 764s msggroup 'testfilestats' 764s msgtest "Test that file $1 has $2 $3" "$4" 764s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 764s msgpass 764s else 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 764s { 764s echo 764s ls -ld "$1" || true 764s echo -n "stat(1) reports for $2: " 764s stat --format "$2" "$1" || true 764s } >"$OUTPUT" 2>&1 764s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 764s fi 764s msggroup 764s } 764s testaccessrights() { 764s msggroup 'testaccessrights' 764s testfilestats "$1" '%a' '=' "$2" 764s msggroup 764s } 764s 764s testwebserverlaststatuscode() { 764s msggroup 'testwebserverlaststatuscode' 764s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 764s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 764s rm -f "$DOWNLOG" "$STATUS" 764s msgtest 'Test last status code from the webserver was' "$1" 764s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 764s msgpass 764s else 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 764s { 764s if [ -n "$2" ]; then 764s shift 764s echo >&2 '#### Additionally provided output files contain:' 764s cat >&2 "$@" 764s fi 764s echo >&2 '#### Download log of the status code:' 764s cat >&2 "$DOWNLOG" 764s } >"$OUTPUT" 2>&1 764s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 764s fi 764s msggroup 764s } 764s 764s mapkeynametokeyid() { 764s while [ -n "$1" ]; do 764s case "$1" in 764s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 764s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 764s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 764s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 764s oldarchive) echo 'FDD2DB85F68C85A3';; 764s *) echo 'UNKNOWN KEY';; 764s esac 764s shift 764s done 764s } 764s testaptkeys() { 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 764s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 764s echo -n > "$OUTPUT" 764s fi 764s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 764s } 764s 764s pause() { 764s echo "STOPPED execution. Press enter to continue" 764s local IGNORE 764s read IGNORE 764s } 764s 764s logcurrentarchivedirectory() { 764s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 764s stat --format '%U:%G:%a:%n' "$line" 764s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 764s } 764s listcurrentlistsdirectory() { 764s { 764s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 764s stat --format '%U:%G:%a:%n' "$line" 764s done 764s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 764s stat --format '%U:%G:%a:%s:%y:%n' "$line" 764s done 764s } | sort 764s } 764s forallsupportedcompressors() { 764s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 764s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 764s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 764s "$@" "$COMP" 764s done 764s } 764s 764s breakfiles() { 764s while [ -n "$1" ]; do 764s mv -f "${1}" "${1}.bak" 764s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 764s shift 764s done 764s } 764s unbreakfiles() { 764s while [ -n "$1" ]; do 764s mv -f "${1}.bak" "${1}" 764s shift 764s done 764s } 764s 764s ### convenience hacks ### 764s mkdir() { 764s # creating some directories by hand is a tedious task, so make it look simple 764s local PARAMS="$*" 764s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 764s # only the last directory created by mkdir is effected by the -m ! 764s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 764s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 764s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 764s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 764s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 764s if [ "$(id -u)" = '0' ]; then 764s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 764s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 764s fi 764s else 764s command mkdir "$@" 764s fi 764s } 764s 764s ### The following tests are run by most test methods automatically to check 764s ### general things about commands executed without writing the test every time. 764s 764s aptautotest() { 764s if [ $# -lt 3 ]; then return; fi 764s local TESTCALL="$1" 764s local CMD="$2" 764s local FIRSTOPT="$3" 764s shift 2 764s for i in "$@"; do 764s if ! expr match "$i" '^-' >/dev/null 2>&1; then 764s FIRSTOPT="$i" 764s break 764s fi 764s done 764s shift 764s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 764s if command -v $AUTOTEST >/dev/null; then 764s # save and restore the *.output files from other tests 764s # as we might otherwise override them in these automatic tests 764s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 764s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 764s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 764s $AUTOTEST "$TESTCALL" "$@" 764s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 764s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 764s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 764s fi 764s } 764s 764s cdfind() { 764s ( cd /; find "$@" ) 764s } 764s aptautotest_aptget_update() { 764s local TESTCALL="$1" 764s while [ -n "$2" ]; do 764s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 764s shift 764s done 764s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 764s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 764s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 764s # all copied files are properly chmodded 764s local backupIFS="$IFS" 764s IFS="$(printf "\n\b")" 764s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 764s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 764s done 764s IFS="$backupIFS" 764s if [ "$TESTCALL" = 'testsuccess' ]; then 764s # failure cases can retain partial files and such 764s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 764s fi 764s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 764s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 764s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 764s fi 764s } 764s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 764s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 764s 764s testaptautotestnodpkgwarning() { 764s local TESTCALL="$1" 764s while [ -n "$2" ]; do 764s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 764s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 764s shift 764s done 764s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 764s } 764s 764s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 764s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 764s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 764s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 764s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 764s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 764s 764s testaptmarknodefaultsections() { 764s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 764s } 764s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 764s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 764s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 764s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 764s cat: ./downloaded/foo1: No such file or directory 764s cmp: ./downloaded/foo1: No such file or directory 764s FAIL: exitcode 2 764s 764s cat: ./downloaded/foo1: No such file or directory 764s #!/bin/sh -- # no runable script, just for vi 764s 764s EXIT_CODE=0 764s 764s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 764s if [ "$1" = "-q" ]; then 764s export MSGLEVEL=2 764s elif [ "$1" = "-qq" ]; then 764s export MSGLEVEL=1 764s elif [ "$1" = "-v" ]; then 764s export MSGLEVEL=4 764s elif [ "$1" = '--color=no' ]; then 764s export MSGCOLOR='NO' 764s elif [ "$1" = '--color=yes' ]; then 764s export MSGCOLOR='YES' 764s elif [ "$1" = '--color' ]; then 764s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 764s shift 764s elif [ "$1" = '--level' ]; then 764s export MSGLEVEL=$2 764s shift 764s else 764s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 764s fi 764s shift 764s done 764s export MSGLEVEL="${MSGLEVEL:-3}" 764s 764s # we all like colorful messages 764s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 764s if [ ! -t 1 ]; then # but check that we output to a terminal 764s export MSGCOLOR='NO' 764s fi 764s fi 764s 764s if [ "$MSGCOLOR" != 'NO' ]; then 764s CERROR="\033[1;31m" # red 764s CWARNING="\033[1;33m" # yellow 764s CMSG="\033[1;32m" # green 764s CINFO="\033[1;96m" # light blue 764s CDEBUG="\033[1;94m" # blue 764s CNORMAL="\033[0;39m" # default system console color 764s CDONE="\033[1;32m" # green 764s CPASS="\033[1;32m" # green 764s CFAIL="\033[1;31m" # red 764s CCMD="\033[1;35m" # pink 764s fi 764s 764s msgprintf() { 764s local START="$1" 764s local MIDDLE="$2" 764s local END="$3" 764s shift 3 764s if [ -n "$1" ]; then 764s printf "$START " "$1" 764s shift 764s while [ -n "$1" ]; do 764s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 764s shift 764s done 764s fi 764s printf "${END}" 764s } 764s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 764s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 764s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 764s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 764s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 764s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 764s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 764s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 764s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 764s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 764s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 764s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 764s msgreportheader() { 764s if [ -n "$MSGTEST_MSG" ]; then 764s test "$1" != 'msgfailoutput' || echo 764s if [ -n "$MSGTEST_MSGMSG" ]; then 764s echo "$MSGTEST_MSGMSG" 764s fi 764s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 764s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 764s fi 764s echo -n "$MSGTEST_MSG" 764s unset MSGTEST_MSG 764s fi 764s } 764s msgskip() { 764s msgreportheader 'msgskip' 764s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 764s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 764s } 764s msgfail() { 764s msgreportheader 'msgfail' 764s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 764s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 764s if [ -n "$APT_DEBUG_TESTS" ]; then 764s runapt $SHELL 764s fi 764s EXIT_CODE=$((EXIT_CODE+1)); 764s } 764s MSGGROUP_LEVEL=0 764s msggroup() { 764s if [ -n "$1" ]; then 764s if [ $MSGGROUP_LEVEL = 0 ]; then 764s MSGTEST_GRP='NEXT' 764s fi 764s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 764s else 764s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 764s if [ $MSGGROUP_LEVEL = 0 ]; then 764s unset MSGTEST_GRP 764s fi 764s fi 764s } 764s 764s # enable / disable Debugging 764s if [ $MSGLEVEL -le 0 ]; then 764s msgdie() { true; } 764s fi 764s if [ $MSGLEVEL -le 1 ]; then 764s msgwarn() { true; } 764s msgnwarn() { true; } 764s fi 764s if [ $MSGLEVEL -le 2 ]; then 764s msgmsg() { 764s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 764s } 764s msgnmsg() { true; } 764s msgtest() { 764s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 764s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 764s MSGTEST_GRP="$MSGTEST_MSG" 764s fi 764s } 764s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 764s fi 764s if [ $MSGLEVEL -le 3 ]; then 764s msginfo() { true; } 764s msgninfo() { true; } 764s fi 764s if [ $MSGLEVEL -le 4 ]; then 764s msgdebug() { true; } 764s msgndebug() { true; } 764s fi 764s if [ $MSGLEVEL -le 1 ]; then 764s msgpass() { true; } 764s fi 764s msgdone() { 764s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 764s [ "$1" = "info" -a $MSGLEVEL -le 3 ] || 764s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 764s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 764s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 764s true; 764s else 764s printf "${CDONE}DONE${CNORMAL}\n"; 764s fi 764s } 764s getaptconfig() { 764s if [ -f ./aptconfig.conf ]; then 764s echo "$(readlink -f ./aptconfig.conf)" 764s elif [ -f ../aptconfig.conf ]; then 764s echo "$(readlink -f ../aptconfig.conf)" 764s elif [ -f ../../aptconfig.conf ]; then 764s echo "$(readlink -f ../../aptconfig.conf)" 764s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 764s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 764s fi 764s } 764s runapt() { 764s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 764s local CMD="$1" 764s shift 764s case "$CMD" in 764s sh|aptitude|*/*|command) ;; 764s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 764s esac 764s if [ "$CMD" = 'aptitude' ]; then 764s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 764s else 764s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 764s fi 764s } 764s runpython3() { runapt command python3 "$@"; } 764s aptconfig() { runapt apt-config "$@"; } 764s aptcache() { runapt apt-cache "$@"; } 764s aptcdrom() { runapt apt-cdrom "$@"; } 764s aptget() { runapt apt-get "$@"; } 764s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 764s aptkey() { runapt apt-key "$@"; } 764s aptmark() { runapt apt-mark "$@"; } 764s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 764s apt() { runapt apt "$@"; } 764s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 764s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 764s aptitude() { runapt aptitude "$@"; } 764s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 764s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 764s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 764s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 764s 764s dpkg() { 764s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 764s } 764s dpkgquery() { 764s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 764s } 764s dpkg_version() { 764s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 764s } 764s dpkgcheckbuilddeps() { 764s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 764s } 764s gdb() { 764s local CMD 764s case "$1" in 764s aptget) CMD="apt-get";; 764s aptcache) CMD="apt-cache";; 764s aptcdrom) CMD="apt-cdrom";; 764s aptconfig) CMD="apt-config";; 764s aptmark) CMD="apt-mark";; 764s apthelper) CMD="apt-helper";; 764s aptftparchive) CMD="apt-ftparchive";; 764s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 764s *) CMD="$1";; 764s esac 764s shift 764s if [ "${CMD##*/}" = "$CMD" ]; then 764s CMD="${APTCMDLINEBINDIR}/${CMD}" 764s fi 764s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 764s } 764s 764s valgrind() { 764s local CMD 764s case "$1" in 764s aptget) CMD="apt-get";; 764s aptcache) CMD="apt-cache";; 764s aptcdrom) CMD="apt-cdrom";; 764s aptconfig) CMD="apt-config";; 764s aptmark) CMD="apt-mark";; 764s apthelper) CMD="apt-helper";; 764s aptftparchive) CMD="apt-ftparchive";; 764s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 764s *) CMD="$1";; 764s esac 764s shift 764s if [ "$CMD" = "apt-ftparchive" ]; then 764s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 764s fi 764s if [ "${CMD##*/}" = "$CMD" ]; then 764s CMD="${APTCMDLINEBINDIR}/${CMD}" 764s fi 764s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 764s } 764s 764s lastmodification() { 764s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 764s } 764s releasefiledate() { 764s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 764s } 764s 764s exitwithstatus() { 764s # error if we about to overflow, but ... 764s # "255 failures ought to be enough for everybody" 764s if [ $EXIT_CODE -gt 255 ]; then 764s msgdie "Total failure count $EXIT_CODE too big" 764s fi 764s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 764s } 764s 764s shellsetedetector() { 764s local exit_status=$? 764s if [ "$exit_status" != '0' ]; then 764s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 764s if [ "$EXIT_CODE" = '0' ]; then 764s EXIT_CODE="$exit_status" 764s fi 764s fi 764s } 764s 764s addtrap() { 764s if [ "$1" = 'prefix' ]; then 764s CURRENTTRAP="$2 $CURRENTTRAP" 764s else 764s CURRENTTRAP="$CURRENTTRAP $1" 764s fi 764s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 764s } 764s 764s escape_shell() { 764s echo "$@" | sed -e "s#'#'\"'\"'#g" 764s } 764s 764s find_project_binary_dir() { 764s if [ -z "$PROJECT_BINARY_DIR" ]; then 764s PROJECT_BINARY_DIR= 764s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 764s test -e "$dir/CMakeCache.txt" || continue 764s if [ -z "$PROJECT_BINARY_DIR" ] || 764s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 764s PROJECT_BINARY_DIR="$dir" 764s fi 764s done 764s if [ -z "$PROJECT_BINARY_DIR" ]; then 764s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 764s exit 1 764s fi 764s export PROJECT_BINARY_DIR 764s fi 764s } 764s _removetmpworkingdirectory() { 764s cd / 764s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 764s rm -rf "$TMPWORKINGDIRECTORY" 764s fi 764s TMPWORKINGDIRECTORY='' 764s } 764s setupenvironment() { 764s # cleanup the environment a bit 764s export LC_ALL=C 764s unset LANGUAGE COLUMNS NLSPATH 764s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 764s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 764s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 764s unset GREP_OPTIONS POSIXLY_CORRECT 764s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 764s export GCOV_ERROR_FILE=/dev/null 764s 764s # Next check needs a gnu stat, let's figure that out early. 764s stat=stat 764s if command -v gnustat >/dev/null 2>&1; then 764s stat=gnustat 764s fi 764s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 764s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 764s unset TMPDIR 764s fi 764s if [ -z "$TMPWORKINGDIRECTORY" ]; then 764s addtrap '_removetmpworkingdirectory;' 764s TMPWORKINGDIRECTORY="$(mktemp -d)" 764s fi 764s if [ -n "$TMPDIR_ADD" ]; then 764s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 764s mkdir -p "$TMPWORKINGDIRECTORY" 764s unset TMPDIR_ADD 764s export TMPDIR="$TMPWORKINGDIRECTORY" 764s fi 764s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 764s 764s # Setup coreutils on BSD systems 764s mkdir "${TMPWORKINGDIRECTORY}/bin" 764s for prefix in gnu g; do 764s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 764s if command -v $prefix$command 2>/dev/null >/dev/null; then 764s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 764s fi 764s done 764s done 764s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 764s 764s if [ -z "$TESTDIRECTORY" ]; then 764s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 764s fi 764s cd "$TMPWORKINGDIRECTORY" 764s 764s mkdir -m 700 'downloaded' 764s if [ "$(id -u)" = '0' ]; then 764s # relax permissions so that running as root with user switching works 764s umask 022 764s chmod 711 "$TMPWORKINGDIRECTORY" 764s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 764s fi 764s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 764s 764s _setupprojectenvironment 764s 764s # create some files in /tmp and look at user/group to get what this means 764s TEST_DEFAULT_USER="$(id -un)" 764s touch "${TMPWORKINGDIRECTORY}/test-file" 764s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 764s 764s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 764s . "${TESTDIRECTORY}/extra-environment" 764s fi 764s 764s msgdone "info" 764s } 764s _setupprojectenvironment() { 764s # allow overriding the default BUILDDIR locations 764s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 764s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 764s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 764s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 764s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 764s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 764s APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 764s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 764s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 764s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 764s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 764s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 764s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 764s 764s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 764s mkdir aptarchive keys 764s cd rootdir 764s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 764s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 764s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 764s touch var/lib/dpkg/available var/lib/dpkg/lock 764s echo '1' > var/lib/dpkg/info/format 764s ln -s "${METHODSDIR}" usr/lib/apt/methods 764s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 764s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 764s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 764s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 764s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 764s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 764s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 764s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 764s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 764s else 764s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 764s fi 764s cd .. 764s local BASENAME="${0##*/}" 764s local PACKAGESFILE="Packages-${BASENAME#*-}" 764s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 764s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 764s fi 764s local SOURCESSFILE="Sources-${BASENAME#*-}" 764s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 764s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 764s fi 764s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 764s chmod 644 keys/* 764s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 764s 764s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 764s echo "Dir::Etc \"etc\";" >> aptconfig.conf 764s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 764s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 764s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 764s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 764s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 764s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 764s # either store apt-key were we can access it, even if we run it as a different user 764s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 764s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 764s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 764s # destroys coverage reporting though, so we disable changing user for the calling gpgv 764s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 764s if [ "$(id -u)" = '0' ]; then 764s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 764s # same for the solver executables 764s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 764s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 764s fi 764s 764s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 764s EXEC='' 764s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 764s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 764s restoredpkgstatus() { 764s if [ -n "\$BACKUP" ]; then 764s if [ -e "\$BACKUP" ]; then 764s mv -f "\$BACKUP" "\$ORIGINAL" 764s else 764s rm -f "\$ORIGINAL" 764s fi 764s BACKUP='' 764s fi 764s } 764s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 764s if [ -e "\$ORIGINAL" ]; then 764s cp -a "\$ORIGINAL" "\$BACKUP" 764s fi 764s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 764s 764s Package: dpkg 764s Architecture: all 764s Version: ${DPKG_VERSION}+fake 764s Status: install ok installed 764s Maintainer: Joe Sixpack 764s Installed-Size: 42 764s Description: tells dpkg it supports what we need 764s Some versions of dpkg check its own version from the status file 764s to know if it supports multi-arch and stuff in --assert-*. 764s 764s EOS 764s fi 764s EOF 764s fi 764s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 764s 764s { 764s echo 'quiet "0";' 764s echo 'quiet::NoUpdate "true";' 764s echo 'quiet::NoStatistic "true";' 764s # too distracting for users, but helpful to detect changes 764s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 764s echo 'Acquire::Progress::Diffpercent "true";' 764s # in testcases, it can appear as if localhost has a rotation setup, 764s # hide this as we can't really deal with it properly 764s echo 'Acquire::Failure::ShowIP "false";' 764s # randomess and tests don't play well together 764s echo 'Acquire::IndexTargets::Randomized "false";' 764s # fakeroot can't fake everything, so disabled in production but good for tests 764s echo 'APT::Sandbox::Verify "true";' 764s } >> aptconfig.conf 764s 764s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 764s if [ "$(id -u)" = '0' ]; then 764s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 764s fi 764s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 764s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 764s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 764s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 764s # Allow release files to be 10 hours in the future, rather than 10 seconds 764s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 764s 764s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 764s 764s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 764s confighashes 'SHA256' # these are tests, not security best-practices 764s 764s # Make dpkg inherit testing path 764s echo 'DPkg::Path "";' >> aptconfig.conf 764s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 764s 764s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 764s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 764s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 764s fi 764s 764s # most tests just need one signed Release file, not both 764s export APT_DONT_SIGN='Release.gpg' 764s 764s # prefer our apt binaries over the system apt binaries 764s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 764s } 764s 764s getarchitecture() { 764s if [ "$1" = "native" -o -z "$1" ]; then 764s eval `aptconfig shell ARCH APT::Architecture` 764s if [ -n "$ARCH" ]; then 764s echo $ARCH 764s else 764s dpkg --print-architecture 764s fi 764s else 764s echo $1 764s fi 764s } 764s 764s getarchitectures() { 764s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 764s } 764s 764s getarchitecturesfromcommalist() { 764s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 764s } 764s 764s configarchitecture() { 764s { 764s echo "APT::Architecture \"$(getarchitecture $1)\";" 764s while [ -n "$1" ]; do 764s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 764s shift 764s done 764s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 764s configdpkg 764s } 764s 764s configdpkg() { 764s if [ ! -e rootdir/var/lib/dpkg/status ]; then 764s local BASENAME="${0##*/}" 764s local STATUSFILE="status-${BASENAME#*-}" 764s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 764s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 764s # Add an empty line to the end if there is none 764s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 764s echo >> rootdir/var/lib/dpkg/status 764s fi 764s fi 764s fi 764s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 764s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 764s local ARCHS="$(getarchitectures)" 764s local DPKGARCH="$(dpkg --print-architecture)" 764s # this ensures that even if multi-arch isn't active in the view 764s # of apt, given that dpkg can't be told which arch is native 764s # the arch apt treats as native might be foreign for dpkg 764s for ARCH in ${ARCHS}; do 764s if [ "${ARCH}" != "${DPKGARCH}" ]; then 764s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 764s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 764s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 764s else 764s # old-style used e.g. in Ubuntu-P – and as it seems travis 764s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 764s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 764s fi 764s fi 764s fi 764s done 764s else 764s # test multiarch before dpkg is ready for it… 764s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 764s fi 764s } 764s 764s configdpkgnoopchroot() { 764s # create a library to noop chroot() and rewrite maintainer script executions 764s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 764s # chroot directory dpkg could chroot into to execute the maintainer scripts 764s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 764s cat > noopchroot.c << EOF 764s #define _GNU_SOURCE 764s #include 764s #include 764s #include 764s #include 764s 764s static char * chrootdir = NULL; 764s 764s int chroot(const char *path) { 764s printf("WARNING: CHROOTing to %s was ignored!\n", path); 764s free(chrootdir); 764s chrootdir = strdup(path); 764s return 0; 764s } 764s int execvp(const char *file, char *const argv[]) { 764s static int (*func_execvp) (const char *, char * const []) = NULL; 764s if (func_execvp == NULL) 764s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 764s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 764s return func_execvp(file, argv); 764s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 764s char *newfile; 764s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 764s perror("asprintf"); 764s return -1; 764s } 764s char const * const baseadmindir = "/var/lib/dpkg"; 764s char *admindir; 764s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 764s perror("asprintf"); 764s return -1; 764s } 764s setenv("DPKG_ADMINDIR", admindir, 1); 764s return func_execvp(newfile, argv); 764s } 764s EOF 764s if cc -ldl 2>&1 | grep -q dl; then 764s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 764s else 764s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 764s fi 764s } 764s configcompression() { 764s if [ "$1" = 'ALL' ]; then 764s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 764s return 764s fi 764s local CMD='apthelper cat-file -C' 764s while [ -n "$1" ]; do 764s case "$1" in 764s '.') printf ".\t.\tcat\n";; 764s 'gz') printf "gzip\tgz\t$CMD $1\n";; 764s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 764s 'zst') printf "zstd\tzst\t$CMD $1\n";; 764s *) printf "$1\t$1\t$CMD $1\n";; 764s esac 764s shift 764s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 764s } 764s confighashes() { 764s { 764s echo 'APT::FTPArchive {' 764s { 764s while [ -n "$1" ]; do 764s printf "$1" | tr 'a-z' 'A-Z' 764s printf "\t\"true\";\n" 764s shift 764s done 764s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 764s printf "$h\t\"false\";\n" 764s done 764s } | awk '!x[$1]++' 764s echo '};' 764s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 764s } 764s forcecompressor() { 764s COMPRESSOR="$1" 764s COMPRESS="$1" 764s COMPRESSOR_CMD="apthelper cat-file -C $1" 764s case $COMPRESSOR in 764s gzip) COMPRESS='gz';; 764s bzip2) COMPRESS='bz2';; 764s zstd) COMPRESS='zst';; 764s esac 764s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 764s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 764s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 764s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 764s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 764s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 764s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 764s done 764s } 764s 764s _setupsimplenativepackage() { 764s local NAME="$1" 764s local ARCH="$2" 764s local VERSION="$3" 764s local RELEASE="${4:-unstable}" 764s local DEPENDENCIES="$5" 764s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 764s If you find such a package installed on your system, 764s something went horribly wrong! They are autogenerated 764s and used only by testcases and serve no other purpose…}" 764s 764s local SECTION="${7:-others}" 764s local PRIORITY="${8:-optional}" 764s local FILE_TREE="$9" 764s local COMPRESS_TYPE="${10:-gzip}" 764s local DISTSECTION 764s if [ "$SECTION" = "${SECTION#*/}" ]; then 764s DISTSECTION="main" 764s else 764s DISTSECTION="${SECTION%/*}" 764s fi 764s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 764s 764s mkdir -p "$BUILDDIR/debian/source" 764s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 764s echo "#!/bin/sh 764s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 764s 764s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 764s echo "$NAME ($VERSION) $RELEASE; urgency=low 764s 764s * Initial release 764s 764s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 764s { 764s echo "Source: $NAME 764s Priority: $PRIORITY 764s Maintainer: Joe Sixpack 764s Standards-Version: 4.3.1 764s Rules-Requires-Root: no" 764s if [ "$SECTION" != '' ]; then 764s echo "Section: $SECTION" 764s fi 764s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 764s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 764s echo " 764s Package: $NAME" 764s 764s if [ "$ARCH" = 'all' ]; then 764s echo "Architecture: all" 764s else 764s echo "Architecture: any" 764s fi 764s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 764s test -z "$DEPS" || echo "$DEPS" 764s printf "%b\n" "Description: $DESCRIPTION" 764s } > "${BUILDDIR}/debian/control" 764s 764s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 764s } 764s 764s make_tiny_rules() { 764s local OUT="$1" 764s if command -v gmake >/dev/null 2>&1; then 764s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 764s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 764s else 764s echo '#!/usr/bin/make -f' > "$OUT" 764s fi 764s echo '%:' >> "$OUT" 764s echo ' dh $@' >> "$OUT" 764s } 764s 764s setupsimplenativepackage() { 764s _setupsimplenativepackage "$@" 764s local NAME="$1" 764s local VERSION="$3" 764s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 764s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 764s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 764s } 764s 764s buildsimplenativepackage() { 764s local NAME="$1" 764s local ARCH="$2" 764s local VERSION="$3" 764s local RELEASE="${4:-unstable}" 764s local DEPENDENCIES="$5" 764s local DESCRIPTION="$6" 764s local SECTION="${7:-others}" 764s local PRIORITY="${8:-optional}" 764s local FILE_TREE="$9" 764s local COMPRESS_TYPE="${10:-gzip}" 764s local DISTSECTION 764s if [ "$SECTION" = "${SECTION#*/}" ]; then 764s DISTSECTION="main" 764s else 764s DISTSECTION="${SECTION%/*}" 764s fi 764s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 764s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 764s _setupsimplenativepackage "$@" 764s cd "${BUILDDIR}/.." 764s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 764s cd - >/dev/null 764s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 764s | while read SRC; do 764s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 764s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 764s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 764s # adv --yes --default-key 'Joe Sixpack' \ 764s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 764s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 764s # fi 764s done 764s 764s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 764s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 764s rm -rf "${BUILDDIR}/debian/tmp" 764s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 764s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 764s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 764s if [ -n "$FILE_TREE" ]; then 764s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 764s fi 764s 764s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 764s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 764s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 764s # ensure the right permissions as dpkg-deb insists 764s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 764s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 764s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 764s done 764s 764s local NM 764s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 764s NM="$(echo "$NAME" | cut -c 1-4)" 764s else 764s NM="$(echo "$NAME" | cut -c 1)" 764s fi 764s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 764s mkdir -p "$CHANGEPATH" 764s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 764s rm -rf "${BUILDDIR}" 764s msgdone "info" 764s } 764s 764s buildpackage() { 764s local BUILDDIR=$1 764s local RELEASE=$2 764s local SECTION=$3 764s local ARCH=$(getarchitecture $4) 764s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 764s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 764s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 764s cd "$BUILDDIR" 764s if [ "$ARCH" = "all" ]; then 764s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 764s fi 764s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 764s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 764s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 764s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 764s cd - > /dev/null 764s for PKG in $PKGS; do 764s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 764s done 764s for SRC in $SRCS; do 764s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 764s done 764s } 764s 764s buildaptarchive() { 764s if [ -d incoming ]; then 764s buildaptarchivefromincoming "$@" 764s else 764s buildaptarchivefromfiles "$@" 764s fi 764s } 764s 764s createaptftparchiveconfig() { 764s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 764s local COMPRESSORS="${COMPRESSORS%* }" 764s local ARCHS="$(getarchitectures)" 764s cat > ftparchive.conf <> ftparchive.conf 764s } 764s 764s buildaptftparchivedirectorystructure() { 764s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 764s for DIST in $DISTS; do 764s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 764s for SECTION in $SECTIONS; do 764s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 764s for ARCH in $ARCHS; do 764s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 764s done 764s mkdir -p "dists/${DIST}/${SECTION}/source" 764s mkdir -p "dists/${DIST}/${SECTION}/i18n" 764s done 764s done 764s } 764s 764s insertpackage() { 764s local RELEASES="$1" 764s local NAME="$2" 764s local ARCH="$3" 764s local VERSION="$4" 764s local DEPENDENCIES="$5" 764s local PRIORITY="${6:-optional}" 764s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 764s If you find such a package installed on your system, 764s something went horribly wrong! They are autogenerated 764s and used only by testcases and serve no other purpose…}" 764s local SECTION="${8:-other}" 764s 764s if [ "$SECTION" = "${SECTION#*/}" ]; then 764s DISTSECTION="main" 764s else 764s DISTSECTION="${SECTION%/*}" 764s fi 764s local ARCHS="" 764s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 764s if [ "$RELEASE" = 'installed' ]; then 764s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 764s continue 764s fi 764s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 764s if [ "$arch" = 'none' ]; then 764s ARCHS="$(getarchitectures)" 764s else 764s ARCHS="$arch" 764s fi 764s for BUILDARCH in $ARCHS; do 764s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 764s mkdir -p "$PPATH" 764s { 764s echo "Package: $NAME 764s Priority: $PRIORITY 764s Section: $SECTION 764s Installed-Size: 42 764s Size: 42" 764s if echo "$DEPENDENCIES" | grep -q SHA256:; then 764s : 764s else 764s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 764s fi 764s echo "Maintainer: Joe Sixpack " 764s test "$arch" = 'none' || echo "Architecture: $arch" 764s echo "Version: $VERSION 764s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 764s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 764s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 764s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 764s echo 764s } >> "${PPATH}/Packages" 764s done 764s done 764s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 764s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 764s echo "Package: $NAME 764s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 764s Description-en: $DESCRIPTION 764s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 764s done 764s } 764s 764s insertsource() { 764s local RELEASES="$1" 764s local NAME="$2" 764s local ARCH="$3" 764s local VERSION="$4" 764s local DEPENDENCIES="$5" 764s local BINARY="${6:-$NAME}" 764s local ARCHS="" 764s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 764s local SPATH="aptarchive/dists/${RELEASE}/main/source" 764s mkdir -p $SPATH 764s local FILE="${SPATH}/Sources" 764s local DSCFILE="${NAME}_${VERSION}.dsc" 764s local TARFILE="${NAME}_${VERSION}.tar.gz" 764s echo "Package: $NAME 764s Binary: $BINARY 764s Version: $VERSION 764s Maintainer: Joe Sixpack 764s Architecture: $ARCH" >> $FILE 764s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 764s echo "Files: 764s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 764s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 764s Checksums-Sha256: 764s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 764s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 764s " >> "$FILE" 764s done 764s } 764s 764s insertinstalledpackage() { 764s local NAME="$1" 764s local ARCH="$2" 764s local VERSION="$3" 764s local DEPENDENCIES="$4" 764s local PRIORITY="${5:-optional}" 764s local STATUS="${6:-install ok installed}" 764s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 764s If you find such a package installed on your system, 764s something went horribly wrong! They are autogenerated 764s and used only by testcases and serve no other purpose…}" 764s local SECTION="${8:-other}" 764s 764s local FILE='rootdir/var/lib/dpkg/status' 764s local INFO='rootdir/var/lib/dpkg/info' 764s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 764s echo "Package: $NAME 764s Status: $STATUS 764s Priority: $PRIORITY 764s Section: $SECTION 764s Installed-Size: 42 764s Maintainer: Joe Sixpack 764s Version: $VERSION" >> "$FILE" 764s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 764s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 764s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 764s echo >> "$FILE" 764s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 764s echo -n > "${INFO}/${NAME}:${arch}.list" 764s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 764s else 764s echo -n > "${INFO}/${NAME}.list" 764s echo -n > "${INFO}/${NAME}.md5sums" 764s fi 764s done 764s } 764s 764s 764s buildaptarchivefromincoming() { 764s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 764s cd aptarchive 764s [ -e pool ] || ln -s ../incoming pool 764s [ -e ftparchive.conf ] || createaptftparchiveconfig 764s [ -e dists ] || buildaptftparchivedirectorystructure 764s msgninfo "\tGenerate Packages, Sources and Contents files… " 764s testsuccess aptftparchive generate ftparchive.conf 764s cd - > /dev/null 764s msgdone "info" 764s generatereleasefiles "$@" 764s } 764s 764s buildaptarchivefromfiles() { 764s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 764s local DIR='aptarchive' 764s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 764s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 764s msgninfo "\t${line} file… " 764s compressfile "$line" "$1" 764s msgdone "info" 764s done 764s generatereleasefiles "$@" 764s } 764s 764s compressfile() { 764s while read compressor extension command; do 764s if [ "$compressor" = '.' ]; then 764s if [ -n "$2" ]; then 764s touch -d "$2" "$1" 764s fi 764s continue 764s fi 764s cat "$1" | $command > "${1}.${extension}" 764s if [ -n "$2" ]; then 764s touch -d "$2" "${1}.${extension}" 764s fi 764s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 764s } 764s 764s # can be overridden by testcases for their pleasure 764s getcodenamefromsuite() { 764s case "$1" in 764s unstable) echo 'sid';; 764s *) echo -n "$1";; 764s esac 764s } 764s getreleaseversionfromsuite() { true; } 764s getlabelfromsuite() { true; } 764s getoriginfromsuite() { true; } 764s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 764s getnotautomaticfromsuite() { 764s case "$1" in 764s experimental|experimental2) echo "yes";; 764s esac 764s } 764s getbutautomaticupgradesfromsuite() { true; } 764s 764s aptftparchiverelease() { 764s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 764s } 764s generatereleasefiles() { 764s # $1 is the Date header and $2 is the ValidUntil header to be set 764s # both should be given in notation date/touch can understand 764s local DATE="$1" 764s local VALIDUNTIL="$2" 764s if [ -e aptarchive/dists ]; then 764s msgninfo "\tGenerate Release files for dists… " 764s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 764s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 764s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 764s local CODENAME="$(getcodenamefromsuite $SUITE)" 764s local VERSION="$(getreleaseversionfromsuite $SUITE)" 764s local LABEL="$(getlabelfromsuite $SUITE)" 764s local ORIGIN="$(getoriginfromsuite $SUITE)" 764s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 764s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 764s aptftparchiverelease "$dir" \ 764s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 764s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 764s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 764s -o APT::FTPArchive::Release::Label="${LABEL}" \ 764s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 764s -o APT::FTPArchive::Release::Version="${VERSION}" \ 764s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 764s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 764s > "$dir/Release" 764s done 764s else 764s msgninfo "\tGenerate Release files for flat… " 764s aptftparchiverelease ./aptarchive > aptarchive/Release 764s fi 764s if [ -n "$VALIDUNTIL" ]; then 764s sed -i "/^Date: / a\ 764s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 764s fi 764s if [ -n "$DATE" -a "$DATE" != "now" ]; then 764s for release in $(find ./aptarchive -name 'Release'); do 764s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 764s touch -d "$DATE" "$release" 764s done 764s fi 764s msgdone "info" 764s } 764s 764s setupdistsaptarchive() { 764s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 764s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 764s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 764s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 764s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 764s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 764s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 764s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 764s msgdone "info" 764s done 764s } 764s 764s setupflataptarchive() { 764s local APTARCHIVE="$(readlink -f ./aptarchive)" 764s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 764s if [ -f "${APTARCHIVE}/Packages" ]; then 764s msgninfo "\tadd deb sources.list line… " 764s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 764s msgdone 'info' 764s else 764s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 764s fi 764s if [ -f "${APTARCHIVE}/Sources" ]; then 764s msgninfo "\tadd deb-src sources.list line… " 764s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 764s msgdone 'info' 764s else 764s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 764s fi 764s } 764s 764s setupaptarchive() { 764s local NOUPDATE=0 764s if [ "$1" = '--no-update' ]; then 764s NOUPDATE=1 764s shift 764s fi 764s buildaptarchive "$@" 764s if [ -e aptarchive/dists ]; then 764s setupdistsaptarchive 764s else 764s setupflataptarchive 764s fi 764s signreleasefiles 'Joe Sixpack' 764s if [ "1" != "$NOUPDATE" ]; then 764s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 764s fi 764s } 764s 764s killgpgagent() { 764s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 764s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 764s if [ ! -e "${GPGHOME}" ]; then return; fi 764s # ensure the agent dies quickly as different versions have different suicide heuristics 764s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 764s rm -rf "$GPGHOME" 764s } 764s dosigning() { 764s local KEY="$1" 764s shift 764s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 764s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 764s GPGHOME="$APT_TEST_SIGNINGHOME" 764s else 764s if [ ! -e "$GPGHOME" ]; then 764s mkdir -p --mode=700 "${GPGHOME}" 764s addtrap 'prefix' 'killgpgagent;' 764s fi 764s fi 764s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 764s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 764s "$@" 764s } 764s signreleasefiles() { 764s local SIGNERS="${1:-Joe Sixpack}" 764s local REPODIR="${2:-aptarchive}" 764s if [ -n "$1" ]; then shift; fi 764s if [ -n "$1" ]; then shift; fi 764s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 764s msgninfo "\tSign archive with $SIGNERS key $KEY… " 764s local REXKEY='keys/rexexpired' 764s local SECEXPIREBAK="${REXKEY}.sec.bak" 764s local PUBEXPIREBAK="${REXKEY}.pub.bak" 764s local SIGUSERS="" 764s while [ -n "${SIGNERS%%,*}" ]; do 764s local SIGNER="${SIGNERS%%,*}" 764s if [ "${SIGNERS}" = "${SIGNER}" ]; then 764s SIGNERS="" 764s fi 764s SIGNERS="${SIGNERS#*,}" 764s # FIXME: This should be the full name, but we can't encode the space properly currently 764s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 764s if [ "${SIGNER}" = 'Rex Expired' ]; then 764s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 764s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 764s # therefore we 'temporary' make the key not expired and restore a backup after signing 764s cp "${REXKEY}.sec" "$SECEXPIREBAK" 764s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 764s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 764s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 764s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 764s cp "$SECUNEXPIRED" "${REXKEY}.sec" 764s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 764s else 764s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 764s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 764s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 764s cat setexpire.gpg 764s exit 1 764s fi 764s cp "${REXKEY}.sec" "$SECUNEXPIRED" 764s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 764s fi 764s fi 764s if [ ! -e "${KEY}.pub" ]; then 764s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 764s cat "${K}.pub" >> "${KEY}.new.pub" 764s cat "${K}.sec" >> "${KEY}.new.sec" 764s fi 764s done 764s if [ ! -e "${KEY}.pub" ]; then 764s mv "${KEY}.new.pub" "${KEY}.pub" 764s mv "${KEY}.new.sec" "${KEY}.sec" 764s fi 764s for RELEASE in $(find "${REPODIR}/" -name Release); do 764s # we might have set a specific date for the Release file, so copy it 764s local DATE="$(stat --format "%y" "${RELEASE}")" 764s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 764s rm -f "${RELEASE}.gpg" 764s else 764s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 764s touch -d "$DATE" "${RELEASE}.gpg" 764s fi 764s local INRELEASE="${RELEASE%/*}/InRelease" 764s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 764s rm -f "$INRELEASE" 764s else 764s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 764s touch -d "$DATE" "${INRELEASE}" 764s fi 764s done 764s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 764s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 764s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 764s fi 764s msgdone 'info' 764s } 764s 764s redatereleasefiles() { 764s local DATE="$(date -u -d "$1" -R)" 764s for release in $(find aptarchive/ -name 'Release'); do 764s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 764s touch -d "$DATE" "$release" 764s done 764s signreleasefiles "${2:-Joe Sixpack}" 764s } 764s 764s webserverconfig() { 764s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 764s local NOCHECK=false 764s if [ "$1" = '--no-check' ]; then 764s NOCHECK=true 764s shift 764s fi 764s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 764s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 764s rm -f "$STATUS" "$DOWNLOG" 764s local URI 764s if [ -n "$2" ]; then 764s msgtest "Set webserver config option '${1}' to" "$2" 764s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 764s else 764s msgtest 'Clear webserver config option' "${1}" 764s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 764s fi 764s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 764s msgpass 764s else 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 764s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 764s msgfailoutput '' "$OUTPUT" 764s fi 764s $NOCHECK || testwebserverlaststatuscode '200' 764s } 764s 764s rewritesourceslist() { 764s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 764s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 764s sed -i $LIST \ 764s -e "s#file://$APTARCHIVE#${1}#" \ 764s -e "s#file:$APTARCHIVE#${1}#" \ 764s -e "s#copy://$APTARCHIVE#${1}#" \ 764s -e "s#copy:$APTARCHIVE#${1}#" \ 764s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 764s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 764s done 764s } 764s 764s # wait for up to 10s for a pid file to appear to avoid possible race 764s # when a helper is started and doesn't write the PID quick enough 764s waitforpidfile() { 764s local PIDFILE="$1" 764s for i in $(seq 10); do 764s if test -s "$PIDFILE"; then 764s return 0 764s fi 764s sleep 1 764s done 764s msgdie "waiting for $PIDFILE failed" 764s return 1 764s } 764s 764s changetowebserver() { 764s local REWRITE='yes' 764s if [ "$1" = '--no-rewrite' ]; then 764s REWRITE='no' 764s shift 764s fi 764s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 764s cd aptarchive 764s local LOG="webserver.log" 764s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 764s cat "$LOG" 764s false 764s fi 764s waitforpidfile aptwebserver.pid 764s local PID="$(cat aptwebserver.pid)" 764s if [ -z "$PID" ]; then 764s msgdie 'Could not fork aptwebserver successfully' 764s fi 764s addtrap "kill $PID;" 764s waitforpidfile aptwebserver.port 764s APTHTTPPORT="$(cat aptwebserver.port)" 764s if [ -z "$APTHTTPPORT" ]; then 764s msgdie 'Could not get port for aptwebserver successfully' 764s fi 764s cd - > /dev/null 764s else 764s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 764s fi 764s if [ "$REWRITE" != 'no' ]; then 764s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 764s fi 764s } 764s 764s changetohttpswebserver() { 764s local REWRITE='yes' 764s if [ "$1" = '--no-rewrite' ]; then 764s REWRITE='no' 764s shift 764s fi 764s local stunnel4 764s if command -v stunnel4 >/dev/null 2>&1; then 764s stunnel4=stunnel4 764s elif command -v stunnel >/dev/null 2>&1; then 764s stunnel4=stunnel 764s else 764s msgdie 'You need to install stunnel4 for https testcases' 764s fi 764s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 764s changetowebserver --no-rewrite "$@" 764s fi 764s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 764s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 764s output = /dev/null 764s 764s [https] 764s accept = 127.0.0.1:0 764s connect = $APTHTTPPORT 764s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 764s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 764s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 764s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 764s if [ -z "$PID" ]; then 764s msgdie 'Could not fork $stunnel4 successfully' 764s fi 764s addtrap 'prefix' "kill ${PID};" 764s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 764s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 764s if [ "$REWRITE" != 'no' ]; then 764s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 764s fi 764s } 764s 764s changetocdrom() { 764s mkdir -p rootdir/media/cdrom/.disk 764s local CD="$(readlink -f rootdir/media/cdrom)" 764s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 764s if [ ! -d aptarchive/dists ]; then 764s msgdie 'Flat file archive cdroms can not be created currently' 764s return 1 764s fi 764s mv aptarchive/dists "$CD" 764s ln -s "$(readlink -f ./incoming)" "$CD/pool" 764s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 764s # start with an unmounted disk 764s mv "${CD}" "${CD}-unmounted" 764s # we don't want the disk to be modifiable 764s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 764s chmod -R 555 rootdir/media/cdrom-unmounted/dists 764s } 764s 764s downloadfile() { 764s local PROTO="${1%%:*}" 764s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 764s download-file "$1" "$2" "$3" 2>&1 ; then 764s return 1 764s fi 764s # only if the file exists the download was successful 764s if [ -r "$2" ]; then 764s return 0 764s else 764s return 1 764s fi 764s } 764s 764s cleanup_output() { 764s cat "$1" | sed \ 764s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 764s -e '/^profiling:/ d' \ 764s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 764s >"$2" 764s } 764s 764s checkdiff() { 764s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 764s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 764s touch "$TMPFILE1" "$TMPFILE2" 764s 764s cleanup_output "$1" "$TMPFILE1" 764s cleanup_output "$2" "$TMPFILE2" 764s 764s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 764s if [ -n "$DIFFTEXT" ]; then 764s echo >&2 764s echo >&2 "$DIFFTEXT" 764s return 1 764s else 764s return 0 764s fi 764s } 764s 764s testoutputequal() { 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 764s local COMPAREFILE="$1" 764s shift 764s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 764s msgpass 764s else 764s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 764s cat "$COMPAREFILE" >>"${OUTPUT}" 764s msgfailoutput '' "$OUTPUT" "$@" 764s fi 764s } 764s 764s testfileequal() { 764s msggroup 'testfileequal' 764s local MSG='Test for correctness of file' 764s if [ "$1" = '--nomsg' ]; then 764s MSG='' 764s shift 764s fi 764s local FILE="$1" 764s shift 764s if [ -n "$MSG" ]; then 764s msgtest "$MSG" "$FILE" 764s fi 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 764s if [ -z "$*" ]; then 764s testoutputequal "$FILE" echo -n '' 764s else 764s testoutputequal "$FILE" echo "$*" 764s fi 764s msggroup 764s } 764s 764s testempty() { 764s msggroup 'testempty' 764s if [ "$1" = '--nomsg' ]; then 764s shift 764s else 764s msgtest "Test for no output of" "$*" 764s fi 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 764s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 764s msgpass 764s else 764s msgfailoutput '' "$COMPAREFILE" "$@" 764s fi 764s aptautotest 'testempty' "$@" 764s msggroup 764s } 764s testwarningempty() { 764s testwarning "$@" 764s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 764s } 764s testnotempty() { 764s msggroup 'testnotempty' 764s msgtest "Test for some output of" "$*" 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 764s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 764s msgpass 764s else 764s msgfailoutput '' "$COMPAREFILE" "$@" 764s fi 764s aptautotest 'testnotempty' "$@" 764s msggroup 764s } 764s 764s testequal() { 764s msggroup 'testequal' 764s local MSG='Test of equality of' 764s if [ "$1" = '--nomsg' ]; then 764s MSG='' 764s shift 764s fi 764s 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 764s echo "$1" > "$COMPAREFILE" 764s shift 764s 764s if [ -n "$MSG" ]; then 764s msgtest "$MSG" "$*" 764s fi 764s testoutputequal "$COMPAREFILE" "$@" 764s aptautotest 'testequal' "$@" 764s msggroup 764s } 764s 764s testequalor2() { 764s msggroup 'testequalor2' 764s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 764s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 764s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 764s echo "$1" > "$COMPAREFILE1" 764s echo "$2" > "$COMPAREFILE2" 764s shift 2 764s msgtest "Test for equality OR of" "$*" 764s "$@" >"$COMPAREAGAINST" 2>&1 || true 764s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 764s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 764s then 764s msgpass 764s else 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 764s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 764s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 764s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 764s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 764s msgfailoutput '' "$OUTPUT" 764s fi 764s aptautotest 'testequalor2' "$@" 764s msggroup 764s } 764s 764s testshowvirtual() { 764s msggroup 'testshowvirtual' 764s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 764s local PACKAGE="$1" 764s shift 764s while [ -n "$1" ]; do 764s VIRTUAL="${VIRTUAL} 764s N: Can't select versions from package '$1' as it is purely virtual" 764s PACKAGE="${PACKAGE} $1" 764s shift 764s done 764s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 764s VIRTUAL="${VIRTUAL} 764s N: No packages found" 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 764s local ARCH="$(getarchitecture 'native')" 764s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 764s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 764s msggroup 764s } 764s 764s testnopackage() { 764s msggroup 'testnopackage' 764s msgtest "Test for non-existent packages" "apt-cache show $*" 764s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 764s if [ -n "$SHOWPKG" ]; then 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 764s echo "$SHOWPKG" >"$OUTPUT" 764s msgfailoutput '' "$OUTPUT" 764s else 764s msgpass 764s fi 764s msggroup 764s } 764s testnosrcpackage() { 764s msggroup 'testnosrcpackage' 764s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 764s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 764s if [ -n "$SHOWPKG" ]; then 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 764s echo "$SHOWPKG" >"$OUTPUT" 764s msgfailoutput '' "$OUTPUT" 764s else 764s msgpass 764s fi 764s msggroup 764s } 764s 764s testdpkgstatus() { 764s msggroup 'testdpkgstatus' 764s local STATE="$1" 764s local NR="$2" 764s shift 2 764s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 764s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 764s if [ "$PKGS" != $NR ]; then 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 764s echo "$PKGS" >"$OUTPUT" 764s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 764s msgfailoutput '' "$OUTPUT" 764s else 764s msgpass 764s fi 764s msggroup 764s } 764s 764s testdpkginstalled() { 764s msggroup 'testdpkginstalled' 764s testdpkgstatus 'ii' "$#" "$@" 764s msggroup 764s } 764s 764s testdpkgnotinstalled() { 764s msggroup 'testdpkgnotinstalled' 764s testdpkgstatus 'ii' '0' "$@" 764s msggroup 764s } 764s 764s testmarkedauto() { 764s msggroup 'testmarkedauto' 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 764s if [ -n "$1" ]; then 764s msgtest 'Test for correctly marked as auto-installed' "$*" 764s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 764s else 764s msgtest 'Test for correctly marked as auto-installed' 'no package' 764s echo -n > "$COMPAREFILE" 764s fi 764s testoutputequal "$COMPAREFILE" aptmark showauto 764s msggroup 764s } 764s testmarkedmanual() { 764s msggroup 'testmarkedmanual' 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 764s if [ -n "$1" ]; then 764s msgtest 'Test for correctly marked as manually installed' "$*" 764s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 764s else 764s msgtest 'Test for correctly marked as manually installed' 'no package' 764s echo -n > "$COMPAREFILE" 764s fi 764s testoutputequal "$COMPAREFILE" aptmark showmanual 764s msggroup 764s } 764s 764s catfile() { 764s if [ "${1##*.}" = 'deb' ]; then 764s stat >&2 "$1" || true 764s file >&2 "$1" || true 764s else 764s cat >&2 "$1" || true 764s fi 764s } 764s msgfailoutput() { 764s msgreportheader 'msgfailoutput' 764s local MSG="$1" 764s local OUTPUT="$2" 764s shift 2 764s local CMD="$1" 764s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 764s echo >&2 764s while [ -n "$2" ]; do shift; done 764s echo "#### Complete file: $1 ####" 764s catfile "$1" 764s echo "#### $CMD output ####" 764s elif [ "$1" = 'test' ]; then 764s echo >&2 764s # doesn't support ! or non-file flags 764s msgfailoutputstatfile() { 764s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 764s if expr match "$1" "$FILEFLAGS" >/dev/null; then 764s echo "#### stat(2) of file: $2 ####" 764s stat "$2" || true 764s if test -d "$2"; then 764s echo "#### The directory contains: $2 ####" 764s ls >&2 "$2" || true 764s elif test -e "$2"; then 764s echo "#### Complete file: $2 ####" 764s catfile "$2" 764s fi 764s fi 764s } 764s msgfailoutputstatfile "$2" "$3" 764s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 764s shift 3 764s msgfailoutputstatfile "$2" "$3" 764s done 764s echo '#### test output ####' 764s elif [ "$1" = 'cmp' ]; then 764s echo >&2 764s while [ -n "$2" ]; do 764s echo "#### Complete file: $2 ####" 764s catfile "$2" 764s shift 764s done 764s echo '#### cmp output ####' 764s elif [ "$1" = 'rm' ]; then 764s echo "#### Directory listing of: $(pwd) ####" 764s ls -l 764s fi 764s catfile "$OUTPUT" 764s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 764s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 764s local COREEXE='' 764s for CORENAME in 'core' 'core.pid'; do 764s if [ -s "$CORENAME" ]; then 764s cp -a ${CORENAME} "$COREDUMP" 764s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 764s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 764s else 764s continue 764s fi 764s break 764s done 764s if [ -s "$COREDUMP" ]; then 764s true # found already as a file 764s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 764s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 764s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 764s else 764s echo '### core dump not found ###' 764s cat /proc/sys/kernel/core_pattern 764s fi 764s if [ -s "$COREDUMP" ]; then 764s if [ -z "$COREEXE" ]; then 764s case "$CMD" in 764s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 764s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 764s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 764s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 764s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 764s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 764s esac 764s fi 764s 764s if [ -d "${ARTIFACTSDIR}" ]; then 764s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 764s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 764s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 764s fi 764s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 764s echo "#### gdb backtrace ####" 764s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 764s fi 764s fi 764s rm -f "$COREDUMP" 764s fi 764s msgfail "$MSG" 764s } 764s 764s testsuccesswithglobalerror() { 764s local TYPE="$1" 764s local ERRORS="$2" 764s shift 2 764s msggroup "$TYPE" 764s if [ "$1" = '--nomsg' ]; then 764s shift 764s else 764s msgtest 'Test for successful execution of' "$*" 764s fi 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 764s if "$@" >"${OUTPUT}" 2>&1; then 764s if expr match "$1" '^apt.*' >/dev/null; then 764s if grep -q -E ' runtime error: ' "$OUTPUT"; then 764s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 764s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 764s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 764s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 764s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 764s msgpass 764s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 764s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 764s msgpass 764s else 764s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 764s fi 764s else 764s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 764s fi 764s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 764s if grep -q -E "^N: " "$OUTPUT"; then 764s msgpass 764s else 764s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 764s fi 764s else 764s msgpass 764s fi 764s else 764s msgpass 764s fi 764s else 764s local EXITCODE=$? 764s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 764s fi 764s aptautotest "$TYPE" "$@" 764s msggroup 764s } 764s testsuccesswithnotice() { 764s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 764s } 764s testsuccess() { 764s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 764s } 764s testwarning() { 764s msggroup 'testwarning' 764s if [ "$1" = '--nomsg' ]; then 764s shift 764s else 764s msgtest 'Test for successful execution with warnings of' "$*" 764s fi 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 764s if "$@" >"${OUTPUT}" 2>&1; then 764s if expr match "$1" '^apt.*' >/dev/null; then 764s if grep -q -E ' runtime error: ' "$OUTPUT"; then 764s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 764s elif grep -q -E '^E: ' "$OUTPUT"; then 764s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 764s elif ! grep -q -E '^W: ' "$OUTPUT"; then 764s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 764s else 764s msgpass 764s fi 764s else 764s msgpass 764s fi 764s else 764s local EXITCODE=$? 764s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 764s fi 764s aptautotest 'testwarning' "$@" 764s msggroup 764s } 764s testfailure() { 764s msggroup 'testfailure' 764s if [ "$1" = '--nomsg' ]; then 764s shift 764s else 764s msgtest 'Test for failure in execution of' "$*" 764s fi 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 764s if "$@" >"${OUTPUT}" 2>&1; then 764s local EXITCODE=$? 764s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 764s else 764s local EXITCODE=$? 764s if expr match "$1" '^apt.*' >/dev/null; then 764s if [ "$1" = 'aptkey' ]; then 764s if grep -q " Can't check signature: 764s BAD signature from 764s signature could not be verified" "$OUTPUT"; then 764s msgpass 764s else 764s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 764s fi 764s else 764s if grep -q -E ' runtime error: ' "$OUTPUT"; then 764s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 764s elif grep -q -E '==ERROR' "$OUTPUT"; then 764s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 764s elif ! grep -q -E '^E: ' "$OUTPUT"; then 764s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 764s else 764s msgpass 764s fi 764s fi 764s else 764s msgpass 764s fi 764s fi 764s aptautotest 'testfailure' "$@" 764s msggroup 764s } 764s 764s testreturnstateequal() { 764s local STATE="$1" 764s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 764s local STATE="$2" 764s local TYPE="$3" 764s shift 3 764s msggroup "${STATE}equal" 764s if [ "$1" != '--nomsg' ]; then 764s local CMP="$1" 764s shift 764s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 764s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 764s else 764s local CMP="$2" 764s shift 2 764s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 764s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 764s fi 764s else 764s msggroup "${STATE}equal" 764s if [ "$2" != '--nomsg' ]; then 764s local CMP="$2" 764s shift 2 764s "$STATE" "$@" 764s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 764s else 764s local CMP="$3" 764s shift 3 764s "$STATE" --nomsg "$@" 764s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 764s fi 764s fi 764s msggroup 764s } 764s testsuccessequal() { 764s # we compare output, so we know perfectly well about N: 764s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 764s } 764s testwarningequal() { 764s testreturnstateequal 'testwarning' "$@" 764s } 764s testfailureequal() { 764s testreturnstateequal 'testfailure' "$@" 764s } 764s 764s testfailuremsg() { 764s msggroup 'testfailuremsg' 764s local CMP="$1" 764s shift 764s testfailure "$@" 764s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 764s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 764s testoutputequal "$COMPAREFILE" echo "$CMP" 764s msggroup 764s } 764s testwarningmsg() { 764s msggroup 'testwarningmsg' 764s local CMP="$1" 764s shift 764s testwarning "$@" 764s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 764s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 764s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 764s testoutputequal "$COMPAREFILE" echo "$CMP" 764s msggroup 764s } 764s 764s testfilestats() { 764s msggroup 'testfilestats' 764s msgtest "Test that file $1 has $2 $3" "$4" 764s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 764s msgpass 764s else 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 764s { 764s echo 764s ls -ld "$1" || true 764s echo -n "stat(1) reports for $2: " 764s stat --format "$2" "$1" || true 764s } >"$OUTPUT" 2>&1 764s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 764s fi 764s msggroup 764s } 764s testaccessrights() { 764s msggroup 'testaccessrights' 764s testfilestats "$1" '%a' '=' "$2" 764s msggroup 764s } 764s 764s testwebserverlaststatuscode() { 764s msggroup 'testwebserverlaststatuscode' 764s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 764s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 764s rm -f "$DOWNLOG" "$STATUS" 764s msgtest 'Test last status code from the webserver was' "$1" 764s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 764s msgpass 764s else 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 764s { 764s if [ -n "$2" ]; then 764s shift 764s echo >&2 '#### Additionally provided output files contain:' 764s cat >&2 "$@" 764s fi 764s echo >&2 '#### Download log of the status code:' 764s cat >&2 "$DOWNLOG" 764s } >"$OUTPUT" 2>&1 764s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 764s fi 764s msggroup 764s } 764s 764s mapkeynametokeyid() { 764s while [ -n "$1" ]; do 764s case "$1" in 764s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 764s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 764s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 764s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 764s oldarchive) echo 'FDD2DB85F68C85A3';; 764s *) echo 'UNKNOWN KEY';; 764s esac 764s shift 764s done 764s } 764s testaptkeys() { 764s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 764s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 764s echo -n > "$OUTPUT" 764s fi 764s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 764s } 764s 764s pause() { 764s echo "STOPPED execution. Press enter to continue" 764s local IGNORE 764s read IGNORE 764s } 764s 764s logcurrentarchivedirectory() { 764s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 764s stat --format '%U:%G:%a:%n' "$line" 764s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 764s } 764s listcurrentlistsdirectory() { 764s { 764s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 764s stat --format '%U:%G:%a:%n' "$line" 764s done 764s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 764s stat --format '%U:%G:%a:%s:%y:%n' "$line" 764s done 764s } | sort 764s } 764s forallsupportedcompressors() { 764s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 764s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 764s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 764s "$@" "$COMP" 764s done 764s } 764s 764s breakfiles() { 764s while [ -n "$1" ]; do 764s mv -f "${1}" "${1}.bak" 764s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 764s shift 764s done 764s } 764s unbreakfiles() { 764s while [ -n "$1" ]; do 764s mv -f "${1}.bak" "${1}" 764s shift 764s done 764s } 764s 764s ### convenience hacks ### 764s mkdir() { 764s # creating some directories by hand is a tedious task, so make it look simple 764s local PARAMS="$*" 764s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 764s # only the last directory created by mkdir is effected by the -m ! 764s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 764s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 764s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 764s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 764s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 764s if [ "$(id -u)" = '0' ]; then 764s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 764s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 764s fi 764s else 764s command mkdir "$@" 764s fi 764s } 764s 764s ### The following tests are run by most test methods automatically to check 764s ### general things about commands executed without writing the test every time. 764s 764s aptautotest() { 764s if [ $# -lt 3 ]; then return; fi 764s local TESTCALL="$1" 764s local CMD="$2" 764s local FIRSTOPT="$3" 764s shift 2 764s for i in "$@"; do 764s if ! expr match "$i" '^-' >/dev/null 2>&1; then 764s FIRSTOPT="$i" 764s break 764s fi 764s done 764s shift 764s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 764s if command -v $AUTOTEST >/dev/null; then 764s # save and restore the *.output files from other tests 764s # as we might otherwise override them in these automatic tests 764s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 764s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 764s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 764s $AUTOTEST "$TESTCALL" "$@" 764s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 764s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 764s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 764s fi 764s } 764s 764s cdfind() { 764s ( cd /; find "$@" ) 764s } 764s aptautotest_aptget_update() { 764s local TESTCALL="$1" 764s while [ -n "$2" ]; do 764s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 764s shift 764s done 764s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 764s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 764s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 764s # all copied files are properly chmodded 764s local backupIFS="$IFS" 764s IFS="$(printf "\n\b")" 764s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 764s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 764s done 764s IFS="$backupIFS" 764s if [ "$TESTCALL" = 'testsuccess' ]; then 764s # failure cases can retain partial files and such 764s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 764s fi 764s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 764s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 764s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 764s fi 764s } 764s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 764s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 764s 764s testaptautotestnodpkgwarning() { 764s local TESTCALL="$1" 764s while [ -n "$2" ]; do 764s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 764s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 764s shift 764s done 764s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 764s } 764s 764s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 764s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 764s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 764s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 764s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 764s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 764s 764s testaptmarknodefaultsections() { 764s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 764s } 764s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 764s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 764s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 764s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 764s cmp: ./downloaded/foo1: No such file or directory 764s FAIL: exitcode 2 891s 891s Redirect leads first URI to the second URI … Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 891s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 891s Configured access method http 891s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 891s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 891s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 891s Configured access method http 891s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 891s -> http:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpkg=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 891s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo2%0aFilename:%20./downloaded/foo1%0a%0a 891s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo%0aFilename:%20./downloaded/foo2%0a%0a 891s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20http://localhost:44339/foo2 891s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 891s <- http:GET /foo2 HTTP/1.1 891s Host: localhost:44339 891s Accept: text/* 891s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 891s 891s 102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 891s 891s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo2 891s Answer for: http://localhost:44339/foo2 891s HTTP/1.1 301 Moved Permanently 891s Content-Length: 357 891s Location: https://localhost:44339/foo 891s Content-Type: text/html; charset=utf-8 891s Server: APT webserver 891s Accept-Ranges: bytes 891s Date: Fri, 13 Jun 2025 00:12:13 GMT 891s 891s GET /foo HTTP/1.1 891s Host: localhost:44339 891s Accept: text/* 891s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 891s 891s 891s <- http:103%20Redirect%0aNew-URI:%20https://localhost:44339/foo%0aURI:%20http://localhost:44339/foo2 891s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 891s Answer for: http://localhost:44339/foo 891s HTTP/1.1 200 OK 891s Content-Length: 77417 891s Last-Modified: Fri, 13 Jun 2025 00:07:57 GMT 891s Server: APT webserver 891s Accept-Ranges: bytes 891s Date: Fri, 13 Jun 2025 00:12:13 GMT 891s 891s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 891s Configured access method https 891s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 891s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 891s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 891s Configured access method https 891s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 891s -> https:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernel 891s Test for successful execution of cmp /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework ./downloaded/foo1 … #### Complete file: /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework #### 891s #### Complete file: ./downloaded/foo1 #### 891s #### cmp output #### 891s 891s Test for successful execution of cmp ./downloaded/foo1 ./downloaded/foo2 … #### Complete file: ./downloaded/foo1 #### 891s #### Complete file: ./downloaded/foo2 #### 891s #### cmp output #### 891s P P PPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpkg=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 891s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 891s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo 891s <- http:200%20URI%20Start%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aURI:%20http://localhost:44339/foo 891s Get:2 http://localhost:44339/foo [77.4 kB] 891s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20https://localhost:44339/foo 891s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 891s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 891s <- http:201%20URI%20Done%0aChecksum-FileSize-Hash:%2077417%0aSHA512-Hash:%2099758b98725ee45110a374044902230c8b056c97567d3ec249dc4add195e13a8d07d7d5d5081938286c2c21ec0841528b6cee8986d16a3a9d0abd4c570dd7dce%0aSHA256-Hash:%2072d18d223dc239300d7548396ef9409ee2e4ff5163d55557a87d9852c098e15e%0aSHA1-Hash:%20357fe7a44e62f7a01e1b4c96ee33675f03223500%0aMD5Sum-Hash:%20582a51e7590162e00495e35c882c4b44%0aMD5-Hash:%20582a51e7590162e00495e35c882c4b44%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aFilename:%20./downloaded/foo2%0aURI:%20http://localhost:44339/foo 891s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 891s Ign:1 http://localhost:44339/foo2 891s Could not wait for server fd - select (11: Resource temporarily unavailable) 891s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 891s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 891s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 891s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 891s Ign:1 http://localhost:44339/foo2 891s Could not wait for server fd - select (11: Resource temporarily unavailable) 891s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 891s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 891s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 891s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 891s Ign:1 http://localhost:44339/foo2 891s Could not wait for server fd - select (11: Resource temporarily unavailable) 891s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 891s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 891s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 891s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 891s Err:1 http://localhost:44339/foo2 891s Could not wait for server fd - select (11: Resource temporarily unavailable) 891s E: Failed to fetch https://localhost:44339/foo Could not wait for server fd - select (11: Resource temporarily unavailable) 891s E: Download Failed 891s FAIL: exitcode 100 891s 891s #!/bin/sh -- # no runable script, just for vi 891s 891s EXIT_CODE=0 891s 891s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 891s if [ "$1" = "-q" ]; then 891s export MSGLEVEL=2 891s elif [ "$1" = "-qq" ]; then 891s export MSGLEVEL=1 891s elif [ "$1" = "-v" ]; then 891s export MSGLEVEL=4 891s elif [ "$1" = '--color=no' ]; then 891s export MSGCOLOR='NO' 891s elif [ "$1" = '--color=yes' ]; then 891s export MSGCOLOR='YES' 891s elif [ "$1" = '--color' ]; then 891s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 891s shift 891s elif [ "$1" = '--level' ]; then 891s export MSGLEVEL=$2 891s shift 891s else 891s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 891s fi 891s shift 891s done 891s export MSGLEVEL="${MSGLEVEL:-3}" 891s 891s # we all like colorful messages 891s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 891s if [ ! -t 1 ]; then # but check that we output to a terminal 891s export MSGCOLOR='NO' 891s fi 891s fi 891s 891s if [ "$MSGCOLOR" != 'NO' ]; then 891s CERROR="\033[1;31m" # red 891s CWARNING="\033[1;33m" # yellow 891s CMSG="\033[1;32m" # green 891s CINFO="\033[1;96m" # light blue 891s CDEBUG="\033[1;94m" # blue 891s CNORMAL="\033[0;39m" # default system console color 891s CDONE="\033[1;32m" # green 891s CPASS="\033[1;32m" # green 891s CFAIL="\033[1;31m" # red 891s CCMD="\033[1;35m" # pink 891s fi 891s 891s msgprintf() { 891s local START="$1" 891s local MIDDLE="$2" 891s local END="$3" 891s shift 3 891s if [ -n "$1" ]; then 891s printf "$START " "$1" 891s shift 891s while [ -n "$1" ]; do 891s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 891s shift 891s done 891s fi 891s printf "${END}" 891s } 891s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 891s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 891s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 891s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 891s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 891s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 891s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 891s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 891s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 891s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 891s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 891s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 891s msgreportheader() { 891s if [ -n "$MSGTEST_MSG" ]; then 891s test "$1" != 'msgfailoutput' || echo 891s if [ -n "$MSGTEST_MSGMSG" ]; then 891s echo "$MSGTEST_MSGMSG" 891s fi 891s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 891s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 891s fi 891s echo -n "$MSGTEST_MSG" 891s unset MSGTEST_MSG 891s fi 891s } 891s msgskip() { 891s msgreportheader 'msgskip' 891s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 891s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 891s } 891s msgfail() { 891s msgreportheader 'msgfail' 891s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 891s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 891s if [ -n "$APT_DEBUG_TESTS" ]; then 891s runapt $SHELL 891s fi 891s EXIT_CODE=$((EXIT_CODE+1)); 891s } 891s MSGGROUP_LEVEL=0 891s msggroup() { 891s if [ -n "$1" ]; then 891s if [ $MSGGROUP_LEVEL = 0 ]; then 891s MSGTEST_GRP='NEXT' 891s fi 891s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 891s else 891s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 891s if [ $MSGGROUP_LEVEL = 0 ]; then 891s unset MSGTEST_GRP 891s fi 891s fi 891s } 891s 891s # enable / disable Debugging 891s if [ $MSGLEVEL -le 0 ]; then 891s msgdie() { true; } 891s fi 891s if [ $MSGLEVEL -le 1 ]; then 891s msgwarn() { true; } 891s msgnwarn() { true; } 891s fi 891s if [ $MSGLEVEL -le 2 ]; then 891s msgmsg() { 891s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 891s } 891s msgnmsg() { true; } 891s msgtest() { 891s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 891s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 891s MSGTEST_GRP="$MSGTEST_MSG" 891s fi 891s } 891s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 891s fi 891s if [ $MSGLEVEL -le 3 ]; then 891s msginfo() { true; } 891s msgninfo() { true; } 891s fi 891s if [ $MSGLEVEL -le 4 ]; then 891s msgdebug() { true; } 891s msgndebug() { true; } 891s fi 891s if [ $MSGLEVEL -le 1 ]; then 891s msgpass() { true; } 891s fi 891s msgdone() { 891s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 891s [ "$1" = "info" -a $MSGLEVEL -le 3 ] || 891s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 891s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 891s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 891s true; 891s else 891s printf "${CDONE}DONE${CNORMAL}\n"; 891s fi 891s } 891s getaptconfig() { 891s if [ -f ./aptconfig.conf ]; then 891s echo "$(readlink -f ./aptconfig.conf)" 891s elif [ -f ../aptconfig.conf ]; then 891s echo "$(readlink -f ../aptconfig.conf)" 891s elif [ -f ../../aptconfig.conf ]; then 891s echo "$(readlink -f ../../aptconfig.conf)" 891s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 891s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 891s fi 891s } 891s runapt() { 891s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 891s local CMD="$1" 891s shift 891s case "$CMD" in 891s sh|aptitude|*/*|command) ;; 891s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 891s esac 891s if [ "$CMD" = 'aptitude' ]; then 891s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 891s else 891s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 891s fi 891s } 891s runpython3() { runapt command python3 "$@"; } 891s aptconfig() { runapt apt-config "$@"; } 891s aptcache() { runapt apt-cache "$@"; } 891s aptcdrom() { runapt apt-cdrom "$@"; } 891s aptget() { runapt apt-get "$@"; } 891s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 891s aptkey() { runapt apt-key "$@"; } 891s aptmark() { runapt apt-mark "$@"; } 891s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 891s apt() { runapt apt "$@"; } 891s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 891s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 891s aptitude() { runapt aptitude "$@"; } 891s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 891s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 891s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 891s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 891s 891s dpkg() { 891s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 891s } 891s dpkgquery() { 891s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 891s } 891s dpkg_version() { 891s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 891s } 891s dpkgcheckbuilddeps() { 891s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 891s } 891s gdb() { 891s local CMD 891s case "$1" in 891s aptget) CMD="apt-get";; 891s aptcache) CMD="apt-cache";; 891s aptcdrom) CMD="apt-cdrom";; 891s aptconfig) CMD="apt-config";; 891s aptmark) CMD="apt-mark";; 891s apthelper) CMD="apt-helper";; 891s aptftparchive) CMD="apt-ftparchive";; 891s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 891s *) CMD="$1";; 891s esac 891s shift 891s if [ "${CMD##*/}" = "$CMD" ]; then 891s CMD="${APTCMDLINEBINDIR}/${CMD}" 891s fi 891s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 891s } 891s 891s valgrind() { 891s local CMD 891s case "$1" in 891s aptget) CMD="apt-get";; 891s aptcache) CMD="apt-cache";; 891s aptcdrom) CMD="apt-cdrom";; 891s aptconfig) CMD="apt-config";; 891s aptmark) CMD="apt-mark";; 891s apthelper) CMD="apt-helper";; 891s aptftparchive) CMD="apt-ftparchive";; 891s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 891s *) CMD="$1";; 891s esac 891s shift 891s if [ "$CMD" = "apt-ftparchive" ]; then 891s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 891s fi 891s if [ "${CMD##*/}" = "$CMD" ]; then 891s CMD="${APTCMDLINEBINDIR}/${CMD}" 891s fi 891s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 891s } 891s 891s lastmodification() { 891s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 891s } 891s releasefiledate() { 891s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 891s } 891s 891s exitwithstatus() { 891s # error if we about to overflow, but ... 891s # "255 failures ought to be enough for everybody" 891s if [ $EXIT_CODE -gt 255 ]; then 891s msgdie "Total failure count $EXIT_CODE too big" 891s fi 891s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 891s } 891s 891s shellsetedetector() { 891s local exit_status=$? 891s if [ "$exit_status" != '0' ]; then 891s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 891s if [ "$EXIT_CODE" = '0' ]; then 891s EXIT_CODE="$exit_status" 891s fi 891s fi 891s } 891s 891s addtrap() { 891s if [ "$1" = 'prefix' ]; then 891s CURRENTTRAP="$2 $CURRENTTRAP" 891s else 891s CURRENTTRAP="$CURRENTTRAP $1" 891s fi 891s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 891s } 891s 891s escape_shell() { 891s echo "$@" | sed -e "s#'#'\"'\"'#g" 891s } 891s 891s find_project_binary_dir() { 891s if [ -z "$PROJECT_BINARY_DIR" ]; then 891s PROJECT_BINARY_DIR= 891s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 891s test -e "$dir/CMakeCache.txt" || continue 891s if [ -z "$PROJECT_BINARY_DIR" ] || 891s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 891s PROJECT_BINARY_DIR="$dir" 891s fi 891s done 891s if [ -z "$PROJECT_BINARY_DIR" ]; then 891s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 891s exit 1 891s fi 891s export PROJECT_BINARY_DIR 891s fi 891s } 891s _removetmpworkingdirectory() { 891s cd / 891s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 891s rm -rf "$TMPWORKINGDIRECTORY" 891s fi 891s TMPWORKINGDIRECTORY='' 891s } 891s setupenvironment() { 891s # cleanup the environment a bit 891s export LC_ALL=C 891s unset LANGUAGE COLUMNS NLSPATH 891s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 891s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 891s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 891s unset GREP_OPTIONS POSIXLY_CORRECT 891s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 891s export GCOV_ERROR_FILE=/dev/null 891s 891s # Next check needs a gnu stat, let's figure that out early. 891s stat=stat 891s if command -v gnustat >/dev/null 2>&1; then 891s stat=gnustat 891s fi 891s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 891s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 891s unset TMPDIR 891s fi 891s if [ -z "$TMPWORKINGDIRECTORY" ]; then 891s addtrap '_removetmpworkingdirectory;' 891s TMPWORKINGDIRECTORY="$(mktemp -d)" 891s fi 891s if [ -n "$TMPDIR_ADD" ]; then 891s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 891s mkdir -p "$TMPWORKINGDIRECTORY" 891s unset TMPDIR_ADD 891s export TMPDIR="$TMPWORKINGDIRECTORY" 891s fi 891s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 891s 891s # Setup coreutils on BSD systems 891s mkdir "${TMPWORKINGDIRECTORY}/bin" 891s for prefix in gnu g; do 891s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 891s if command -v $prefix$command 2>/dev/null >/dev/null; then 891s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 891s fi 891s done 891s done 891s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 891s 891s if [ -z "$TESTDIRECTORY" ]; then 891s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 891s fi 891s cd "$TMPWORKINGDIRECTORY" 891s 891s mkdir -m 700 'downloaded' 891s if [ "$(id -u)" = '0' ]; then 891s # relax permissions so that running as root with user switching works 891s umask 022 891s chmod 711 "$TMPWORKINGDIRECTORY" 891s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 891s fi 891s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 891s 891s _setupprojectenvironment 891s 891s # create some files in /tmp and look at user/group to get what this means 891s TEST_DEFAULT_USER="$(id -un)" 891s touch "${TMPWORKINGDIRECTORY}/test-file" 891s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 891s 891s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 891s . "${TESTDIRECTORY}/extra-environment" 891s fi 891s 891s msgdone "info" 891s } 891s _setupprojectenvironment() { 891s # allow overriding the default BUILDDIR locations 891s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 891s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 891s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 891s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 891s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 891s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 891s APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 891s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 891s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 891s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 891s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 891s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 891s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 891s 891s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 891s mkdir aptarchive keys 891s cd rootdir 891s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 891s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 891s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 891s touch var/lib/dpkg/available var/lib/dpkg/lock 891s echo '1' > var/lib/dpkg/info/format 891s ln -s "${METHODSDIR}" usr/lib/apt/methods 891s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 891s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 891s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 891s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 891s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 891s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 891s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 891s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 891s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 891s else 891s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 891s fi 891s cd .. 891s local BASENAME="${0##*/}" 891s local PACKAGESFILE="Packages-${BASENAME#*-}" 891s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 891s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 891s fi 891s local SOURCESSFILE="Sources-${BASENAME#*-}" 891s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 891s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 891s fi 891s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 891s chmod 644 keys/* 891s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 891s 891s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 891s echo "Dir::Etc \"etc\";" >> aptconfig.conf 891s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 891s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 891s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 891s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 891s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 891s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 891s # either store apt-key were we can access it, even if we run it as a different user 891s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 891s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 891s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 891s # destroys coverage reporting though, so we disable changing user for the calling gpgv 891s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 891s if [ "$(id -u)" = '0' ]; then 891s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 891s # same for the solver executables 891s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 891s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 891s fi 891s 891s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 891s EXEC='' 891s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 891s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 891s restoredpkgstatus() { 891s if [ -n "\$BACKUP" ]; then 891s if [ -e "\$BACKUP" ]; then 891s mv -f "\$BACKUP" "\$ORIGINAL" 891s else 891s rm -f "\$ORIGINAL" 891s fi 891s BACKUP='' 891s fi 891s } 891s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 891s if [ -e "\$ORIGINAL" ]; then 891s cp -a "\$ORIGINAL" "\$BACKUP" 891s fi 891s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 891s 891s Package: dpkg 891s Architecture: all 891s Version: ${DPKG_VERSION}+fake 891s Status: install ok installed 891s Maintainer: Joe Sixpack 891s Installed-Size: 42 891s Description: tells dpkg it supports what we need 891s Some versions of dpkg check its own version from the status file 891s to know if it supports multi-arch and stuff in --assert-*. 891s 891s EOS 891s fi 891s EOF 891s fi 891s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 891s 891s { 891s echo 'quiet "0";' 891s echo 'quiet::NoUpdate "true";' 891s echo 'quiet::NoStatistic "true";' 891s # too distracting for users, but helpful to detect changes 891s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 891s echo 'Acquire::Progress::Diffpercent "true";' 891s # in testcases, it can appear as if localhost has a rotation setup, 891s # hide this as we can't really deal with it properly 891s echo 'Acquire::Failure::ShowIP "false";' 891s # randomess and tests don't play well together 891s echo 'Acquire::IndexTargets::Randomized "false";' 891s # fakeroot can't fake everything, so disabled in production but good for tests 891s echo 'APT::Sandbox::Verify "true";' 891s } >> aptconfig.conf 891s 891s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 891s if [ "$(id -u)" = '0' ]; then 891s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 891s fi 891s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 891s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 891s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 891s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 891s # Allow release files to be 10 hours in the future, rather than 10 seconds 891s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 891s 891s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 891s 891s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 891s confighashes 'SHA256' # these are tests, not security best-practices 891s 891s # Make dpkg inherit testing path 891s echo 'DPkg::Path "";' >> aptconfig.conf 891s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 891s 891s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 891s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 891s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 891s fi 891s 891s # most tests just need one signed Release file, not both 891s export APT_DONT_SIGN='Release.gpg' 891s 891s # prefer our apt binaries over the system apt binaries 891s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 891s } 891s 891s getarchitecture() { 891s if [ "$1" = "native" -o -z "$1" ]; then 891s eval `aptconfig shell ARCH APT::Architecture` 891s if [ -n "$ARCH" ]; then 891s echo $ARCH 891s else 891s dpkg --print-architecture 891s fi 891s else 891s echo $1 891s fi 891s } 891s 891s getarchitectures() { 891s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 891s } 891s 891s getarchitecturesfromcommalist() { 891s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 891s } 891s 891s configarchitecture() { 891s { 891s echo "APT::Architecture \"$(getarchitecture $1)\";" 891s while [ -n "$1" ]; do 891s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 891s shift 891s done 891s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 891s configdpkg 891s } 891s 891s configdpkg() { 891s if [ ! -e rootdir/var/lib/dpkg/status ]; then 891s local BASENAME="${0##*/}" 891s local STATUSFILE="status-${BASENAME#*-}" 891s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 891s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 891s # Add an empty line to the end if there is none 891s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 891s echo >> rootdir/var/lib/dpkg/status 891s fi 891s fi 891s fi 891s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 891s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 891s local ARCHS="$(getarchitectures)" 891s local DPKGARCH="$(dpkg --print-architecture)" 891s # this ensures that even if multi-arch isn't active in the view 891s # of apt, given that dpkg can't be told which arch is native 891s # the arch apt treats as native might be foreign for dpkg 891s for ARCH in ${ARCHS}; do 891s if [ "${ARCH}" != "${DPKGARCH}" ]; then 891s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 891s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 891s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 891s else 891s # old-style used e.g. in Ubuntu-P – and as it seems travis 891s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 891s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 891s fi 891s fi 891s fi 891s done 891s else 891s # test multiarch before dpkg is ready for it… 891s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 891s fi 891s } 891s 891s configdpkgnoopchroot() { 891s # create a library to noop chroot() and rewrite maintainer script executions 891s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 891s # chroot directory dpkg could chroot into to execute the maintainer scripts 891s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 891s cat > noopchroot.c << EOF 891s #define _GNU_SOURCE 891s #include 891s #include 891s #include 891s #include 891s 891s static char * chrootdir = NULL; 891s 891s int chroot(const char *path) { 891s printf("WARNING: CHROOTing to %s was ignored!\n", path); 891s free(chrootdir); 891s chrootdir = strdup(path); 891s return 0; 891s } 891s int execvp(const char *file, char *const argv[]) { 891s static int (*func_execvp) (const char *, char * const []) = NULL; 891s if (func_execvp == NULL) 891s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 891s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 891s return func_execvp(file, argv); 891s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 891s char *newfile; 891s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 891s perror("asprintf"); 891s return -1; 891s } 891s char const * const baseadmindir = "/var/lib/dpkg"; 891s char *admindir; 891s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 891s perror("asprintf"); 891s return -1; 891s } 891s setenv("DPKG_ADMINDIR", admindir, 1); 891s return func_execvp(newfile, argv); 891s } 891s EOF 891s if cc -ldl 2>&1 | grep -q dl; then 891s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 891s else 891s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 891s fi 891s } 891s configcompression() { 891s if [ "$1" = 'ALL' ]; then 891s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 891s return 891s fi 891s local CMD='apthelper cat-file -C' 891s while [ -n "$1" ]; do 891s case "$1" in 891s '.') printf ".\t.\tcat\n";; 891s 'gz') printf "gzip\tgz\t$CMD $1\n";; 891s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 891s 'zst') printf "zstd\tzst\t$CMD $1\n";; 891s *) printf "$1\t$1\t$CMD $1\n";; 891s esac 891s shift 891s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 891s } 891s confighashes() { 891s { 891s echo 'APT::FTPArchive {' 891s { 891s while [ -n "$1" ]; do 891s printf "$1" | tr 'a-z' 'A-Z' 891s printf "\t\"true\";\n" 891s shift 891s done 891s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 891s printf "$h\t\"false\";\n" 891s done 891s } | awk '!x[$1]++' 891s echo '};' 891s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 891s } 891s forcecompressor() { 891s COMPRESSOR="$1" 891s COMPRESS="$1" 891s COMPRESSOR_CMD="apthelper cat-file -C $1" 891s case $COMPRESSOR in 891s gzip) COMPRESS='gz';; 891s bzip2) COMPRESS='bz2';; 891s zstd) COMPRESS='zst';; 891s esac 891s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 891s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 891s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 891s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 891s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 891s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 891s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 891s done 891s } 891s 891s _setupsimplenativepackage() { 891s local NAME="$1" 891s local ARCH="$2" 891s local VERSION="$3" 891s local RELEASE="${4:-unstable}" 891s local DEPENDENCIES="$5" 891s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 891s If you find such a package installed on your system, 891s something went horribly wrong! They are autogenerated 891s and used only by testcases and serve no other purpose…}" 891s 891s local SECTION="${7:-others}" 891s local PRIORITY="${8:-optional}" 891s local FILE_TREE="$9" 891s local COMPRESS_TYPE="${10:-gzip}" 891s local DISTSECTION 891s if [ "$SECTION" = "${SECTION#*/}" ]; then 891s DISTSECTION="main" 891s else 891s DISTSECTION="${SECTION%/*}" 891s fi 891s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 891s 891s mkdir -p "$BUILDDIR/debian/source" 891s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 891s echo "#!/bin/sh 891s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 891s 891s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 891s echo "$NAME ($VERSION) $RELEASE; urgency=low 891s 891s * Initial release 891s 891s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 891s { 891s echo "Source: $NAME 891s Priority: $PRIORITY 891s Maintainer: Joe Sixpack 891s Standards-Version: 4.3.1 891s Rules-Requires-Root: no" 891s if [ "$SECTION" != '' ]; then 891s echo "Section: $SECTION" 891s fi 891s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 891s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 891s echo " 891s Package: $NAME" 891s 891s if [ "$ARCH" = 'all' ]; then 891s echo "Architecture: all" 891s else 891s echo "Architecture: any" 891s fi 891s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 891s test -z "$DEPS" || echo "$DEPS" 891s printf "%b\n" "Description: $DESCRIPTION" 891s } > "${BUILDDIR}/debian/control" 891s 891s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 891s } 891s 891s make_tiny_rules() { 891s local OUT="$1" 891s if command -v gmake >/dev/null 2>&1; then 891s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 891s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 891s else 891s echo '#!/usr/bin/make -f' > "$OUT" 891s fi 891s echo '%:' >> "$OUT" 891s echo ' dh $@' >> "$OUT" 891s } 891s 891s setupsimplenativepackage() { 891s _setupsimplenativepackage "$@" 891s local NAME="$1" 891s local VERSION="$3" 891s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 891s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 891s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 891s } 891s 891s buildsimplenativepackage() { 891s local NAME="$1" 891s local ARCH="$2" 891s local VERSION="$3" 891s local RELEASE="${4:-unstable}" 891s local DEPENDENCIES="$5" 891s local DESCRIPTION="$6" 891s local SECTION="${7:-others}" 891s local PRIORITY="${8:-optional}" 891s local FILE_TREE="$9" 891s local COMPRESS_TYPE="${10:-gzip}" 891s local DISTSECTION 891s if [ "$SECTION" = "${SECTION#*/}" ]; then 891s DISTSECTION="main" 891s else 891s DISTSECTION="${SECTION%/*}" 891s fi 891s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 891s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 891s _setupsimplenativepackage "$@" 891s cd "${BUILDDIR}/.." 891s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 891s cd - >/dev/null 891s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 891s | while read SRC; do 891s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 891s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 891s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 891s # adv --yes --default-key 'Joe Sixpack' \ 891s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 891s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 891s # fi 891s done 891s 891s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 891s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 891s rm -rf "${BUILDDIR}/debian/tmp" 891s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 891s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 891s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 891s if [ -n "$FILE_TREE" ]; then 891s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 891s fi 891s 891s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 891s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 891s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 891s # ensure the right permissions as dpkg-deb insists 891s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 891s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 891s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 891s done 891s 891s local NM 891s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 891s NM="$(echo "$NAME" | cut -c 1-4)" 891s else 891s NM="$(echo "$NAME" | cut -c 1)" 891s fi 891s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 891s mkdir -p "$CHANGEPATH" 891s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 891s rm -rf "${BUILDDIR}" 891s msgdone "info" 891s } 891s 891s buildpackage() { 891s local BUILDDIR=$1 891s local RELEASE=$2 891s local SECTION=$3 891s local ARCH=$(getarchitecture $4) 891s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 891s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 891s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 891s cd "$BUILDDIR" 891s if [ "$ARCH" = "all" ]; then 891s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 891s fi 891s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 891s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 891s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 891s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 891s cd - > /dev/null 891s for PKG in $PKGS; do 891s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 891s done 891s for SRC in $SRCS; do 891s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 891s done 891s } 891s 891s buildaptarchive() { 891s if [ -d incoming ]; then 891s buildaptarchivefromincoming "$@" 891s else 891s buildaptarchivefromfiles "$@" 891s fi 891s } 891s 891s createaptftparchiveconfig() { 891s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 891s local COMPRESSORS="${COMPRESSORS%* }" 891s local ARCHS="$(getarchitectures)" 891s cat > ftparchive.conf <> ftparchive.conf 891s } 891s 891s buildaptftparchivedirectorystructure() { 891s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 891s for DIST in $DISTS; do 891s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 891s for SECTION in $SECTIONS; do 891s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 891s for ARCH in $ARCHS; do 891s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 891s done 891s mkdir -p "dists/${DIST}/${SECTION}/source" 891s mkdir -p "dists/${DIST}/${SECTION}/i18n" 891s done 891s done 891s } 891s 891s insertpackage() { 891s local RELEASES="$1" 891s local NAME="$2" 891s local ARCH="$3" 891s local VERSION="$4" 891s local DEPENDENCIES="$5" 891s local PRIORITY="${6:-optional}" 891s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 891s If you find such a package installed on your system, 891s something went horribly wrong! They are autogenerated 891s and used only by testcases and serve no other purpose…}" 891s local SECTION="${8:-other}" 891s 891s if [ "$SECTION" = "${SECTION#*/}" ]; then 891s DISTSECTION="main" 891s else 891s DISTSECTION="${SECTION%/*}" 891s fi 891s local ARCHS="" 891s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 891s if [ "$RELEASE" = 'installed' ]; then 891s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 891s continue 891s fi 891s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 891s if [ "$arch" = 'none' ]; then 891s ARCHS="$(getarchitectures)" 891s else 891s ARCHS="$arch" 891s fi 891s for BUILDARCH in $ARCHS; do 891s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 891s mkdir -p "$PPATH" 891s { 891s echo "Package: $NAME 891s Priority: $PRIORITY 891s Section: $SECTION 891s Installed-Size: 42 891s Size: 42" 891s if echo "$DEPENDENCIES" | grep -q SHA256:; then 891s : 891s else 891s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 891s fi 891s echo "Maintainer: Joe Sixpack " 891s test "$arch" = 'none' || echo "Architecture: $arch" 891s echo "Version: $VERSION 891s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 891s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 891s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 891s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 891s echo 891s } >> "${PPATH}/Packages" 891s done 891s done 891s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 891s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 891s echo "Package: $NAME 891s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 891s Description-en: $DESCRIPTION 891s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 891s done 891s } 891s 891s insertsource() { 891s local RELEASES="$1" 891s local NAME="$2" 891s local ARCH="$3" 891s local VERSION="$4" 891s local DEPENDENCIES="$5" 891s local BINARY="${6:-$NAME}" 891s local ARCHS="" 891s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 891s local SPATH="aptarchive/dists/${RELEASE}/main/source" 891s mkdir -p $SPATH 891s local FILE="${SPATH}/Sources" 891s local DSCFILE="${NAME}_${VERSION}.dsc" 891s local TARFILE="${NAME}_${VERSION}.tar.gz" 891s echo "Package: $NAME 891s Binary: $BINARY 891s Version: $VERSION 891s Maintainer: Joe Sixpack 891s Architecture: $ARCH" >> $FILE 891s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 891s echo "Files: 891s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 891s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 891s Checksums-Sha256: 891s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 891s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 891s " >> "$FILE" 891s done 891s } 891s 891s insertinstalledpackage() { 891s local NAME="$1" 891s local ARCH="$2" 891s local VERSION="$3" 891s local DEPENDENCIES="$4" 891s local PRIORITY="${5:-optional}" 891s local STATUS="${6:-install ok installed}" 891s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 891s If you find such a package installed on your system, 891s something went horribly wrong! They are autogenerated 891s and used only by testcases and serve no other purpose…}" 891s local SECTION="${8:-other}" 891s 891s local FILE='rootdir/var/lib/dpkg/status' 891s local INFO='rootdir/var/lib/dpkg/info' 891s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 891s echo "Package: $NAME 891s Status: $STATUS 891s Priority: $PRIORITY 891s Section: $SECTION 891s Installed-Size: 42 891s Maintainer: Joe Sixpack 891s Version: $VERSION" >> "$FILE" 891s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 891s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 891s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 891s echo >> "$FILE" 891s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 891s echo -n > "${INFO}/${NAME}:${arch}.list" 891s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 891s else 891s echo -n > "${INFO}/${NAME}.list" 891s echo -n > "${INFO}/${NAME}.md5sums" 891s fi 891s done 891s } 891s 891s 891s buildaptarchivefromincoming() { 891s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 891s cd aptarchive 891s [ -e pool ] || ln -s ../incoming pool 891s [ -e ftparchive.conf ] || createaptftparchiveconfig 891s [ -e dists ] || buildaptftparchivedirectorystructure 891s msgninfo "\tGenerate Packages, Sources and Contents files… " 891s testsuccess aptftparchive generate ftparchive.conf 891s cd - > /dev/null 891s msgdone "info" 891s generatereleasefiles "$@" 891s } 891s 891s buildaptarchivefromfiles() { 891s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 891s local DIR='aptarchive' 891s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 891s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 891s msgninfo "\t${line} file… " 891s compressfile "$line" "$1" 891s msgdone "info" 891s done 891s generatereleasefiles "$@" 891s } 891s 891s compressfile() { 891s while read compressor extension command; do 891s if [ "$compressor" = '.' ]; then 891s if [ -n "$2" ]; then 891s touch -d "$2" "$1" 891s fi 891s continue 891s fi 891s cat "$1" | $command > "${1}.${extension}" 891s if [ -n "$2" ]; then 891s touch -d "$2" "${1}.${extension}" 891s fi 891s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 891s } 891s 891s # can be overridden by testcases for their pleasure 891s getcodenamefromsuite() { 891s case "$1" in 891s unstable) echo 'sid';; 891s *) echo -n "$1";; 891s esac 891s } 891s getreleaseversionfromsuite() { true; } 891s getlabelfromsuite() { true; } 891s getoriginfromsuite() { true; } 891s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 891s getnotautomaticfromsuite() { 891s case "$1" in 891s experimental|experimental2) echo "yes";; 891s esac 891s } 891s getbutautomaticupgradesfromsuite() { true; } 891s 891s aptftparchiverelease() { 891s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 891s } 891s generatereleasefiles() { 891s # $1 is the Date header and $2 is the ValidUntil header to be set 891s # both should be given in notation date/touch can understand 891s local DATE="$1" 891s local VALIDUNTIL="$2" 891s if [ -e aptarchive/dists ]; then 891s msgninfo "\tGenerate Release files for dists… " 891s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 891s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 891s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 891s local CODENAME="$(getcodenamefromsuite $SUITE)" 891s local VERSION="$(getreleaseversionfromsuite $SUITE)" 891s local LABEL="$(getlabelfromsuite $SUITE)" 891s local ORIGIN="$(getoriginfromsuite $SUITE)" 891s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 891s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 891s aptftparchiverelease "$dir" \ 891s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 891s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 891s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 891s -o APT::FTPArchive::Release::Label="${LABEL}" \ 891s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 891s -o APT::FTPArchive::Release::Version="${VERSION}" \ 891s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 891s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 891s > "$dir/Release" 891s done 891s else 891s msgninfo "\tGenerate Release files for flat… " 891s aptftparchiverelease ./aptarchive > aptarchive/Release 891s fi 891s if [ -n "$VALIDUNTIL" ]; then 891s sed -i "/^Date: / a\ 891s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 891s fi 891s if [ -n "$DATE" -a "$DATE" != "now" ]; then 891s for release in $(find ./aptarchive -name 'Release'); do 891s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 891s touch -d "$DATE" "$release" 891s done 891s fi 891s msgdone "info" 891s } 891s 891s setupdistsaptarchive() { 891s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 891s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 891s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 891s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 891s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 891s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 891s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 891s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 891s msgdone "info" 891s done 891s } 891s 891s setupflataptarchive() { 891s local APTARCHIVE="$(readlink -f ./aptarchive)" 891s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 891s if [ -f "${APTARCHIVE}/Packages" ]; then 891s msgninfo "\tadd deb sources.list line… " 891s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 891s msgdone 'info' 891s else 891s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 891s fi 891s if [ -f "${APTARCHIVE}/Sources" ]; then 891s msgninfo "\tadd deb-src sources.list line… " 891s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 891s msgdone 'info' 891s else 891s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 891s fi 891s } 891s 891s setupaptarchive() { 891s local NOUPDATE=0 891s if [ "$1" = '--no-update' ]; then 891s NOUPDATE=1 891s shift 891s fi 891s buildaptarchive "$@" 891s if [ -e aptarchive/dists ]; then 891s setupdistsaptarchive 891s else 891s setupflataptarchive 891s fi 891s signreleasefiles 'Joe Sixpack' 891s if [ "1" != "$NOUPDATE" ]; then 891s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 891s fi 891s } 891s 891s killgpgagent() { 891s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 891s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 891s if [ ! -e "${GPGHOME}" ]; then return; fi 891s # ensure the agent dies quickly as different versions have different suicide heuristics 891s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 891s rm -rf "$GPGHOME" 891s } 891s dosigning() { 891s local KEY="$1" 891s shift 891s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 891s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 891s GPGHOME="$APT_TEST_SIGNINGHOME" 891s else 891s if [ ! -e "$GPGHOME" ]; then 891s mkdir -p --mode=700 "${GPGHOME}" 891s addtrap 'prefix' 'killgpgagent;' 891s fi 891s fi 891s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 891s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 891s "$@" 891s } 891s signreleasefiles() { 891s local SIGNERS="${1:-Joe Sixpack}" 891s local REPODIR="${2:-aptarchive}" 891s if [ -n "$1" ]; then shift; fi 891s if [ -n "$1" ]; then shift; fi 891s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 891s msgninfo "\tSign archive with $SIGNERS key $KEY… " 891s local REXKEY='keys/rexexpired' 891s local SECEXPIREBAK="${REXKEY}.sec.bak" 891s local PUBEXPIREBAK="${REXKEY}.pub.bak" 891s local SIGUSERS="" 891s while [ -n "${SIGNERS%%,*}" ]; do 891s local SIGNER="${SIGNERS%%,*}" 891s if [ "${SIGNERS}" = "${SIGNER}" ]; then 891s SIGNERS="" 891s fi 891s SIGNERS="${SIGNERS#*,}" 891s # FIXME: This should be the full name, but we can't encode the space properly currently 891s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 891s if [ "${SIGNER}" = 'Rex Expired' ]; then 891s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 891s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 891s # therefore we 'temporary' make the key not expired and restore a backup after signing 891s cp "${REXKEY}.sec" "$SECEXPIREBAK" 891s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 891s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 891s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 891s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 891s cp "$SECUNEXPIRED" "${REXKEY}.sec" 891s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 891s else 891s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 891s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 891s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 891s cat setexpire.gpg 891s exit 1 891s fi 891s cp "${REXKEY}.sec" "$SECUNEXPIRED" 891s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 891s fi 891s fi 891s if [ ! -e "${KEY}.pub" ]; then 891s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 891s cat "${K}.pub" >> "${KEY}.new.pub" 891s cat "${K}.sec" >> "${KEY}.new.sec" 891s fi 891s done 891s if [ ! -e "${KEY}.pub" ]; then 891s mv "${KEY}.new.pub" "${KEY}.pub" 891s mv "${KEY}.new.sec" "${KEY}.sec" 891s fi 891s for RELEASE in $(find "${REPODIR}/" -name Release); do 891s # we might have set a specific date for the Release file, so copy it 891s local DATE="$(stat --format "%y" "${RELEASE}")" 891s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 891s rm -f "${RELEASE}.gpg" 891s else 891s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 891s touch -d "$DATE" "${RELEASE}.gpg" 891s fi 891s local INRELEASE="${RELEASE%/*}/InRelease" 891s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 891s rm -f "$INRELEASE" 891s else 891s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 891s touch -d "$DATE" "${INRELEASE}" 891s fi 891s done 891s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 891s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 891s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 891s fi 891s msgdone 'info' 891s } 891s 891s redatereleasefiles() { 891s local DATE="$(date -u -d "$1" -R)" 891s for release in $(find aptarchive/ -name 'Release'); do 891s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 891s touch -d "$DATE" "$release" 891s done 891s signreleasefiles "${2:-Joe Sixpack}" 891s } 891s 891s webserverconfig() { 891s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 891s local NOCHECK=false 891s if [ "$1" = '--no-check' ]; then 891s NOCHECK=true 891s shift 891s fi 891s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 891s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 891s rm -f "$STATUS" "$DOWNLOG" 891s local URI 891s if [ -n "$2" ]; then 891s msgtest "Set webserver config option '${1}' to" "$2" 891s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 891s else 891s msgtest 'Clear webserver config option' "${1}" 891s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 891s fi 891s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 891s msgpass 891s else 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 891s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 891s msgfailoutput '' "$OUTPUT" 891s fi 891s $NOCHECK || testwebserverlaststatuscode '200' 891s } 891s 891s rewritesourceslist() { 891s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 891s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 891s sed -i $LIST \ 891s -e "s#file://$APTARCHIVE#${1}#" \ 891s -e "s#file:$APTARCHIVE#${1}#" \ 891s -e "s#copy://$APTARCHIVE#${1}#" \ 891s -e "s#copy:$APTARCHIVE#${1}#" \ 891s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 891s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 891s done 891s } 891s 891s # wait for up to 10s for a pid file to appear to avoid possible race 891s # when a helper is started and doesn't write the PID quick enough 891s waitforpidfile() { 891s local PIDFILE="$1" 891s for i in $(seq 10); do 891s if test -s "$PIDFILE"; then 891s return 0 891s fi 891s sleep 1 891s done 891s msgdie "waiting for $PIDFILE failed" 891s return 1 891s } 891s 891s changetowebserver() { 891s local REWRITE='yes' 891s if [ "$1" = '--no-rewrite' ]; then 891s REWRITE='no' 891s shift 891s fi 891s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 891s cd aptarchive 891s local LOG="webserver.log" 891s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 891s cat "$LOG" 891s false 891s fi 891s waitforpidfile aptwebserver.pid 891s local PID="$(cat aptwebserver.pid)" 891s if [ -z "$PID" ]; then 891s msgdie 'Could not fork aptwebserver successfully' 891s fi 891s addtrap "kill $PID;" 891s waitforpidfile aptwebserver.port 891s APTHTTPPORT="$(cat aptwebserver.port)" 891s if [ -z "$APTHTTPPORT" ]; then 891s msgdie 'Could not get port for aptwebserver successfully' 891s fi 891s cd - > /dev/null 891s else 891s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 891s fi 891s if [ "$REWRITE" != 'no' ]; then 891s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 891s fi 891s } 891s 891s changetohttpswebserver() { 891s local REWRITE='yes' 891s if [ "$1" = '--no-rewrite' ]; then 891s REWRITE='no' 891s shift 891s fi 891s local stunnel4 891s if command -v stunnel4 >/dev/null 2>&1; then 891s stunnel4=stunnel4 891s elif command -v stunnel >/dev/null 2>&1; then 891s stunnel4=stunnel 891s else 891s msgdie 'You need to install stunnel4 for https testcases' 891s fi 891s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 891s changetowebserver --no-rewrite "$@" 891s fi 891s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 891s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 891s output = /dev/null 891s 891s [https] 891s accept = 127.0.0.1:0 891s connect = $APTHTTPPORT 891s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 891s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 891s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 891s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 891s if [ -z "$PID" ]; then 891s msgdie 'Could not fork $stunnel4 successfully' 891s fi 891s addtrap 'prefix' "kill ${PID};" 891s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 891s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 891s if [ "$REWRITE" != 'no' ]; then 891s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 891s fi 891s } 891s 891s changetocdrom() { 891s mkdir -p rootdir/media/cdrom/.disk 891s local CD="$(readlink -f rootdir/media/cdrom)" 891s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 891s if [ ! -d aptarchive/dists ]; then 891s msgdie 'Flat file archive cdroms can not be created currently' 891s return 1 891s fi 891s mv aptarchive/dists "$CD" 891s ln -s "$(readlink -f ./incoming)" "$CD/pool" 891s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 891s # start with an unmounted disk 891s mv "${CD}" "${CD}-unmounted" 891s # we don't want the disk to be modifiable 891s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 891s chmod -R 555 rootdir/media/cdrom-unmounted/dists 891s } 891s 891s downloadfile() { 891s local PROTO="${1%%:*}" 891s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 891s download-file "$1" "$2" "$3" 2>&1 ; then 891s return 1 891s fi 891s # only if the file exists the download was successful 891s if [ -r "$2" ]; then 891s return 0 891s else 891s return 1 891s fi 891s } 891s 891s cleanup_output() { 891s cat "$1" | sed \ 891s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 891s -e '/^profiling:/ d' \ 891s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 891s >"$2" 891s } 891s 891s checkdiff() { 891s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 891s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 891s touch "$TMPFILE1" "$TMPFILE2" 891s 891s cleanup_output "$1" "$TMPFILE1" 891s cleanup_output "$2" "$TMPFILE2" 891s 891s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 891s if [ -n "$DIFFTEXT" ]; then 891s echo >&2 891s echo >&2 "$DIFFTEXT" 891s return 1 891s else 891s return 0 891s fi 891s } 891s 891s testoutputequal() { 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 891s local COMPAREFILE="$1" 891s shift 891s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 891s msgpass 891s else 891s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 891s cat "$COMPAREFILE" >>"${OUTPUT}" 891s msgfailoutput '' "$OUTPUT" "$@" 891s fi 891s } 891s 891s testfileequal() { 891s msggroup 'testfileequal' 891s local MSG='Test for correctness of file' 891s if [ "$1" = '--nomsg' ]; then 891s MSG='' 891s shift 891s fi 891s local FILE="$1" 891s shift 891s if [ -n "$MSG" ]; then 891s msgtest "$MSG" "$FILE" 891s fi 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 891s if [ -z "$*" ]; then 891s testoutputequal "$FILE" echo -n '' 891s else 891s testoutputequal "$FILE" echo "$*" 891s fi 891s msggroup 891s } 891s 891s testempty() { 891s msggroup 'testempty' 891s if [ "$1" = '--nomsg' ]; then 891s shift 891s else 891s msgtest "Test for no output of" "$*" 891s fi 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 891s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 891s msgpass 891s else 891s msgfailoutput '' "$COMPAREFILE" "$@" 891s fi 891s aptautotest 'testempty' "$@" 891s msggroup 891s } 891s testwarningempty() { 891s testwarning "$@" 891s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 891s } 891s testnotempty() { 891s msggroup 'testnotempty' 891s msgtest "Test for some output of" "$*" 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 891s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 891s msgpass 891s else 891s msgfailoutput '' "$COMPAREFILE" "$@" 891s fi 891s aptautotest 'testnotempty' "$@" 891s msggroup 891s } 891s 891s testequal() { 891s msggroup 'testequal' 891s local MSG='Test of equality of' 891s if [ "$1" = '--nomsg' ]; then 891s MSG='' 891s shift 891s fi 891s 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 891s echo "$1" > "$COMPAREFILE" 891s shift 891s 891s if [ -n "$MSG" ]; then 891s msgtest "$MSG" "$*" 891s fi 891s testoutputequal "$COMPAREFILE" "$@" 891s aptautotest 'testequal' "$@" 891s msggroup 891s } 891s 891s testequalor2() { 891s msggroup 'testequalor2' 891s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 891s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 891s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 891s echo "$1" > "$COMPAREFILE1" 891s echo "$2" > "$COMPAREFILE2" 891s shift 2 891s msgtest "Test for equality OR of" "$*" 891s "$@" >"$COMPAREAGAINST" 2>&1 || true 891s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 891s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 891s then 891s msgpass 891s else 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 891s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 891s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 891s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 891s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 891s msgfailoutput '' "$OUTPUT" 891s fi 891s aptautotest 'testequalor2' "$@" 891s msggroup 891s } 891s 891s testshowvirtual() { 891s msggroup 'testshowvirtual' 891s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 891s local PACKAGE="$1" 891s shift 891s while [ -n "$1" ]; do 891s VIRTUAL="${VIRTUAL} 891s N: Can't select versions from package '$1' as it is purely virtual" 891s PACKAGE="${PACKAGE} $1" 891s shift 891s done 891s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 891s VIRTUAL="${VIRTUAL} 891s N: No packages found" 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 891s local ARCH="$(getarchitecture 'native')" 891s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 891s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 891s msggroup 891s } 891s 891s testnopackage() { 891s msggroup 'testnopackage' 891s msgtest "Test for non-existent packages" "apt-cache show $*" 891s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 891s if [ -n "$SHOWPKG" ]; then 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 891s echo "$SHOWPKG" >"$OUTPUT" 891s msgfailoutput '' "$OUTPUT" 891s else 891s msgpass 891s fi 891s msggroup 891s } 891s testnosrcpackage() { 891s msggroup 'testnosrcpackage' 891s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 891s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 891s if [ -n "$SHOWPKG" ]; then 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 891s echo "$SHOWPKG" >"$OUTPUT" 891s msgfailoutput '' "$OUTPUT" 891s else 891s msgpass 891s fi 891s msggroup 891s } 891s 891s testdpkgstatus() { 891s msggroup 'testdpkgstatus' 891s local STATE="$1" 891s local NR="$2" 891s shift 2 891s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 891s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 891s if [ "$PKGS" != $NR ]; then 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 891s echo "$PKGS" >"$OUTPUT" 891s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 891s msgfailoutput '' "$OUTPUT" 891s else 891s msgpass 891s fi 891s msggroup 891s } 891s 891s testdpkginstalled() { 891s msggroup 'testdpkginstalled' 891s testdpkgstatus 'ii' "$#" "$@" 891s msggroup 891s } 891s 891s testdpkgnotinstalled() { 891s msggroup 'testdpkgnotinstalled' 891s testdpkgstatus 'ii' '0' "$@" 891s msggroup 891s } 891s 891s testmarkedauto() { 891s msggroup 'testmarkedauto' 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 891s if [ -n "$1" ]; then 891s msgtest 'Test for correctly marked as auto-installed' "$*" 891s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 891s else 891s msgtest 'Test for correctly marked as auto-installed' 'no package' 891s echo -n > "$COMPAREFILE" 891s fi 891s testoutputequal "$COMPAREFILE" aptmark showauto 891s msggroup 891s } 891s testmarkedmanual() { 891s msggroup 'testmarkedmanual' 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 891s if [ -n "$1" ]; then 891s msgtest 'Test for correctly marked as manually installed' "$*" 891s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 891s else 891s msgtest 'Test for correctly marked as manually installed' 'no package' 891s echo -n > "$COMPAREFILE" 891s fi 891s testoutputequal "$COMPAREFILE" aptmark showmanual 891s msggroup 891s } 891s 891s catfile() { 891s if [ "${1##*.}" = 'deb' ]; then 891s stat >&2 "$1" || true 891s file >&2 "$1" || true 891s else 891s cat >&2 "$1" || true 891s fi 891s } 891s msgfailoutput() { 891s msgreportheader 'msgfailoutput' 891s local MSG="$1" 891s local OUTPUT="$2" 891s shift 2 891s local CMD="$1" 891s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 891s echo >&2 891s while [ -n "$2" ]; do shift; done 891s echo "#### Complete file: $1 ####" 891s catfile "$1" 891s echo "#### $CMD output ####" 891s elif [ "$1" = 'test' ]; then 891s echo >&2 891s # doesn't support ! or non-file flags 891s msgfailoutputstatfile() { 891s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 891s if expr match "$1" "$FILEFLAGS" >/dev/null; then 891s echo "#### stat(2) of file: $2 ####" 891s stat "$2" || true 891s if test -d "$2"; then 891s echo "#### The directory contains: $2 ####" 891s ls >&2 "$2" || true 891s elif test -e "$2"; then 891s echo "#### Complete file: $2 ####" 891s catfile "$2" 891s fi 891s fi 891s } 891s msgfailoutputstatfile "$2" "$3" 891s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 891s shift 3 891s msgfailoutputstatfile "$2" "$3" 891s done 891s echo '#### test output ####' 891s elif [ "$1" = 'cmp' ]; then 891s echo >&2 891s while [ -n "$2" ]; do 891s echo "#### Complete file: $2 ####" 891s catfile "$2" 891s shift 891s done 891s echo '#### cmp output ####' 891s elif [ "$1" = 'rm' ]; then 891s echo "#### Directory listing of: $(pwd) ####" 891s ls -l 891s fi 891s catfile "$OUTPUT" 891s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 891s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 891s local COREEXE='' 891s for CORENAME in 'core' 'core.pid'; do 891s if [ -s "$CORENAME" ]; then 891s cp -a ${CORENAME} "$COREDUMP" 891s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 891s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 891s else 891s continue 891s fi 891s break 891s done 891s if [ -s "$COREDUMP" ]; then 891s true # found already as a file 891s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 891s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 891s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 891s else 891s echo '### core dump not found ###' 891s cat /proc/sys/kernel/core_pattern 891s fi 891s if [ -s "$COREDUMP" ]; then 891s if [ -z "$COREEXE" ]; then 891s case "$CMD" in 891s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 891s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 891s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 891s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 891s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 891s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 891s esac 891s fi 891s 891s if [ -d "${ARTIFACTSDIR}" ]; then 891s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 891s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 891s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 891s fi 891s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 891s echo "#### gdb backtrace ####" 891s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 891s fi 891s fi 891s rm -f "$COREDUMP" 891s fi 891s msgfail "$MSG" 891s } 891s 891s testsuccesswithglobalerror() { 891s local TYPE="$1" 891s local ERRORS="$2" 891s shift 2 891s msggroup "$TYPE" 891s if [ "$1" = '--nomsg' ]; then 891s shift 891s else 891s msgtest 'Test for successful execution of' "$*" 891s fi 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 891s if "$@" >"${OUTPUT}" 2>&1; then 891s if expr match "$1" '^apt.*' >/dev/null; then 891s if grep -q -E ' runtime error: ' "$OUTPUT"; then 891s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 891s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 891s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 891s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 891s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 891s msgpass 891s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 891s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 891s msgpass 891s else 891s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 891s fi 891s else 891s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 891s fi 891s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 891s if grep -q -E "^N: " "$OUTPUT"; then 891s msgpass 891s else 891s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 891s fi 891s else 891s msgpass 891s fi 891s else 891s msgpass 891s fi 891s else 891s local EXITCODE=$? 891s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 891s fi 891s aptautotest "$TYPE" "$@" 891s msggroup 891s } 891s testsuccesswithnotice() { 891s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 891s } 891s testsuccess() { 891s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 891s } 891s testwarning() { 891s msggroup 'testwarning' 891s if [ "$1" = '--nomsg' ]; then 891s shift 891s else 891s msgtest 'Test for successful execution with warnings of' "$*" 891s fi 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 891s if "$@" >"${OUTPUT}" 2>&1; then 891s if expr match "$1" '^apt.*' >/dev/null; then 891s if grep -q -E ' runtime error: ' "$OUTPUT"; then 891s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 891s elif grep -q -E '^E: ' "$OUTPUT"; then 891s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 891s elif ! grep -q -E '^W: ' "$OUTPUT"; then 891s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 891s else 891s msgpass 891s fi 891s else 891s msgpass 891s fi 891s else 891s local EXITCODE=$? 891s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 891s fi 891s aptautotest 'testwarning' "$@" 891s msggroup 891s } 891s testfailure() { 891s msggroup 'testfailure' 891s if [ "$1" = '--nomsg' ]; then 891s shift 891s else 891s msgtest 'Test for failure in execution of' "$*" 891s fi 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 891s if "$@" >"${OUTPUT}" 2>&1; then 891s local EXITCODE=$? 891s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 891s else 891s local EXITCODE=$? 891s if expr match "$1" '^apt.*' >/dev/null; then 891s if [ "$1" = 'aptkey' ]; then 891s if grep -q " Can't check signature: 891s BAD signature from 891s signature could not be verified" "$OUTPUT"; then 891s msgpass 891s else 891s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 891s fi 891s else 891s if grep -q -E ' runtime error: ' "$OUTPUT"; then 891s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 891s elif grep -q -E '==ERROR' "$OUTPUT"; then 891s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 891s elif ! grep -q -E '^E: ' "$OUTPUT"; then 891s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 891s else 891s msgpass 891s fi 891s fi 891s else 891s msgpass 891s fi 891s fi 891s aptautotest 'testfailure' "$@" 891s msggroup 891s } 891s 891s testreturnstateequal() { 891s local STATE="$1" 891s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 891s local STATE="$2" 891s local TYPE="$3" 891s shift 3 891s msggroup "${STATE}equal" 891s if [ "$1" != '--nomsg' ]; then 891s local CMP="$1" 891s shift 891s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 891s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 891s else 891s local CMP="$2" 891s shift 2 891s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 891s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 891s fi 891s else 891s msggroup "${STATE}equal" 891s if [ "$2" != '--nomsg' ]; then 891s local CMP="$2" 891s shift 2 891s "$STATE" "$@" 891s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 891s else 891s local CMP="$3" 891s shift 3 891s "$STATE" --nomsg "$@" 891s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 891s fi 891s fi 891s msggroup 891s } 891s testsuccessequal() { 891s # we compare output, so we know perfectly well about N: 891s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 891s } 891s testwarningequal() { 891s testreturnstateequal 'testwarning' "$@" 891s } 891s testfailureequal() { 891s testreturnstateequal 'testfailure' "$@" 891s } 891s 891s testfailuremsg() { 891s msggroup 'testfailuremsg' 891s local CMP="$1" 891s shift 891s testfailure "$@" 891s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 891s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 891s testoutputequal "$COMPAREFILE" echo "$CMP" 891s msggroup 891s } 891s testwarningmsg() { 891s msggroup 'testwarningmsg' 891s local CMP="$1" 891s shift 891s testwarning "$@" 891s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 891s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 891s testoutputequal "$COMPAREFILE" echo "$CMP" 891s msggroup 891s } 891s 891s testfilestats() { 891s msggroup 'testfilestats' 891s msgtest "Test that file $1 has $2 $3" "$4" 891s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 891s msgpass 891s else 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 891s { 891s echo 891s ls -ld "$1" || true 891s echo -n "stat(1) reports for $2: " 891s stat --format "$2" "$1" || true 891s } >"$OUTPUT" 2>&1 891s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 891s fi 891s msggroup 891s } 891s testaccessrights() { 891s msggroup 'testaccessrights' 891s testfilestats "$1" '%a' '=' "$2" 891s msggroup 891s } 891s 891s testwebserverlaststatuscode() { 891s msggroup 'testwebserverlaststatuscode' 891s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 891s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 891s rm -f "$DOWNLOG" "$STATUS" 891s msgtest 'Test last status code from the webserver was' "$1" 891s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 891s msgpass 891s else 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 891s { 891s if [ -n "$2" ]; then 891s shift 891s echo >&2 '#### Additionally provided output files contain:' 891s cat >&2 "$@" 891s fi 891s echo >&2 '#### Download log of the status code:' 891s cat >&2 "$DOWNLOG" 891s } >"$OUTPUT" 2>&1 891s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 891s fi 891s msggroup 891s } 891s 891s mapkeynametokeyid() { 891s while [ -n "$1" ]; do 891s case "$1" in 891s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 891s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 891s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 891s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 891s oldarchive) echo 'FDD2DB85F68C85A3';; 891s *) echo 'UNKNOWN KEY';; 891s esac 891s shift 891s done 891s } 891s testaptkeys() { 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 891s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 891s echo -n > "$OUTPUT" 891s fi 891s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 891s } 891s 891s pause() { 891s echo "STOPPED execution. Press enter to continue" 891s local IGNORE 891s read IGNORE 891s } 891s 891s logcurrentarchivedirectory() { 891s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 891s stat --format '%U:%G:%a:%n' "$line" 891s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 891s } 891s listcurrentlistsdirectory() { 891s { 891s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 891s stat --format '%U:%G:%a:%n' "$line" 891s done 891s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 891s stat --format '%U:%G:%a:%s:%y:%n' "$line" 891s done 891s } | sort 891s } 891s forallsupportedcompressors() { 891s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 891s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 891s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 891s "$@" "$COMP" 891s done 891s } 891s 891s breakfiles() { 891s while [ -n "$1" ]; do 891s mv -f "${1}" "${1}.bak" 891s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 891s shift 891s done 891s } 891s unbreakfiles() { 891s while [ -n "$1" ]; do 891s mv -f "${1}.bak" "${1}" 891s shift 891s done 891s } 891s 891s ### convenience hacks ### 891s mkdir() { 891s # creating some directories by hand is a tedious task, so make it look simple 891s local PARAMS="$*" 891s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 891s # only the last directory created by mkdir is effected by the -m ! 891s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 891s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 891s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 891s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 891s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 891s if [ "$(id -u)" = '0' ]; then 891s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 891s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 891s fi 891s else 891s command mkdir "$@" 891s fi 891s } 891s 891s ### The following tests are run by most test methods automatically to check 891s ### general things about commands executed without writing the test every time. 891s 891s aptautotest() { 891s if [ $# -lt 3 ]; then return; fi 891s local TESTCALL="$1" 891s local CMD="$2" 891s local FIRSTOPT="$3" 891s shift 2 891s for i in "$@"; do 891s if ! expr match "$i" '^-' >/dev/null 2>&1; then 891s FIRSTOPT="$i" 891s break 891s fi 891s done 891s shift 891s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 891s if command -v $AUTOTEST >/dev/null; then 891s # save and restore the *.output files from other tests 891s # as we might otherwise override them in these automatic tests 891s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 891s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 891s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 891s $AUTOTEST "$TESTCALL" "$@" 891s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 891s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 891s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 891s fi 891s } 891s 891s cdfind() { 891s ( cd /; find "$@" ) 891s } 891s aptautotest_aptget_update() { 891s local TESTCALL="$1" 891s while [ -n "$2" ]; do 891s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 891s shift 891s done 891s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 891s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 891s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 891s # all copied files are properly chmodded 891s local backupIFS="$IFS" 891s IFS="$(printf "\n\b")" 891s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 891s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 891s done 891s IFS="$backupIFS" 891s if [ "$TESTCALL" = 'testsuccess' ]; then 891s # failure cases can retain partial files and such 891s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 891s fi 891s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 891s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 891s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 891s fi 891s } 891s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 891s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 891s 891s testaptautotestnodpkgwarning() { 891s local TESTCALL="$1" 891s while [ -n "$2" ]; do 891s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 891s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 891s shift 891s done 891s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 891s } 891s 891s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 891s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 891s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 891s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 891s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 891s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 891s 891s testaptmarknodefaultsections() { 891s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 891s } 891s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 891s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 891s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 891s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 891s cat: ./downloaded/foo1: No such file or directory 891s cmp: ./downloaded/foo1: No such file or directory 891s FAIL: exitcode 2 891s 891s cat: ./downloaded/foo1: No such file or directory 891s #!/bin/sh -- # no runable script, just for vi 891s 891s EXIT_CODE=0 891s 891s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 891s if [ "$1" = "-q" ]; then 891s export MSGLEVEL=2 891s elif [ "$1" = "-qq" ]; then 891s export MSGLEVEL=1 891s elif [ "$1" = "-v" ]; then 891s export MSGLEVEL=4 891s elif [ "$1" = '--color=no' ]; then 891s export MSGCOLOR='NO' 891s elif [ "$1" = '--color=yes' ]; then 891s export MSGCOLOR='YES' 891s elif [ "$1" = '--color' ]; then 891s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 891s shift 891s elif [ "$1" = '--level' ]; then 891s export MSGLEVEL=$2 891s shift 891s else 891s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 891s fi 891s shift 891s done 891s export MSGLEVEL="${MSGLEVEL:-3}" 891s 891s # we all like colorful messages 891s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 891s if [ ! -t 1 ]; then # but check that we output to a terminal 891s export MSGCOLOR='NO' 891s fi 891s fi 891s 891s if [ "$MSGCOLOR" != 'NO' ]; then 891s CERROR="\033[1;31m" # red 891s CWARNING="\033[1;33m" # yellow 891s CMSG="\033[1;32m" # green 891s CINFO="\033[1;96m" # light blue 891s CDEBUG="\033[1;94m" # blue 891s CNORMAL="\033[0;39m" # default system console color 891s CDONE="\033[1;32m" # green 891s CPASS="\033[1;32m" # green 891s CFAIL="\033[1;31m" # red 891s CCMD="\033[1;35m" # pink 891s fi 891s 891s msgprintf() { 891s local START="$1" 891s local MIDDLE="$2" 891s local END="$3" 891s shift 3 891s if [ -n "$1" ]; then 891s printf "$START " "$1" 891s shift 891s while [ -n "$1" ]; do 891s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 891s shift 891s done 891s fi 891s printf "${END}" 891s } 891s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 891s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 891s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 891s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 891s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 891s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 891s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 891s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 891s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 891s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 891s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 891s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 891s msgreportheader() { 891s if [ -n "$MSGTEST_MSG" ]; then 891s test "$1" != 'msgfailoutput' || echo 891s if [ -n "$MSGTEST_MSGMSG" ]; then 891s echo "$MSGTEST_MSGMSG" 891s fi 891s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 891s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 891s fi 891s echo -n "$MSGTEST_MSG" 891s unset MSGTEST_MSG 891s fi 891s } 891s msgskip() { 891s msgreportheader 'msgskip' 891s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 891s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 891s } 891s msgfail() { 891s msgreportheader 'msgfail' 891s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 891s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 891s if [ -n "$APT_DEBUG_TESTS" ]; then 891s runapt $SHELL 891s fi 891s EXIT_CODE=$((EXIT_CODE+1)); 891s } 891s MSGGROUP_LEVEL=0 891s msggroup() { 891s if [ -n "$1" ]; then 891s if [ $MSGGROUP_LEVEL = 0 ]; then 891s MSGTEST_GRP='NEXT' 891s fi 891s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 891s else 891s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 891s if [ $MSGGROUP_LEVEL = 0 ]; then 891s unset MSGTEST_GRP 891s fi 891s fi 891s } 891s 891s # enable / disable Debugging 891s if [ $MSGLEVEL -le 0 ]; then 891s msgdie() { true; } 891s fi 891s if [ $MSGLEVEL -le 1 ]; then 891s msgwarn() { true; } 891s msgnwarn() { true; } 891s fi 891s if [ $MSGLEVEL -le 2 ]; then 891s msgmsg() { 891s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 891s } 891s msgnmsg() { true; } 891s msgtest() { 891s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 891s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 891s MSGTEST_GRP="$MSGTEST_MSG" 891s fi 891s } 891s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 891s fi 891s if [ $MSGLEVEL -le 3 ]; then 891s msginfo() { true; } 891s msgninfo() { true; } 891s fi 891s if [ $MSGLEVEL -le 4 ]; then 891s msgdebug() { true; } 891s msgndebug() { true; } 891s fi 891s if [ $MSGLEVEL -le 1 ]; then 891s msgpass() { true; } 891s fi 891s msgdone() { 891s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 891s [ "$1" = "info" -a $MSGLEVEL -le 3 ] || 891s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 891s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 891s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 891s true; 891s else 891s printf "${CDONE}DONE${CNORMAL}\n"; 891s fi 891s } 891s getaptconfig() { 891s if [ -f ./aptconfig.conf ]; then 891s echo "$(readlink -f ./aptconfig.conf)" 891s elif [ -f ../aptconfig.conf ]; then 891s echo "$(readlink -f ../aptconfig.conf)" 891s elif [ -f ../../aptconfig.conf ]; then 891s echo "$(readlink -f ../../aptconfig.conf)" 891s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 891s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 891s fi 891s } 891s runapt() { 891s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 891s local CMD="$1" 891s shift 891s case "$CMD" in 891s sh|aptitude|*/*|command) ;; 891s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 891s esac 891s if [ "$CMD" = 'aptitude' ]; then 891s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 891s else 891s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 891s fi 891s } 891s runpython3() { runapt command python3 "$@"; } 891s aptconfig() { runapt apt-config "$@"; } 891s aptcache() { runapt apt-cache "$@"; } 891s aptcdrom() { runapt apt-cdrom "$@"; } 891s aptget() { runapt apt-get "$@"; } 891s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 891s aptkey() { runapt apt-key "$@"; } 891s aptmark() { runapt apt-mark "$@"; } 891s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 891s apt() { runapt apt "$@"; } 891s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 891s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 891s aptitude() { runapt aptitude "$@"; } 891s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 891s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 891s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 891s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 891s 891s dpkg() { 891s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 891s } 891s dpkgquery() { 891s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 891s } 891s dpkg_version() { 891s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 891s } 891s dpkgcheckbuilddeps() { 891s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 891s } 891s gdb() { 891s local CMD 891s case "$1" in 891s aptget) CMD="apt-get";; 891s aptcache) CMD="apt-cache";; 891s aptcdrom) CMD="apt-cdrom";; 891s aptconfig) CMD="apt-config";; 891s aptmark) CMD="apt-mark";; 891s apthelper) CMD="apt-helper";; 891s aptftparchive) CMD="apt-ftparchive";; 891s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 891s *) CMD="$1";; 891s esac 891s shift 891s if [ "${CMD##*/}" = "$CMD" ]; then 891s CMD="${APTCMDLINEBINDIR}/${CMD}" 891s fi 891s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 891s } 891s 891s valgrind() { 891s local CMD 891s case "$1" in 891s aptget) CMD="apt-get";; 891s aptcache) CMD="apt-cache";; 891s aptcdrom) CMD="apt-cdrom";; 891s aptconfig) CMD="apt-config";; 891s aptmark) CMD="apt-mark";; 891s apthelper) CMD="apt-helper";; 891s aptftparchive) CMD="apt-ftparchive";; 891s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 891s *) CMD="$1";; 891s esac 891s shift 891s if [ "$CMD" = "apt-ftparchive" ]; then 891s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 891s fi 891s if [ "${CMD##*/}" = "$CMD" ]; then 891s CMD="${APTCMDLINEBINDIR}/${CMD}" 891s fi 891s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 891s } 891s 891s lastmodification() { 891s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 891s } 891s releasefiledate() { 891s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 891s } 891s 891s exitwithstatus() { 891s # error if we about to overflow, but ... 891s # "255 failures ought to be enough for everybody" 891s if [ $EXIT_CODE -gt 255 ]; then 891s msgdie "Total failure count $EXIT_CODE too big" 891s fi 891s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 891s } 891s 891s shellsetedetector() { 891s local exit_status=$? 891s if [ "$exit_status" != '0' ]; then 891s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 891s if [ "$EXIT_CODE" = '0' ]; then 891s EXIT_CODE="$exit_status" 891s fi 891s fi 891s } 891s 891s addtrap() { 891s if [ "$1" = 'prefix' ]; then 891s CURRENTTRAP="$2 $CURRENTTRAP" 891s else 891s CURRENTTRAP="$CURRENTTRAP $1" 891s fi 891s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 891s } 891s 891s escape_shell() { 891s echo "$@" | sed -e "s#'#'\"'\"'#g" 891s } 891s 891s find_project_binary_dir() { 891s if [ -z "$PROJECT_BINARY_DIR" ]; then 891s PROJECT_BINARY_DIR= 891s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 891s test -e "$dir/CMakeCache.txt" || continue 891s if [ -z "$PROJECT_BINARY_DIR" ] || 891s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 891s PROJECT_BINARY_DIR="$dir" 891s fi 891s done 891s if [ -z "$PROJECT_BINARY_DIR" ]; then 891s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 891s exit 1 891s fi 891s export PROJECT_BINARY_DIR 891s fi 891s } 891s _removetmpworkingdirectory() { 891s cd / 891s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 891s rm -rf "$TMPWORKINGDIRECTORY" 891s fi 891s TMPWORKINGDIRECTORY='' 891s } 891s setupenvironment() { 891s # cleanup the environment a bit 891s export LC_ALL=C 891s unset LANGUAGE COLUMNS NLSPATH 891s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 891s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 891s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 891s unset GREP_OPTIONS POSIXLY_CORRECT 891s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 891s export GCOV_ERROR_FILE=/dev/null 891s 891s # Next check needs a gnu stat, let's figure that out early. 891s stat=stat 891s if command -v gnustat >/dev/null 2>&1; then 891s stat=gnustat 891s fi 891s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 891s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 891s unset TMPDIR 891s fi 891s if [ -z "$TMPWORKINGDIRECTORY" ]; then 891s addtrap '_removetmpworkingdirectory;' 891s TMPWORKINGDIRECTORY="$(mktemp -d)" 891s fi 891s if [ -n "$TMPDIR_ADD" ]; then 891s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 891s mkdir -p "$TMPWORKINGDIRECTORY" 891s unset TMPDIR_ADD 891s export TMPDIR="$TMPWORKINGDIRECTORY" 891s fi 891s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 891s 891s # Setup coreutils on BSD systems 891s mkdir "${TMPWORKINGDIRECTORY}/bin" 891s for prefix in gnu g; do 891s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 891s if command -v $prefix$command 2>/dev/null >/dev/null; then 891s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 891s fi 891s done 891s done 891s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 891s 891s if [ -z "$TESTDIRECTORY" ]; then 891s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 891s fi 891s cd "$TMPWORKINGDIRECTORY" 891s 891s mkdir -m 700 'downloaded' 891s if [ "$(id -u)" = '0' ]; then 891s # relax permissions so that running as root with user switching works 891s umask 022 891s chmod 711 "$TMPWORKINGDIRECTORY" 891s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 891s fi 891s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 891s 891s _setupprojectenvironment 891s 891s # create some files in /tmp and look at user/group to get what this means 891s TEST_DEFAULT_USER="$(id -un)" 891s touch "${TMPWORKINGDIRECTORY}/test-file" 891s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 891s 891s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 891s . "${TESTDIRECTORY}/extra-environment" 891s fi 891s 891s msgdone "info" 891s } 891s _setupprojectenvironment() { 891s # allow overriding the default BUILDDIR locations 891s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 891s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 891s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 891s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 891s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 891s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 891s APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 891s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 891s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 891s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 891s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 891s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 891s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 891s 891s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 891s mkdir aptarchive keys 891s cd rootdir 891s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 891s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 891s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 891s touch var/lib/dpkg/available var/lib/dpkg/lock 891s echo '1' > var/lib/dpkg/info/format 891s ln -s "${METHODSDIR}" usr/lib/apt/methods 891s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 891s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 891s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 891s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 891s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 891s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 891s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 891s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 891s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 891s else 891s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 891s fi 891s cd .. 891s local BASENAME="${0##*/}" 891s local PACKAGESFILE="Packages-${BASENAME#*-}" 891s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 891s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 891s fi 891s local SOURCESSFILE="Sources-${BASENAME#*-}" 891s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 891s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 891s fi 891s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 891s chmod 644 keys/* 891s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 891s 891s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 891s echo "Dir::Etc \"etc\";" >> aptconfig.conf 891s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 891s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 891s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 891s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 891s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 891s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 891s # either store apt-key were we can access it, even if we run it as a different user 891s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 891s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 891s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 891s # destroys coverage reporting though, so we disable changing user for the calling gpgv 891s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 891s if [ "$(id -u)" = '0' ]; then 891s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 891s # same for the solver executables 891s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 891s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 891s fi 891s 891s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 891s EXEC='' 891s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 891s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 891s restoredpkgstatus() { 891s if [ -n "\$BACKUP" ]; then 891s if [ -e "\$BACKUP" ]; then 891s mv -f "\$BACKUP" "\$ORIGINAL" 891s else 891s rm -f "\$ORIGINAL" 891s fi 891s BACKUP='' 891s fi 891s } 891s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 891s if [ -e "\$ORIGINAL" ]; then 891s cp -a "\$ORIGINAL" "\$BACKUP" 891s fi 891s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 891s 891s Package: dpkg 891s Architecture: all 891s Version: ${DPKG_VERSION}+fake 891s Status: install ok installed 891s Maintainer: Joe Sixpack 891s Installed-Size: 42 891s Description: tells dpkg it supports what we need 891s Some versions of dpkg check its own version from the status file 891s to know if it supports multi-arch and stuff in --assert-*. 891s 891s EOS 891s fi 891s EOF 891s fi 891s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 891s 891s { 891s echo 'quiet "0";' 891s echo 'quiet::NoUpdate "true";' 891s echo 'quiet::NoStatistic "true";' 891s # too distracting for users, but helpful to detect changes 891s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 891s echo 'Acquire::Progress::Diffpercent "true";' 891s # in testcases, it can appear as if localhost has a rotation setup, 891s # hide this as we can't really deal with it properly 891s echo 'Acquire::Failure::ShowIP "false";' 891s # randomess and tests don't play well together 891s echo 'Acquire::IndexTargets::Randomized "false";' 891s # fakeroot can't fake everything, so disabled in production but good for tests 891s echo 'APT::Sandbox::Verify "true";' 891s } >> aptconfig.conf 891s 891s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 891s if [ "$(id -u)" = '0' ]; then 891s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 891s fi 891s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 891s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 891s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 891s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 891s # Allow release files to be 10 hours in the future, rather than 10 seconds 891s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 891s 891s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 891s 891s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 891s confighashes 'SHA256' # these are tests, not security best-practices 891s 891s # Make dpkg inherit testing path 891s echo 'DPkg::Path "";' >> aptconfig.conf 891s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 891s 891s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 891s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 891s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 891s fi 891s 891s # most tests just need one signed Release file, not both 891s export APT_DONT_SIGN='Release.gpg' 891s 891s # prefer our apt binaries over the system apt binaries 891s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 891s } 891s 891s getarchitecture() { 891s if [ "$1" = "native" -o -z "$1" ]; then 891s eval `aptconfig shell ARCH APT::Architecture` 891s if [ -n "$ARCH" ]; then 891s echo $ARCH 891s else 891s dpkg --print-architecture 891s fi 891s else 891s echo $1 891s fi 891s } 891s 891s getarchitectures() { 891s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 891s } 891s 891s getarchitecturesfromcommalist() { 891s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 891s } 891s 891s configarchitecture() { 891s { 891s echo "APT::Architecture \"$(getarchitecture $1)\";" 891s while [ -n "$1" ]; do 891s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 891s shift 891s done 891s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 891s configdpkg 891s } 891s 891s configdpkg() { 891s if [ ! -e rootdir/var/lib/dpkg/status ]; then 891s local BASENAME="${0##*/}" 891s local STATUSFILE="status-${BASENAME#*-}" 891s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 891s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 891s # Add an empty line to the end if there is none 891s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 891s echo >> rootdir/var/lib/dpkg/status 891s fi 891s fi 891s fi 891s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 891s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 891s local ARCHS="$(getarchitectures)" 891s local DPKGARCH="$(dpkg --print-architecture)" 891s # this ensures that even if multi-arch isn't active in the view 891s # of apt, given that dpkg can't be told which arch is native 891s # the arch apt treats as native might be foreign for dpkg 891s for ARCH in ${ARCHS}; do 891s if [ "${ARCH}" != "${DPKGARCH}" ]; then 891s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 891s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 891s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 891s else 891s # old-style used e.g. in Ubuntu-P – and as it seems travis 891s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 891s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 891s fi 891s fi 891s fi 891s done 891s else 891s # test multiarch before dpkg is ready for it… 891s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 891s fi 891s } 891s 891s configdpkgnoopchroot() { 891s # create a library to noop chroot() and rewrite maintainer script executions 891s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 891s # chroot directory dpkg could chroot into to execute the maintainer scripts 891s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 891s cat > noopchroot.c << EOF 891s #define _GNU_SOURCE 891s #include 891s #include 891s #include 891s #include 891s 891s static char * chrootdir = NULL; 891s 891s int chroot(const char *path) { 891s printf("WARNING: CHROOTing to %s was ignored!\n", path); 891s free(chrootdir); 891s chrootdir = strdup(path); 891s return 0; 891s } 891s int execvp(const char *file, char *const argv[]) { 891s static int (*func_execvp) (const char *, char * const []) = NULL; 891s if (func_execvp == NULL) 891s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 891s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 891s return func_execvp(file, argv); 891s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 891s char *newfile; 891s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 891s perror("asprintf"); 891s return -1; 891s } 891s char const * const baseadmindir = "/var/lib/dpkg"; 891s char *admindir; 891s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 891s perror("asprintf"); 891s return -1; 891s } 891s setenv("DPKG_ADMINDIR", admindir, 1); 891s return func_execvp(newfile, argv); 891s } 891s EOF 891s if cc -ldl 2>&1 | grep -q dl; then 891s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 891s else 891s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 891s fi 891s } 891s configcompression() { 891s if [ "$1" = 'ALL' ]; then 891s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 891s return 891s fi 891s local CMD='apthelper cat-file -C' 891s while [ -n "$1" ]; do 891s case "$1" in 891s '.') printf ".\t.\tcat\n";; 891s 'gz') printf "gzip\tgz\t$CMD $1\n";; 891s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 891s 'zst') printf "zstd\tzst\t$CMD $1\n";; 891s *) printf "$1\t$1\t$CMD $1\n";; 891s esac 891s shift 891s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 891s } 891s confighashes() { 891s { 891s echo 'APT::FTPArchive {' 891s { 891s while [ -n "$1" ]; do 891s printf "$1" | tr 'a-z' 'A-Z' 891s printf "\t\"true\";\n" 891s shift 891s done 891s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 891s printf "$h\t\"false\";\n" 891s done 891s } | awk '!x[$1]++' 891s echo '};' 891s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 891s } 891s forcecompressor() { 891s COMPRESSOR="$1" 891s COMPRESS="$1" 891s COMPRESSOR_CMD="apthelper cat-file -C $1" 891s case $COMPRESSOR in 891s gzip) COMPRESS='gz';; 891s bzip2) COMPRESS='bz2';; 891s zstd) COMPRESS='zst';; 891s esac 891s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 891s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 891s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 891s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 891s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 891s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 891s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 891s done 891s } 891s 891s _setupsimplenativepackage() { 891s local NAME="$1" 891s local ARCH="$2" 891s local VERSION="$3" 891s local RELEASE="${4:-unstable}" 891s local DEPENDENCIES="$5" 891s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 891s If you find such a package installed on your system, 891s something went horribly wrong! They are autogenerated 891s and used only by testcases and serve no other purpose…}" 891s 891s local SECTION="${7:-others}" 891s local PRIORITY="${8:-optional}" 891s local FILE_TREE="$9" 891s local COMPRESS_TYPE="${10:-gzip}" 891s local DISTSECTION 891s if [ "$SECTION" = "${SECTION#*/}" ]; then 891s DISTSECTION="main" 891s else 891s DISTSECTION="${SECTION%/*}" 891s fi 891s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 891s 891s mkdir -p "$BUILDDIR/debian/source" 891s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 891s echo "#!/bin/sh 891s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 891s 891s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 891s echo "$NAME ($VERSION) $RELEASE; urgency=low 891s 891s * Initial release 891s 891s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 891s { 891s echo "Source: $NAME 891s Priority: $PRIORITY 891s Maintainer: Joe Sixpack 891s Standards-Version: 4.3.1 891s Rules-Requires-Root: no" 891s if [ "$SECTION" != '' ]; then 891s echo "Section: $SECTION" 891s fi 891s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 891s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 891s echo " 891s Package: $NAME" 891s 891s if [ "$ARCH" = 'all' ]; then 891s echo "Architecture: all" 891s else 891s echo "Architecture: any" 891s fi 891s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 891s test -z "$DEPS" || echo "$DEPS" 891s printf "%b\n" "Description: $DESCRIPTION" 891s } > "${BUILDDIR}/debian/control" 891s 891s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 891s } 891s 891s make_tiny_rules() { 891s local OUT="$1" 891s if command -v gmake >/dev/null 2>&1; then 891s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 891s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 891s else 891s echo '#!/usr/bin/make -f' > "$OUT" 891s fi 891s echo '%:' >> "$OUT" 891s echo ' dh $@' >> "$OUT" 891s } 891s 891s setupsimplenativepackage() { 891s _setupsimplenativepackage "$@" 891s local NAME="$1" 891s local VERSION="$3" 891s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 891s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 891s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 891s } 891s 891s buildsimplenativepackage() { 891s local NAME="$1" 891s local ARCH="$2" 891s local VERSION="$3" 891s local RELEASE="${4:-unstable}" 891s local DEPENDENCIES="$5" 891s local DESCRIPTION="$6" 891s local SECTION="${7:-others}" 891s local PRIORITY="${8:-optional}" 891s local FILE_TREE="$9" 891s local COMPRESS_TYPE="${10:-gzip}" 891s local DISTSECTION 891s if [ "$SECTION" = "${SECTION#*/}" ]; then 891s DISTSECTION="main" 891s else 891s DISTSECTION="${SECTION%/*}" 891s fi 891s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 891s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 891s _setupsimplenativepackage "$@" 891s cd "${BUILDDIR}/.." 891s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 891s cd - >/dev/null 891s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 891s | while read SRC; do 891s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 891s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 891s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 891s # adv --yes --default-key 'Joe Sixpack' \ 891s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 891s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 891s # fi 891s done 891s 891s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 891s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 891s rm -rf "${BUILDDIR}/debian/tmp" 891s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 891s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 891s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 891s if [ -n "$FILE_TREE" ]; then 891s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 891s fi 891s 891s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 891s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 891s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 891s # ensure the right permissions as dpkg-deb insists 891s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 891s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 891s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 891s done 891s 891s local NM 891s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 891s NM="$(echo "$NAME" | cut -c 1-4)" 891s else 891s NM="$(echo "$NAME" | cut -c 1)" 891s fi 891s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 891s mkdir -p "$CHANGEPATH" 891s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 891s rm -rf "${BUILDDIR}" 891s msgdone "info" 891s } 891s 891s buildpackage() { 891s local BUILDDIR=$1 891s local RELEASE=$2 891s local SECTION=$3 891s local ARCH=$(getarchitecture $4) 891s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 891s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 891s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 891s cd "$BUILDDIR" 891s if [ "$ARCH" = "all" ]; then 891s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 891s fi 891s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 891s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 891s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 891s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 891s cd - > /dev/null 891s for PKG in $PKGS; do 891s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 891s done 891s for SRC in $SRCS; do 891s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 891s done 891s } 891s 891s buildaptarchive() { 891s if [ -d incoming ]; then 891s buildaptarchivefromincoming "$@" 891s else 891s buildaptarchivefromfiles "$@" 891s fi 891s } 891s 891s createaptftparchiveconfig() { 891s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 891s local COMPRESSORS="${COMPRESSORS%* }" 891s local ARCHS="$(getarchitectures)" 891s cat > ftparchive.conf <> ftparchive.conf 891s } 891s 891s buildaptftparchivedirectorystructure() { 891s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 891s for DIST in $DISTS; do 891s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 891s for SECTION in $SECTIONS; do 891s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 891s for ARCH in $ARCHS; do 891s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 891s done 891s mkdir -p "dists/${DIST}/${SECTION}/source" 891s mkdir -p "dists/${DIST}/${SECTION}/i18n" 891s done 891s done 891s } 891s 891s insertpackage() { 891s local RELEASES="$1" 891s local NAME="$2" 891s local ARCH="$3" 891s local VERSION="$4" 891s local DEPENDENCIES="$5" 891s local PRIORITY="${6:-optional}" 891s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 891s If you find such a package installed on your system, 891s something went horribly wrong! They are autogenerated 891s and used only by testcases and serve no other purpose…}" 891s local SECTION="${8:-other}" 891s 891s if [ "$SECTION" = "${SECTION#*/}" ]; then 891s DISTSECTION="main" 891s else 891s DISTSECTION="${SECTION%/*}" 891s fi 891s local ARCHS="" 891s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 891s if [ "$RELEASE" = 'installed' ]; then 891s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 891s continue 891s fi 891s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 891s if [ "$arch" = 'none' ]; then 891s ARCHS="$(getarchitectures)" 891s else 891s ARCHS="$arch" 891s fi 891s for BUILDARCH in $ARCHS; do 891s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 891s mkdir -p "$PPATH" 891s { 891s echo "Package: $NAME 891s Priority: $PRIORITY 891s Section: $SECTION 891s Installed-Size: 42 891s Size: 42" 891s if echo "$DEPENDENCIES" | grep -q SHA256:; then 891s : 891s else 891s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 891s fi 891s echo "Maintainer: Joe Sixpack " 891s test "$arch" = 'none' || echo "Architecture: $arch" 891s echo "Version: $VERSION 891s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 891s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 891s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 891s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 891s echo 891s } >> "${PPATH}/Packages" 891s done 891s done 891s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 891s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 891s echo "Package: $NAME 891s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 891s Description-en: $DESCRIPTION 891s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 891s done 891s } 891s 891s insertsource() { 891s local RELEASES="$1" 891s local NAME="$2" 891s local ARCH="$3" 891s local VERSION="$4" 891s local DEPENDENCIES="$5" 891s local BINARY="${6:-$NAME}" 891s local ARCHS="" 891s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 891s local SPATH="aptarchive/dists/${RELEASE}/main/source" 891s mkdir -p $SPATH 891s local FILE="${SPATH}/Sources" 891s local DSCFILE="${NAME}_${VERSION}.dsc" 891s local TARFILE="${NAME}_${VERSION}.tar.gz" 891s echo "Package: $NAME 891s Binary: $BINARY 891s Version: $VERSION 891s Maintainer: Joe Sixpack 891s Architecture: $ARCH" >> $FILE 891s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 891s echo "Files: 891s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 891s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 891s Checksums-Sha256: 891s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 891s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 891s " >> "$FILE" 891s done 891s } 891s 891s insertinstalledpackage() { 891s local NAME="$1" 891s local ARCH="$2" 891s local VERSION="$3" 891s local DEPENDENCIES="$4" 891s local PRIORITY="${5:-optional}" 891s local STATUS="${6:-install ok installed}" 891s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 891s If you find such a package installed on your system, 891s something went horribly wrong! They are autogenerated 891s and used only by testcases and serve no other purpose…}" 891s local SECTION="${8:-other}" 891s 891s local FILE='rootdir/var/lib/dpkg/status' 891s local INFO='rootdir/var/lib/dpkg/info' 891s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 891s echo "Package: $NAME 891s Status: $STATUS 891s Priority: $PRIORITY 891s Section: $SECTION 891s Installed-Size: 42 891s Maintainer: Joe Sixpack 891s Version: $VERSION" >> "$FILE" 891s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 891s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 891s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 891s echo >> "$FILE" 891s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 891s echo -n > "${INFO}/${NAME}:${arch}.list" 891s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 891s else 891s echo -n > "${INFO}/${NAME}.list" 891s echo -n > "${INFO}/${NAME}.md5sums" 891s fi 891s done 891s } 891s 891s 891s buildaptarchivefromincoming() { 891s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 891s cd aptarchive 891s [ -e pool ] || ln -s ../incoming pool 891s [ -e ftparchive.conf ] || createaptftparchiveconfig 891s [ -e dists ] || buildaptftparchivedirectorystructure 891s msgninfo "\tGenerate Packages, Sources and Contents files… " 891s testsuccess aptftparchive generate ftparchive.conf 891s cd - > /dev/null 891s msgdone "info" 891s generatereleasefiles "$@" 891s } 891s 891s buildaptarchivefromfiles() { 891s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 891s local DIR='aptarchive' 891s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 891s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 891s msgninfo "\t${line} file… " 891s compressfile "$line" "$1" 891s msgdone "info" 891s done 891s generatereleasefiles "$@" 891s } 891s 891s compressfile() { 891s while read compressor extension command; do 891s if [ "$compressor" = '.' ]; then 891s if [ -n "$2" ]; then 891s touch -d "$2" "$1" 891s fi 891s continue 891s fi 891s cat "$1" | $command > "${1}.${extension}" 891s if [ -n "$2" ]; then 891s touch -d "$2" "${1}.${extension}" 891s fi 891s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 891s } 891s 891s # can be overridden by testcases for their pleasure 891s getcodenamefromsuite() { 891s case "$1" in 891s unstable) echo 'sid';; 891s *) echo -n "$1";; 891s esac 891s } 891s getreleaseversionfromsuite() { true; } 891s getlabelfromsuite() { true; } 891s getoriginfromsuite() { true; } 891s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 891s getnotautomaticfromsuite() { 891s case "$1" in 891s experimental|experimental2) echo "yes";; 891s esac 891s } 891s getbutautomaticupgradesfromsuite() { true; } 891s 891s aptftparchiverelease() { 891s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 891s } 891s generatereleasefiles() { 891s # $1 is the Date header and $2 is the ValidUntil header to be set 891s # both should be given in notation date/touch can understand 891s local DATE="$1" 891s local VALIDUNTIL="$2" 891s if [ -e aptarchive/dists ]; then 891s msgninfo "\tGenerate Release files for dists… " 891s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 891s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 891s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 891s local CODENAME="$(getcodenamefromsuite $SUITE)" 891s local VERSION="$(getreleaseversionfromsuite $SUITE)" 891s local LABEL="$(getlabelfromsuite $SUITE)" 891s local ORIGIN="$(getoriginfromsuite $SUITE)" 891s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 891s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 891s aptftparchiverelease "$dir" \ 891s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 891s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 891s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 891s -o APT::FTPArchive::Release::Label="${LABEL}" \ 891s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 891s -o APT::FTPArchive::Release::Version="${VERSION}" \ 891s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 891s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 891s > "$dir/Release" 891s done 891s else 891s msgninfo "\tGenerate Release files for flat… " 891s aptftparchiverelease ./aptarchive > aptarchive/Release 891s fi 891s if [ -n "$VALIDUNTIL" ]; then 891s sed -i "/^Date: / a\ 891s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 891s fi 891s if [ -n "$DATE" -a "$DATE" != "now" ]; then 891s for release in $(find ./aptarchive -name 'Release'); do 891s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 891s touch -d "$DATE" "$release" 891s done 891s fi 891s msgdone "info" 891s } 891s 891s setupdistsaptarchive() { 891s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 891s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 891s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 891s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 891s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 891s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 891s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 891s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 891s msgdone "info" 891s done 891s } 891s 891s setupflataptarchive() { 891s local APTARCHIVE="$(readlink -f ./aptarchive)" 891s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 891s if [ -f "${APTARCHIVE}/Packages" ]; then 891s msgninfo "\tadd deb sources.list line… " 891s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 891s msgdone 'info' 891s else 891s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 891s fi 891s if [ -f "${APTARCHIVE}/Sources" ]; then 891s msgninfo "\tadd deb-src sources.list line… " 891s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 891s msgdone 'info' 891s else 891s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 891s fi 891s } 891s 891s setupaptarchive() { 891s local NOUPDATE=0 891s if [ "$1" = '--no-update' ]; then 891s NOUPDATE=1 891s shift 891s fi 891s buildaptarchive "$@" 891s if [ -e aptarchive/dists ]; then 891s setupdistsaptarchive 891s else 891s setupflataptarchive 891s fi 891s signreleasefiles 'Joe Sixpack' 891s if [ "1" != "$NOUPDATE" ]; then 891s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 891s fi 891s } 891s 891s killgpgagent() { 891s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 891s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 891s if [ ! -e "${GPGHOME}" ]; then return; fi 891s # ensure the agent dies quickly as different versions have different suicide heuristics 891s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 891s rm -rf "$GPGHOME" 891s } 891s dosigning() { 891s local KEY="$1" 891s shift 891s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 891s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 891s GPGHOME="$APT_TEST_SIGNINGHOME" 891s else 891s if [ ! -e "$GPGHOME" ]; then 891s mkdir -p --mode=700 "${GPGHOME}" 891s addtrap 'prefix' 'killgpgagent;' 891s fi 891s fi 891s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 891s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 891s "$@" 891s } 891s signreleasefiles() { 891s local SIGNERS="${1:-Joe Sixpack}" 891s local REPODIR="${2:-aptarchive}" 891s if [ -n "$1" ]; then shift; fi 891s if [ -n "$1" ]; then shift; fi 891s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 891s msgninfo "\tSign archive with $SIGNERS key $KEY… " 891s local REXKEY='keys/rexexpired' 891s local SECEXPIREBAK="${REXKEY}.sec.bak" 891s local PUBEXPIREBAK="${REXKEY}.pub.bak" 891s local SIGUSERS="" 891s while [ -n "${SIGNERS%%,*}" ]; do 891s local SIGNER="${SIGNERS%%,*}" 891s if [ "${SIGNERS}" = "${SIGNER}" ]; then 891s SIGNERS="" 891s fi 891s SIGNERS="${SIGNERS#*,}" 891s # FIXME: This should be the full name, but we can't encode the space properly currently 891s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 891s if [ "${SIGNER}" = 'Rex Expired' ]; then 891s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 891s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 891s # therefore we 'temporary' make the key not expired and restore a backup after signing 891s cp "${REXKEY}.sec" "$SECEXPIREBAK" 891s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 891s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 891s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 891s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 891s cp "$SECUNEXPIRED" "${REXKEY}.sec" 891s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 891s else 891s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 891s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 891s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 891s cat setexpire.gpg 891s exit 1 891s fi 891s cp "${REXKEY}.sec" "$SECUNEXPIRED" 891s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 891s fi 891s fi 891s if [ ! -e "${KEY}.pub" ]; then 891s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 891s cat "${K}.pub" >> "${KEY}.new.pub" 891s cat "${K}.sec" >> "${KEY}.new.sec" 891s fi 891s done 891s if [ ! -e "${KEY}.pub" ]; then 891s mv "${KEY}.new.pub" "${KEY}.pub" 891s mv "${KEY}.new.sec" "${KEY}.sec" 891s fi 891s for RELEASE in $(find "${REPODIR}/" -name Release); do 891s # we might have set a specific date for the Release file, so copy it 891s local DATE="$(stat --format "%y" "${RELEASE}")" 891s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 891s rm -f "${RELEASE}.gpg" 891s else 891s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 891s touch -d "$DATE" "${RELEASE}.gpg" 891s fi 891s local INRELEASE="${RELEASE%/*}/InRelease" 891s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 891s rm -f "$INRELEASE" 891s else 891s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 891s touch -d "$DATE" "${INRELEASE}" 891s fi 891s done 891s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 891s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 891s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 891s fi 891s msgdone 'info' 891s } 891s 891s redatereleasefiles() { 891s local DATE="$(date -u -d "$1" -R)" 891s for release in $(find aptarchive/ -name 'Release'); do 891s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 891s touch -d "$DATE" "$release" 891s done 891s signreleasefiles "${2:-Joe Sixpack}" 891s } 891s 891s webserverconfig() { 891s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 891s local NOCHECK=false 891s if [ "$1" = '--no-check' ]; then 891s NOCHECK=true 891s shift 891s fi 891s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 891s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 891s rm -f "$STATUS" "$DOWNLOG" 891s local URI 891s if [ -n "$2" ]; then 891s msgtest "Set webserver config option '${1}' to" "$2" 891s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 891s else 891s msgtest 'Clear webserver config option' "${1}" 891s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 891s fi 891s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 891s msgpass 891s else 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 891s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 891s msgfailoutput '' "$OUTPUT" 891s fi 891s $NOCHECK || testwebserverlaststatuscode '200' 891s } 891s 891s rewritesourceslist() { 891s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 891s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 891s sed -i $LIST \ 891s -e "s#file://$APTARCHIVE#${1}#" \ 891s -e "s#file:$APTARCHIVE#${1}#" \ 891s -e "s#copy://$APTARCHIVE#${1}#" \ 891s -e "s#copy:$APTARCHIVE#${1}#" \ 891s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 891s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 891s done 891s } 891s 891s # wait for up to 10s for a pid file to appear to avoid possible race 891s # when a helper is started and doesn't write the PID quick enough 891s waitforpidfile() { 891s local PIDFILE="$1" 891s for i in $(seq 10); do 891s if test -s "$PIDFILE"; then 891s return 0 891s fi 891s sleep 1 891s done 891s msgdie "waiting for $PIDFILE failed" 891s return 1 891s } 891s 891s changetowebserver() { 891s local REWRITE='yes' 891s if [ "$1" = '--no-rewrite' ]; then 891s REWRITE='no' 891s shift 891s fi 891s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 891s cd aptarchive 891s local LOG="webserver.log" 891s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 891s cat "$LOG" 891s false 891s fi 891s waitforpidfile aptwebserver.pid 891s local PID="$(cat aptwebserver.pid)" 891s if [ -z "$PID" ]; then 891s msgdie 'Could not fork aptwebserver successfully' 891s fi 891s addtrap "kill $PID;" 891s waitforpidfile aptwebserver.port 891s APTHTTPPORT="$(cat aptwebserver.port)" 891s if [ -z "$APTHTTPPORT" ]; then 891s msgdie 'Could not get port for aptwebserver successfully' 891s fi 891s cd - > /dev/null 891s else 891s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 891s fi 891s if [ "$REWRITE" != 'no' ]; then 891s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 891s fi 891s } 891s 891s changetohttpswebserver() { 891s local REWRITE='yes' 891s if [ "$1" = '--no-rewrite' ]; then 891s REWRITE='no' 891s shift 891s fi 891s local stunnel4 891s if command -v stunnel4 >/dev/null 2>&1; then 891s stunnel4=stunnel4 891s elif command -v stunnel >/dev/null 2>&1; then 891s stunnel4=stunnel 891s else 891s msgdie 'You need to install stunnel4 for https testcases' 891s fi 891s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 891s changetowebserver --no-rewrite "$@" 891s fi 891s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 891s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 891s output = /dev/null 891s 891s [https] 891s accept = 127.0.0.1:0 891s connect = $APTHTTPPORT 891s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 891s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 891s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 891s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 891s if [ -z "$PID" ]; then 891s msgdie 'Could not fork $stunnel4 successfully' 891s fi 891s addtrap 'prefix' "kill ${PID};" 891s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 891s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 891s if [ "$REWRITE" != 'no' ]; then 891s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 891s fi 891s } 891s 891s changetocdrom() { 891s mkdir -p rootdir/media/cdrom/.disk 891s local CD="$(readlink -f rootdir/media/cdrom)" 891s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 891s if [ ! -d aptarchive/dists ]; then 891s msgdie 'Flat file archive cdroms can not be created currently' 891s return 1 891s fi 891s mv aptarchive/dists "$CD" 891s ln -s "$(readlink -f ./incoming)" "$CD/pool" 891s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 891s # start with an unmounted disk 891s mv "${CD}" "${CD}-unmounted" 891s # we don't want the disk to be modifiable 891s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 891s chmod -R 555 rootdir/media/cdrom-unmounted/dists 891s } 891s 891s downloadfile() { 891s local PROTO="${1%%:*}" 891s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 891s download-file "$1" "$2" "$3" 2>&1 ; then 891s return 1 891s fi 891s # only if the file exists the download was successful 891s if [ -r "$2" ]; then 891s return 0 891s else 891s return 1 891s fi 891s } 891s 891s cleanup_output() { 891s cat "$1" | sed \ 891s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 891s -e '/^profiling:/ d' \ 891s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 891s >"$2" 891s } 891s 891s checkdiff() { 891s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 891s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 891s touch "$TMPFILE1" "$TMPFILE2" 891s 891s cleanup_output "$1" "$TMPFILE1" 891s cleanup_output "$2" "$TMPFILE2" 891s 891s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 891s if [ -n "$DIFFTEXT" ]; then 891s echo >&2 891s echo >&2 "$DIFFTEXT" 891s return 1 891s else 891s return 0 891s fi 891s } 891s 891s testoutputequal() { 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 891s local COMPAREFILE="$1" 891s shift 891s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 891s msgpass 891s else 891s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 891s cat "$COMPAREFILE" >>"${OUTPUT}" 891s msgfailoutput '' "$OUTPUT" "$@" 891s fi 891s } 891s 891s testfileequal() { 891s msggroup 'testfileequal' 891s local MSG='Test for correctness of file' 891s if [ "$1" = '--nomsg' ]; then 891s MSG='' 891s shift 891s fi 891s local FILE="$1" 891s shift 891s if [ -n "$MSG" ]; then 891s msgtest "$MSG" "$FILE" 891s fi 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 891s if [ -z "$*" ]; then 891s testoutputequal "$FILE" echo -n '' 891s else 891s testoutputequal "$FILE" echo "$*" 891s fi 891s msggroup 891s } 891s 891s testempty() { 891s msggroup 'testempty' 891s if [ "$1" = '--nomsg' ]; then 891s shift 891s else 891s msgtest "Test for no output of" "$*" 891s fi 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 891s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 891s msgpass 891s else 891s msgfailoutput '' "$COMPAREFILE" "$@" 891s fi 891s aptautotest 'testempty' "$@" 891s msggroup 891s } 891s testwarningempty() { 891s testwarning "$@" 891s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 891s } 891s testnotempty() { 891s msggroup 'testnotempty' 891s msgtest "Test for some output of" "$*" 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 891s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 891s msgpass 891s else 891s msgfailoutput '' "$COMPAREFILE" "$@" 891s fi 891s aptautotest 'testnotempty' "$@" 891s msggroup 891s } 891s 891s testequal() { 891s msggroup 'testequal' 891s local MSG='Test of equality of' 891s if [ "$1" = '--nomsg' ]; then 891s MSG='' 891s shift 891s fi 891s 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 891s echo "$1" > "$COMPAREFILE" 891s shift 891s 891s if [ -n "$MSG" ]; then 891s msgtest "$MSG" "$*" 891s fi 891s testoutputequal "$COMPAREFILE" "$@" 891s aptautotest 'testequal' "$@" 891s msggroup 891s } 891s 891s testequalor2() { 891s msggroup 'testequalor2' 891s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 891s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 891s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 891s echo "$1" > "$COMPAREFILE1" 891s echo "$2" > "$COMPAREFILE2" 891s shift 2 891s msgtest "Test for equality OR of" "$*" 891s "$@" >"$COMPAREAGAINST" 2>&1 || true 891s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 891s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 891s then 891s msgpass 891s else 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 891s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 891s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 891s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 891s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 891s msgfailoutput '' "$OUTPUT" 891s fi 891s aptautotest 'testequalor2' "$@" 891s msggroup 891s } 891s 891s testshowvirtual() { 891s msggroup 'testshowvirtual' 891s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 891s local PACKAGE="$1" 891s shift 891s while [ -n "$1" ]; do 891s VIRTUAL="${VIRTUAL} 891s N: Can't select versions from package '$1' as it is purely virtual" 891s PACKAGE="${PACKAGE} $1" 891s shift 891s done 891s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 891s VIRTUAL="${VIRTUAL} 891s N: No packages found" 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 891s local ARCH="$(getarchitecture 'native')" 891s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 891s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 891s msggroup 891s } 891s 891s testnopackage() { 891s msggroup 'testnopackage' 891s msgtest "Test for non-existent packages" "apt-cache show $*" 891s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 891s if [ -n "$SHOWPKG" ]; then 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 891s echo "$SHOWPKG" >"$OUTPUT" 891s msgfailoutput '' "$OUTPUT" 891s else 891s msgpass 891s fi 891s msggroup 891s } 891s testnosrcpackage() { 891s msggroup 'testnosrcpackage' 891s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 891s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 891s if [ -n "$SHOWPKG" ]; then 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 891s echo "$SHOWPKG" >"$OUTPUT" 891s msgfailoutput '' "$OUTPUT" 891s else 891s msgpass 891s fi 891s msggroup 891s } 891s 891s testdpkgstatus() { 891s msggroup 'testdpkgstatus' 891s local STATE="$1" 891s local NR="$2" 891s shift 2 891s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 891s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 891s if [ "$PKGS" != $NR ]; then 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 891s echo "$PKGS" >"$OUTPUT" 891s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 891s msgfailoutput '' "$OUTPUT" 891s else 891s msgpass 891s fi 891s msggroup 891s } 891s 891s testdpkginstalled() { 891s msggroup 'testdpkginstalled' 891s testdpkgstatus 'ii' "$#" "$@" 891s msggroup 891s } 891s 891s testdpkgnotinstalled() { 891s msggroup 'testdpkgnotinstalled' 891s testdpkgstatus 'ii' '0' "$@" 891s msggroup 891s } 891s 891s testmarkedauto() { 891s msggroup 'testmarkedauto' 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 891s if [ -n "$1" ]; then 891s msgtest 'Test for correctly marked as auto-installed' "$*" 891s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 891s else 891s msgtest 'Test for correctly marked as auto-installed' 'no package' 891s echo -n > "$COMPAREFILE" 891s fi 891s testoutputequal "$COMPAREFILE" aptmark showauto 891s msggroup 891s } 891s testmarkedmanual() { 891s msggroup 'testmarkedmanual' 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 891s if [ -n "$1" ]; then 891s msgtest 'Test for correctly marked as manually installed' "$*" 891s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 891s else 891s msgtest 'Test for correctly marked as manually installed' 'no package' 891s echo -n > "$COMPAREFILE" 891s fi 891s testoutputequal "$COMPAREFILE" aptmark showmanual 891s msggroup 891s } 891s 891s catfile() { 891s if [ "${1##*.}" = 'deb' ]; then 891s stat >&2 "$1" || true 891s file >&2 "$1" || true 891s else 891s cat >&2 "$1" || true 891s fi 891s } 891s msgfailoutput() { 891s msgreportheader 'msgfailoutput' 891s local MSG="$1" 891s local OUTPUT="$2" 891s shift 2 891s local CMD="$1" 891s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 891s echo >&2 891s while [ -n "$2" ]; do shift; done 891s echo "#### Complete file: $1 ####" 891s catfile "$1" 891s echo "#### $CMD output ####" 891s elif [ "$1" = 'test' ]; then 891s echo >&2 891s # doesn't support ! or non-file flags 891s msgfailoutputstatfile() { 891s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 891s if expr match "$1" "$FILEFLAGS" >/dev/null; then 891s echo "#### stat(2) of file: $2 ####" 891s stat "$2" || true 891s if test -d "$2"; then 891s echo "#### The directory contains: $2 ####" 891s ls >&2 "$2" || true 891s elif test -e "$2"; then 891s echo "#### Complete file: $2 ####" 891s catfile "$2" 891s fi 891s fi 891s } 891s msgfailoutputstatfile "$2" "$3" 891s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 891s shift 3 891s msgfailoutputstatfile "$2" "$3" 891s done 891s echo '#### test output ####' 891s elif [ "$1" = 'cmp' ]; then 891s echo >&2 891s while [ -n "$2" ]; do 891s echo "#### Complete file: $2 ####" 891s catfile "$2" 891s shift 891s done 891s echo '#### cmp output ####' 891s elif [ "$1" = 'rm' ]; then 891s echo "#### Directory listing of: $(pwd) ####" 891s ls -l 891s fi 891s catfile "$OUTPUT" 891s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 891s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 891s local COREEXE='' 891s for CORENAME in 'core' 'core.pid'; do 891s if [ -s "$CORENAME" ]; then 891s cp -a ${CORENAME} "$COREDUMP" 891s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 891s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 891s else 891s continue 891s fi 891s break 891s done 891s if [ -s "$COREDUMP" ]; then 891s true # found already as a file 891s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 891s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 891s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 891s else 891s echo '### core dump not found ###' 891s cat /proc/sys/kernel/core_pattern 891s fi 891s if [ -s "$COREDUMP" ]; then 891s if [ -z "$COREEXE" ]; then 891s case "$CMD" in 891s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 891s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 891s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 891s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 891s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 891s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 891s esac 891s fi 891s 891s if [ -d "${ARTIFACTSDIR}" ]; then 891s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 891s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 891s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 891s fi 891s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 891s echo "#### gdb backtrace ####" 891s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 891s fi 891s fi 891s rm -f "$COREDUMP" 891s fi 891s msgfail "$MSG" 891s } 891s 891s testsuccesswithglobalerror() { 891s local TYPE="$1" 891s local ERRORS="$2" 891s shift 2 891s msggroup "$TYPE" 891s if [ "$1" = '--nomsg' ]; then 891s shift 891s else 891s msgtest 'Test for successful execution of' "$*" 891s fi 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 891s if "$@" >"${OUTPUT}" 2>&1; then 891s if expr match "$1" '^apt.*' >/dev/null; then 891s if grep -q -E ' runtime error: ' "$OUTPUT"; then 891s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 891s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 891s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 891s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 891s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 891s msgpass 891s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 891s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 891s msgpass 891s else 891s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 891s fi 891s else 891s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 891s fi 891s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 891s if grep -q -E "^N: " "$OUTPUT"; then 891s msgpass 891s else 891s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 891s fi 891s else 891s msgpass 891s fi 891s else 891s msgpass 891s fi 891s else 891s local EXITCODE=$? 891s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 891s fi 891s aptautotest "$TYPE" "$@" 891s msggroup 891s } 891s testsuccesswithnotice() { 891s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 891s } 891s testsuccess() { 891s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 891s } 891s testwarning() { 891s msggroup 'testwarning' 891s if [ "$1" = '--nomsg' ]; then 891s shift 891s else 891s msgtest 'Test for successful execution with warnings of' "$*" 891s fi 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 891s if "$@" >"${OUTPUT}" 2>&1; then 891s if expr match "$1" '^apt.*' >/dev/null; then 891s if grep -q -E ' runtime error: ' "$OUTPUT"; then 891s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 891s elif grep -q -E '^E: ' "$OUTPUT"; then 891s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 891s elif ! grep -q -E '^W: ' "$OUTPUT"; then 891s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 891s else 891s msgpass 891s fi 891s else 891s msgpass 891s fi 891s else 891s local EXITCODE=$? 891s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 891s fi 891s aptautotest 'testwarning' "$@" 891s msggroup 891s } 891s testfailure() { 891s msggroup 'testfailure' 891s if [ "$1" = '--nomsg' ]; then 891s shift 891s else 891s msgtest 'Test for failure in execution of' "$*" 891s fi 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 891s if "$@" >"${OUTPUT}" 2>&1; then 891s local EXITCODE=$? 891s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 891s else 891s local EXITCODE=$? 891s if expr match "$1" '^apt.*' >/dev/null; then 891s if [ "$1" = 'aptkey' ]; then 891s if grep -q " Can't check signature: 891s BAD signature from 891s signature could not be verified" "$OUTPUT"; then 891s msgpass 891s else 891s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 891s fi 891s else 891s if grep -q -E ' runtime error: ' "$OUTPUT"; then 891s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 891s elif grep -q -E '==ERROR' "$OUTPUT"; then 891s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 891s elif ! grep -q -E '^E: ' "$OUTPUT"; then 891s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 891s else 891s msgpass 891s fi 891s fi 891s else 891s msgpass 891s fi 891s fi 891s aptautotest 'testfailure' "$@" 891s msggroup 891s } 891s 891s testreturnstateequal() { 891s local STATE="$1" 891s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 891s local STATE="$2" 891s local TYPE="$3" 891s shift 3 891s msggroup "${STATE}equal" 891s if [ "$1" != '--nomsg' ]; then 891s local CMP="$1" 891s shift 891s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 891s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 891s else 891s local CMP="$2" 891s shift 2 891s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 891s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 891s fi 891s else 891s msggroup "${STATE}equal" 891s if [ "$2" != '--nomsg' ]; then 891s local CMP="$2" 891s shift 2 891s "$STATE" "$@" 891s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 891s else 891s local CMP="$3" 891s shift 3 891s "$STATE" --nomsg "$@" 891s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 891s fi 891s fi 891s msggroup 891s } 891s testsuccessequal() { 891s # we compare output, so we know perfectly well about N: 891s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 891s } 891s testwarningequal() { 891s testreturnstateequal 'testwarning' "$@" 891s } 891s testfailureequal() { 891s testreturnstateequal 'testfailure' "$@" 891s } 891s 891s testfailuremsg() { 891s msggroup 'testfailuremsg' 891s local CMP="$1" 891s shift 891s testfailure "$@" 891s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 891s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 891s testoutputequal "$COMPAREFILE" echo "$CMP" 891s msggroup 891s } 891s testwarningmsg() { 891s msggroup 'testwarningmsg' 891s local CMP="$1" 891s shift 891s testwarning "$@" 891s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 891s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 891s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 891s testoutputequal "$COMPAREFILE" echo "$CMP" 891s msggroup 891s } 891s 891s testfilestats() { 891s msggroup 'testfilestats' 891s msgtest "Test that file $1 has $2 $3" "$4" 891s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 891s msgpass 891s else 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 891s { 891s echo 891s ls -ld "$1" || true 891s echo -n "stat(1) reports for $2: " 891s stat --format "$2" "$1" || true 891s } >"$OUTPUT" 2>&1 891s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 891s fi 891s msggroup 891s } 891s testaccessrights() { 891s msggroup 'testaccessrights' 891s testfilestats "$1" '%a' '=' "$2" 891s msggroup 891s } 891s 891s testwebserverlaststatuscode() { 891s msggroup 'testwebserverlaststatuscode' 891s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 891s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 891s rm -f "$DOWNLOG" "$STATUS" 891s msgtest 'Test last status code from the webserver was' "$1" 891s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 891s msgpass 891s else 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 891s { 891s if [ -n "$2" ]; then 891s shift 891s echo >&2 '#### Additionally provided output files contain:' 891s cat >&2 "$@" 891s fi 891s echo >&2 '#### Download log of the status code:' 891s cat >&2 "$DOWNLOG" 891s } >"$OUTPUT" 2>&1 891s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 891s fi 891s msggroup 891s } 891s 891s mapkeynametokeyid() { 891s while [ -n "$1" ]; do 891s case "$1" in 891s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 891s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 891s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 891s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 891s oldarchive) echo 'FDD2DB85F68C85A3';; 891s *) echo 'UNKNOWN KEY';; 891s esac 891s shift 891s done 891s } 891s testaptkeys() { 891s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 891s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 891s echo -n > "$OUTPUT" 891s fi 891s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 891s } 891s 891s pause() { 891s echo "STOPPED execution. Press enter to continue" 891s local IGNORE 891s read IGNORE 891s } 891s 891s logcurrentarchivedirectory() { 891s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 891s stat --format '%U:%G:%a:%n' "$line" 891s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 891s } 891s listcurrentlistsdirectory() { 891s { 891s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 891s stat --format '%U:%G:%a:%n' "$line" 891s done 891s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 891s stat --format '%U:%G:%a:%s:%y:%n' "$line" 891s done 891s } | sort 891s } 891s forallsupportedcompressors() { 891s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 891s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 891s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 891s "$@" "$COMP" 891s done 891s } 891s 891s breakfiles() { 891s while [ -n "$1" ]; do 891s mv -f "${1}" "${1}.bak" 891s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 891s shift 891s done 891s } 891s unbreakfiles() { 891s while [ -n "$1" ]; do 891s mv -f "${1}.bak" "${1}" 891s shift 891s done 891s } 891s 891s ### convenience hacks ### 891s mkdir() { 891s # creating some directories by hand is a tedious task, so make it look simple 891s local PARAMS="$*" 891s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 891s # only the last directory created by mkdir is effected by the -m ! 891s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 891s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 891s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 891s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 891s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 891s if [ "$(id -u)" = '0' ]; then 891s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 891s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 891s fi 891s else 891s command mkdir "$@" 891s fi 891s } 891s 891s ### The following tests are run by most test methods automatically to check 891s ### general things about commands executed without writing the test every time. 891s 891s aptautotest() { 891s if [ $# -lt 3 ]; then return; fi 891s local TESTCALL="$1" 891s local CMD="$2" 891s local FIRSTOPT="$3" 891s shift 2 891s for i in "$@"; do 891s if ! expr match "$i" '^-' >/dev/null 2>&1; then 891s FIRSTOPT="$i" 891s break 891s fi 891s done 891s shift 891s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 891s if command -v $AUTOTEST >/dev/null; then 891s # save and restore the *.output files from other tests 891s # as we might otherwise override them in these automatic tests 891s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 891s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 891s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 891s $AUTOTEST "$TESTCALL" "$@" 891s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 891s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 891s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 891s fi 891s } 891s 891s cdfind() { 891s ( cd /; find "$@" ) 891s } 891s aptautotest_aptget_update() { 891s local TESTCALL="$1" 891s while [ -n "$2" ]; do 891s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 891s shift 891s done 891s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 891s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 891s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 891s # all copied files are properly chmodded 891s local backupIFS="$IFS" 891s IFS="$(printf "\n\b")" 891s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 891s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 891s done 891s IFS="$backupIFS" 891s if [ "$TESTCALL" = 'testsuccess' ]; then 891s # failure cases can retain partial files and such 891s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 891s fi 891s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 891s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 891s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 891s fi 891s } 891s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 891s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 891s 891s testaptautotestnodpkgwarning() { 891s local TESTCALL="$1" 891s while [ -n "$2" ]; do 891s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 891s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 891s shift 891s done 891s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 891s } 891s 891s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 891s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 891s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 891s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 891s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 891s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 891s 891s testaptmarknodefaultsections() { 891s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 891s } 891s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 891s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 891s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 891s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 891s cmp: ./downloaded/foo1: No such file or directory 891s FAIL: exitcode 2 1018s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 1018s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1018s Configured access method http 1018s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1018s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 1018s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1018s Configured access method http 1018s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1018s -> http:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpk 1018s Redirect leads first URI to the second URI … 1018s Test for successful execution of cmp /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework ./downloaded/foo1 … #### Complete file: /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework #### 1018s #### Complete file: ./downloaded/foo1 #### 1018s #### cmp output #### 1018s 1018s Test for successful execution of cmp ./downloaded/foo1 ./downloaded/foo2 … #### Complete file: ./downloaded/foo1 #### 1018s #### Complete file: ./downloaded/foo2 #### 1018s #### cmp output #### 1018s P P Pg=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 1018s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo2%0aFilename:%20./downloaded/foo1%0a%0a 1018s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo%0aFilename:%20./downloaded/foo2%0a%0a 1018s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20http://localhost:44339/foo2 1018s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 1018s GET /foo2 HTTP/1.1 1018s Host: localhost:44339 1018s Accept: text/* 1018s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 1018s 1018s 1018s <- http:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 1018s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo2 1018s Answer for: http://localhost:44339/foo2 1018s HTTP/1.1 301 Moved Permanently 1018s Content-Length: 357 1018s Location: https://localhost:44339/foo 1018s Content-Type: text/html; charset=utf-8 1018s Server: APT webserver 1018s Accept-Ranges: bytes 1018s Date: Fri, 13 Jun 2025 00:14:20 GMT 1018s 1018s GET /foo HTTP/1.1 1018s Host: localhost:44339 1018s Accept: text/* 1018s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 1018s 1018s <- 1018s http:103%20Redirect%0aNew-URI:%20https://localhost:44339/foo%0aURI:%20http://localhost:44339/foo2 1018s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 1018s Answer for: http://localhost:44339/foo 1018s HTTP/1.1 200 OK 1018s Content-Length: 77417 1018s Last-Modified: Fri, 13 Jun 2025 00:07:57 GMT 1018s Server: APT webserver 1018s Accept-Ranges: bytes 1018s Date: Fri, 13 Jun 2025 00:14:20 GMT 1018s 1018s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1018s Configured access method https 1018s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1018s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 1018s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1018s Configured access method https 1018s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1018s -> https:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpkg=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 1018s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1018s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo 1018s <- http:200%20URI%20Start%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aURI:%20http://localhost:44339/foo 1018s Get:2 http://localhost:44339/foo [77.4 kB] 1018s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20https://localhost:44339/foo 1018s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1018s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1018s <- http:201%20URI%20Done%0aChecksum-FileSize-Hash:%2077417%0aSHA512-Hash:%2099758b98725ee45110a374044902230c8b056c97567d3ec249dc4add195e13a8d07d7d5d5081938286c2c21ec0841528b6cee8986d16a3a9d0abd4c570dd7dce%0aSHA256-Hash:%2072d18d223dc239300d7548396ef9409ee2e4ff5163d55557a87d9852c098e15e%0aSHA1-Hash:%20357fe7a44e62f7a01e1b4c96ee33675f03223500%0aMD5Sum-Hash:%20582a51e7590162e00495e35c882c4b44%0aMD5-Hash:%20582a51e7590162e00495e35c882c4b44%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aFilename:%20./downloaded/foo2%0aURI:%20http://localhost:44339/foo 1018s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1018s Ign:1 http://localhost:44339/foo2 1018s Could not wait for server fd - select (11: Resource temporarily unavailable) 1018s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1018s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1018s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1018s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1018s Ign:1 http://localhost:44339/foo2 1018s Could not wait for server fd - select (11: Resource temporarily unavailable) 1018s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1018s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1018s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1018s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1018s Ign:1 http://localhost:44339/foo2 1018s Could not wait for server fd - select (11: Resource temporarily unavailable) 1018s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1018s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1018s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1018s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1018s Err:1 http://localhost:44339/foo2 1018s Could not wait for server fd - select (11: Resource temporarily unavailable) 1018s E: Failed to fetch https://localhost:44339/foo Could not wait for server fd - select (11: Resource temporarily unavailable) 1018s E: Download Failed 1018s FAIL: exitcode 100 1018s 1018s #!/bin/sh -- # no runable script, just for vi 1018s 1018s EXIT_CODE=0 1018s 1018s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 1018s if [ "$1" = "-q" ]; then 1018s export MSGLEVEL=2 1018s elif [ "$1" = "-qq" ]; then 1018s export MSGLEVEL=1 1018s elif [ "$1" = "-v" ]; then 1018s export MSGLEVEL=4 1018s elif [ "$1" = '--color=no' ]; then 1018s export MSGCOLOR='NO' 1018s elif [ "$1" = '--color=yes' ]; then 1018s export MSGCOLOR='YES' 1018s elif [ "$1" = '--color' ]; then 1018s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 1018s shift 1018s elif [ "$1" = '--level' ]; then 1018s export MSGLEVEL=$2 1018s shift 1018s else 1018s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 1018s fi 1018s shift 1018s done 1018s export MSGLEVEL="${MSGLEVEL:-3}" 1018s 1018s # we all like colorful messages 1018s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 1018s if [ ! -t 1 ]; then # but check that we output to a terminal 1018s export MSGCOLOR='NO' 1018s fi 1018s fi 1018s 1018s if [ "$MSGCOLOR" != 'NO' ]; then 1018s CERROR="\033[1;31m" # red 1018s CWARNING="\033[1;33m" # yellow 1018s CMSG="\033[1;32m" # green 1018s CINFO="\033[1;96m" # light blue 1018s CDEBUG="\033[1;94m" # blue 1018s CNORMAL="\033[0;39m" # default system console color 1018s CDONE="\033[1;32m" # green 1018s CPASS="\033[1;32m" # green 1018s CFAIL="\033[1;31m" # red 1018s CCMD="\033[1;35m" # pink 1018s fi 1018s 1018s msgprintf() { 1018s local START="$1" 1018s local MIDDLE="$2" 1018s local END="$3" 1018s shift 3 1018s if [ -n "$1" ]; then 1018s printf "$START " "$1" 1018s shift 1018s while [ -n "$1" ]; do 1018s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 1018s shift 1018s done 1018s fi 1018s printf "${END}" 1018s } 1018s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 1018s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 1018s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 1018s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 1018s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 1018s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 1018s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 1018s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 1018s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 1018s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 1018s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 1018s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 1018s msgreportheader() { 1018s if [ -n "$MSGTEST_MSG" ]; then 1018s test "$1" != 'msgfailoutput' || echo 1018s if [ -n "$MSGTEST_MSGMSG" ]; then 1018s echo "$MSGTEST_MSGMSG" 1018s fi 1018s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 1018s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 1018s fi 1018s echo -n "$MSGTEST_MSG" 1018s unset MSGTEST_MSG 1018s fi 1018s } 1018s msgskip() { 1018s msgreportheader 'msgskip' 1018s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 1018s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 1018s } 1018s msgfail() { 1018s msgreportheader 'msgfail' 1018s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 1018s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 1018s if [ -n "$APT_DEBUG_TESTS" ]; then 1018s runapt $SHELL 1018s fi 1018s EXIT_CODE=$((EXIT_CODE+1)); 1018s } 1018s MSGGROUP_LEVEL=0 1018s msggroup() { 1018s if [ -n "$1" ]; then 1018s if [ $MSGGROUP_LEVEL = 0 ]; then 1018s MSGTEST_GRP='NEXT' 1018s fi 1018s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 1018s else 1018s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 1018s if [ $MSGGROUP_LEVEL = 0 ]; then 1018s unset MSGTEST_GRP 1018s fi 1018s fi 1018s } 1018s 1018s # enable / disable Debugging 1018s if [ $MSGLEVEL -le 0 ]; then 1018s msgdie() { true; } 1018s fi 1018s if [ $MSGLEVEL -le 1 ]; then 1018s msgwarn() { true; } 1018s msgnwarn() { true; } 1018s fi 1018s if [ $MSGLEVEL -le 2 ]; then 1018s msgmsg() { 1018s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 1018s } 1018s msgnmsg() { true; } 1018s msgtest() { 1018s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 1018s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 1018s MSGTEST_GRP="$MSGTEST_MSG" 1018s fi 1018s } 1018s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 1018s fi 1018s if [ $MSGLEVEL -le 3 ]; then 1018s msginfo() { true; } 1018s msgninfo() { true; } 1018s fi 1018s if [ $MSGLEVEL -le 4 ]; then 1018s msgdebug() { true; } 1018s msgndebug() { true; } 1018s fi 1018s if [ $MSGLEVEL -le 1 ]; then 1018s msgpass() { true; } 1018s fi 1018s msgdone() { 1018s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 1018s [ "$1" = "info" -a $MSGLEVEL -le 3 ] || 1018s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 1018s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 1018s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 1018s true; 1018s else 1018s printf "${CDONE}DONE${CNORMAL}\n"; 1018s fi 1018s } 1018s getaptconfig() { 1018s if [ -f ./aptconfig.conf ]; then 1018s echo "$(readlink -f ./aptconfig.conf)" 1018s elif [ -f ../aptconfig.conf ]; then 1018s echo "$(readlink -f ../aptconfig.conf)" 1018s elif [ -f ../../aptconfig.conf ]; then 1018s echo "$(readlink -f ../../aptconfig.conf)" 1018s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 1018s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 1018s fi 1018s } 1018s runapt() { 1018s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 1018s local CMD="$1" 1018s shift 1018s case "$CMD" in 1018s sh|aptitude|*/*|command) ;; 1018s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 1018s esac 1018s if [ "$CMD" = 'aptitude' ]; then 1018s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 1018s else 1018s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 1018s fi 1018s } 1018s runpython3() { runapt command python3 "$@"; } 1018s aptconfig() { runapt apt-config "$@"; } 1018s aptcache() { runapt apt-cache "$@"; } 1018s aptcdrom() { runapt apt-cdrom "$@"; } 1018s aptget() { runapt apt-get "$@"; } 1018s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 1018s aptkey() { runapt apt-key "$@"; } 1018s aptmark() { runapt apt-mark "$@"; } 1018s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 1018s apt() { runapt apt "$@"; } 1018s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 1018s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 1018s aptitude() { runapt aptitude "$@"; } 1018s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 1018s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 1018s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 1018s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 1018s 1018s dpkg() { 1018s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 1018s } 1018s dpkgquery() { 1018s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1018s } 1018s dpkg_version() { 1018s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 1018s } 1018s dpkgcheckbuilddeps() { 1018s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1018s } 1018s gdb() { 1018s local CMD 1018s case "$1" in 1018s aptget) CMD="apt-get";; 1018s aptcache) CMD="apt-cache";; 1018s aptcdrom) CMD="apt-cdrom";; 1018s aptconfig) CMD="apt-config";; 1018s aptmark) CMD="apt-mark";; 1018s apthelper) CMD="apt-helper";; 1018s aptftparchive) CMD="apt-ftparchive";; 1018s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1018s *) CMD="$1";; 1018s esac 1018s shift 1018s if [ "${CMD##*/}" = "$CMD" ]; then 1018s CMD="${APTCMDLINEBINDIR}/${CMD}" 1018s fi 1018s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 1018s } 1018s 1018s valgrind() { 1018s local CMD 1018s case "$1" in 1018s aptget) CMD="apt-get";; 1018s aptcache) CMD="apt-cache";; 1018s aptcdrom) CMD="apt-cdrom";; 1018s aptconfig) CMD="apt-config";; 1018s aptmark) CMD="apt-mark";; 1018s apthelper) CMD="apt-helper";; 1018s aptftparchive) CMD="apt-ftparchive";; 1018s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1018s *) CMD="$1";; 1018s esac 1018s shift 1018s if [ "$CMD" = "apt-ftparchive" ]; then 1018s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 1018s fi 1018s if [ "${CMD##*/}" = "$CMD" ]; then 1018s CMD="${APTCMDLINEBINDIR}/${CMD}" 1018s fi 1018s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 1018s } 1018s 1018s lastmodification() { 1018s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 1018s } 1018s releasefiledate() { 1018s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 1018s } 1018s 1018s exitwithstatus() { 1018s # error if we about to overflow, but ... 1018s # "255 failures ought to be enough for everybody" 1018s if [ $EXIT_CODE -gt 255 ]; then 1018s msgdie "Total failure count $EXIT_CODE too big" 1018s fi 1018s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 1018s } 1018s 1018s shellsetedetector() { 1018s local exit_status=$? 1018s if [ "$exit_status" != '0' ]; then 1018s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 1018s if [ "$EXIT_CODE" = '0' ]; then 1018s EXIT_CODE="$exit_status" 1018s fi 1018s fi 1018s } 1018s 1018s addtrap() { 1018s if [ "$1" = 'prefix' ]; then 1018s CURRENTTRAP="$2 $CURRENTTRAP" 1018s else 1018s CURRENTTRAP="$CURRENTTRAP $1" 1018s fi 1018s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1018s } 1018s 1018s escape_shell() { 1018s echo "$@" | sed -e "s#'#'\"'\"'#g" 1018s } 1018s 1018s find_project_binary_dir() { 1018s if [ -z "$PROJECT_BINARY_DIR" ]; then 1018s PROJECT_BINARY_DIR= 1018s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 1018s test -e "$dir/CMakeCache.txt" || continue 1018s if [ -z "$PROJECT_BINARY_DIR" ] || 1018s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 1018s PROJECT_BINARY_DIR="$dir" 1018s fi 1018s done 1018s if [ -z "$PROJECT_BINARY_DIR" ]; then 1018s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 1018s exit 1 1018s fi 1018s export PROJECT_BINARY_DIR 1018s fi 1018s } 1018s _removetmpworkingdirectory() { 1018s cd / 1018s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 1018s rm -rf "$TMPWORKINGDIRECTORY" 1018s fi 1018s TMPWORKINGDIRECTORY='' 1018s } 1018s setupenvironment() { 1018s # cleanup the environment a bit 1018s export LC_ALL=C 1018s unset LANGUAGE COLUMNS NLSPATH 1018s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 1018s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 1018s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 1018s unset GREP_OPTIONS POSIXLY_CORRECT 1018s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 1018s export GCOV_ERROR_FILE=/dev/null 1018s 1018s # Next check needs a gnu stat, let's figure that out early. 1018s stat=stat 1018s if command -v gnustat >/dev/null 2>&1; then 1018s stat=gnustat 1018s fi 1018s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 1018s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 1018s unset TMPDIR 1018s fi 1018s if [ -z "$TMPWORKINGDIRECTORY" ]; then 1018s addtrap '_removetmpworkingdirectory;' 1018s TMPWORKINGDIRECTORY="$(mktemp -d)" 1018s fi 1018s if [ -n "$TMPDIR_ADD" ]; then 1018s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 1018s mkdir -p "$TMPWORKINGDIRECTORY" 1018s unset TMPDIR_ADD 1018s export TMPDIR="$TMPWORKINGDIRECTORY" 1018s fi 1018s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 1018s 1018s # Setup coreutils on BSD systems 1018s mkdir "${TMPWORKINGDIRECTORY}/bin" 1018s for prefix in gnu g; do 1018s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 1018s if command -v $prefix$command 2>/dev/null >/dev/null; then 1018s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 1018s fi 1018s done 1018s done 1018s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 1018s 1018s if [ -z "$TESTDIRECTORY" ]; then 1018s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 1018s fi 1018s cd "$TMPWORKINGDIRECTORY" 1018s 1018s mkdir -m 700 'downloaded' 1018s if [ "$(id -u)" = '0' ]; then 1018s # relax permissions so that running as root with user switching works 1018s umask 022 1018s chmod 711 "$TMPWORKINGDIRECTORY" 1018s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 1018s fi 1018s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 1018s 1018s _setupprojectenvironment 1018s 1018s # create some files in /tmp and look at user/group to get what this means 1018s TEST_DEFAULT_USER="$(id -un)" 1018s touch "${TMPWORKINGDIRECTORY}/test-file" 1018s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 1018s 1018s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 1018s . "${TESTDIRECTORY}/extra-environment" 1018s fi 1018s 1018s msgdone "info" 1018s } 1018s _setupprojectenvironment() { 1018s # allow overriding the default BUILDDIR locations 1018s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 1018s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 1018s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 1018s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 1018s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1018s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 1018s APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 1018s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1018s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 1018s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 1018s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 1018s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 1018s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 1018s 1018s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 1018s mkdir aptarchive keys 1018s cd rootdir 1018s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 1018s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 1018s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 1018s touch var/lib/dpkg/available var/lib/dpkg/lock 1018s echo '1' > var/lib/dpkg/info/format 1018s ln -s "${METHODSDIR}" usr/lib/apt/methods 1018s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 1018s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 1018s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 1018s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 1018s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 1018s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 1018s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 1018s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 1018s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 1018s else 1018s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 1018s fi 1018s cd .. 1018s local BASENAME="${0##*/}" 1018s local PACKAGESFILE="Packages-${BASENAME#*-}" 1018s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 1018s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 1018s fi 1018s local SOURCESSFILE="Sources-${BASENAME#*-}" 1018s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 1018s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 1018s fi 1018s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 1018s chmod 644 keys/* 1018s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 1018s 1018s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 1018s echo "Dir::Etc \"etc\";" >> aptconfig.conf 1018s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 1018s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 1018s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 1018s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 1018s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 1018s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 1018s # either store apt-key were we can access it, even if we run it as a different user 1018s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 1018s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 1018s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 1018s # destroys coverage reporting though, so we disable changing user for the calling gpgv 1018s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 1018s if [ "$(id -u)" = '0' ]; then 1018s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 1018s # same for the solver executables 1018s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 1018s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 1018s fi 1018s 1018s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 1018s EXEC='' 1018s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 1018s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 1018s restoredpkgstatus() { 1018s if [ -n "\$BACKUP" ]; then 1018s if [ -e "\$BACKUP" ]; then 1018s mv -f "\$BACKUP" "\$ORIGINAL" 1018s else 1018s rm -f "\$ORIGINAL" 1018s fi 1018s BACKUP='' 1018s fi 1018s } 1018s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1018s if [ -e "\$ORIGINAL" ]; then 1018s cp -a "\$ORIGINAL" "\$BACKUP" 1018s fi 1018s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 1018s 1018s Package: dpkg 1018s Architecture: all 1018s Version: ${DPKG_VERSION}+fake 1018s Status: install ok installed 1018s Maintainer: Joe Sixpack 1018s Installed-Size: 42 1018s Description: tells dpkg it supports what we need 1018s Some versions of dpkg check its own version from the status file 1018s to know if it supports multi-arch and stuff in --assert-*. 1018s 1018s EOS 1018s fi 1018s EOF 1018s fi 1018s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 1018s 1018s { 1018s echo 'quiet "0";' 1018s echo 'quiet::NoUpdate "true";' 1018s echo 'quiet::NoStatistic "true";' 1018s # too distracting for users, but helpful to detect changes 1018s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 1018s echo 'Acquire::Progress::Diffpercent "true";' 1018s # in testcases, it can appear as if localhost has a rotation setup, 1018s # hide this as we can't really deal with it properly 1018s echo 'Acquire::Failure::ShowIP "false";' 1018s # randomess and tests don't play well together 1018s echo 'Acquire::IndexTargets::Randomized "false";' 1018s # fakeroot can't fake everything, so disabled in production but good for tests 1018s echo 'APT::Sandbox::Verify "true";' 1018s } >> aptconfig.conf 1018s 1018s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1018s if [ "$(id -u)" = '0' ]; then 1018s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1018s fi 1018s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 1018s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 1018s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 1018s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 1018s # Allow release files to be 10 hours in the future, rather than 10 seconds 1018s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 1018s 1018s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 1018s 1018s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 1018s confighashes 'SHA256' # these are tests, not security best-practices 1018s 1018s # Make dpkg inherit testing path 1018s echo 'DPkg::Path "";' >> aptconfig.conf 1018s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 1018s 1018s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 1018s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 1018s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 1018s fi 1018s 1018s # most tests just need one signed Release file, not both 1018s export APT_DONT_SIGN='Release.gpg' 1018s 1018s # prefer our apt binaries over the system apt binaries 1018s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 1018s } 1018s 1018s getarchitecture() { 1018s if [ "$1" = "native" -o -z "$1" ]; then 1018s eval `aptconfig shell ARCH APT::Architecture` 1018s if [ -n "$ARCH" ]; then 1018s echo $ARCH 1018s else 1018s dpkg --print-architecture 1018s fi 1018s else 1018s echo $1 1018s fi 1018s } 1018s 1018s getarchitectures() { 1018s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 1018s } 1018s 1018s getarchitecturesfromcommalist() { 1018s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 1018s } 1018s 1018s configarchitecture() { 1018s { 1018s echo "APT::Architecture \"$(getarchitecture $1)\";" 1018s while [ -n "$1" ]; do 1018s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 1018s shift 1018s done 1018s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 1018s configdpkg 1018s } 1018s 1018s configdpkg() { 1018s if [ ! -e rootdir/var/lib/dpkg/status ]; then 1018s local BASENAME="${0##*/}" 1018s local STATUSFILE="status-${BASENAME#*-}" 1018s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 1018s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 1018s # Add an empty line to the end if there is none 1018s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 1018s echo >> rootdir/var/lib/dpkg/status 1018s fi 1018s fi 1018s fi 1018s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 1018s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 1018s local ARCHS="$(getarchitectures)" 1018s local DPKGARCH="$(dpkg --print-architecture)" 1018s # this ensures that even if multi-arch isn't active in the view 1018s # of apt, given that dpkg can't be told which arch is native 1018s # the arch apt treats as native might be foreign for dpkg 1018s for ARCH in ${ARCHS}; do 1018s if [ "${ARCH}" != "${DPKGARCH}" ]; then 1018s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 1018s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 1018s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 1018s else 1018s # old-style used e.g. in Ubuntu-P – and as it seems travis 1018s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1018s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1018s fi 1018s fi 1018s fi 1018s done 1018s else 1018s # test multiarch before dpkg is ready for it… 1018s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 1018s fi 1018s } 1018s 1018s configdpkgnoopchroot() { 1018s # create a library to noop chroot() and rewrite maintainer script executions 1018s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 1018s # chroot directory dpkg could chroot into to execute the maintainer scripts 1018s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 1018s cat > noopchroot.c << EOF 1018s #define _GNU_SOURCE 1018s #include 1018s #include 1018s #include 1018s #include 1018s 1018s static char * chrootdir = NULL; 1018s 1018s int chroot(const char *path) { 1018s printf("WARNING: CHROOTing to %s was ignored!\n", path); 1018s free(chrootdir); 1018s chrootdir = strdup(path); 1018s return 0; 1018s } 1018s int execvp(const char *file, char *const argv[]) { 1018s static int (*func_execvp) (const char *, char * const []) = NULL; 1018s if (func_execvp == NULL) 1018s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 1018s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 1018s return func_execvp(file, argv); 1018s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 1018s char *newfile; 1018s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 1018s perror("asprintf"); 1018s return -1; 1018s } 1018s char const * const baseadmindir = "/var/lib/dpkg"; 1018s char *admindir; 1018s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 1018s perror("asprintf"); 1018s return -1; 1018s } 1018s setenv("DPKG_ADMINDIR", admindir, 1); 1018s return func_execvp(newfile, argv); 1018s } 1018s EOF 1018s if cc -ldl 2>&1 | grep -q dl; then 1018s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 1018s else 1018s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 1018s fi 1018s } 1018s configcompression() { 1018s if [ "$1" = 'ALL' ]; then 1018s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 1018s return 1018s fi 1018s local CMD='apthelper cat-file -C' 1018s while [ -n "$1" ]; do 1018s case "$1" in 1018s '.') printf ".\t.\tcat\n";; 1018s 'gz') printf "gzip\tgz\t$CMD $1\n";; 1018s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 1018s 'zst') printf "zstd\tzst\t$CMD $1\n";; 1018s *) printf "$1\t$1\t$CMD $1\n";; 1018s esac 1018s shift 1018s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1018s } 1018s confighashes() { 1018s { 1018s echo 'APT::FTPArchive {' 1018s { 1018s while [ -n "$1" ]; do 1018s printf "$1" | tr 'a-z' 'A-Z' 1018s printf "\t\"true\";\n" 1018s shift 1018s done 1018s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 1018s printf "$h\t\"false\";\n" 1018s done 1018s } | awk '!x[$1]++' 1018s echo '};' 1018s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 1018s } 1018s forcecompressor() { 1018s COMPRESSOR="$1" 1018s COMPRESS="$1" 1018s COMPRESSOR_CMD="apthelper cat-file -C $1" 1018s case $COMPRESSOR in 1018s gzip) COMPRESS='gz';; 1018s bzip2) COMPRESS='bz2';; 1018s zstd) COMPRESS='zst';; 1018s esac 1018s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1018s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 1018s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 1018s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1018s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 1018s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 1018s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 1018s done 1018s } 1018s 1018s _setupsimplenativepackage() { 1018s local NAME="$1" 1018s local ARCH="$2" 1018s local VERSION="$3" 1018s local RELEASE="${4:-unstable}" 1018s local DEPENDENCIES="$5" 1018s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 1018s If you find such a package installed on your system, 1018s something went horribly wrong! They are autogenerated 1018s and used only by testcases and serve no other purpose…}" 1018s 1018s local SECTION="${7:-others}" 1018s local PRIORITY="${8:-optional}" 1018s local FILE_TREE="$9" 1018s local COMPRESS_TYPE="${10:-gzip}" 1018s local DISTSECTION 1018s if [ "$SECTION" = "${SECTION#*/}" ]; then 1018s DISTSECTION="main" 1018s else 1018s DISTSECTION="${SECTION%/*}" 1018s fi 1018s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1018s 1018s mkdir -p "$BUILDDIR/debian/source" 1018s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 1018s echo "#!/bin/sh 1018s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 1018s 1018s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 1018s echo "$NAME ($VERSION) $RELEASE; urgency=low 1018s 1018s * Initial release 1018s 1018s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 1018s { 1018s echo "Source: $NAME 1018s Priority: $PRIORITY 1018s Maintainer: Joe Sixpack 1018s Standards-Version: 4.3.1 1018s Rules-Requires-Root: no" 1018s if [ "$SECTION" != '' ]; then 1018s echo "Section: $SECTION" 1018s fi 1018s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 1018s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 1018s echo " 1018s Package: $NAME" 1018s 1018s if [ "$ARCH" = 'all' ]; then 1018s echo "Architecture: all" 1018s else 1018s echo "Architecture: any" 1018s fi 1018s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 1018s test -z "$DEPS" || echo "$DEPS" 1018s printf "%b\n" "Description: $DESCRIPTION" 1018s } > "${BUILDDIR}/debian/control" 1018s 1018s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 1018s } 1018s 1018s make_tiny_rules() { 1018s local OUT="$1" 1018s if command -v gmake >/dev/null 2>&1; then 1018s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 1018s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 1018s else 1018s echo '#!/usr/bin/make -f' > "$OUT" 1018s fi 1018s echo '%:' >> "$OUT" 1018s echo ' dh $@' >> "$OUT" 1018s } 1018s 1018s setupsimplenativepackage() { 1018s _setupsimplenativepackage "$@" 1018s local NAME="$1" 1018s local VERSION="$3" 1018s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1018s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 1018s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 1018s } 1018s 1018s buildsimplenativepackage() { 1018s local NAME="$1" 1018s local ARCH="$2" 1018s local VERSION="$3" 1018s local RELEASE="${4:-unstable}" 1018s local DEPENDENCIES="$5" 1018s local DESCRIPTION="$6" 1018s local SECTION="${7:-others}" 1018s local PRIORITY="${8:-optional}" 1018s local FILE_TREE="$9" 1018s local COMPRESS_TYPE="${10:-gzip}" 1018s local DISTSECTION 1018s if [ "$SECTION" = "${SECTION#*/}" ]; then 1018s DISTSECTION="main" 1018s else 1018s DISTSECTION="${SECTION%/*}" 1018s fi 1018s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1018s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 1018s _setupsimplenativepackage "$@" 1018s cd "${BUILDDIR}/.." 1018s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 1018s cd - >/dev/null 1018s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 1018s | while read SRC; do 1018s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 1018s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 1018s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 1018s # adv --yes --default-key 'Joe Sixpack' \ 1018s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1018s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1018s # fi 1018s done 1018s 1018s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1018s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 1018s rm -rf "${BUILDDIR}/debian/tmp" 1018s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 1018s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 1018s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 1018s if [ -n "$FILE_TREE" ]; then 1018s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 1018s fi 1018s 1018s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 1018s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 1018s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 1018s # ensure the right permissions as dpkg-deb insists 1018s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 1018s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 1018s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 1018s done 1018s 1018s local NM 1018s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 1018s NM="$(echo "$NAME" | cut -c 1-4)" 1018s else 1018s NM="$(echo "$NAME" | cut -c 1)" 1018s fi 1018s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 1018s mkdir -p "$CHANGEPATH" 1018s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 1018s rm -rf "${BUILDDIR}" 1018s msgdone "info" 1018s } 1018s 1018s buildpackage() { 1018s local BUILDDIR=$1 1018s local RELEASE=$2 1018s local SECTION=$3 1018s local ARCH=$(getarchitecture $4) 1018s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 1018s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 1018s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 1018s cd "$BUILDDIR" 1018s if [ "$ARCH" = "all" ]; then 1018s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 1018s fi 1018s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 1018s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 1018s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 1018s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 1018s cd - > /dev/null 1018s for PKG in $PKGS; do 1018s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 1018s done 1018s for SRC in $SRCS; do 1018s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 1018s done 1018s } 1018s 1018s buildaptarchive() { 1018s if [ -d incoming ]; then 1018s buildaptarchivefromincoming "$@" 1018s else 1018s buildaptarchivefromfiles "$@" 1018s fi 1018s } 1018s 1018s createaptftparchiveconfig() { 1018s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 1018s local COMPRESSORS="${COMPRESSORS%* }" 1018s local ARCHS="$(getarchitectures)" 1018s cat > ftparchive.conf <> ftparchive.conf 1018s } 1018s 1018s buildaptftparchivedirectorystructure() { 1018s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 1018s for DIST in $DISTS; do 1018s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 1018s for SECTION in $SECTIONS; do 1018s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 1018s for ARCH in $ARCHS; do 1018s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 1018s done 1018s mkdir -p "dists/${DIST}/${SECTION}/source" 1018s mkdir -p "dists/${DIST}/${SECTION}/i18n" 1018s done 1018s done 1018s } 1018s 1018s insertpackage() { 1018s local RELEASES="$1" 1018s local NAME="$2" 1018s local ARCH="$3" 1018s local VERSION="$4" 1018s local DEPENDENCIES="$5" 1018s local PRIORITY="${6:-optional}" 1018s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 1018s If you find such a package installed on your system, 1018s something went horribly wrong! They are autogenerated 1018s and used only by testcases and serve no other purpose…}" 1018s local SECTION="${8:-other}" 1018s 1018s if [ "$SECTION" = "${SECTION#*/}" ]; then 1018s DISTSECTION="main" 1018s else 1018s DISTSECTION="${SECTION%/*}" 1018s fi 1018s local ARCHS="" 1018s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1018s if [ "$RELEASE" = 'installed' ]; then 1018s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 1018s continue 1018s fi 1018s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1018s if [ "$arch" = 'none' ]; then 1018s ARCHS="$(getarchitectures)" 1018s else 1018s ARCHS="$arch" 1018s fi 1018s for BUILDARCH in $ARCHS; do 1018s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 1018s mkdir -p "$PPATH" 1018s { 1018s echo "Package: $NAME 1018s Priority: $PRIORITY 1018s Section: $SECTION 1018s Installed-Size: 42 1018s Size: 42" 1018s if echo "$DEPENDENCIES" | grep -q SHA256:; then 1018s : 1018s else 1018s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 1018s fi 1018s echo "Maintainer: Joe Sixpack " 1018s test "$arch" = 'none' || echo "Architecture: $arch" 1018s echo "Version: $VERSION 1018s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 1018s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 1018s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 1018s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 1018s echo 1018s } >> "${PPATH}/Packages" 1018s done 1018s done 1018s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 1018s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 1018s echo "Package: $NAME 1018s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 1018s Description-en: $DESCRIPTION 1018s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 1018s done 1018s } 1018s 1018s insertsource() { 1018s local RELEASES="$1" 1018s local NAME="$2" 1018s local ARCH="$3" 1018s local VERSION="$4" 1018s local DEPENDENCIES="$5" 1018s local BINARY="${6:-$NAME}" 1018s local ARCHS="" 1018s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1018s local SPATH="aptarchive/dists/${RELEASE}/main/source" 1018s mkdir -p $SPATH 1018s local FILE="${SPATH}/Sources" 1018s local DSCFILE="${NAME}_${VERSION}.dsc" 1018s local TARFILE="${NAME}_${VERSION}.tar.gz" 1018s echo "Package: $NAME 1018s Binary: $BINARY 1018s Version: $VERSION 1018s Maintainer: Joe Sixpack 1018s Architecture: $ARCH" >> $FILE 1018s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1018s echo "Files: 1018s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1018s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1018s Checksums-Sha256: 1018s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1018s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1018s " >> "$FILE" 1018s done 1018s } 1018s 1018s insertinstalledpackage() { 1018s local NAME="$1" 1018s local ARCH="$2" 1018s local VERSION="$3" 1018s local DEPENDENCIES="$4" 1018s local PRIORITY="${5:-optional}" 1018s local STATUS="${6:-install ok installed}" 1018s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 1018s If you find such a package installed on your system, 1018s something went horribly wrong! They are autogenerated 1018s and used only by testcases and serve no other purpose…}" 1018s local SECTION="${8:-other}" 1018s 1018s local FILE='rootdir/var/lib/dpkg/status' 1018s local INFO='rootdir/var/lib/dpkg/info' 1018s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1018s echo "Package: $NAME 1018s Status: $STATUS 1018s Priority: $PRIORITY 1018s Section: $SECTION 1018s Installed-Size: 42 1018s Maintainer: Joe Sixpack 1018s Version: $VERSION" >> "$FILE" 1018s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 1018s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1018s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 1018s echo >> "$FILE" 1018s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 1018s echo -n > "${INFO}/${NAME}:${arch}.list" 1018s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 1018s else 1018s echo -n > "${INFO}/${NAME}.list" 1018s echo -n > "${INFO}/${NAME}.md5sums" 1018s fi 1018s done 1018s } 1018s 1018s 1018s buildaptarchivefromincoming() { 1018s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 1018s cd aptarchive 1018s [ -e pool ] || ln -s ../incoming pool 1018s [ -e ftparchive.conf ] || createaptftparchiveconfig 1018s [ -e dists ] || buildaptftparchivedirectorystructure 1018s msgninfo "\tGenerate Packages, Sources and Contents files… " 1018s testsuccess aptftparchive generate ftparchive.conf 1018s cd - > /dev/null 1018s msgdone "info" 1018s generatereleasefiles "$@" 1018s } 1018s 1018s buildaptarchivefromfiles() { 1018s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 1018s local DIR='aptarchive' 1018s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 1018s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 1018s msgninfo "\t${line} file… " 1018s compressfile "$line" "$1" 1018s msgdone "info" 1018s done 1018s generatereleasefiles "$@" 1018s } 1018s 1018s compressfile() { 1018s while read compressor extension command; do 1018s if [ "$compressor" = '.' ]; then 1018s if [ -n "$2" ]; then 1018s touch -d "$2" "$1" 1018s fi 1018s continue 1018s fi 1018s cat "$1" | $command > "${1}.${extension}" 1018s if [ -n "$2" ]; then 1018s touch -d "$2" "${1}.${extension}" 1018s fi 1018s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1018s } 1018s 1018s # can be overridden by testcases for their pleasure 1018s getcodenamefromsuite() { 1018s case "$1" in 1018s unstable) echo 'sid';; 1018s *) echo -n "$1";; 1018s esac 1018s } 1018s getreleaseversionfromsuite() { true; } 1018s getlabelfromsuite() { true; } 1018s getoriginfromsuite() { true; } 1018s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 1018s getnotautomaticfromsuite() { 1018s case "$1" in 1018s experimental|experimental2) echo "yes";; 1018s esac 1018s } 1018s getbutautomaticupgradesfromsuite() { true; } 1018s 1018s aptftparchiverelease() { 1018s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 1018s } 1018s generatereleasefiles() { 1018s # $1 is the Date header and $2 is the ValidUntil header to be set 1018s # both should be given in notation date/touch can understand 1018s local DATE="$1" 1018s local VALIDUNTIL="$2" 1018s if [ -e aptarchive/dists ]; then 1018s msgninfo "\tGenerate Release files for dists… " 1018s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 1018s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 1018s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 1018s local CODENAME="$(getcodenamefromsuite $SUITE)" 1018s local VERSION="$(getreleaseversionfromsuite $SUITE)" 1018s local LABEL="$(getlabelfromsuite $SUITE)" 1018s local ORIGIN="$(getoriginfromsuite $SUITE)" 1018s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 1018s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 1018s aptftparchiverelease "$dir" \ 1018s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 1018s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 1018s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 1018s -o APT::FTPArchive::Release::Label="${LABEL}" \ 1018s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 1018s -o APT::FTPArchive::Release::Version="${VERSION}" \ 1018s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 1018s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 1018s > "$dir/Release" 1018s done 1018s else 1018s msgninfo "\tGenerate Release files for flat… " 1018s aptftparchiverelease ./aptarchive > aptarchive/Release 1018s fi 1018s if [ -n "$VALIDUNTIL" ]; then 1018s sed -i "/^Date: / a\ 1018s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 1018s fi 1018s if [ -n "$DATE" -a "$DATE" != "now" ]; then 1018s for release in $(find ./aptarchive -name 'Release'); do 1018s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 1018s touch -d "$DATE" "$release" 1018s done 1018s fi 1018s msgdone "info" 1018s } 1018s 1018s setupdistsaptarchive() { 1018s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1018s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 1018s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 1018s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 1018s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 1018s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 1018s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 1018s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 1018s msgdone "info" 1018s done 1018s } 1018s 1018s setupflataptarchive() { 1018s local APTARCHIVE="$(readlink -f ./aptarchive)" 1018s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1018s if [ -f "${APTARCHIVE}/Packages" ]; then 1018s msgninfo "\tadd deb sources.list line… " 1018s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1018s msgdone 'info' 1018s else 1018s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1018s fi 1018s if [ -f "${APTARCHIVE}/Sources" ]; then 1018s msgninfo "\tadd deb-src sources.list line… " 1018s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1018s msgdone 'info' 1018s else 1018s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1018s fi 1018s } 1018s 1018s setupaptarchive() { 1018s local NOUPDATE=0 1018s if [ "$1" = '--no-update' ]; then 1018s NOUPDATE=1 1018s shift 1018s fi 1018s buildaptarchive "$@" 1018s if [ -e aptarchive/dists ]; then 1018s setupdistsaptarchive 1018s else 1018s setupflataptarchive 1018s fi 1018s signreleasefiles 'Joe Sixpack' 1018s if [ "1" != "$NOUPDATE" ]; then 1018s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 1018s fi 1018s } 1018s 1018s killgpgagent() { 1018s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 1018s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1018s if [ ! -e "${GPGHOME}" ]; then return; fi 1018s # ensure the agent dies quickly as different versions have different suicide heuristics 1018s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 1018s rm -rf "$GPGHOME" 1018s } 1018s dosigning() { 1018s local KEY="$1" 1018s shift 1018s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1018s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 1018s GPGHOME="$APT_TEST_SIGNINGHOME" 1018s else 1018s if [ ! -e "$GPGHOME" ]; then 1018s mkdir -p --mode=700 "${GPGHOME}" 1018s addtrap 'prefix' 'killgpgagent;' 1018s fi 1018s fi 1018s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 1018s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1018s "$@" 1018s } 1018s signreleasefiles() { 1018s local SIGNERS="${1:-Joe Sixpack}" 1018s local REPODIR="${2:-aptarchive}" 1018s if [ -n "$1" ]; then shift; fi 1018s if [ -n "$1" ]; then shift; fi 1018s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1018s msgninfo "\tSign archive with $SIGNERS key $KEY… " 1018s local REXKEY='keys/rexexpired' 1018s local SECEXPIREBAK="${REXKEY}.sec.bak" 1018s local PUBEXPIREBAK="${REXKEY}.pub.bak" 1018s local SIGUSERS="" 1018s while [ -n "${SIGNERS%%,*}" ]; do 1018s local SIGNER="${SIGNERS%%,*}" 1018s if [ "${SIGNERS}" = "${SIGNER}" ]; then 1018s SIGNERS="" 1018s fi 1018s SIGNERS="${SIGNERS#*,}" 1018s # FIXME: This should be the full name, but we can't encode the space properly currently 1018s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 1018s if [ "${SIGNER}" = 'Rex Expired' ]; then 1018s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 1018s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 1018s # therefore we 'temporary' make the key not expired and restore a backup after signing 1018s cp "${REXKEY}.sec" "$SECEXPIREBAK" 1018s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 1018s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 1018s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 1018s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 1018s cp "$SECUNEXPIRED" "${REXKEY}.sec" 1018s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 1018s else 1018s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 1018s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1018s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 1018s cat setexpire.gpg 1018s exit 1 1018s fi 1018s cp "${REXKEY}.sec" "$SECUNEXPIRED" 1018s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 1018s fi 1018s fi 1018s if [ ! -e "${KEY}.pub" ]; then 1018s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1018s cat "${K}.pub" >> "${KEY}.new.pub" 1018s cat "${K}.sec" >> "${KEY}.new.sec" 1018s fi 1018s done 1018s if [ ! -e "${KEY}.pub" ]; then 1018s mv "${KEY}.new.pub" "${KEY}.pub" 1018s mv "${KEY}.new.sec" "${KEY}.sec" 1018s fi 1018s for RELEASE in $(find "${REPODIR}/" -name Release); do 1018s # we might have set a specific date for the Release file, so copy it 1018s local DATE="$(stat --format "%y" "${RELEASE}")" 1018s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 1018s rm -f "${RELEASE}.gpg" 1018s else 1018s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 1018s touch -d "$DATE" "${RELEASE}.gpg" 1018s fi 1018s local INRELEASE="${RELEASE%/*}/InRelease" 1018s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 1018s rm -f "$INRELEASE" 1018s else 1018s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 1018s touch -d "$DATE" "${INRELEASE}" 1018s fi 1018s done 1018s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 1018s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 1018s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 1018s fi 1018s msgdone 'info' 1018s } 1018s 1018s redatereleasefiles() { 1018s local DATE="$(date -u -d "$1" -R)" 1018s for release in $(find aptarchive/ -name 'Release'); do 1018s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 1018s touch -d "$DATE" "$release" 1018s done 1018s signreleasefiles "${2:-Joe Sixpack}" 1018s } 1018s 1018s webserverconfig() { 1018s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 1018s local NOCHECK=false 1018s if [ "$1" = '--no-check' ]; then 1018s NOCHECK=true 1018s shift 1018s fi 1018s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 1018s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 1018s rm -f "$STATUS" "$DOWNLOG" 1018s local URI 1018s if [ -n "$2" ]; then 1018s msgtest "Set webserver config option '${1}' to" "$2" 1018s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 1018s else 1018s msgtest 'Clear webserver config option' "${1}" 1018s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 1018s fi 1018s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 1018s msgpass 1018s else 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 1018s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 1018s msgfailoutput '' "$OUTPUT" 1018s fi 1018s $NOCHECK || testwebserverlaststatuscode '200' 1018s } 1018s 1018s rewritesourceslist() { 1018s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 1018s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 1018s sed -i $LIST \ 1018s -e "s#file://$APTARCHIVE#${1}#" \ 1018s -e "s#file:$APTARCHIVE#${1}#" \ 1018s -e "s#copy://$APTARCHIVE#${1}#" \ 1018s -e "s#copy:$APTARCHIVE#${1}#" \ 1018s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 1018s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 1018s done 1018s } 1018s 1018s # wait for up to 10s for a pid file to appear to avoid possible race 1018s # when a helper is started and doesn't write the PID quick enough 1018s waitforpidfile() { 1018s local PIDFILE="$1" 1018s for i in $(seq 10); do 1018s if test -s "$PIDFILE"; then 1018s return 0 1018s fi 1018s sleep 1 1018s done 1018s msgdie "waiting for $PIDFILE failed" 1018s return 1 1018s } 1018s 1018s changetowebserver() { 1018s local REWRITE='yes' 1018s if [ "$1" = '--no-rewrite' ]; then 1018s REWRITE='no' 1018s shift 1018s fi 1018s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 1018s cd aptarchive 1018s local LOG="webserver.log" 1018s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 1018s cat "$LOG" 1018s false 1018s fi 1018s waitforpidfile aptwebserver.pid 1018s local PID="$(cat aptwebserver.pid)" 1018s if [ -z "$PID" ]; then 1018s msgdie 'Could not fork aptwebserver successfully' 1018s fi 1018s addtrap "kill $PID;" 1018s waitforpidfile aptwebserver.port 1018s APTHTTPPORT="$(cat aptwebserver.port)" 1018s if [ -z "$APTHTTPPORT" ]; then 1018s msgdie 'Could not get port for aptwebserver successfully' 1018s fi 1018s cd - > /dev/null 1018s else 1018s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 1018s fi 1018s if [ "$REWRITE" != 'no' ]; then 1018s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 1018s fi 1018s } 1018s 1018s changetohttpswebserver() { 1018s local REWRITE='yes' 1018s if [ "$1" = '--no-rewrite' ]; then 1018s REWRITE='no' 1018s shift 1018s fi 1018s local stunnel4 1018s if command -v stunnel4 >/dev/null 2>&1; then 1018s stunnel4=stunnel4 1018s elif command -v stunnel >/dev/null 2>&1; then 1018s stunnel4=stunnel 1018s else 1018s msgdie 'You need to install stunnel4 for https testcases' 1018s fi 1018s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 1018s changetowebserver --no-rewrite "$@" 1018s fi 1018s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 1018s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 1018s output = /dev/null 1018s 1018s [https] 1018s accept = 127.0.0.1:0 1018s connect = $APTHTTPPORT 1018s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 1018s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 1018s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 1018s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 1018s if [ -z "$PID" ]; then 1018s msgdie 'Could not fork $stunnel4 successfully' 1018s fi 1018s addtrap 'prefix' "kill ${PID};" 1018s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 1018s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 1018s if [ "$REWRITE" != 'no' ]; then 1018s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 1018s fi 1018s } 1018s 1018s changetocdrom() { 1018s mkdir -p rootdir/media/cdrom/.disk 1018s local CD="$(readlink -f rootdir/media/cdrom)" 1018s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 1018s if [ ! -d aptarchive/dists ]; then 1018s msgdie 'Flat file archive cdroms can not be created currently' 1018s return 1 1018s fi 1018s mv aptarchive/dists "$CD" 1018s ln -s "$(readlink -f ./incoming)" "$CD/pool" 1018s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 1018s # start with an unmounted disk 1018s mv "${CD}" "${CD}-unmounted" 1018s # we don't want the disk to be modifiable 1018s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 1018s chmod -R 555 rootdir/media/cdrom-unmounted/dists 1018s } 1018s 1018s downloadfile() { 1018s local PROTO="${1%%:*}" 1018s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 1018s download-file "$1" "$2" "$3" 2>&1 ; then 1018s return 1 1018s fi 1018s # only if the file exists the download was successful 1018s if [ -r "$2" ]; then 1018s return 0 1018s else 1018s return 1 1018s fi 1018s } 1018s 1018s cleanup_output() { 1018s cat "$1" | sed \ 1018s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 1018s -e '/^profiling:/ d' \ 1018s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 1018s >"$2" 1018s } 1018s 1018s checkdiff() { 1018s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 1018s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 1018s touch "$TMPFILE1" "$TMPFILE2" 1018s 1018s cleanup_output "$1" "$TMPFILE1" 1018s cleanup_output "$2" "$TMPFILE2" 1018s 1018s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 1018s if [ -n "$DIFFTEXT" ]; then 1018s echo >&2 1018s echo >&2 "$DIFFTEXT" 1018s return 1 1018s else 1018s return 0 1018s fi 1018s } 1018s 1018s testoutputequal() { 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 1018s local COMPAREFILE="$1" 1018s shift 1018s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 1018s msgpass 1018s else 1018s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 1018s cat "$COMPAREFILE" >>"${OUTPUT}" 1018s msgfailoutput '' "$OUTPUT" "$@" 1018s fi 1018s } 1018s 1018s testfileequal() { 1018s msggroup 'testfileequal' 1018s local MSG='Test for correctness of file' 1018s if [ "$1" = '--nomsg' ]; then 1018s MSG='' 1018s shift 1018s fi 1018s local FILE="$1" 1018s shift 1018s if [ -n "$MSG" ]; then 1018s msgtest "$MSG" "$FILE" 1018s fi 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 1018s if [ -z "$*" ]; then 1018s testoutputequal "$FILE" echo -n '' 1018s else 1018s testoutputequal "$FILE" echo "$*" 1018s fi 1018s msggroup 1018s } 1018s 1018s testempty() { 1018s msggroup 'testempty' 1018s if [ "$1" = '--nomsg' ]; then 1018s shift 1018s else 1018s msgtest "Test for no output of" "$*" 1018s fi 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 1018s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 1018s msgpass 1018s else 1018s msgfailoutput '' "$COMPAREFILE" "$@" 1018s fi 1018s aptautotest 'testempty' "$@" 1018s msggroup 1018s } 1018s testwarningempty() { 1018s testwarning "$@" 1018s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 1018s } 1018s testnotempty() { 1018s msggroup 'testnotempty' 1018s msgtest "Test for some output of" "$*" 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 1018s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 1018s msgpass 1018s else 1018s msgfailoutput '' "$COMPAREFILE" "$@" 1018s fi 1018s aptautotest 'testnotempty' "$@" 1018s msggroup 1018s } 1018s 1018s testequal() { 1018s msggroup 'testequal' 1018s local MSG='Test of equality of' 1018s if [ "$1" = '--nomsg' ]; then 1018s MSG='' 1018s shift 1018s fi 1018s 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 1018s echo "$1" > "$COMPAREFILE" 1018s shift 1018s 1018s if [ -n "$MSG" ]; then 1018s msgtest "$MSG" "$*" 1018s fi 1018s testoutputequal "$COMPAREFILE" "$@" 1018s aptautotest 'testequal' "$@" 1018s msggroup 1018s } 1018s 1018s testequalor2() { 1018s msggroup 'testequalor2' 1018s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 1018s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 1018s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 1018s echo "$1" > "$COMPAREFILE1" 1018s echo "$2" > "$COMPAREFILE2" 1018s shift 2 1018s msgtest "Test for equality OR of" "$*" 1018s "$@" >"$COMPAREAGAINST" 2>&1 || true 1018s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 1018s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 1018s then 1018s msgpass 1018s else 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 1018s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 1018s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1018s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 1018s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1018s msgfailoutput '' "$OUTPUT" 1018s fi 1018s aptautotest 'testequalor2' "$@" 1018s msggroup 1018s } 1018s 1018s testshowvirtual() { 1018s msggroup 'testshowvirtual' 1018s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 1018s local PACKAGE="$1" 1018s shift 1018s while [ -n "$1" ]; do 1018s VIRTUAL="${VIRTUAL} 1018s N: Can't select versions from package '$1' as it is purely virtual" 1018s PACKAGE="${PACKAGE} $1" 1018s shift 1018s done 1018s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 1018s VIRTUAL="${VIRTUAL} 1018s N: No packages found" 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 1018s local ARCH="$(getarchitecture 'native')" 1018s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 1018s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 1018s msggroup 1018s } 1018s 1018s testnopackage() { 1018s msggroup 'testnopackage' 1018s msgtest "Test for non-existent packages" "apt-cache show $*" 1018s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 1018s if [ -n "$SHOWPKG" ]; then 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1018s echo "$SHOWPKG" >"$OUTPUT" 1018s msgfailoutput '' "$OUTPUT" 1018s else 1018s msgpass 1018s fi 1018s msggroup 1018s } 1018s testnosrcpackage() { 1018s msggroup 'testnosrcpackage' 1018s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 1018s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 1018s if [ -n "$SHOWPKG" ]; then 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 1018s echo "$SHOWPKG" >"$OUTPUT" 1018s msgfailoutput '' "$OUTPUT" 1018s else 1018s msgpass 1018s fi 1018s msggroup 1018s } 1018s 1018s testdpkgstatus() { 1018s msggroup 'testdpkgstatus' 1018s local STATE="$1" 1018s local NR="$2" 1018s shift 2 1018s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 1018s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 1018s if [ "$PKGS" != $NR ]; then 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1018s echo "$PKGS" >"$OUTPUT" 1018s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 1018s msgfailoutput '' "$OUTPUT" 1018s else 1018s msgpass 1018s fi 1018s msggroup 1018s } 1018s 1018s testdpkginstalled() { 1018s msggroup 'testdpkginstalled' 1018s testdpkgstatus 'ii' "$#" "$@" 1018s msggroup 1018s } 1018s 1018s testdpkgnotinstalled() { 1018s msggroup 'testdpkgnotinstalled' 1018s testdpkgstatus 'ii' '0' "$@" 1018s msggroup 1018s } 1018s 1018s testmarkedauto() { 1018s msggroup 'testmarkedauto' 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 1018s if [ -n "$1" ]; then 1018s msgtest 'Test for correctly marked as auto-installed' "$*" 1018s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1018s else 1018s msgtest 'Test for correctly marked as auto-installed' 'no package' 1018s echo -n > "$COMPAREFILE" 1018s fi 1018s testoutputequal "$COMPAREFILE" aptmark showauto 1018s msggroup 1018s } 1018s testmarkedmanual() { 1018s msggroup 'testmarkedmanual' 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 1018s if [ -n "$1" ]; then 1018s msgtest 'Test for correctly marked as manually installed' "$*" 1018s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1018s else 1018s msgtest 'Test for correctly marked as manually installed' 'no package' 1018s echo -n > "$COMPAREFILE" 1018s fi 1018s testoutputequal "$COMPAREFILE" aptmark showmanual 1018s msggroup 1018s } 1018s 1018s catfile() { 1018s if [ "${1##*.}" = 'deb' ]; then 1018s stat >&2 "$1" || true 1018s file >&2 "$1" || true 1018s else 1018s cat >&2 "$1" || true 1018s fi 1018s } 1018s msgfailoutput() { 1018s msgreportheader 'msgfailoutput' 1018s local MSG="$1" 1018s local OUTPUT="$2" 1018s shift 2 1018s local CMD="$1" 1018s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 1018s echo >&2 1018s while [ -n "$2" ]; do shift; done 1018s echo "#### Complete file: $1 ####" 1018s catfile "$1" 1018s echo "#### $CMD output ####" 1018s elif [ "$1" = 'test' ]; then 1018s echo >&2 1018s # doesn't support ! or non-file flags 1018s msgfailoutputstatfile() { 1018s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 1018s if expr match "$1" "$FILEFLAGS" >/dev/null; then 1018s echo "#### stat(2) of file: $2 ####" 1018s stat "$2" || true 1018s if test -d "$2"; then 1018s echo "#### The directory contains: $2 ####" 1018s ls >&2 "$2" || true 1018s elif test -e "$2"; then 1018s echo "#### Complete file: $2 ####" 1018s catfile "$2" 1018s fi 1018s fi 1018s } 1018s msgfailoutputstatfile "$2" "$3" 1018s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 1018s shift 3 1018s msgfailoutputstatfile "$2" "$3" 1018s done 1018s echo '#### test output ####' 1018s elif [ "$1" = 'cmp' ]; then 1018s echo >&2 1018s while [ -n "$2" ]; do 1018s echo "#### Complete file: $2 ####" 1018s catfile "$2" 1018s shift 1018s done 1018s echo '#### cmp output ####' 1018s elif [ "$1" = 'rm' ]; then 1018s echo "#### Directory listing of: $(pwd) ####" 1018s ls -l 1018s fi 1018s catfile "$OUTPUT" 1018s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 1018s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 1018s local COREEXE='' 1018s for CORENAME in 'core' 'core.pid'; do 1018s if [ -s "$CORENAME" ]; then 1018s cp -a ${CORENAME} "$COREDUMP" 1018s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 1018s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 1018s else 1018s continue 1018s fi 1018s break 1018s done 1018s if [ -s "$COREDUMP" ]; then 1018s true # found already as a file 1018s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 1018s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 1018s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 1018s else 1018s echo '### core dump not found ###' 1018s cat /proc/sys/kernel/core_pattern 1018s fi 1018s if [ -s "$COREDUMP" ]; then 1018s if [ -z "$COREEXE" ]; then 1018s case "$CMD" in 1018s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1018s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 1018s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 1018s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 1018s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 1018s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1018s esac 1018s fi 1018s 1018s if [ -d "${ARTIFACTSDIR}" ]; then 1018s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 1018s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 1018s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 1018s fi 1018s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 1018s echo "#### gdb backtrace ####" 1018s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 1018s fi 1018s fi 1018s rm -f "$COREDUMP" 1018s fi 1018s msgfail "$MSG" 1018s } 1018s 1018s testsuccesswithglobalerror() { 1018s local TYPE="$1" 1018s local ERRORS="$2" 1018s shift 2 1018s msggroup "$TYPE" 1018s if [ "$1" = '--nomsg' ]; then 1018s shift 1018s else 1018s msgtest 'Test for successful execution of' "$*" 1018s fi 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 1018s if "$@" >"${OUTPUT}" 2>&1; then 1018s if expr match "$1" '^apt.*' >/dev/null; then 1018s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1018s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1018s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 1018s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 1018s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 1018s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1018s msgpass 1018s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 1018s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1018s msgpass 1018s else 1018s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1018s fi 1018s else 1018s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1018s fi 1018s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 1018s if grep -q -E "^N: " "$OUTPUT"; then 1018s msgpass 1018s else 1018s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 1018s fi 1018s else 1018s msgpass 1018s fi 1018s else 1018s msgpass 1018s fi 1018s else 1018s local EXITCODE=$? 1018s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1018s fi 1018s aptautotest "$TYPE" "$@" 1018s msggroup 1018s } 1018s testsuccesswithnotice() { 1018s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 1018s } 1018s testsuccess() { 1018s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 1018s } 1018s testwarning() { 1018s msggroup 'testwarning' 1018s if [ "$1" = '--nomsg' ]; then 1018s shift 1018s else 1018s msgtest 'Test for successful execution with warnings of' "$*" 1018s fi 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 1018s if "$@" >"${OUTPUT}" 2>&1; then 1018s if expr match "$1" '^apt.*' >/dev/null; then 1018s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1018s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1018s elif grep -q -E '^E: ' "$OUTPUT"; then 1018s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 1018s elif ! grep -q -E '^W: ' "$OUTPUT"; then 1018s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 1018s else 1018s msgpass 1018s fi 1018s else 1018s msgpass 1018s fi 1018s else 1018s local EXITCODE=$? 1018s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1018s fi 1018s aptautotest 'testwarning' "$@" 1018s msggroup 1018s } 1018s testfailure() { 1018s msggroup 'testfailure' 1018s if [ "$1" = '--nomsg' ]; then 1018s shift 1018s else 1018s msgtest 'Test for failure in execution of' "$*" 1018s fi 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 1018s if "$@" >"${OUTPUT}" 2>&1; then 1018s local EXITCODE=$? 1018s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1018s else 1018s local EXITCODE=$? 1018s if expr match "$1" '^apt.*' >/dev/null; then 1018s if [ "$1" = 'aptkey' ]; then 1018s if grep -q " Can't check signature: 1018s BAD signature from 1018s signature could not be verified" "$OUTPUT"; then 1018s msgpass 1018s else 1018s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 1018s fi 1018s else 1018s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1018s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1018s elif grep -q -E '==ERROR' "$OUTPUT"; then 1018s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 1018s elif ! grep -q -E '^E: ' "$OUTPUT"; then 1018s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 1018s else 1018s msgpass 1018s fi 1018s fi 1018s else 1018s msgpass 1018s fi 1018s fi 1018s aptautotest 'testfailure' "$@" 1018s msggroup 1018s } 1018s 1018s testreturnstateequal() { 1018s local STATE="$1" 1018s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 1018s local STATE="$2" 1018s local TYPE="$3" 1018s shift 3 1018s msggroup "${STATE}equal" 1018s if [ "$1" != '--nomsg' ]; then 1018s local CMP="$1" 1018s shift 1018s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1018s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1018s else 1018s local CMP="$2" 1018s shift 2 1018s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1018s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1018s fi 1018s else 1018s msggroup "${STATE}equal" 1018s if [ "$2" != '--nomsg' ]; then 1018s local CMP="$2" 1018s shift 2 1018s "$STATE" "$@" 1018s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1018s else 1018s local CMP="$3" 1018s shift 3 1018s "$STATE" --nomsg "$@" 1018s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1018s fi 1018s fi 1018s msggroup 1018s } 1018s testsuccessequal() { 1018s # we compare output, so we know perfectly well about N: 1018s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 1018s } 1018s testwarningequal() { 1018s testreturnstateequal 'testwarning' "$@" 1018s } 1018s testfailureequal() { 1018s testreturnstateequal 'testfailure' "$@" 1018s } 1018s 1018s testfailuremsg() { 1018s msggroup 'testfailuremsg' 1018s local CMP="$1" 1018s shift 1018s testfailure "$@" 1018s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 1018s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 1018s testoutputequal "$COMPAREFILE" echo "$CMP" 1018s msggroup 1018s } 1018s testwarningmsg() { 1018s msggroup 'testwarningmsg' 1018s local CMP="$1" 1018s shift 1018s testwarning "$@" 1018s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 1018s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 1018s testoutputequal "$COMPAREFILE" echo "$CMP" 1018s msggroup 1018s } 1018s 1018s testfilestats() { 1018s msggroup 'testfilestats' 1018s msgtest "Test that file $1 has $2 $3" "$4" 1018s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 1018s msgpass 1018s else 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 1018s { 1018s echo 1018s ls -ld "$1" || true 1018s echo -n "stat(1) reports for $2: " 1018s stat --format "$2" "$1" || true 1018s } >"$OUTPUT" 2>&1 1018s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 1018s fi 1018s msggroup 1018s } 1018s testaccessrights() { 1018s msggroup 'testaccessrights' 1018s testfilestats "$1" '%a' '=' "$2" 1018s msggroup 1018s } 1018s 1018s testwebserverlaststatuscode() { 1018s msggroup 'testwebserverlaststatuscode' 1018s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 1018s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 1018s rm -f "$DOWNLOG" "$STATUS" 1018s msgtest 'Test last status code from the webserver was' "$1" 1018s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 1018s msgpass 1018s else 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 1018s { 1018s if [ -n "$2" ]; then 1018s shift 1018s echo >&2 '#### Additionally provided output files contain:' 1018s cat >&2 "$@" 1018s fi 1018s echo >&2 '#### Download log of the status code:' 1018s cat >&2 "$DOWNLOG" 1018s } >"$OUTPUT" 2>&1 1018s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 1018s fi 1018s msggroup 1018s } 1018s 1018s mapkeynametokeyid() { 1018s while [ -n "$1" ]; do 1018s case "$1" in 1018s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 1018s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 1018s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 1018s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 1018s oldarchive) echo 'FDD2DB85F68C85A3';; 1018s *) echo 'UNKNOWN KEY';; 1018s esac 1018s shift 1018s done 1018s } 1018s testaptkeys() { 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 1018s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 1018s echo -n > "$OUTPUT" 1018s fi 1018s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 1018s } 1018s 1018s pause() { 1018s echo "STOPPED execution. Press enter to continue" 1018s local IGNORE 1018s read IGNORE 1018s } 1018s 1018s logcurrentarchivedirectory() { 1018s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 1018s stat --format '%U:%G:%a:%n' "$line" 1018s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 1018s } 1018s listcurrentlistsdirectory() { 1018s { 1018s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 1018s stat --format '%U:%G:%a:%n' "$line" 1018s done 1018s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 1018s stat --format '%U:%G:%a:%s:%y:%n' "$line" 1018s done 1018s } | sort 1018s } 1018s forallsupportedcompressors() { 1018s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1018s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1018s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 1018s "$@" "$COMP" 1018s done 1018s } 1018s 1018s breakfiles() { 1018s while [ -n "$1" ]; do 1018s mv -f "${1}" "${1}.bak" 1018s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 1018s shift 1018s done 1018s } 1018s unbreakfiles() { 1018s while [ -n "$1" ]; do 1018s mv -f "${1}.bak" "${1}" 1018s shift 1018s done 1018s } 1018s 1018s ### convenience hacks ### 1018s mkdir() { 1018s # creating some directories by hand is a tedious task, so make it look simple 1018s local PARAMS="$*" 1018s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 1018s # only the last directory created by mkdir is effected by the -m ! 1018s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 1018s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 1018s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1018s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1018s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 1018s if [ "$(id -u)" = '0' ]; then 1018s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1018s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1018s fi 1018s else 1018s command mkdir "$@" 1018s fi 1018s } 1018s 1018s ### The following tests are run by most test methods automatically to check 1018s ### general things about commands executed without writing the test every time. 1018s 1018s aptautotest() { 1018s if [ $# -lt 3 ]; then return; fi 1018s local TESTCALL="$1" 1018s local CMD="$2" 1018s local FIRSTOPT="$3" 1018s shift 2 1018s for i in "$@"; do 1018s if ! expr match "$i" '^-' >/dev/null 2>&1; then 1018s FIRSTOPT="$i" 1018s break 1018s fi 1018s done 1018s shift 1018s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 1018s if command -v $AUTOTEST >/dev/null; then 1018s # save and restore the *.output files from other tests 1018s # as we might otherwise override them in these automatic tests 1018s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1018s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1018s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1018s $AUTOTEST "$TESTCALL" "$@" 1018s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1018s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1018s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1018s fi 1018s } 1018s 1018s cdfind() { 1018s ( cd /; find "$@" ) 1018s } 1018s aptautotest_aptget_update() { 1018s local TESTCALL="$1" 1018s while [ -n "$2" ]; do 1018s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 1018s shift 1018s done 1018s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 1018s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1018s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1018s # all copied files are properly chmodded 1018s local backupIFS="$IFS" 1018s IFS="$(printf "\n\b")" 1018s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 1018s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 1018s done 1018s IFS="$backupIFS" 1018s if [ "$TESTCALL" = 'testsuccess' ]; then 1018s # failure cases can retain partial files and such 1018s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 1018s fi 1018s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 1018s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 1018s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 1018s fi 1018s } 1018s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 1018s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 1018s 1018s testaptautotestnodpkgwarning() { 1018s local TESTCALL="$1" 1018s while [ -n "$2" ]; do 1018s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 1018s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 1018s shift 1018s done 1018s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 1018s } 1018s 1018s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 1018s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 1018s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 1018s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 1018s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 1018s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 1018s 1018s testaptmarknodefaultsections() { 1018s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 1018s } 1018s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 1018s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 1018s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 1018s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 1018s cat: ./downloaded/foo1: No such file or directory 1018s cmp: ./downloaded/foo1: No such file or directory 1018s FAIL: exitcode 2 1018s 1018s cat: ./downloaded/foo1: No such file or directory 1018s #!/bin/sh -- # no runable script, just for vi 1018s 1018s EXIT_CODE=0 1018s 1018s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 1018s if [ "$1" = "-q" ]; then 1018s export MSGLEVEL=2 1018s elif [ "$1" = "-qq" ]; then 1018s export MSGLEVEL=1 1018s elif [ "$1" = "-v" ]; then 1018s export MSGLEVEL=4 1018s elif [ "$1" = '--color=no' ]; then 1018s export MSGCOLOR='NO' 1018s elif [ "$1" = '--color=yes' ]; then 1018s export MSGCOLOR='YES' 1018s elif [ "$1" = '--color' ]; then 1018s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 1018s shift 1018s elif [ "$1" = '--level' ]; then 1018s export MSGLEVEL=$2 1018s shift 1018s else 1018s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 1018s fi 1018s shift 1018s done 1018s export MSGLEVEL="${MSGLEVEL:-3}" 1018s 1018s # we all like colorful messages 1018s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 1018s if [ ! -t 1 ]; then # but check that we output to a terminal 1018s export MSGCOLOR='NO' 1018s fi 1018s fi 1018s 1018s if [ "$MSGCOLOR" != 'NO' ]; then 1018s CERROR="\033[1;31m" # red 1018s CWARNING="\033[1;33m" # yellow 1018s CMSG="\033[1;32m" # green 1018s CINFO="\033[1;96m" # light blue 1018s CDEBUG="\033[1;94m" # blue 1018s CNORMAL="\033[0;39m" # default system console color 1018s CDONE="\033[1;32m" # green 1018s CPASS="\033[1;32m" # green 1018s CFAIL="\033[1;31m" # red 1018s CCMD="\033[1;35m" # pink 1018s fi 1018s 1018s msgprintf() { 1018s local START="$1" 1018s local MIDDLE="$2" 1018s local END="$3" 1018s shift 3 1018s if [ -n "$1" ]; then 1018s printf "$START " "$1" 1018s shift 1018s while [ -n "$1" ]; do 1018s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 1018s shift 1018s done 1018s fi 1018s printf "${END}" 1018s } 1018s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 1018s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 1018s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 1018s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 1018s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 1018s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 1018s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 1018s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 1018s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 1018s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 1018s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 1018s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 1018s msgreportheader() { 1018s if [ -n "$MSGTEST_MSG" ]; then 1018s test "$1" != 'msgfailoutput' || echo 1018s if [ -n "$MSGTEST_MSGMSG" ]; then 1018s echo "$MSGTEST_MSGMSG" 1018s fi 1018s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 1018s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 1018s fi 1018s echo -n "$MSGTEST_MSG" 1018s unset MSGTEST_MSG 1018s fi 1018s } 1018s msgskip() { 1018s msgreportheader 'msgskip' 1018s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 1018s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 1018s } 1018s msgfail() { 1018s msgreportheader 'msgfail' 1018s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 1018s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 1018s if [ -n "$APT_DEBUG_TESTS" ]; then 1018s runapt $SHELL 1018s fi 1018s EXIT_CODE=$((EXIT_CODE+1)); 1018s } 1018s MSGGROUP_LEVEL=0 1018s msggroup() { 1018s if [ -n "$1" ]; then 1018s if [ $MSGGROUP_LEVEL = 0 ]; then 1018s MSGTEST_GRP='NEXT' 1018s fi 1018s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 1018s else 1018s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 1018s if [ $MSGGROUP_LEVEL = 0 ]; then 1018s unset MSGTEST_GRP 1018s fi 1018s fi 1018s } 1018s 1018s # enable / disable Debugging 1018s if [ $MSGLEVEL -le 0 ]; then 1018s msgdie() { true; } 1018s fi 1018s if [ $MSGLEVEL -le 1 ]; then 1018s msgwarn() { true; } 1018s msgnwarn() { true; } 1018s fi 1018s if [ $MSGLEVEL -le 2 ]; then 1018s msgmsg() { 1018s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 1018s } 1018s msgnmsg() { true; } 1018s msgtest() { 1018s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 1018s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 1018s MSGTEST_GRP="$MSGTEST_MSG" 1018s fi 1018s } 1018s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 1018s fi 1018s if [ $MSGLEVEL -le 3 ]; then 1018s msginfo() { true; } 1018s msgninfo() { true; } 1018s fi 1018s if [ $MSGLEVEL -le 4 ]; then 1018s msgdebug() { true; } 1018s msgndebug() { true; } 1018s fi 1018s if [ $MSGLEVEL -le 1 ]; then 1018s msgpass() { true; } 1018s fi 1018s msgdone() { 1018s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 1018s [ "$1" = "info" -a $MSGLEVEL -le 3 ] || 1018s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 1018s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 1018s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 1018s true; 1018s else 1018s printf "${CDONE}DONE${CNORMAL}\n"; 1018s fi 1018s } 1018s getaptconfig() { 1018s if [ -f ./aptconfig.conf ]; then 1018s echo "$(readlink -f ./aptconfig.conf)" 1018s elif [ -f ../aptconfig.conf ]; then 1018s echo "$(readlink -f ../aptconfig.conf)" 1018s elif [ -f ../../aptconfig.conf ]; then 1018s echo "$(readlink -f ../../aptconfig.conf)" 1018s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 1018s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 1018s fi 1018s } 1018s runapt() { 1018s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 1018s local CMD="$1" 1018s shift 1018s case "$CMD" in 1018s sh|aptitude|*/*|command) ;; 1018s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 1018s esac 1018s if [ "$CMD" = 'aptitude' ]; then 1018s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 1018s else 1018s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 1018s fi 1018s } 1018s runpython3() { runapt command python3 "$@"; } 1018s aptconfig() { runapt apt-config "$@"; } 1018s aptcache() { runapt apt-cache "$@"; } 1018s aptcdrom() { runapt apt-cdrom "$@"; } 1018s aptget() { runapt apt-get "$@"; } 1018s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 1018s aptkey() { runapt apt-key "$@"; } 1018s aptmark() { runapt apt-mark "$@"; } 1018s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 1018s apt() { runapt apt "$@"; } 1018s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 1018s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 1018s aptitude() { runapt aptitude "$@"; } 1018s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 1018s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 1018s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 1018s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 1018s 1018s dpkg() { 1018s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 1018s } 1018s dpkgquery() { 1018s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1018s } 1018s dpkg_version() { 1018s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 1018s } 1018s dpkgcheckbuilddeps() { 1018s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1018s } 1018s gdb() { 1018s local CMD 1018s case "$1" in 1018s aptget) CMD="apt-get";; 1018s aptcache) CMD="apt-cache";; 1018s aptcdrom) CMD="apt-cdrom";; 1018s aptconfig) CMD="apt-config";; 1018s aptmark) CMD="apt-mark";; 1018s apthelper) CMD="apt-helper";; 1018s aptftparchive) CMD="apt-ftparchive";; 1018s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1018s *) CMD="$1";; 1018s esac 1018s shift 1018s if [ "${CMD##*/}" = "$CMD" ]; then 1018s CMD="${APTCMDLINEBINDIR}/${CMD}" 1018s fi 1018s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 1018s } 1018s 1018s valgrind() { 1018s local CMD 1018s case "$1" in 1018s aptget) CMD="apt-get";; 1018s aptcache) CMD="apt-cache";; 1018s aptcdrom) CMD="apt-cdrom";; 1018s aptconfig) CMD="apt-config";; 1018s aptmark) CMD="apt-mark";; 1018s apthelper) CMD="apt-helper";; 1018s aptftparchive) CMD="apt-ftparchive";; 1018s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1018s *) CMD="$1";; 1018s esac 1018s shift 1018s if [ "$CMD" = "apt-ftparchive" ]; then 1018s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 1018s fi 1018s if [ "${CMD##*/}" = "$CMD" ]; then 1018s CMD="${APTCMDLINEBINDIR}/${CMD}" 1018s fi 1018s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 1018s } 1018s 1018s lastmodification() { 1018s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 1018s } 1018s releasefiledate() { 1018s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 1018s } 1018s 1018s exitwithstatus() { 1018s # error if we about to overflow, but ... 1018s # "255 failures ought to be enough for everybody" 1018s if [ $EXIT_CODE -gt 255 ]; then 1018s msgdie "Total failure count $EXIT_CODE too big" 1018s fi 1018s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 1018s } 1018s 1018s shellsetedetector() { 1018s local exit_status=$? 1018s if [ "$exit_status" != '0' ]; then 1018s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 1018s if [ "$EXIT_CODE" = '0' ]; then 1018s EXIT_CODE="$exit_status" 1018s fi 1018s fi 1018s } 1018s 1018s addtrap() { 1018s if [ "$1" = 'prefix' ]; then 1018s CURRENTTRAP="$2 $CURRENTTRAP" 1018s else 1018s CURRENTTRAP="$CURRENTTRAP $1" 1018s fi 1018s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1018s } 1018s 1018s escape_shell() { 1018s echo "$@" | sed -e "s#'#'\"'\"'#g" 1018s } 1018s 1018s find_project_binary_dir() { 1018s if [ -z "$PROJECT_BINARY_DIR" ]; then 1018s PROJECT_BINARY_DIR= 1018s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 1018s test -e "$dir/CMakeCache.txt" || continue 1018s if [ -z "$PROJECT_BINARY_DIR" ] || 1018s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 1018s PROJECT_BINARY_DIR="$dir" 1018s fi 1018s done 1018s if [ -z "$PROJECT_BINARY_DIR" ]; then 1018s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 1018s exit 1 1018s fi 1018s export PROJECT_BINARY_DIR 1018s fi 1018s } 1018s _removetmpworkingdirectory() { 1018s cd / 1018s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 1018s rm -rf "$TMPWORKINGDIRECTORY" 1018s fi 1018s TMPWORKINGDIRECTORY='' 1018s } 1018s setupenvironment() { 1018s # cleanup the environment a bit 1018s export LC_ALL=C 1018s unset LANGUAGE COLUMNS NLSPATH 1018s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 1018s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 1018s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 1018s unset GREP_OPTIONS POSIXLY_CORRECT 1018s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 1018s export GCOV_ERROR_FILE=/dev/null 1018s 1018s # Next check needs a gnu stat, let's figure that out early. 1018s stat=stat 1018s if command -v gnustat >/dev/null 2>&1; then 1018s stat=gnustat 1018s fi 1018s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 1018s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 1018s unset TMPDIR 1018s fi 1018s if [ -z "$TMPWORKINGDIRECTORY" ]; then 1018s addtrap '_removetmpworkingdirectory;' 1018s TMPWORKINGDIRECTORY="$(mktemp -d)" 1018s fi 1018s if [ -n "$TMPDIR_ADD" ]; then 1018s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 1018s mkdir -p "$TMPWORKINGDIRECTORY" 1018s unset TMPDIR_ADD 1018s export TMPDIR="$TMPWORKINGDIRECTORY" 1018s fi 1018s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 1018s 1018s # Setup coreutils on BSD systems 1018s mkdir "${TMPWORKINGDIRECTORY}/bin" 1018s for prefix in gnu g; do 1018s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 1018s if command -v $prefix$command 2>/dev/null >/dev/null; then 1018s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 1018s fi 1018s done 1018s done 1018s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 1018s 1018s if [ -z "$TESTDIRECTORY" ]; then 1018s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 1018s fi 1018s cd "$TMPWORKINGDIRECTORY" 1018s 1018s mkdir -m 700 'downloaded' 1018s if [ "$(id -u)" = '0' ]; then 1018s # relax permissions so that running as root with user switching works 1018s umask 022 1018s chmod 711 "$TMPWORKINGDIRECTORY" 1018s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 1018s fi 1018s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 1018s 1018s _setupprojectenvironment 1018s 1018s # create some files in /tmp and look at user/group to get what this means 1018s TEST_DEFAULT_USER="$(id -un)" 1018s touch "${TMPWORKINGDIRECTORY}/test-file" 1018s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 1018s 1018s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 1018s . "${TESTDIRECTORY}/extra-environment" 1018s fi 1018s 1018s msgdone "info" 1018s } 1018s _setupprojectenvironment() { 1018s # allow overriding the default BUILDDIR locations 1018s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 1018s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 1018s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 1018s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 1018s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1018s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 1018s APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 1018s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1018s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 1018s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 1018s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 1018s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 1018s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 1018s 1018s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 1018s mkdir aptarchive keys 1018s cd rootdir 1018s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 1018s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 1018s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 1018s touch var/lib/dpkg/available var/lib/dpkg/lock 1018s echo '1' > var/lib/dpkg/info/format 1018s ln -s "${METHODSDIR}" usr/lib/apt/methods 1018s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 1018s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 1018s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 1018s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 1018s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 1018s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 1018s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 1018s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 1018s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 1018s else 1018s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 1018s fi 1018s cd .. 1018s local BASENAME="${0##*/}" 1018s local PACKAGESFILE="Packages-${BASENAME#*-}" 1018s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 1018s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 1018s fi 1018s local SOURCESSFILE="Sources-${BASENAME#*-}" 1018s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 1018s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 1018s fi 1018s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 1018s chmod 644 keys/* 1018s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 1018s 1018s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 1018s echo "Dir::Etc \"etc\";" >> aptconfig.conf 1018s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 1018s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 1018s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 1018s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 1018s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 1018s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 1018s # either store apt-key were we can access it, even if we run it as a different user 1018s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 1018s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 1018s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 1018s # destroys coverage reporting though, so we disable changing user for the calling gpgv 1018s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 1018s if [ "$(id -u)" = '0' ]; then 1018s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 1018s # same for the solver executables 1018s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 1018s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 1018s fi 1018s 1018s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 1018s EXEC='' 1018s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 1018s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 1018s restoredpkgstatus() { 1018s if [ -n "\$BACKUP" ]; then 1018s if [ -e "\$BACKUP" ]; then 1018s mv -f "\$BACKUP" "\$ORIGINAL" 1018s else 1018s rm -f "\$ORIGINAL" 1018s fi 1018s BACKUP='' 1018s fi 1018s } 1018s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1018s if [ -e "\$ORIGINAL" ]; then 1018s cp -a "\$ORIGINAL" "\$BACKUP" 1018s fi 1018s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 1018s 1018s Package: dpkg 1018s Architecture: all 1018s Version: ${DPKG_VERSION}+fake 1018s Status: install ok installed 1018s Maintainer: Joe Sixpack 1018s Installed-Size: 42 1018s Description: tells dpkg it supports what we need 1018s Some versions of dpkg check its own version from the status file 1018s to know if it supports multi-arch and stuff in --assert-*. 1018s 1018s EOS 1018s fi 1018s EOF 1018s fi 1018s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 1018s 1018s { 1018s echo 'quiet "0";' 1018s echo 'quiet::NoUpdate "true";' 1018s echo 'quiet::NoStatistic "true";' 1018s # too distracting for users, but helpful to detect changes 1018s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 1018s echo 'Acquire::Progress::Diffpercent "true";' 1018s # in testcases, it can appear as if localhost has a rotation setup, 1018s # hide this as we can't really deal with it properly 1018s echo 'Acquire::Failure::ShowIP "false";' 1018s # randomess and tests don't play well together 1018s echo 'Acquire::IndexTargets::Randomized "false";' 1018s # fakeroot can't fake everything, so disabled in production but good for tests 1018s echo 'APT::Sandbox::Verify "true";' 1018s } >> aptconfig.conf 1018s 1018s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1018s if [ "$(id -u)" = '0' ]; then 1018s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1018s fi 1018s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 1018s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 1018s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 1018s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 1018s # Allow release files to be 10 hours in the future, rather than 10 seconds 1018s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 1018s 1018s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 1018s 1018s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 1018s confighashes 'SHA256' # these are tests, not security best-practices 1018s 1018s # Make dpkg inherit testing path 1018s echo 'DPkg::Path "";' >> aptconfig.conf 1018s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 1018s 1018s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 1018s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 1018s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 1018s fi 1018s 1018s # most tests just need one signed Release file, not both 1018s export APT_DONT_SIGN='Release.gpg' 1018s 1018s # prefer our apt binaries over the system apt binaries 1018s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 1018s } 1018s 1018s getarchitecture() { 1018s if [ "$1" = "native" -o -z "$1" ]; then 1018s eval `aptconfig shell ARCH APT::Architecture` 1018s if [ -n "$ARCH" ]; then 1018s echo $ARCH 1018s else 1018s dpkg --print-architecture 1018s fi 1018s else 1018s echo $1 1018s fi 1018s } 1018s 1018s getarchitectures() { 1018s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 1018s } 1018s 1018s getarchitecturesfromcommalist() { 1018s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 1018s } 1018s 1018s configarchitecture() { 1018s { 1018s echo "APT::Architecture \"$(getarchitecture $1)\";" 1018s while [ -n "$1" ]; do 1018s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 1018s shift 1018s done 1018s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 1018s configdpkg 1018s } 1018s 1018s configdpkg() { 1018s if [ ! -e rootdir/var/lib/dpkg/status ]; then 1018s local BASENAME="${0##*/}" 1018s local STATUSFILE="status-${BASENAME#*-}" 1018s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 1018s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 1018s # Add an empty line to the end if there is none 1018s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 1018s echo >> rootdir/var/lib/dpkg/status 1018s fi 1018s fi 1018s fi 1018s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 1018s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 1018s local ARCHS="$(getarchitectures)" 1018s local DPKGARCH="$(dpkg --print-architecture)" 1018s # this ensures that even if multi-arch isn't active in the view 1018s # of apt, given that dpkg can't be told which arch is native 1018s # the arch apt treats as native might be foreign for dpkg 1018s for ARCH in ${ARCHS}; do 1018s if [ "${ARCH}" != "${DPKGARCH}" ]; then 1018s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 1018s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 1018s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 1018s else 1018s # old-style used e.g. in Ubuntu-P – and as it seems travis 1018s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1018s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1018s fi 1018s fi 1018s fi 1018s done 1018s else 1018s # test multiarch before dpkg is ready for it… 1018s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 1018s fi 1018s } 1018s 1018s configdpkgnoopchroot() { 1018s # create a library to noop chroot() and rewrite maintainer script executions 1018s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 1018s # chroot directory dpkg could chroot into to execute the maintainer scripts 1018s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 1018s cat > noopchroot.c << EOF 1018s #define _GNU_SOURCE 1018s #include 1018s #include 1018s #include 1018s #include 1018s 1018s static char * chrootdir = NULL; 1018s 1018s int chroot(const char *path) { 1018s printf("WARNING: CHROOTing to %s was ignored!\n", path); 1018s free(chrootdir); 1018s chrootdir = strdup(path); 1018s return 0; 1018s } 1018s int execvp(const char *file, char *const argv[]) { 1018s static int (*func_execvp) (const char *, char * const []) = NULL; 1018s if (func_execvp == NULL) 1018s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 1018s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 1018s return func_execvp(file, argv); 1018s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 1018s char *newfile; 1018s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 1018s perror("asprintf"); 1018s return -1; 1018s } 1018s char const * const baseadmindir = "/var/lib/dpkg"; 1018s char *admindir; 1018s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 1018s perror("asprintf"); 1018s return -1; 1018s } 1018s setenv("DPKG_ADMINDIR", admindir, 1); 1018s return func_execvp(newfile, argv); 1018s } 1018s EOF 1018s if cc -ldl 2>&1 | grep -q dl; then 1018s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 1018s else 1018s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 1018s fi 1018s } 1018s configcompression() { 1018s if [ "$1" = 'ALL' ]; then 1018s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 1018s return 1018s fi 1018s local CMD='apthelper cat-file -C' 1018s while [ -n "$1" ]; do 1018s case "$1" in 1018s '.') printf ".\t.\tcat\n";; 1018s 'gz') printf "gzip\tgz\t$CMD $1\n";; 1018s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 1018s 'zst') printf "zstd\tzst\t$CMD $1\n";; 1018s *) printf "$1\t$1\t$CMD $1\n";; 1018s esac 1018s shift 1018s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1018s } 1018s confighashes() { 1018s { 1018s echo 'APT::FTPArchive {' 1018s { 1018s while [ -n "$1" ]; do 1018s printf "$1" | tr 'a-z' 'A-Z' 1018s printf "\t\"true\";\n" 1018s shift 1018s done 1018s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 1018s printf "$h\t\"false\";\n" 1018s done 1018s } | awk '!x[$1]++' 1018s echo '};' 1018s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 1018s } 1018s forcecompressor() { 1018s COMPRESSOR="$1" 1018s COMPRESS="$1" 1018s COMPRESSOR_CMD="apthelper cat-file -C $1" 1018s case $COMPRESSOR in 1018s gzip) COMPRESS='gz';; 1018s bzip2) COMPRESS='bz2';; 1018s zstd) COMPRESS='zst';; 1018s esac 1018s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1018s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 1018s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 1018s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1018s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 1018s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 1018s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 1018s done 1018s } 1018s 1018s _setupsimplenativepackage() { 1018s local NAME="$1" 1018s local ARCH="$2" 1018s local VERSION="$3" 1018s local RELEASE="${4:-unstable}" 1018s local DEPENDENCIES="$5" 1018s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 1018s If you find such a package installed on your system, 1018s something went horribly wrong! They are autogenerated 1018s and used only by testcases and serve no other purpose…}" 1018s 1018s local SECTION="${7:-others}" 1018s local PRIORITY="${8:-optional}" 1018s local FILE_TREE="$9" 1018s local COMPRESS_TYPE="${10:-gzip}" 1018s local DISTSECTION 1018s if [ "$SECTION" = "${SECTION#*/}" ]; then 1018s DISTSECTION="main" 1018s else 1018s DISTSECTION="${SECTION%/*}" 1018s fi 1018s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1018s 1018s mkdir -p "$BUILDDIR/debian/source" 1018s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 1018s echo "#!/bin/sh 1018s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 1018s 1018s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 1018s echo "$NAME ($VERSION) $RELEASE; urgency=low 1018s 1018s * Initial release 1018s 1018s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 1018s { 1018s echo "Source: $NAME 1018s Priority: $PRIORITY 1018s Maintainer: Joe Sixpack 1018s Standards-Version: 4.3.1 1018s Rules-Requires-Root: no" 1018s if [ "$SECTION" != '' ]; then 1018s echo "Section: $SECTION" 1018s fi 1018s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 1018s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 1018s echo " 1018s Package: $NAME" 1018s 1018s if [ "$ARCH" = 'all' ]; then 1018s echo "Architecture: all" 1018s else 1018s echo "Architecture: any" 1018s fi 1018s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 1018s test -z "$DEPS" || echo "$DEPS" 1018s printf "%b\n" "Description: $DESCRIPTION" 1018s } > "${BUILDDIR}/debian/control" 1018s 1018s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 1018s } 1018s 1018s make_tiny_rules() { 1018s local OUT="$1" 1018s if command -v gmake >/dev/null 2>&1; then 1018s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 1018s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 1018s else 1018s echo '#!/usr/bin/make -f' > "$OUT" 1018s fi 1018s echo '%:' >> "$OUT" 1018s echo ' dh $@' >> "$OUT" 1018s } 1018s 1018s setupsimplenativepackage() { 1018s _setupsimplenativepackage "$@" 1018s local NAME="$1" 1018s local VERSION="$3" 1018s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1018s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 1018s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 1018s } 1018s 1018s buildsimplenativepackage() { 1018s local NAME="$1" 1018s local ARCH="$2" 1018s local VERSION="$3" 1018s local RELEASE="${4:-unstable}" 1018s local DEPENDENCIES="$5" 1018s local DESCRIPTION="$6" 1018s local SECTION="${7:-others}" 1018s local PRIORITY="${8:-optional}" 1018s local FILE_TREE="$9" 1018s local COMPRESS_TYPE="${10:-gzip}" 1018s local DISTSECTION 1018s if [ "$SECTION" = "${SECTION#*/}" ]; then 1018s DISTSECTION="main" 1018s else 1018s DISTSECTION="${SECTION%/*}" 1018s fi 1018s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1018s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 1018s _setupsimplenativepackage "$@" 1018s cd "${BUILDDIR}/.." 1018s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 1018s cd - >/dev/null 1018s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 1018s | while read SRC; do 1018s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 1018s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 1018s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 1018s # adv --yes --default-key 'Joe Sixpack' \ 1018s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1018s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1018s # fi 1018s done 1018s 1018s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1018s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 1018s rm -rf "${BUILDDIR}/debian/tmp" 1018s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 1018s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 1018s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 1018s if [ -n "$FILE_TREE" ]; then 1018s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 1018s fi 1018s 1018s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 1018s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 1018s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 1018s # ensure the right permissions as dpkg-deb insists 1018s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 1018s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 1018s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 1018s done 1018s 1018s local NM 1018s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 1018s NM="$(echo "$NAME" | cut -c 1-4)" 1018s else 1018s NM="$(echo "$NAME" | cut -c 1)" 1018s fi 1018s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 1018s mkdir -p "$CHANGEPATH" 1018s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 1018s rm -rf "${BUILDDIR}" 1018s msgdone "info" 1018s } 1018s 1018s buildpackage() { 1018s local BUILDDIR=$1 1018s local RELEASE=$2 1018s local SECTION=$3 1018s local ARCH=$(getarchitecture $4) 1018s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 1018s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 1018s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 1018s cd "$BUILDDIR" 1018s if [ "$ARCH" = "all" ]; then 1018s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 1018s fi 1018s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 1018s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 1018s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 1018s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 1018s cd - > /dev/null 1018s for PKG in $PKGS; do 1018s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 1018s done 1018s for SRC in $SRCS; do 1018s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 1018s done 1018s } 1018s 1018s buildaptarchive() { 1018s if [ -d incoming ]; then 1018s buildaptarchivefromincoming "$@" 1018s else 1018s buildaptarchivefromfiles "$@" 1018s fi 1018s } 1018s 1018s createaptftparchiveconfig() { 1018s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 1018s local COMPRESSORS="${COMPRESSORS%* }" 1018s local ARCHS="$(getarchitectures)" 1018s cat > ftparchive.conf <> ftparchive.conf 1018s } 1018s 1018s buildaptftparchivedirectorystructure() { 1018s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 1018s for DIST in $DISTS; do 1018s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 1018s for SECTION in $SECTIONS; do 1018s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 1018s for ARCH in $ARCHS; do 1018s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 1018s done 1018s mkdir -p "dists/${DIST}/${SECTION}/source" 1018s mkdir -p "dists/${DIST}/${SECTION}/i18n" 1018s done 1018s done 1018s } 1018s 1018s insertpackage() { 1018s local RELEASES="$1" 1018s local NAME="$2" 1018s local ARCH="$3" 1018s local VERSION="$4" 1018s local DEPENDENCIES="$5" 1018s local PRIORITY="${6:-optional}" 1018s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 1018s If you find such a package installed on your system, 1018s something went horribly wrong! They are autogenerated 1018s and used only by testcases and serve no other purpose…}" 1018s local SECTION="${8:-other}" 1018s 1018s if [ "$SECTION" = "${SECTION#*/}" ]; then 1018s DISTSECTION="main" 1018s else 1018s DISTSECTION="${SECTION%/*}" 1018s fi 1018s local ARCHS="" 1018s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1018s if [ "$RELEASE" = 'installed' ]; then 1018s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 1018s continue 1018s fi 1018s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1018s if [ "$arch" = 'none' ]; then 1018s ARCHS="$(getarchitectures)" 1018s else 1018s ARCHS="$arch" 1018s fi 1018s for BUILDARCH in $ARCHS; do 1018s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 1018s mkdir -p "$PPATH" 1018s { 1018s echo "Package: $NAME 1018s Priority: $PRIORITY 1018s Section: $SECTION 1018s Installed-Size: 42 1018s Size: 42" 1018s if echo "$DEPENDENCIES" | grep -q SHA256:; then 1018s : 1018s else 1018s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 1018s fi 1018s echo "Maintainer: Joe Sixpack " 1018s test "$arch" = 'none' || echo "Architecture: $arch" 1018s echo "Version: $VERSION 1018s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 1018s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 1018s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 1018s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 1018s echo 1018s } >> "${PPATH}/Packages" 1018s done 1018s done 1018s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 1018s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 1018s echo "Package: $NAME 1018s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 1018s Description-en: $DESCRIPTION 1018s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 1018s done 1018s } 1018s 1018s insertsource() { 1018s local RELEASES="$1" 1018s local NAME="$2" 1018s local ARCH="$3" 1018s local VERSION="$4" 1018s local DEPENDENCIES="$5" 1018s local BINARY="${6:-$NAME}" 1018s local ARCHS="" 1018s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1018s local SPATH="aptarchive/dists/${RELEASE}/main/source" 1018s mkdir -p $SPATH 1018s local FILE="${SPATH}/Sources" 1018s local DSCFILE="${NAME}_${VERSION}.dsc" 1018s local TARFILE="${NAME}_${VERSION}.tar.gz" 1018s echo "Package: $NAME 1018s Binary: $BINARY 1018s Version: $VERSION 1018s Maintainer: Joe Sixpack 1018s Architecture: $ARCH" >> $FILE 1018s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1018s echo "Files: 1018s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1018s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1018s Checksums-Sha256: 1018s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1018s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1018s " >> "$FILE" 1018s done 1018s } 1018s 1018s insertinstalledpackage() { 1018s local NAME="$1" 1018s local ARCH="$2" 1018s local VERSION="$3" 1018s local DEPENDENCIES="$4" 1018s local PRIORITY="${5:-optional}" 1018s local STATUS="${6:-install ok installed}" 1018s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 1018s If you find such a package installed on your system, 1018s something went horribly wrong! They are autogenerated 1018s and used only by testcases and serve no other purpose…}" 1018s local SECTION="${8:-other}" 1018s 1018s local FILE='rootdir/var/lib/dpkg/status' 1018s local INFO='rootdir/var/lib/dpkg/info' 1018s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1018s echo "Package: $NAME 1018s Status: $STATUS 1018s Priority: $PRIORITY 1018s Section: $SECTION 1018s Installed-Size: 42 1018s Maintainer: Joe Sixpack 1018s Version: $VERSION" >> "$FILE" 1018s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 1018s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1018s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 1018s echo >> "$FILE" 1018s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 1018s echo -n > "${INFO}/${NAME}:${arch}.list" 1018s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 1018s else 1018s echo -n > "${INFO}/${NAME}.list" 1018s echo -n > "${INFO}/${NAME}.md5sums" 1018s fi 1018s done 1018s } 1018s 1018s 1018s buildaptarchivefromincoming() { 1018s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 1018s cd aptarchive 1018s [ -e pool ] || ln -s ../incoming pool 1018s [ -e ftparchive.conf ] || createaptftparchiveconfig 1018s [ -e dists ] || buildaptftparchivedirectorystructure 1018s msgninfo "\tGenerate Packages, Sources and Contents files… " 1018s testsuccess aptftparchive generate ftparchive.conf 1018s cd - > /dev/null 1018s msgdone "info" 1018s generatereleasefiles "$@" 1018s } 1018s 1018s buildaptarchivefromfiles() { 1018s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 1018s local DIR='aptarchive' 1018s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 1018s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 1018s msgninfo "\t${line} file… " 1018s compressfile "$line" "$1" 1018s msgdone "info" 1018s done 1018s generatereleasefiles "$@" 1018s } 1018s 1018s compressfile() { 1018s while read compressor extension command; do 1018s if [ "$compressor" = '.' ]; then 1018s if [ -n "$2" ]; then 1018s touch -d "$2" "$1" 1018s fi 1018s continue 1018s fi 1018s cat "$1" | $command > "${1}.${extension}" 1018s if [ -n "$2" ]; then 1018s touch -d "$2" "${1}.${extension}" 1018s fi 1018s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1018s } 1018s 1018s # can be overridden by testcases for their pleasure 1018s getcodenamefromsuite() { 1018s case "$1" in 1018s unstable) echo 'sid';; 1018s *) echo -n "$1";; 1018s esac 1018s } 1018s getreleaseversionfromsuite() { true; } 1018s getlabelfromsuite() { true; } 1018s getoriginfromsuite() { true; } 1018s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 1018s getnotautomaticfromsuite() { 1018s case "$1" in 1018s experimental|experimental2) echo "yes";; 1018s esac 1018s } 1018s getbutautomaticupgradesfromsuite() { true; } 1018s 1018s aptftparchiverelease() { 1018s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 1018s } 1018s generatereleasefiles() { 1018s # $1 is the Date header and $2 is the ValidUntil header to be set 1018s # both should be given in notation date/touch can understand 1018s local DATE="$1" 1018s local VALIDUNTIL="$2" 1018s if [ -e aptarchive/dists ]; then 1018s msgninfo "\tGenerate Release files for dists… " 1018s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 1018s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 1018s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 1018s local CODENAME="$(getcodenamefromsuite $SUITE)" 1018s local VERSION="$(getreleaseversionfromsuite $SUITE)" 1018s local LABEL="$(getlabelfromsuite $SUITE)" 1018s local ORIGIN="$(getoriginfromsuite $SUITE)" 1018s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 1018s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 1018s aptftparchiverelease "$dir" \ 1018s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 1018s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 1018s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 1018s -o APT::FTPArchive::Release::Label="${LABEL}" \ 1018s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 1018s -o APT::FTPArchive::Release::Version="${VERSION}" \ 1018s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 1018s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 1018s > "$dir/Release" 1018s done 1018s else 1018s msgninfo "\tGenerate Release files for flat… " 1018s aptftparchiverelease ./aptarchive > aptarchive/Release 1018s fi 1018s if [ -n "$VALIDUNTIL" ]; then 1018s sed -i "/^Date: / a\ 1018s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 1018s fi 1018s if [ -n "$DATE" -a "$DATE" != "now" ]; then 1018s for release in $(find ./aptarchive -name 'Release'); do 1018s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 1018s touch -d "$DATE" "$release" 1018s done 1018s fi 1018s msgdone "info" 1018s } 1018s 1018s setupdistsaptarchive() { 1018s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1018s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 1018s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 1018s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 1018s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 1018s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 1018s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 1018s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 1018s msgdone "info" 1018s done 1018s } 1018s 1018s setupflataptarchive() { 1018s local APTARCHIVE="$(readlink -f ./aptarchive)" 1018s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1018s if [ -f "${APTARCHIVE}/Packages" ]; then 1018s msgninfo "\tadd deb sources.list line… " 1018s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1018s msgdone 'info' 1018s else 1018s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1018s fi 1018s if [ -f "${APTARCHIVE}/Sources" ]; then 1018s msgninfo "\tadd deb-src sources.list line… " 1018s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1018s msgdone 'info' 1018s else 1018s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1018s fi 1018s } 1018s 1018s setupaptarchive() { 1018s local NOUPDATE=0 1018s if [ "$1" = '--no-update' ]; then 1018s NOUPDATE=1 1018s shift 1018s fi 1018s buildaptarchive "$@" 1018s if [ -e aptarchive/dists ]; then 1018s setupdistsaptarchive 1018s else 1018s setupflataptarchive 1018s fi 1018s signreleasefiles 'Joe Sixpack' 1018s if [ "1" != "$NOUPDATE" ]; then 1018s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 1018s fi 1018s } 1018s 1018s killgpgagent() { 1018s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 1018s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1018s if [ ! -e "${GPGHOME}" ]; then return; fi 1018s # ensure the agent dies quickly as different versions have different suicide heuristics 1018s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 1018s rm -rf "$GPGHOME" 1018s } 1018s dosigning() { 1018s local KEY="$1" 1018s shift 1018s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1018s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 1018s GPGHOME="$APT_TEST_SIGNINGHOME" 1018s else 1018s if [ ! -e "$GPGHOME" ]; then 1018s mkdir -p --mode=700 "${GPGHOME}" 1018s addtrap 'prefix' 'killgpgagent;' 1018s fi 1018s fi 1018s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 1018s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1018s "$@" 1018s } 1018s signreleasefiles() { 1018s local SIGNERS="${1:-Joe Sixpack}" 1018s local REPODIR="${2:-aptarchive}" 1018s if [ -n "$1" ]; then shift; fi 1018s if [ -n "$1" ]; then shift; fi 1018s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1018s msgninfo "\tSign archive with $SIGNERS key $KEY… " 1018s local REXKEY='keys/rexexpired' 1018s local SECEXPIREBAK="${REXKEY}.sec.bak" 1018s local PUBEXPIREBAK="${REXKEY}.pub.bak" 1018s local SIGUSERS="" 1018s while [ -n "${SIGNERS%%,*}" ]; do 1018s local SIGNER="${SIGNERS%%,*}" 1018s if [ "${SIGNERS}" = "${SIGNER}" ]; then 1018s SIGNERS="" 1018s fi 1018s SIGNERS="${SIGNERS#*,}" 1018s # FIXME: This should be the full name, but we can't encode the space properly currently 1018s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 1018s if [ "${SIGNER}" = 'Rex Expired' ]; then 1018s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 1018s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 1018s # therefore we 'temporary' make the key not expired and restore a backup after signing 1018s cp "${REXKEY}.sec" "$SECEXPIREBAK" 1018s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 1018s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 1018s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 1018s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 1018s cp "$SECUNEXPIRED" "${REXKEY}.sec" 1018s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 1018s else 1018s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 1018s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1018s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 1018s cat setexpire.gpg 1018s exit 1 1018s fi 1018s cp "${REXKEY}.sec" "$SECUNEXPIRED" 1018s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 1018s fi 1018s fi 1018s if [ ! -e "${KEY}.pub" ]; then 1018s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1018s cat "${K}.pub" >> "${KEY}.new.pub" 1018s cat "${K}.sec" >> "${KEY}.new.sec" 1018s fi 1018s done 1018s if [ ! -e "${KEY}.pub" ]; then 1018s mv "${KEY}.new.pub" "${KEY}.pub" 1018s mv "${KEY}.new.sec" "${KEY}.sec" 1018s fi 1018s for RELEASE in $(find "${REPODIR}/" -name Release); do 1018s # we might have set a specific date for the Release file, so copy it 1018s local DATE="$(stat --format "%y" "${RELEASE}")" 1018s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 1018s rm -f "${RELEASE}.gpg" 1018s else 1018s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 1018s touch -d "$DATE" "${RELEASE}.gpg" 1018s fi 1018s local INRELEASE="${RELEASE%/*}/InRelease" 1018s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 1018s rm -f "$INRELEASE" 1018s else 1018s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 1018s touch -d "$DATE" "${INRELEASE}" 1018s fi 1018s done 1018s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 1018s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 1018s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 1018s fi 1018s msgdone 'info' 1018s } 1018s 1018s redatereleasefiles() { 1018s local DATE="$(date -u -d "$1" -R)" 1018s for release in $(find aptarchive/ -name 'Release'); do 1018s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 1018s touch -d "$DATE" "$release" 1018s done 1018s signreleasefiles "${2:-Joe Sixpack}" 1018s } 1018s 1018s webserverconfig() { 1018s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 1018s local NOCHECK=false 1018s if [ "$1" = '--no-check' ]; then 1018s NOCHECK=true 1018s shift 1018s fi 1018s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 1018s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 1018s rm -f "$STATUS" "$DOWNLOG" 1018s local URI 1018s if [ -n "$2" ]; then 1018s msgtest "Set webserver config option '${1}' to" "$2" 1018s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 1018s else 1018s msgtest 'Clear webserver config option' "${1}" 1018s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 1018s fi 1018s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 1018s msgpass 1018s else 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 1018s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 1018s msgfailoutput '' "$OUTPUT" 1018s fi 1018s $NOCHECK || testwebserverlaststatuscode '200' 1018s } 1018s 1018s rewritesourceslist() { 1018s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 1018s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 1018s sed -i $LIST \ 1018s -e "s#file://$APTARCHIVE#${1}#" \ 1018s -e "s#file:$APTARCHIVE#${1}#" \ 1018s -e "s#copy://$APTARCHIVE#${1}#" \ 1018s -e "s#copy:$APTARCHIVE#${1}#" \ 1018s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 1018s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 1018s done 1018s } 1018s 1018s # wait for up to 10s for a pid file to appear to avoid possible race 1018s # when a helper is started and doesn't write the PID quick enough 1018s waitforpidfile() { 1018s local PIDFILE="$1" 1018s for i in $(seq 10); do 1018s if test -s "$PIDFILE"; then 1018s return 0 1018s fi 1018s sleep 1 1018s done 1018s msgdie "waiting for $PIDFILE failed" 1018s return 1 1018s } 1018s 1018s changetowebserver() { 1018s local REWRITE='yes' 1018s if [ "$1" = '--no-rewrite' ]; then 1018s REWRITE='no' 1018s shift 1018s fi 1018s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 1018s cd aptarchive 1018s local LOG="webserver.log" 1018s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 1018s cat "$LOG" 1018s false 1018s fi 1018s waitforpidfile aptwebserver.pid 1018s local PID="$(cat aptwebserver.pid)" 1018s if [ -z "$PID" ]; then 1018s msgdie 'Could not fork aptwebserver successfully' 1018s fi 1018s addtrap "kill $PID;" 1018s waitforpidfile aptwebserver.port 1018s APTHTTPPORT="$(cat aptwebserver.port)" 1018s if [ -z "$APTHTTPPORT" ]; then 1018s msgdie 'Could not get port for aptwebserver successfully' 1018s fi 1018s cd - > /dev/null 1018s else 1018s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 1018s fi 1018s if [ "$REWRITE" != 'no' ]; then 1018s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 1018s fi 1018s } 1018s 1018s changetohttpswebserver() { 1018s local REWRITE='yes' 1018s if [ "$1" = '--no-rewrite' ]; then 1018s REWRITE='no' 1018s shift 1018s fi 1018s local stunnel4 1018s if command -v stunnel4 >/dev/null 2>&1; then 1018s stunnel4=stunnel4 1018s elif command -v stunnel >/dev/null 2>&1; then 1018s stunnel4=stunnel 1018s else 1018s msgdie 'You need to install stunnel4 for https testcases' 1018s fi 1018s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 1018s changetowebserver --no-rewrite "$@" 1018s fi 1018s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 1018s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 1018s output = /dev/null 1018s 1018s [https] 1018s accept = 127.0.0.1:0 1018s connect = $APTHTTPPORT 1018s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 1018s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 1018s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 1018s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 1018s if [ -z "$PID" ]; then 1018s msgdie 'Could not fork $stunnel4 successfully' 1018s fi 1018s addtrap 'prefix' "kill ${PID};" 1018s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 1018s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 1018s if [ "$REWRITE" != 'no' ]; then 1018s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 1018s fi 1018s } 1018s 1018s changetocdrom() { 1018s mkdir -p rootdir/media/cdrom/.disk 1018s local CD="$(readlink -f rootdir/media/cdrom)" 1018s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 1018s if [ ! -d aptarchive/dists ]; then 1018s msgdie 'Flat file archive cdroms can not be created currently' 1018s return 1 1018s fi 1018s mv aptarchive/dists "$CD" 1018s ln -s "$(readlink -f ./incoming)" "$CD/pool" 1018s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 1018s # start with an unmounted disk 1018s mv "${CD}" "${CD}-unmounted" 1018s # we don't want the disk to be modifiable 1018s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 1018s chmod -R 555 rootdir/media/cdrom-unmounted/dists 1018s } 1018s 1018s downloadfile() { 1018s local PROTO="${1%%:*}" 1018s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 1018s download-file "$1" "$2" "$3" 2>&1 ; then 1018s return 1 1018s fi 1018s # only if the file exists the download was successful 1018s if [ -r "$2" ]; then 1018s return 0 1018s else 1018s return 1 1018s fi 1018s } 1018s 1018s cleanup_output() { 1018s cat "$1" | sed \ 1018s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 1018s -e '/^profiling:/ d' \ 1018s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 1018s >"$2" 1018s } 1018s 1018s checkdiff() { 1018s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 1018s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 1018s touch "$TMPFILE1" "$TMPFILE2" 1018s 1018s cleanup_output "$1" "$TMPFILE1" 1018s cleanup_output "$2" "$TMPFILE2" 1018s 1018s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 1018s if [ -n "$DIFFTEXT" ]; then 1018s echo >&2 1018s echo >&2 "$DIFFTEXT" 1018s return 1 1018s else 1018s return 0 1018s fi 1018s } 1018s 1018s testoutputequal() { 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 1018s local COMPAREFILE="$1" 1018s shift 1018s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 1018s msgpass 1018s else 1018s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 1018s cat "$COMPAREFILE" >>"${OUTPUT}" 1018s msgfailoutput '' "$OUTPUT" "$@" 1018s fi 1018s } 1018s 1018s testfileequal() { 1018s msggroup 'testfileequal' 1018s local MSG='Test for correctness of file' 1018s if [ "$1" = '--nomsg' ]; then 1018s MSG='' 1018s shift 1018s fi 1018s local FILE="$1" 1018s shift 1018s if [ -n "$MSG" ]; then 1018s msgtest "$MSG" "$FILE" 1018s fi 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 1018s if [ -z "$*" ]; then 1018s testoutputequal "$FILE" echo -n '' 1018s else 1018s testoutputequal "$FILE" echo "$*" 1018s fi 1018s msggroup 1018s } 1018s 1018s testempty() { 1018s msggroup 'testempty' 1018s if [ "$1" = '--nomsg' ]; then 1018s shift 1018s else 1018s msgtest "Test for no output of" "$*" 1018s fi 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 1018s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 1018s msgpass 1018s else 1018s msgfailoutput '' "$COMPAREFILE" "$@" 1018s fi 1018s aptautotest 'testempty' "$@" 1018s msggroup 1018s } 1018s testwarningempty() { 1018s testwarning "$@" 1018s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 1018s } 1018s testnotempty() { 1018s msggroup 'testnotempty' 1018s msgtest "Test for some output of" "$*" 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 1018s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 1018s msgpass 1018s else 1018s msgfailoutput '' "$COMPAREFILE" "$@" 1018s fi 1018s aptautotest 'testnotempty' "$@" 1018s msggroup 1018s } 1018s 1018s testequal() { 1018s msggroup 'testequal' 1018s local MSG='Test of equality of' 1018s if [ "$1" = '--nomsg' ]; then 1018s MSG='' 1018s shift 1018s fi 1018s 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 1018s echo "$1" > "$COMPAREFILE" 1018s shift 1018s 1018s if [ -n "$MSG" ]; then 1018s msgtest "$MSG" "$*" 1018s fi 1018s testoutputequal "$COMPAREFILE" "$@" 1018s aptautotest 'testequal' "$@" 1018s msggroup 1018s } 1018s 1018s testequalor2() { 1018s msggroup 'testequalor2' 1018s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 1018s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 1018s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 1018s echo "$1" > "$COMPAREFILE1" 1018s echo "$2" > "$COMPAREFILE2" 1018s shift 2 1018s msgtest "Test for equality OR of" "$*" 1018s "$@" >"$COMPAREAGAINST" 2>&1 || true 1018s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 1018s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 1018s then 1018s msgpass 1018s else 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 1018s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 1018s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1018s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 1018s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1018s msgfailoutput '' "$OUTPUT" 1018s fi 1018s aptautotest 'testequalor2' "$@" 1018s msggroup 1018s } 1018s 1018s testshowvirtual() { 1018s msggroup 'testshowvirtual' 1018s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 1018s local PACKAGE="$1" 1018s shift 1018s while [ -n "$1" ]; do 1018s VIRTUAL="${VIRTUAL} 1018s N: Can't select versions from package '$1' as it is purely virtual" 1018s PACKAGE="${PACKAGE} $1" 1018s shift 1018s done 1018s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 1018s VIRTUAL="${VIRTUAL} 1018s N: No packages found" 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 1018s local ARCH="$(getarchitecture 'native')" 1018s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 1018s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 1018s msggroup 1018s } 1018s 1018s testnopackage() { 1018s msggroup 'testnopackage' 1018s msgtest "Test for non-existent packages" "apt-cache show $*" 1018s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 1018s if [ -n "$SHOWPKG" ]; then 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1018s echo "$SHOWPKG" >"$OUTPUT" 1018s msgfailoutput '' "$OUTPUT" 1018s else 1018s msgpass 1018s fi 1018s msggroup 1018s } 1018s testnosrcpackage() { 1018s msggroup 'testnosrcpackage' 1018s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 1018s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 1018s if [ -n "$SHOWPKG" ]; then 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 1018s echo "$SHOWPKG" >"$OUTPUT" 1018s msgfailoutput '' "$OUTPUT" 1018s else 1018s msgpass 1018s fi 1018s msggroup 1018s } 1018s 1018s testdpkgstatus() { 1018s msggroup 'testdpkgstatus' 1018s local STATE="$1" 1018s local NR="$2" 1018s shift 2 1018s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 1018s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 1018s if [ "$PKGS" != $NR ]; then 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1018s echo "$PKGS" >"$OUTPUT" 1018s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 1018s msgfailoutput '' "$OUTPUT" 1018s else 1018s msgpass 1018s fi 1018s msggroup 1018s } 1018s 1018s testdpkginstalled() { 1018s msggroup 'testdpkginstalled' 1018s testdpkgstatus 'ii' "$#" "$@" 1018s msggroup 1018s } 1018s 1018s testdpkgnotinstalled() { 1018s msggroup 'testdpkgnotinstalled' 1018s testdpkgstatus 'ii' '0' "$@" 1018s msggroup 1018s } 1018s 1018s testmarkedauto() { 1018s msggroup 'testmarkedauto' 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 1018s if [ -n "$1" ]; then 1018s msgtest 'Test for correctly marked as auto-installed' "$*" 1018s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1018s else 1018s msgtest 'Test for correctly marked as auto-installed' 'no package' 1018s echo -n > "$COMPAREFILE" 1018s fi 1018s testoutputequal "$COMPAREFILE" aptmark showauto 1018s msggroup 1018s } 1018s testmarkedmanual() { 1018s msggroup 'testmarkedmanual' 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 1018s if [ -n "$1" ]; then 1018s msgtest 'Test for correctly marked as manually installed' "$*" 1018s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1018s else 1018s msgtest 'Test for correctly marked as manually installed' 'no package' 1018s echo -n > "$COMPAREFILE" 1018s fi 1018s testoutputequal "$COMPAREFILE" aptmark showmanual 1018s msggroup 1018s } 1018s 1018s catfile() { 1018s if [ "${1##*.}" = 'deb' ]; then 1018s stat >&2 "$1" || true 1018s file >&2 "$1" || true 1018s else 1018s cat >&2 "$1" || true 1018s fi 1018s } 1018s msgfailoutput() { 1018s msgreportheader 'msgfailoutput' 1018s local MSG="$1" 1018s local OUTPUT="$2" 1018s shift 2 1018s local CMD="$1" 1018s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 1018s echo >&2 1018s while [ -n "$2" ]; do shift; done 1018s echo "#### Complete file: $1 ####" 1018s catfile "$1" 1018s echo "#### $CMD output ####" 1018s elif [ "$1" = 'test' ]; then 1018s echo >&2 1018s # doesn't support ! or non-file flags 1018s msgfailoutputstatfile() { 1018s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 1018s if expr match "$1" "$FILEFLAGS" >/dev/null; then 1018s echo "#### stat(2) of file: $2 ####" 1018s stat "$2" || true 1018s if test -d "$2"; then 1018s echo "#### The directory contains: $2 ####" 1018s ls >&2 "$2" || true 1018s elif test -e "$2"; then 1018s echo "#### Complete file: $2 ####" 1018s catfile "$2" 1018s fi 1018s fi 1018s } 1018s msgfailoutputstatfile "$2" "$3" 1018s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 1018s shift 3 1018s msgfailoutputstatfile "$2" "$3" 1018s done 1018s echo '#### test output ####' 1018s elif [ "$1" = 'cmp' ]; then 1018s echo >&2 1018s while [ -n "$2" ]; do 1018s echo "#### Complete file: $2 ####" 1018s catfile "$2" 1018s shift 1018s done 1018s echo '#### cmp output ####' 1018s elif [ "$1" = 'rm' ]; then 1018s echo "#### Directory listing of: $(pwd) ####" 1018s ls -l 1018s fi 1018s catfile "$OUTPUT" 1018s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 1018s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 1018s local COREEXE='' 1018s for CORENAME in 'core' 'core.pid'; do 1018s if [ -s "$CORENAME" ]; then 1018s cp -a ${CORENAME} "$COREDUMP" 1018s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 1018s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 1018s else 1018s continue 1018s fi 1018s break 1018s done 1018s if [ -s "$COREDUMP" ]; then 1018s true # found already as a file 1018s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 1018s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 1018s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 1018s else 1018s echo '### core dump not found ###' 1018s cat /proc/sys/kernel/core_pattern 1018s fi 1018s if [ -s "$COREDUMP" ]; then 1018s if [ -z "$COREEXE" ]; then 1018s case "$CMD" in 1018s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1018s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 1018s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 1018s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 1018s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 1018s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1018s esac 1018s fi 1018s 1018s if [ -d "${ARTIFACTSDIR}" ]; then 1018s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 1018s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 1018s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 1018s fi 1018s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 1018s echo "#### gdb backtrace ####" 1018s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 1018s fi 1018s fi 1018s rm -f "$COREDUMP" 1018s fi 1018s msgfail "$MSG" 1018s } 1018s 1018s testsuccesswithglobalerror() { 1018s local TYPE="$1" 1018s local ERRORS="$2" 1018s shift 2 1018s msggroup "$TYPE" 1018s if [ "$1" = '--nomsg' ]; then 1018s shift 1018s else 1018s msgtest 'Test for successful execution of' "$*" 1018s fi 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 1018s if "$@" >"${OUTPUT}" 2>&1; then 1018s if expr match "$1" '^apt.*' >/dev/null; then 1018s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1018s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1018s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 1018s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 1018s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 1018s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1018s msgpass 1018s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 1018s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1018s msgpass 1018s else 1018s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1018s fi 1018s else 1018s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1018s fi 1018s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 1018s if grep -q -E "^N: " "$OUTPUT"; then 1018s msgpass 1018s else 1018s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 1018s fi 1018s else 1018s msgpass 1018s fi 1018s else 1018s msgpass 1018s fi 1018s else 1018s local EXITCODE=$? 1018s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1018s fi 1018s aptautotest "$TYPE" "$@" 1018s msggroup 1018s } 1018s testsuccesswithnotice() { 1018s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 1018s } 1018s testsuccess() { 1018s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 1018s } 1018s testwarning() { 1018s msggroup 'testwarning' 1018s if [ "$1" = '--nomsg' ]; then 1018s shift 1018s else 1018s msgtest 'Test for successful execution with warnings of' "$*" 1018s fi 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 1018s if "$@" >"${OUTPUT}" 2>&1; then 1018s if expr match "$1" '^apt.*' >/dev/null; then 1018s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1018s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1018s elif grep -q -E '^E: ' "$OUTPUT"; then 1018s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 1018s elif ! grep -q -E '^W: ' "$OUTPUT"; then 1018s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 1018s else 1018s msgpass 1018s fi 1018s else 1018s msgpass 1018s fi 1018s else 1018s local EXITCODE=$? 1018s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1018s fi 1018s aptautotest 'testwarning' "$@" 1018s msggroup 1018s } 1018s testfailure() { 1018s msggroup 'testfailure' 1018s if [ "$1" = '--nomsg' ]; then 1018s shift 1018s else 1018s msgtest 'Test for failure in execution of' "$*" 1018s fi 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 1018s if "$@" >"${OUTPUT}" 2>&1; then 1018s local EXITCODE=$? 1018s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1018s else 1018s local EXITCODE=$? 1018s if expr match "$1" '^apt.*' >/dev/null; then 1018s if [ "$1" = 'aptkey' ]; then 1018s if grep -q " Can't check signature: 1018s BAD signature from 1018s signature could not be verified" "$OUTPUT"; then 1018s msgpass 1018s else 1018s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 1018s fi 1018s else 1018s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1018s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1018s elif grep -q -E '==ERROR' "$OUTPUT"; then 1018s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 1018s elif ! grep -q -E '^E: ' "$OUTPUT"; then 1018s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 1018s else 1018s msgpass 1018s fi 1018s fi 1018s else 1018s msgpass 1018s fi 1018s fi 1018s aptautotest 'testfailure' "$@" 1018s msggroup 1018s } 1018s 1018s testreturnstateequal() { 1018s local STATE="$1" 1018s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 1018s local STATE="$2" 1018s local TYPE="$3" 1018s shift 3 1018s msggroup "${STATE}equal" 1018s if [ "$1" != '--nomsg' ]; then 1018s local CMP="$1" 1018s shift 1018s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1018s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1018s else 1018s local CMP="$2" 1018s shift 2 1018s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1018s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1018s fi 1018s else 1018s msggroup "${STATE}equal" 1018s if [ "$2" != '--nomsg' ]; then 1018s local CMP="$2" 1018s shift 2 1018s "$STATE" "$@" 1018s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1018s else 1018s local CMP="$3" 1018s shift 3 1018s "$STATE" --nomsg "$@" 1018s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1018s fi 1018s fi 1018s msggroup 1018s } 1018s testsuccessequal() { 1018s # we compare output, so we know perfectly well about N: 1018s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 1018s } 1018s testwarningequal() { 1018s testreturnstateequal 'testwarning' "$@" 1018s } 1018s testfailureequal() { 1018s testreturnstateequal 'testfailure' "$@" 1018s } 1018s 1018s testfailuremsg() { 1018s msggroup 'testfailuremsg' 1018s local CMP="$1" 1018s shift 1018s testfailure "$@" 1018s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 1018s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 1018s testoutputequal "$COMPAREFILE" echo "$CMP" 1018s msggroup 1018s } 1018s testwarningmsg() { 1018s msggroup 'testwarningmsg' 1018s local CMP="$1" 1018s shift 1018s testwarning "$@" 1018s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 1018s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 1018s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 1018s testoutputequal "$COMPAREFILE" echo "$CMP" 1018s msggroup 1018s } 1018s 1018s testfilestats() { 1018s msggroup 'testfilestats' 1018s msgtest "Test that file $1 has $2 $3" "$4" 1018s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 1018s msgpass 1018s else 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 1018s { 1018s echo 1018s ls -ld "$1" || true 1018s echo -n "stat(1) reports for $2: " 1018s stat --format "$2" "$1" || true 1018s } >"$OUTPUT" 2>&1 1018s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 1018s fi 1018s msggroup 1018s } 1018s testaccessrights() { 1018s msggroup 'testaccessrights' 1018s testfilestats "$1" '%a' '=' "$2" 1018s msggroup 1018s } 1018s 1018s testwebserverlaststatuscode() { 1018s msggroup 'testwebserverlaststatuscode' 1018s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 1018s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 1018s rm -f "$DOWNLOG" "$STATUS" 1018s msgtest 'Test last status code from the webserver was' "$1" 1018s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 1018s msgpass 1018s else 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 1018s { 1018s if [ -n "$2" ]; then 1018s shift 1018s echo >&2 '#### Additionally provided output files contain:' 1018s cat >&2 "$@" 1018s fi 1018s echo >&2 '#### Download log of the status code:' 1018s cat >&2 "$DOWNLOG" 1018s } >"$OUTPUT" 2>&1 1018s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 1018s fi 1018s msggroup 1018s } 1018s 1018s mapkeynametokeyid() { 1018s while [ -n "$1" ]; do 1018s case "$1" in 1018s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 1018s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 1018s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 1018s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 1018s oldarchive) echo 'FDD2DB85F68C85A3';; 1018s *) echo 'UNKNOWN KEY';; 1018s esac 1018s shift 1018s done 1018s } 1018s testaptkeys() { 1018s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 1018s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 1018s echo -n > "$OUTPUT" 1018s fi 1018s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 1018s } 1018s 1018s pause() { 1018s echo "STOPPED execution. Press enter to continue" 1018s local IGNORE 1018s read IGNORE 1018s } 1018s 1018s logcurrentarchivedirectory() { 1018s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 1018s stat --format '%U:%G:%a:%n' "$line" 1018s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 1018s } 1018s listcurrentlistsdirectory() { 1018s { 1018s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 1018s stat --format '%U:%G:%a:%n' "$line" 1018s done 1018s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 1018s stat --format '%U:%G:%a:%s:%y:%n' "$line" 1018s done 1018s } | sort 1018s } 1018s forallsupportedcompressors() { 1018s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1018s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1018s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 1018s "$@" "$COMP" 1018s done 1018s } 1018s 1018s breakfiles() { 1018s while [ -n "$1" ]; do 1018s mv -f "${1}" "${1}.bak" 1018s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 1018s shift 1018s done 1018s } 1018s unbreakfiles() { 1018s while [ -n "$1" ]; do 1018s mv -f "${1}.bak" "${1}" 1018s shift 1018s done 1018s } 1018s 1018s ### convenience hacks ### 1018s mkdir() { 1018s # creating some directories by hand is a tedious task, so make it look simple 1018s local PARAMS="$*" 1018s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 1018s # only the last directory created by mkdir is effected by the -m ! 1018s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 1018s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 1018s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1018s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1018s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 1018s if [ "$(id -u)" = '0' ]; then 1018s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1018s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1018s fi 1018s else 1018s command mkdir "$@" 1018s fi 1018s } 1018s 1018s ### The following tests are run by most test methods automatically to check 1018s ### general things about commands executed without writing the test every time. 1018s 1018s aptautotest() { 1018s if [ $# -lt 3 ]; then return; fi 1018s local TESTCALL="$1" 1018s local CMD="$2" 1018s local FIRSTOPT="$3" 1018s shift 2 1018s for i in "$@"; do 1018s if ! expr match "$i" '^-' >/dev/null 2>&1; then 1018s FIRSTOPT="$i" 1018s break 1018s fi 1018s done 1018s shift 1018s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 1018s if command -v $AUTOTEST >/dev/null; then 1018s # save and restore the *.output files from other tests 1018s # as we might otherwise override them in these automatic tests 1018s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1018s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1018s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1018s $AUTOTEST "$TESTCALL" "$@" 1018s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1018s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1018s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1018s fi 1018s } 1018s 1018s cdfind() { 1018s ( cd /; find "$@" ) 1018s } 1018s aptautotest_aptget_update() { 1018s local TESTCALL="$1" 1018s while [ -n "$2" ]; do 1018s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 1018s shift 1018s done 1018s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 1018s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1018s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1018s # all copied files are properly chmodded 1018s local backupIFS="$IFS" 1018s IFS="$(printf "\n\b")" 1018s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 1018s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 1018s done 1018s IFS="$backupIFS" 1018s if [ "$TESTCALL" = 'testsuccess' ]; then 1018s # failure cases can retain partial files and such 1018s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 1018s fi 1018s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 1018s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 1018s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 1018s fi 1018s } 1018s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 1018s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 1018s 1018s testaptautotestnodpkgwarning() { 1018s local TESTCALL="$1" 1018s while [ -n "$2" ]; do 1018s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 1018s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 1018s shift 1018s done 1018s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 1018s } 1018s 1018s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 1018s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 1018s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 1018s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 1018s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 1018s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 1018s 1018s testaptmarknodefaultsections() { 1018s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 1018s } 1018s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 1018s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 1018s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 1018s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 1018s cmp: ./downloaded/foo1: No such file or directory 1018s FAIL: exitcode 2 1145s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 1145s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1145s Configured access method http 1145s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1145s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 1145s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1145s Configured access method http 1145s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1145s -> http:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpk 1145s Redirect leads first URI to the second URI … 1145s Test for successful execution of cmp /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework ./downloaded/foo1 … #### Complete file: /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework #### 1145s #### Complete file: ./downloaded/foo1 #### 1145s #### cmp output #### 1145s 1145s Test for successful execution of cmp ./downloaded/foo1 ./downloaded/foo2 … #### Complete file: ./downloaded/foo1 #### 1145s #### Complete file: ./downloaded/foo2 #### 1145s #### cmp output #### 1145s Pg=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 1145s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo2%0aFilename:%20./downloaded/foo1%0a%0a 1145s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo%0aFilename:%20./downloaded/foo2%0a%0a 1145s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20http://localhost:44339/foo2 1145s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 1145s <- http:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 1145s GET /foo2 HTTP/1.1 1145s Host: localhost:44339 1145s Accept: text/* 1145s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 1145s 1145s 1145s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo2 1145s Answer for: http://localhost:44339/foo2 1145s HTTP/1.1 301 Moved Permanently 1145s Content-Length: 357 1145s Location: https://localhost:44339/foo 1145s Content-Type: text/html; charset=utf-8 1145s Server: APT webserver 1145s Accept-Ranges: bytes 1145s Date: Fri, 13 Jun 2025 00:16:27 GMT 1145s 1145s <- GET /foo HTTP/1.1 1145s Host: localhost:44339 1145s Accept: text/* 1145s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 1145s 1145s http: 1145s 103%20Redirect%0aNew-URI:%20https://localhost:44339/foo%0aURI:%20http://localhost:44339/foo2 1145s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 1145s Answer for: http://localhost:44339/foo 1145s HTTP/1.1 200 OK 1145s Content-Length: 77417 1145s Last-Modified: Fri, 13 Jun 2025 00:07:57 GMT 1145s Server: APT webserver 1145s Accept-Ranges: bytes 1145s Date: Fri, 13 Jun 2025 00:16:27 GMT 1145s 1145s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1145s Configured access method https 1145s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1145s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 1145s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1145s Configured access method https 1145s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1145s -> https:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpkg=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 1145s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1145s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo 1145s <- http:200%20URI%20Start%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aURI:%20http://localhost:44339/foo 1145s Get:2 http://localhost:44339/foo [77.4 kB] 1145s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20https://localhost:44339/foo 1145s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1145s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1145s <- http:201%20URI%20Done%0aChecksum-FileSize-Hash:%2077417%0aSHA512-Hash:%2099758b98725ee45110a374044902230c8b056c97567d3ec249dc4add195e13a8d07d7d5d5081938286c2c21ec0841528b6cee8986d16a3a9d0abd4c570dd7dce%0aSHA256-Hash:%2072d18d223dc239300d7548396ef9409ee2e4ff5163d55557a87d9852c098e15e%0aSHA1-Hash:%20357fe7a44e62f7a01e1b4c96ee33675f03223500%0aMD5Sum-Hash:%20582a51e7590162e00495e35c882c4b44%0aMD5-Hash:%20582a51e7590162e00495e35c882c4b44%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aFilename:%20./downloaded/foo2%0aURI:%20http://localhost:44339/foo 1145s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1145s Ign:1 http://localhost:44339/foo2 1145s Could not wait for server fd - select (11: Resource temporarily unavailable) 1145s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1145s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1145s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1145s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1145s Ign:1 http://localhost:44339/foo2 1145s Could not wait for server fd - select (11: Resource temporarily unavailable) 1145s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1145s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1145s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1145s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1145s Ign:1 http://localhost:44339/foo2 1145s Could not wait for server fd - select (11: Resource temporarily unavailable) 1145s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1145s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1145s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1145s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1145s Err:1 http://localhost:44339/foo2 1145s Could not wait for server fd - select (11: Resource temporarily unavailable) 1145s E: Failed to fetch https://localhost:44339/foo Could not wait for server fd - select (11: Resource temporarily unavailable) 1145s E: Download Failed 1145s FAIL: exitcode 100 1145s 1145s #!/bin/sh -- # no runable script, just for vi 1145s 1145s EXIT_CODE=0 1145s 1145s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 1145s if [ "$1" = "-q" ]; then 1145s export MSGLEVEL=2 1145s elif [ "$1" = "-qq" ]; then 1145s export MSGLEVEL=1 1145s elif [ "$1" = "-v" ]; then 1145s export MSGLEVEL=4 1145s elif [ "$1" = '--color=no' ]; then 1145s export MSGCOLOR='NO' 1145s elif [ "$1" = '--color=yes' ]; then 1145s export MSGCOLOR='YES' 1145s elif [ "$1" = '--color' ]; then 1145s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 1145s shift 1145s elif [ "$1" = '--level' ]; then 1145s export MSGLEVEL=$2 1145s shift 1145s else 1145s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 1145s fi 1145s shift 1145s done 1145s export MSGLEVEL="${MSGLEVEL:-3}" 1145s 1145s # we all like colorful messages 1145s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 1145s if [ ! -t 1 ]; then # but check that we output to a terminal 1145s export MSGCOLOR='NO' 1145s fi 1145s fi 1145s 1145s if [ "$MSGCOLOR" != 'NO' ]; then 1145s CERROR="\033[1;31m" # red 1145s CWARNING="\033[1;33m" # yellow 1145s CMSG="\033[1;32m" # green 1145s CINFO="\033[1;96m" # light blue 1145s CDEBUG="\033[1;94m" # blue 1145s CNORMAL="\033[0;39m" # default system console color 1145s CDONE="\033[1;32m" # green 1145s CPASS="\033[1;32m" # green 1145s CFAIL="\033[1;31m" # red 1145s CCMD="\033[1;35m" # pink 1145s fi 1145s 1145s msgprintf() { 1145s local START="$1" 1145s local MIDDLE="$2" 1145s local END="$3" 1145s shift 3 1145s if [ -n "$1" ]; then 1145s printf "$START " "$1" 1145s shift 1145s while [ -n "$1" ]; do 1145s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 1145s shift 1145s done 1145s fi 1145s printf "${END}" 1145s } 1145s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 1145s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 1145s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 1145s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 1145s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 1145s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 1145s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 1145s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 1145s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 1145s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 1145s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 1145s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 1145s msgreportheader() { 1145s if [ -n "$MSGTEST_MSG" ]; then 1145s test "$1" != 'msgfailoutput' || echo 1145s if [ -n "$MSGTEST_MSGMSG" ]; then 1145s echo "$MSGTEST_MSGMSG" 1145s fi 1145s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 1145s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 1145s fi 1145s echo -n "$MSGTEST_MSG" 1145s unset MSGTEST_MSG 1145s fi 1145s } 1145s msgskip() { 1145s msgreportheader 'msgskip' 1145s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 1145s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 1145s } 1145s msgfail() { 1145s msgreportheader 'msgfail' 1145s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 1145s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 1145s if [ -n "$APT_DEBUG_TESTS" ]; then 1145s runapt $SHELL 1145s fi 1145s EXIT_CODE=$((EXIT_CODE+1)); 1145s } 1145s MSGGROUP_LEVEL=0 1145s msggroup() { 1145s if [ -n "$1" ]; then 1145s if [ $MSGGROUP_LEVEL = 0 ]; then 1145s MSGTEST_GRP='NEXT' 1145s fi 1145s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 1145s else 1145s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 1145s if [ $MSGGROUP_LEVEL = 0 ]; then 1145s unset MSGTEST_GRP 1145s fi 1145s fi 1145s } 1145s 1145s # enable / disable Debugging 1145s if [ $MSGLEVEL -le 0 ]; then 1145s msgdie() { true; } 1145s fi 1145s if [ $MSGLEVEL -le 1 ]; then 1145s msgwarn() { true; } 1145s msgnwarn() { true; } 1145s fi 1145s if [ $MSGLEVEL -le 2 ]; then 1145s msgmsg() { 1145s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 1145s } 1145s msgnmsg() { true; } 1145s msgtest() { 1145s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 1145s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 1145s MSGTEST_GRP="$MSGTEST_MSG" 1145s fi 1145s } 1145s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 1145s fi 1145s if [ $MSGLEVEL -le 3 ]; then 1145s msginfo() { true; } 1145s msgninfo() { true; } 1145s fi 1145s if [ $MSGLEVEL -le 4 ]; then 1145s msgdebug() { true; } 1145s msgndebug() { true; } 1145s fi 1145s if [ $MSGLEVEL -le 1 ]; then 1145s msgpass() { true; } 1145s fi 1145s msgdone() { 1145s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 1145s [ "$1" = "info" -a $MSGLEVEL -le 3 ] || 1145s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 1145s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 1145s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 1145s true; 1145s else 1145s printf "${CDONE}DONE${CNORMAL}\n"; 1145s fi 1145s } 1145s getaptconfig() { 1145s if [ -f ./aptconfig.conf ]; then 1145s echo "$(readlink -f ./aptconfig.conf)" 1145s elif [ -f ../aptconfig.conf ]; then 1145s echo "$(readlink -f ../aptconfig.conf)" 1145s elif [ -f ../../aptconfig.conf ]; then 1145s echo "$(readlink -f ../../aptconfig.conf)" 1145s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 1145s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 1145s fi 1145s } 1145s runapt() { 1145s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 1145s local CMD="$1" 1145s shift 1145s case "$CMD" in 1145s sh|aptitude|*/*|command) ;; 1145s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 1145s esac 1145s if [ "$CMD" = 'aptitude' ]; then 1145s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 1145s else 1145s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 1145s fi 1145s } 1145s runpython3() { runapt command python3 "$@"; } 1145s aptconfig() { runapt apt-config "$@"; } 1145s aptcache() { runapt apt-cache "$@"; } 1145s aptcdrom() { runapt apt-cdrom "$@"; } 1145s aptget() { runapt apt-get "$@"; } 1145s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 1145s aptkey() { runapt apt-key "$@"; } 1145s aptmark() { runapt apt-mark "$@"; } 1145s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 1145s apt() { runapt apt "$@"; } 1145s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 1145s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 1145s aptitude() { runapt aptitude "$@"; } 1145s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 1145s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 1145s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 1145s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 1145s 1145s dpkg() { 1145s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 1145s } 1145s dpkgquery() { 1145s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1145s } 1145s dpkg_version() { 1145s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 1145s } 1145s dpkgcheckbuilddeps() { 1145s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1145s } 1145s gdb() { 1145s local CMD 1145s case "$1" in 1145s aptget) CMD="apt-get";; 1145s aptcache) CMD="apt-cache";; 1145s aptcdrom) CMD="apt-cdrom";; 1145s aptconfig) CMD="apt-config";; 1145s aptmark) CMD="apt-mark";; 1145s apthelper) CMD="apt-helper";; 1145s aptftparchive) CMD="apt-ftparchive";; 1145s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1145s *) CMD="$1";; 1145s esac 1145s shift 1145s if [ "${CMD##*/}" = "$CMD" ]; then 1145s CMD="${APTCMDLINEBINDIR}/${CMD}" 1145s fi 1145s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 1145s } 1145s 1145s valgrind() { 1145s local CMD 1145s case "$1" in 1145s aptget) CMD="apt-get";; 1145s aptcache) CMD="apt-cache";; 1145s aptcdrom) CMD="apt-cdrom";; 1145s aptconfig) CMD="apt-config";; 1145s aptmark) CMD="apt-mark";; 1145s apthelper) CMD="apt-helper";; 1145s aptftparchive) CMD="apt-ftparchive";; 1145s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1145s *) CMD="$1";; 1145s esac 1145s shift 1145s if [ "$CMD" = "apt-ftparchive" ]; then 1145s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 1145s fi 1145s if [ "${CMD##*/}" = "$CMD" ]; then 1145s CMD="${APTCMDLINEBINDIR}/${CMD}" 1145s fi 1145s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 1145s } 1145s 1145s lastmodification() { 1145s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 1145s } 1145s releasefiledate() { 1145s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 1145s } 1145s 1145s exitwithstatus() { 1145s # error if we about to overflow, but ... 1145s # "255 failures ought to be enough for everybody" 1145s if [ $EXIT_CODE -gt 255 ]; then 1145s msgdie "Total failure count $EXIT_CODE too big" 1145s fi 1145s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 1145s } 1145s 1145s shellsetedetector() { 1145s local exit_status=$? 1145s if [ "$exit_status" != '0' ]; then 1145s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 1145s if [ "$EXIT_CODE" = '0' ]; then 1145s EXIT_CODE="$exit_status" 1145s fi 1145s fi 1145s } 1145s 1145s addtrap() { 1145s if [ "$1" = 'prefix' ]; then 1145s CURRENTTRAP="$2 $CURRENTTRAP" 1145s else 1145s CURRENTTRAP="$CURRENTTRAP $1" 1145s fi 1145s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1145s } 1145s 1145s escape_shell() { 1145s echo "$@" | sed -e "s#'#'\"'\"'#g" 1145s } 1145s 1145s find_project_binary_dir() { 1145s if [ -z "$PROJECT_BINARY_DIR" ]; then 1145s PROJECT_BINARY_DIR= 1145s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 1145s test -e "$dir/CMakeCache.txt" || continue 1145s if [ -z "$PROJECT_BINARY_DIR" ] || 1145s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 1145s PROJECT_BINARY_DIR="$dir" 1145s fi 1145s done 1145s if [ -z "$PROJECT_BINARY_DIR" ]; then 1145s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 1145s exit 1 1145s fi 1145s export PROJECT_BINARY_DIR 1145s fi 1145s } 1145s _removetmpworkingdirectory() { 1145s cd / 1145s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 1145s rm -rf "$TMPWORKINGDIRECTORY" 1145s fi 1145s TMPWORKINGDIRECTORY='' 1145s } 1145s setupenvironment() { 1145s # cleanup the environment a bit 1145s export LC_ALL=C 1145s unset LANGUAGE COLUMNS NLSPATH 1145s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 1145s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 1145s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 1145s unset GREP_OPTIONS POSIXLY_CORRECT 1145s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 1145s export GCOV_ERROR_FILE=/dev/null 1145s 1145s # Next check needs a gnu stat, let's figure that out early. 1145s stat=stat 1145s if command -v gnustat >/dev/null 2>&1; then 1145s stat=gnustat 1145s fi 1145s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 1145s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 1145s unset TMPDIR 1145s fi 1145s if [ -z "$TMPWORKINGDIRECTORY" ]; then 1145s addtrap '_removetmpworkingdirectory;' 1145s TMPWORKINGDIRECTORY="$(mktemp -d)" 1145s fi 1145s if [ -n "$TMPDIR_ADD" ]; then 1145s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 1145s mkdir -p "$TMPWORKINGDIRECTORY" 1145s unset TMPDIR_ADD 1145s export TMPDIR="$TMPWORKINGDIRECTORY" 1145s fi 1145s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 1145s 1145s # Setup coreutils on BSD systems 1145s mkdir "${TMPWORKINGDIRECTORY}/bin" 1145s for prefix in gnu g; do 1145s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 1145s if command -v $prefix$command 2>/dev/null >/dev/null; then 1145s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 1145s fi 1145s done 1145s done 1145s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 1145s 1145s if [ -z "$TESTDIRECTORY" ]; then 1145s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 1145s fi 1145s cd "$TMPWORKINGDIRECTORY" 1145s 1145s mkdir -m 700 'downloaded' 1145s if [ "$(id -u)" = '0' ]; then 1145s # relax permissions so that running as root with user switching works 1145s umask 022 1145s chmod 711 "$TMPWORKINGDIRECTORY" 1145s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 1145s fi 1145s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 1145s 1145s _setupprojectenvironment 1145s 1145s # create some files in /tmp and look at user/group to get what this means 1145s TEST_DEFAULT_USER="$(id -un)" 1145s touch "${TMPWORKINGDIRECTORY}/test-file" 1145s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 1145s 1145s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 1145s . "${TESTDIRECTORY}/extra-environment" 1145s fi 1145s 1145s msgdone "info" 1145s } 1145s _setupprojectenvironment() { 1145s # allow overriding the default BUILDDIR locations 1145s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 1145s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 1145s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 1145s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 1145s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1145s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 1145s APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 1145s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1145s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 1145s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 1145s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 1145s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 1145s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 1145s 1145s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 1145s mkdir aptarchive keys 1145s cd rootdir 1145s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 1145s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 1145s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 1145s touch var/lib/dpkg/available var/lib/dpkg/lock 1145s echo '1' > var/lib/dpkg/info/format 1145s ln -s "${METHODSDIR}" usr/lib/apt/methods 1145s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 1145s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 1145s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 1145s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 1145s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 1145s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 1145s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 1145s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 1145s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 1145s else 1145s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 1145s fi 1145s cd .. 1145s local BASENAME="${0##*/}" 1145s local PACKAGESFILE="Packages-${BASENAME#*-}" 1145s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 1145s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 1145s fi 1145s local SOURCESSFILE="Sources-${BASENAME#*-}" 1145s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 1145s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 1145s fi 1145s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 1145s chmod 644 keys/* 1145s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 1145s 1145s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 1145s echo "Dir::Etc \"etc\";" >> aptconfig.conf 1145s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 1145s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 1145s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 1145s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 1145s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 1145s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 1145s # either store apt-key were we can access it, even if we run it as a different user 1145s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 1145s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 1145s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 1145s # destroys coverage reporting though, so we disable changing user for the calling gpgv 1145s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 1145s if [ "$(id -u)" = '0' ]; then 1145s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 1145s # same for the solver executables 1145s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 1145s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 1145s fi 1145s 1145s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 1145s EXEC='' 1145s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 1145s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 1145s restoredpkgstatus() { 1145s if [ -n "\$BACKUP" ]; then 1145s if [ -e "\$BACKUP" ]; then 1145s mv -f "\$BACKUP" "\$ORIGINAL" 1145s else 1145s rm -f "\$ORIGINAL" 1145s fi 1145s BACKUP='' 1145s fi 1145s } 1145s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1145s if [ -e "\$ORIGINAL" ]; then 1145s cp -a "\$ORIGINAL" "\$BACKUP" 1145s fi 1145s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 1145s 1145s Package: dpkg 1145s Architecture: all 1145s Version: ${DPKG_VERSION}+fake 1145s Status: install ok installed 1145s Maintainer: Joe Sixpack 1145s Installed-Size: 42 1145s Description: tells dpkg it supports what we need 1145s Some versions of dpkg check its own version from the status file 1145s to know if it supports multi-arch and stuff in --assert-*. 1145s 1145s EOS 1145s fi 1145s EOF 1145s fi 1145s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 1145s 1145s { 1145s echo 'quiet "0";' 1145s echo 'quiet::NoUpdate "true";' 1145s echo 'quiet::NoStatistic "true";' 1145s # too distracting for users, but helpful to detect changes 1145s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 1145s echo 'Acquire::Progress::Diffpercent "true";' 1145s # in testcases, it can appear as if localhost has a rotation setup, 1145s # hide this as we can't really deal with it properly 1145s echo 'Acquire::Failure::ShowIP "false";' 1145s # randomess and tests don't play well together 1145s echo 'Acquire::IndexTargets::Randomized "false";' 1145s # fakeroot can't fake everything, so disabled in production but good for tests 1145s echo 'APT::Sandbox::Verify "true";' 1145s } >> aptconfig.conf 1145s 1145s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1145s if [ "$(id -u)" = '0' ]; then 1145s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1145s fi 1145s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 1145s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 1145s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 1145s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 1145s # Allow release files to be 10 hours in the future, rather than 10 seconds 1145s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 1145s 1145s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 1145s 1145s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 1145s confighashes 'SHA256' # these are tests, not security best-practices 1145s 1145s # Make dpkg inherit testing path 1145s echo 'DPkg::Path "";' >> aptconfig.conf 1145s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 1145s 1145s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 1145s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 1145s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 1145s fi 1145s 1145s # most tests just need one signed Release file, not both 1145s export APT_DONT_SIGN='Release.gpg' 1145s 1145s # prefer our apt binaries over the system apt binaries 1145s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 1145s } 1145s 1145s getarchitecture() { 1145s if [ "$1" = "native" -o -z "$1" ]; then 1145s eval `aptconfig shell ARCH APT::Architecture` 1145s if [ -n "$ARCH" ]; then 1145s echo $ARCH 1145s else 1145s dpkg --print-architecture 1145s fi 1145s else 1145s echo $1 1145s fi 1145s } 1145s 1145s getarchitectures() { 1145s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 1145s } 1145s 1145s getarchitecturesfromcommalist() { 1145s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 1145s } 1145s 1145s configarchitecture() { 1145s { 1145s echo "APT::Architecture \"$(getarchitecture $1)\";" 1145s while [ -n "$1" ]; do 1145s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 1145s shift 1145s done 1145s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 1145s configdpkg 1145s } 1145s 1145s configdpkg() { 1145s if [ ! -e rootdir/var/lib/dpkg/status ]; then 1145s local BASENAME="${0##*/}" 1145s local STATUSFILE="status-${BASENAME#*-}" 1145s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 1145s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 1145s # Add an empty line to the end if there is none 1145s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 1145s echo >> rootdir/var/lib/dpkg/status 1145s fi 1145s fi 1145s fi 1145s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 1145s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 1145s local ARCHS="$(getarchitectures)" 1145s local DPKGARCH="$(dpkg --print-architecture)" 1145s # this ensures that even if multi-arch isn't active in the view 1145s # of apt, given that dpkg can't be told which arch is native 1145s # the arch apt treats as native might be foreign for dpkg 1145s for ARCH in ${ARCHS}; do 1145s if [ "${ARCH}" != "${DPKGARCH}" ]; then 1145s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 1145s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 1145s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 1145s else 1145s # old-style used e.g. in Ubuntu-P – and as it seems travis 1145s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1145s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1145s fi 1145s fi 1145s fi 1145s done 1145s else 1145s # test multiarch before dpkg is ready for it… 1145s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 1145s fi 1145s } 1145s 1145s configdpkgnoopchroot() { 1145s # create a library to noop chroot() and rewrite maintainer script executions 1145s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 1145s # chroot directory dpkg could chroot into to execute the maintainer scripts 1145s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 1145s cat > noopchroot.c << EOF 1145s #define _GNU_SOURCE 1145s #include 1145s #include 1145s #include 1145s #include 1145s 1145s static char * chrootdir = NULL; 1145s 1145s int chroot(const char *path) { 1145s printf("WARNING: CHROOTing to %s was ignored!\n", path); 1145s free(chrootdir); 1145s chrootdir = strdup(path); 1145s return 0; 1145s } 1145s int execvp(const char *file, char *const argv[]) { 1145s static int (*func_execvp) (const char *, char * const []) = NULL; 1145s if (func_execvp == NULL) 1145s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 1145s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 1145s return func_execvp(file, argv); 1145s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 1145s char *newfile; 1145s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 1145s perror("asprintf"); 1145s return -1; 1145s } 1145s char const * const baseadmindir = "/var/lib/dpkg"; 1145s char *admindir; 1145s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 1145s perror("asprintf"); 1145s return -1; 1145s } 1145s setenv("DPKG_ADMINDIR", admindir, 1); 1145s return func_execvp(newfile, argv); 1145s } 1145s EOF 1145s if cc -ldl 2>&1 | grep -q dl; then 1145s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 1145s else 1145s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 1145s fi 1145s } 1145s configcompression() { 1145s if [ "$1" = 'ALL' ]; then 1145s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 1145s return 1145s fi 1145s local CMD='apthelper cat-file -C' 1145s while [ -n "$1" ]; do 1145s case "$1" in 1145s '.') printf ".\t.\tcat\n";; 1145s 'gz') printf "gzip\tgz\t$CMD $1\n";; 1145s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 1145s 'zst') printf "zstd\tzst\t$CMD $1\n";; 1145s *) printf "$1\t$1\t$CMD $1\n";; 1145s esac 1145s shift 1145s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1145s } 1145s confighashes() { 1145s { 1145s echo 'APT::FTPArchive {' 1145s { 1145s while [ -n "$1" ]; do 1145s printf "$1" | tr 'a-z' 'A-Z' 1145s printf "\t\"true\";\n" 1145s shift 1145s done 1145s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 1145s printf "$h\t\"false\";\n" 1145s done 1145s } | awk '!x[$1]++' 1145s echo '};' 1145s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 1145s } 1145s forcecompressor() { 1145s COMPRESSOR="$1" 1145s COMPRESS="$1" 1145s COMPRESSOR_CMD="apthelper cat-file -C $1" 1145s case $COMPRESSOR in 1145s gzip) COMPRESS='gz';; 1145s bzip2) COMPRESS='bz2';; 1145s zstd) COMPRESS='zst';; 1145s esac 1145s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1145s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 1145s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 1145s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1145s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 1145s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 1145s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 1145s done 1145s } 1145s 1145s _setupsimplenativepackage() { 1145s local NAME="$1" 1145s local ARCH="$2" 1145s local VERSION="$3" 1145s local RELEASE="${4:-unstable}" 1145s local DEPENDENCIES="$5" 1145s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 1145s If you find such a package installed on your system, 1145s something went horribly wrong! They are autogenerated 1145s and used only by testcases and serve no other purpose…}" 1145s 1145s local SECTION="${7:-others}" 1145s local PRIORITY="${8:-optional}" 1145s local FILE_TREE="$9" 1145s local COMPRESS_TYPE="${10:-gzip}" 1145s local DISTSECTION 1145s if [ "$SECTION" = "${SECTION#*/}" ]; then 1145s DISTSECTION="main" 1145s else 1145s DISTSECTION="${SECTION%/*}" 1145s fi 1145s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1145s 1145s mkdir -p "$BUILDDIR/debian/source" 1145s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 1145s echo "#!/bin/sh 1145s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 1145s 1145s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 1145s echo "$NAME ($VERSION) $RELEASE; urgency=low 1145s 1145s * Initial release 1145s 1145s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 1145s { 1145s echo "Source: $NAME 1145s Priority: $PRIORITY 1145s Maintainer: Joe Sixpack 1145s Standards-Version: 4.3.1 1145s Rules-Requires-Root: no" 1145s if [ "$SECTION" != '' ]; then 1145s echo "Section: $SECTION" 1145s fi 1145s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 1145s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 1145s echo " 1145s Package: $NAME" 1145s 1145s if [ "$ARCH" = 'all' ]; then 1145s echo "Architecture: all" 1145s else 1145s echo "Architecture: any" 1145s fi 1145s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 1145s test -z "$DEPS" || echo "$DEPS" 1145s printf "%b\n" "Description: $DESCRIPTION" 1145s } > "${BUILDDIR}/debian/control" 1145s 1145s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 1145s } 1145s 1145s make_tiny_rules() { 1145s local OUT="$1" 1145s if command -v gmake >/dev/null 2>&1; then 1145s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 1145s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 1145s else 1145s echo '#!/usr/bin/make -f' > "$OUT" 1145s fi 1145s echo '%:' >> "$OUT" 1145s echo ' dh $@' >> "$OUT" 1145s } 1145s 1145s setupsimplenativepackage() { 1145s _setupsimplenativepackage "$@" 1145s local NAME="$1" 1145s local VERSION="$3" 1145s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1145s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 1145s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 1145s } 1145s 1145s buildsimplenativepackage() { 1145s local NAME="$1" 1145s local ARCH="$2" 1145s local VERSION="$3" 1145s local RELEASE="${4:-unstable}" 1145s local DEPENDENCIES="$5" 1145s local DESCRIPTION="$6" 1145s local SECTION="${7:-others}" 1145s local PRIORITY="${8:-optional}" 1145s local FILE_TREE="$9" 1145s local COMPRESS_TYPE="${10:-gzip}" 1145s local DISTSECTION 1145s if [ "$SECTION" = "${SECTION#*/}" ]; then 1145s DISTSECTION="main" 1145s else 1145s DISTSECTION="${SECTION%/*}" 1145s fi 1145s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1145s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 1145s _setupsimplenativepackage "$@" 1145s cd "${BUILDDIR}/.." 1145s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 1145s cd - >/dev/null 1145s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 1145s | while read SRC; do 1145s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 1145s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 1145s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 1145s # adv --yes --default-key 'Joe Sixpack' \ 1145s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1145s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1145s # fi 1145s done 1145s 1145s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1145s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 1145s rm -rf "${BUILDDIR}/debian/tmp" 1145s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 1145s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 1145s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 1145s if [ -n "$FILE_TREE" ]; then 1145s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 1145s fi 1145s 1145s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 1145s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 1145s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 1145s # ensure the right permissions as dpkg-deb insists 1145s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 1145s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 1145s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 1145s done 1145s 1145s local NM 1145s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 1145s NM="$(echo "$NAME" | cut -c 1-4)" 1145s else 1145s NM="$(echo "$NAME" | cut -c 1)" 1145s fi 1145s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 1145s mkdir -p "$CHANGEPATH" 1145s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 1145s rm -rf "${BUILDDIR}" 1145s msgdone "info" 1145s } 1145s 1145s buildpackage() { 1145s local BUILDDIR=$1 1145s local RELEASE=$2 1145s local SECTION=$3 1145s local ARCH=$(getarchitecture $4) 1145s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 1145s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 1145s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 1145s cd "$BUILDDIR" 1145s if [ "$ARCH" = "all" ]; then 1145s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 1145s fi 1145s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 1145s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 1145s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 1145s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 1145s cd - > /dev/null 1145s for PKG in $PKGS; do 1145s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 1145s done 1145s for SRC in $SRCS; do 1145s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 1145s done 1145s } 1145s 1145s buildaptarchive() { 1145s if [ -d incoming ]; then 1145s buildaptarchivefromincoming "$@" 1145s else 1145s buildaptarchivefromfiles "$@" 1145s fi 1145s } 1145s 1145s createaptftparchiveconfig() { 1145s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 1145s local COMPRESSORS="${COMPRESSORS%* }" 1145s local ARCHS="$(getarchitectures)" 1145s cat > ftparchive.conf <> ftparchive.conf 1145s } 1145s 1145s buildaptftparchivedirectorystructure() { 1145s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 1145s for DIST in $DISTS; do 1145s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 1145s for SECTION in $SECTIONS; do 1145s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 1145s for ARCH in $ARCHS; do 1145s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 1145s done 1145s mkdir -p "dists/${DIST}/${SECTION}/source" 1145s mkdir -p "dists/${DIST}/${SECTION}/i18n" 1145s done 1145s done 1145s } 1145s 1145s insertpackage() { 1145s local RELEASES="$1" 1145s local NAME="$2" 1145s local ARCH="$3" 1145s local VERSION="$4" 1145s local DEPENDENCIES="$5" 1145s local PRIORITY="${6:-optional}" 1145s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 1145s If you find such a package installed on your system, 1145s something went horribly wrong! They are autogenerated 1145s and used only by testcases and serve no other purpose…}" 1145s local SECTION="${8:-other}" 1145s 1145s if [ "$SECTION" = "${SECTION#*/}" ]; then 1145s DISTSECTION="main" 1145s else 1145s DISTSECTION="${SECTION%/*}" 1145s fi 1145s local ARCHS="" 1145s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1145s if [ "$RELEASE" = 'installed' ]; then 1145s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 1145s continue 1145s fi 1145s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1145s if [ "$arch" = 'none' ]; then 1145s ARCHS="$(getarchitectures)" 1145s else 1145s ARCHS="$arch" 1145s fi 1145s for BUILDARCH in $ARCHS; do 1145s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 1145s mkdir -p "$PPATH" 1145s { 1145s echo "Package: $NAME 1145s Priority: $PRIORITY 1145s Section: $SECTION 1145s Installed-Size: 42 1145s Size: 42" 1145s if echo "$DEPENDENCIES" | grep -q SHA256:; then 1145s : 1145s else 1145s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 1145s fi 1145s echo "Maintainer: Joe Sixpack " 1145s test "$arch" = 'none' || echo "Architecture: $arch" 1145s echo "Version: $VERSION 1145s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 1145s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 1145s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 1145s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 1145s echo 1145s } >> "${PPATH}/Packages" 1145s done 1145s done 1145s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 1145s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 1145s echo "Package: $NAME 1145s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 1145s Description-en: $DESCRIPTION 1145s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 1145s done 1145s } 1145s 1145s insertsource() { 1145s local RELEASES="$1" 1145s local NAME="$2" 1145s local ARCH="$3" 1145s local VERSION="$4" 1145s local DEPENDENCIES="$5" 1145s local BINARY="${6:-$NAME}" 1145s local ARCHS="" 1145s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1145s local SPATH="aptarchive/dists/${RELEASE}/main/source" 1145s mkdir -p $SPATH 1145s local FILE="${SPATH}/Sources" 1145s local DSCFILE="${NAME}_${VERSION}.dsc" 1145s local TARFILE="${NAME}_${VERSION}.tar.gz" 1145s echo "Package: $NAME 1145s Binary: $BINARY 1145s Version: $VERSION 1145s Maintainer: Joe Sixpack 1145s Architecture: $ARCH" >> $FILE 1145s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1145s echo "Files: 1145s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1145s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1145s Checksums-Sha256: 1145s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1145s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1145s " >> "$FILE" 1145s done 1145s } 1145s 1145s insertinstalledpackage() { 1145s local NAME="$1" 1145s local ARCH="$2" 1145s local VERSION="$3" 1145s local DEPENDENCIES="$4" 1145s local PRIORITY="${5:-optional}" 1145s local STATUS="${6:-install ok installed}" 1145s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 1145s If you find such a package installed on your system, 1145s something went horribly wrong! They are autogenerated 1145s and used only by testcases and serve no other purpose…}" 1145s local SECTION="${8:-other}" 1145s 1145s local FILE='rootdir/var/lib/dpkg/status' 1145s local INFO='rootdir/var/lib/dpkg/info' 1145s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1145s echo "Package: $NAME 1145s Status: $STATUS 1145s Priority: $PRIORITY 1145s Section: $SECTION 1145s Installed-Size: 42 1145s Maintainer: Joe Sixpack 1145s Version: $VERSION" >> "$FILE" 1145s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 1145s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1145s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 1145s echo >> "$FILE" 1145s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 1145s echo -n > "${INFO}/${NAME}:${arch}.list" 1145s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 1145s else 1145s echo -n > "${INFO}/${NAME}.list" 1145s echo -n > "${INFO}/${NAME}.md5sums" 1145s fi 1145s done 1145s } 1145s 1145s 1145s buildaptarchivefromincoming() { 1145s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 1145s cd aptarchive 1145s [ -e pool ] || ln -s ../incoming pool 1145s [ -e ftparchive.conf ] || createaptftparchiveconfig 1145s [ -e dists ] || buildaptftparchivedirectorystructure 1145s msgninfo "\tGenerate Packages, Sources and Contents files… " 1145s testsuccess aptftparchive generate ftparchive.conf 1145s cd - > /dev/null 1145s msgdone "info" 1145s generatereleasefiles "$@" 1145s } 1145s 1145s buildaptarchivefromfiles() { 1145s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 1145s local DIR='aptarchive' 1145s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 1145s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 1145s msgninfo "\t${line} file… " 1145s compressfile "$line" "$1" 1145s msgdone "info" 1145s done 1145s generatereleasefiles "$@" 1145s } 1145s 1145s compressfile() { 1145s while read compressor extension command; do 1145s if [ "$compressor" = '.' ]; then 1145s if [ -n "$2" ]; then 1145s touch -d "$2" "$1" 1145s fi 1145s continue 1145s fi 1145s cat "$1" | $command > "${1}.${extension}" 1145s if [ -n "$2" ]; then 1145s touch -d "$2" "${1}.${extension}" 1145s fi 1145s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1145s } 1145s 1145s # can be overridden by testcases for their pleasure 1145s getcodenamefromsuite() { 1145s case "$1" in 1145s unstable) echo 'sid';; 1145s *) echo -n "$1";; 1145s esac 1145s } 1145s getreleaseversionfromsuite() { true; } 1145s getlabelfromsuite() { true; } 1145s getoriginfromsuite() { true; } 1145s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 1145s getnotautomaticfromsuite() { 1145s case "$1" in 1145s experimental|experimental2) echo "yes";; 1145s esac 1145s } 1145s getbutautomaticupgradesfromsuite() { true; } 1145s 1145s aptftparchiverelease() { 1145s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 1145s } 1145s generatereleasefiles() { 1145s # $1 is the Date header and $2 is the ValidUntil header to be set 1145s # both should be given in notation date/touch can understand 1145s local DATE="$1" 1145s local VALIDUNTIL="$2" 1145s if [ -e aptarchive/dists ]; then 1145s msgninfo "\tGenerate Release files for dists… " 1145s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 1145s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 1145s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 1145s local CODENAME="$(getcodenamefromsuite $SUITE)" 1145s local VERSION="$(getreleaseversionfromsuite $SUITE)" 1145s local LABEL="$(getlabelfromsuite $SUITE)" 1145s local ORIGIN="$(getoriginfromsuite $SUITE)" 1145s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 1145s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 1145s aptftparchiverelease "$dir" \ 1145s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 1145s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 1145s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 1145s -o APT::FTPArchive::Release::Label="${LABEL}" \ 1145s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 1145s -o APT::FTPArchive::Release::Version="${VERSION}" \ 1145s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 1145s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 1145s > "$dir/Release" 1145s done 1145s else 1145s msgninfo "\tGenerate Release files for flat… " 1145s aptftparchiverelease ./aptarchive > aptarchive/Release 1145s fi 1145s if [ -n "$VALIDUNTIL" ]; then 1145s sed -i "/^Date: / a\ 1145s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 1145s fi 1145s if [ -n "$DATE" -a "$DATE" != "now" ]; then 1145s for release in $(find ./aptarchive -name 'Release'); do 1145s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 1145s touch -d "$DATE" "$release" 1145s done 1145s fi 1145s msgdone "info" 1145s } 1145s 1145s setupdistsaptarchive() { 1145s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1145s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 1145s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 1145s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 1145s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 1145s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 1145s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 1145s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 1145s msgdone "info" 1145s done 1145s } 1145s 1145s setupflataptarchive() { 1145s local APTARCHIVE="$(readlink -f ./aptarchive)" 1145s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1145s if [ -f "${APTARCHIVE}/Packages" ]; then 1145s msgninfo "\tadd deb sources.list line… " 1145s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1145s msgdone 'info' 1145s else 1145s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1145s fi 1145s if [ -f "${APTARCHIVE}/Sources" ]; then 1145s msgninfo "\tadd deb-src sources.list line… " 1145s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1145s msgdone 'info' 1145s else 1145s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1145s fi 1145s } 1145s 1145s setupaptarchive() { 1145s local NOUPDATE=0 1145s if [ "$1" = '--no-update' ]; then 1145s NOUPDATE=1 1145s shift 1145s fi 1145s buildaptarchive "$@" 1145s if [ -e aptarchive/dists ]; then 1145s setupdistsaptarchive 1145s else 1145s setupflataptarchive 1145s fi 1145s signreleasefiles 'Joe Sixpack' 1145s if [ "1" != "$NOUPDATE" ]; then 1145s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 1145s fi 1145s } 1145s 1145s killgpgagent() { 1145s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 1145s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1145s if [ ! -e "${GPGHOME}" ]; then return; fi 1145s # ensure the agent dies quickly as different versions have different suicide heuristics 1145s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 1145s rm -rf "$GPGHOME" 1145s } 1145s dosigning() { 1145s local KEY="$1" 1145s shift 1145s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1145s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 1145s GPGHOME="$APT_TEST_SIGNINGHOME" 1145s else 1145s if [ ! -e "$GPGHOME" ]; then 1145s mkdir -p --mode=700 "${GPGHOME}" 1145s addtrap 'prefix' 'killgpgagent;' 1145s fi 1145s fi 1145s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 1145s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1145s "$@" 1145s } 1145s signreleasefiles() { 1145s local SIGNERS="${1:-Joe Sixpack}" 1145s local REPODIR="${2:-aptarchive}" 1145s if [ -n "$1" ]; then shift; fi 1145s if [ -n "$1" ]; then shift; fi 1145s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1145s msgninfo "\tSign archive with $SIGNERS key $KEY… " 1145s local REXKEY='keys/rexexpired' 1145s local SECEXPIREBAK="${REXKEY}.sec.bak" 1145s local PUBEXPIREBAK="${REXKEY}.pub.bak" 1145s local SIGUSERS="" 1145s while [ -n "${SIGNERS%%,*}" ]; do 1145s local SIGNER="${SIGNERS%%,*}" 1145s if [ "${SIGNERS}" = "${SIGNER}" ]; then 1145s SIGNERS="" 1145s fi 1145s SIGNERS="${SIGNERS#*,}" 1145s # FIXME: This should be the full name, but we can't encode the space properly currently 1145s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 1145s if [ "${SIGNER}" = 'Rex Expired' ]; then 1145s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 1145s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 1145s # therefore we 'temporary' make the key not expired and restore a backup after signing 1145s cp "${REXKEY}.sec" "$SECEXPIREBAK" 1145s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 1145s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 1145s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 1145s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 1145s cp "$SECUNEXPIRED" "${REXKEY}.sec" 1145s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 1145s else 1145s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 1145s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1145s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 1145s cat setexpire.gpg 1145s exit 1 1145s fi 1145s cp "${REXKEY}.sec" "$SECUNEXPIRED" 1145s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 1145s fi 1145s fi 1145s if [ ! -e "${KEY}.pub" ]; then 1145s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1145s cat "${K}.pub" >> "${KEY}.new.pub" 1145s cat "${K}.sec" >> "${KEY}.new.sec" 1145s fi 1145s done 1145s if [ ! -e "${KEY}.pub" ]; then 1145s mv "${KEY}.new.pub" "${KEY}.pub" 1145s mv "${KEY}.new.sec" "${KEY}.sec" 1145s fi 1145s for RELEASE in $(find "${REPODIR}/" -name Release); do 1145s # we might have set a specific date for the Release file, so copy it 1145s local DATE="$(stat --format "%y" "${RELEASE}")" 1145s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 1145s rm -f "${RELEASE}.gpg" 1145s else 1145s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 1145s touch -d "$DATE" "${RELEASE}.gpg" 1145s fi 1145s local INRELEASE="${RELEASE%/*}/InRelease" 1145s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 1145s rm -f "$INRELEASE" 1145s else 1145s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 1145s touch -d "$DATE" "${INRELEASE}" 1145s fi 1145s done 1145s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 1145s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 1145s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 1145s fi 1145s msgdone 'info' 1145s } 1145s 1145s redatereleasefiles() { 1145s local DATE="$(date -u -d "$1" -R)" 1145s for release in $(find aptarchive/ -name 'Release'); do 1145s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 1145s touch -d "$DATE" "$release" 1145s done 1145s signreleasefiles "${2:-Joe Sixpack}" 1145s } 1145s 1145s webserverconfig() { 1145s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 1145s local NOCHECK=false 1145s if [ "$1" = '--no-check' ]; then 1145s NOCHECK=true 1145s shift 1145s fi 1145s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 1145s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 1145s rm -f "$STATUS" "$DOWNLOG" 1145s local URI 1145s if [ -n "$2" ]; then 1145s msgtest "Set webserver config option '${1}' to" "$2" 1145s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 1145s else 1145s msgtest 'Clear webserver config option' "${1}" 1145s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 1145s fi 1145s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 1145s msgpass 1145s else 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 1145s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 1145s msgfailoutput '' "$OUTPUT" 1145s fi 1145s $NOCHECK || testwebserverlaststatuscode '200' 1145s } 1145s 1145s rewritesourceslist() { 1145s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 1145s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 1145s sed -i $LIST \ 1145s -e "s#file://$APTARCHIVE#${1}#" \ 1145s -e "s#file:$APTARCHIVE#${1}#" \ 1145s -e "s#copy://$APTARCHIVE#${1}#" \ 1145s -e "s#copy:$APTARCHIVE#${1}#" \ 1145s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 1145s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 1145s done 1145s } 1145s 1145s # wait for up to 10s for a pid file to appear to avoid possible race 1145s # when a helper is started and doesn't write the PID quick enough 1145s waitforpidfile() { 1145s local PIDFILE="$1" 1145s for i in $(seq 10); do 1145s if test -s "$PIDFILE"; then 1145s return 0 1145s fi 1145s sleep 1 1145s done 1145s msgdie "waiting for $PIDFILE failed" 1145s return 1 1145s } 1145s 1145s changetowebserver() { 1145s local REWRITE='yes' 1145s if [ "$1" = '--no-rewrite' ]; then 1145s REWRITE='no' 1145s shift 1145s fi 1145s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 1145s cd aptarchive 1145s local LOG="webserver.log" 1145s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 1145s cat "$LOG" 1145s false 1145s fi 1145s waitforpidfile aptwebserver.pid 1145s local PID="$(cat aptwebserver.pid)" 1145s if [ -z "$PID" ]; then 1145s msgdie 'Could not fork aptwebserver successfully' 1145s fi 1145s addtrap "kill $PID;" 1145s waitforpidfile aptwebserver.port 1145s APTHTTPPORT="$(cat aptwebserver.port)" 1145s if [ -z "$APTHTTPPORT" ]; then 1145s msgdie 'Could not get port for aptwebserver successfully' 1145s fi 1145s cd - > /dev/null 1145s else 1145s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 1145s fi 1145s if [ "$REWRITE" != 'no' ]; then 1145s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 1145s fi 1145s } 1145s 1145s changetohttpswebserver() { 1145s local REWRITE='yes' 1145s if [ "$1" = '--no-rewrite' ]; then 1145s REWRITE='no' 1145s shift 1145s fi 1145s local stunnel4 1145s if command -v stunnel4 >/dev/null 2>&1; then 1145s stunnel4=stunnel4 1145s elif command -v stunnel >/dev/null 2>&1; then 1145s stunnel4=stunnel 1145s else 1145s msgdie 'You need to install stunnel4 for https testcases' 1145s fi 1145s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 1145s changetowebserver --no-rewrite "$@" 1145s fi 1145s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 1145s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 1145s output = /dev/null 1145s 1145s [https] 1145s accept = 127.0.0.1:0 1145s connect = $APTHTTPPORT 1145s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 1145s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 1145s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 1145s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 1145s if [ -z "$PID" ]; then 1145s msgdie 'Could not fork $stunnel4 successfully' 1145s fi 1145s addtrap 'prefix' "kill ${PID};" 1145s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 1145s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 1145s if [ "$REWRITE" != 'no' ]; then 1145s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 1145s fi 1145s } 1145s 1145s changetocdrom() { 1145s mkdir -p rootdir/media/cdrom/.disk 1145s local CD="$(readlink -f rootdir/media/cdrom)" 1145s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 1145s if [ ! -d aptarchive/dists ]; then 1145s msgdie 'Flat file archive cdroms can not be created currently' 1145s return 1 1145s fi 1145s mv aptarchive/dists "$CD" 1145s ln -s "$(readlink -f ./incoming)" "$CD/pool" 1145s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 1145s # start with an unmounted disk 1145s mv "${CD}" "${CD}-unmounted" 1145s # we don't want the disk to be modifiable 1145s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 1145s chmod -R 555 rootdir/media/cdrom-unmounted/dists 1145s } 1145s 1145s downloadfile() { 1145s local PROTO="${1%%:*}" 1145s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 1145s download-file "$1" "$2" "$3" 2>&1 ; then 1145s return 1 1145s fi 1145s # only if the file exists the download was successful 1145s if [ -r "$2" ]; then 1145s return 0 1145s else 1145s return 1 1145s fi 1145s } 1145s 1145s cleanup_output() { 1145s cat "$1" | sed \ 1145s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 1145s -e '/^profiling:/ d' \ 1145s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 1145s >"$2" 1145s } 1145s 1145s checkdiff() { 1145s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 1145s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 1145s touch "$TMPFILE1" "$TMPFILE2" 1145s 1145s cleanup_output "$1" "$TMPFILE1" 1145s cleanup_output "$2" "$TMPFILE2" 1145s 1145s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 1145s if [ -n "$DIFFTEXT" ]; then 1145s echo >&2 1145s echo >&2 "$DIFFTEXT" 1145s return 1 1145s else 1145s return 0 1145s fi 1145s } 1145s 1145s testoutputequal() { 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 1145s local COMPAREFILE="$1" 1145s shift 1145s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 1145s msgpass 1145s else 1145s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 1145s cat "$COMPAREFILE" >>"${OUTPUT}" 1145s msgfailoutput '' "$OUTPUT" "$@" 1145s fi 1145s } 1145s 1145s testfileequal() { 1145s msggroup 'testfileequal' 1145s local MSG='Test for correctness of file' 1145s if [ "$1" = '--nomsg' ]; then 1145s MSG='' 1145s shift 1145s fi 1145s local FILE="$1" 1145s shift 1145s if [ -n "$MSG" ]; then 1145s msgtest "$MSG" "$FILE" 1145s fi 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 1145s if [ -z "$*" ]; then 1145s testoutputequal "$FILE" echo -n '' 1145s else 1145s testoutputequal "$FILE" echo "$*" 1145s fi 1145s msggroup 1145s } 1145s 1145s testempty() { 1145s msggroup 'testempty' 1145s if [ "$1" = '--nomsg' ]; then 1145s shift 1145s else 1145s msgtest "Test for no output of" "$*" 1145s fi 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 1145s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 1145s msgpass 1145s else 1145s msgfailoutput '' "$COMPAREFILE" "$@" 1145s fi 1145s aptautotest 'testempty' "$@" 1145s msggroup 1145s } 1145s testwarningempty() { 1145s testwarning "$@" 1145s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 1145s } 1145s testnotempty() { 1145s msggroup 'testnotempty' 1145s msgtest "Test for some output of" "$*" 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 1145s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 1145s msgpass 1145s else 1145s msgfailoutput '' "$COMPAREFILE" "$@" 1145s fi 1145s aptautotest 'testnotempty' "$@" 1145s msggroup 1145s } 1145s 1145s testequal() { 1145s msggroup 'testequal' 1145s local MSG='Test of equality of' 1145s if [ "$1" = '--nomsg' ]; then 1145s MSG='' 1145s shift 1145s fi 1145s 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 1145s echo "$1" > "$COMPAREFILE" 1145s shift 1145s 1145s if [ -n "$MSG" ]; then 1145s msgtest "$MSG" "$*" 1145s fi 1145s testoutputequal "$COMPAREFILE" "$@" 1145s aptautotest 'testequal' "$@" 1145s msggroup 1145s } 1145s 1145s testequalor2() { 1145s msggroup 'testequalor2' 1145s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 1145s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 1145s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 1145s echo "$1" > "$COMPAREFILE1" 1145s echo "$2" > "$COMPAREFILE2" 1145s shift 2 1145s msgtest "Test for equality OR of" "$*" 1145s "$@" >"$COMPAREAGAINST" 2>&1 || true 1145s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 1145s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 1145s then 1145s msgpass 1145s else 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 1145s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 1145s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1145s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 1145s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1145s msgfailoutput '' "$OUTPUT" 1145s fi 1145s aptautotest 'testequalor2' "$@" 1145s msggroup 1145s } 1145s 1145s testshowvirtual() { 1145s msggroup 'testshowvirtual' 1145s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 1145s local PACKAGE="$1" 1145s shift 1145s while [ -n "$1" ]; do 1145s VIRTUAL="${VIRTUAL} 1145s N: Can't select versions from package '$1' as it is purely virtual" 1145s PACKAGE="${PACKAGE} $1" 1145s shift 1145s done 1145s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 1145s VIRTUAL="${VIRTUAL} 1145s N: No packages found" 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 1145s local ARCH="$(getarchitecture 'native')" 1145s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 1145s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 1145s msggroup 1145s } 1145s 1145s testnopackage() { 1145s msggroup 'testnopackage' 1145s msgtest "Test for non-existent packages" "apt-cache show $*" 1145s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 1145s if [ -n "$SHOWPKG" ]; then 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1145s echo "$SHOWPKG" >"$OUTPUT" 1145s msgfailoutput '' "$OUTPUT" 1145s else 1145s msgpass 1145s fi 1145s msggroup 1145s } 1145s testnosrcpackage() { 1145s msggroup 'testnosrcpackage' 1145s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 1145s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 1145s if [ -n "$SHOWPKG" ]; then 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 1145s echo "$SHOWPKG" >"$OUTPUT" 1145s msgfailoutput '' "$OUTPUT" 1145s else 1145s msgpass 1145s fi 1145s msggroup 1145s } 1145s 1145s testdpkgstatus() { 1145s msggroup 'testdpkgstatus' 1145s local STATE="$1" 1145s local NR="$2" 1145s shift 2 1145s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 1145s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 1145s if [ "$PKGS" != $NR ]; then 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1145s echo "$PKGS" >"$OUTPUT" 1145s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 1145s msgfailoutput '' "$OUTPUT" 1145s else 1145s msgpass 1145s fi 1145s msggroup 1145s } 1145s 1145s testdpkginstalled() { 1145s msggroup 'testdpkginstalled' 1145s testdpkgstatus 'ii' "$#" "$@" 1145s msggroup 1145s } 1145s 1145s testdpkgnotinstalled() { 1145s msggroup 'testdpkgnotinstalled' 1145s testdpkgstatus 'ii' '0' "$@" 1145s msggroup 1145s } 1145s 1145s testmarkedauto() { 1145s msggroup 'testmarkedauto' 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 1145s if [ -n "$1" ]; then 1145s msgtest 'Test for correctly marked as auto-installed' "$*" 1145s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1145s else 1145s msgtest 'Test for correctly marked as auto-installed' 'no package' 1145s echo -n > "$COMPAREFILE" 1145s fi 1145s testoutputequal "$COMPAREFILE" aptmark showauto 1145s msggroup 1145s } 1145s testmarkedmanual() { 1145s msggroup 'testmarkedmanual' 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 1145s if [ -n "$1" ]; then 1145s msgtest 'Test for correctly marked as manually installed' "$*" 1145s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1145s else 1145s msgtest 'Test for correctly marked as manually installed' 'no package' 1145s echo -n > "$COMPAREFILE" 1145s fi 1145s testoutputequal "$COMPAREFILE" aptmark showmanual 1145s msggroup 1145s } 1145s 1145s catfile() { 1145s if [ "${1##*.}" = 'deb' ]; then 1145s stat >&2 "$1" || true 1145s file >&2 "$1" || true 1145s else 1145s cat >&2 "$1" || true 1145s fi 1145s } 1145s msgfailoutput() { 1145s msgreportheader 'msgfailoutput' 1145s local MSG="$1" 1145s local OUTPUT="$2" 1145s shift 2 1145s local CMD="$1" 1145s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 1145s echo >&2 1145s while [ -n "$2" ]; do shift; done 1145s echo "#### Complete file: $1 ####" 1145s catfile "$1" 1145s echo "#### $CMD output ####" 1145s elif [ "$1" = 'test' ]; then 1145s echo >&2 1145s # doesn't support ! or non-file flags 1145s msgfailoutputstatfile() { 1145s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 1145s if expr match "$1" "$FILEFLAGS" >/dev/null; then 1145s echo "#### stat(2) of file: $2 ####" 1145s stat "$2" || true 1145s if test -d "$2"; then 1145s echo "#### The directory contains: $2 ####" 1145s ls >&2 "$2" || true 1145s elif test -e "$2"; then 1145s echo "#### Complete file: $2 ####" 1145s catfile "$2" 1145s fi 1145s fi 1145s } 1145s msgfailoutputstatfile "$2" "$3" 1145s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 1145s shift 3 1145s msgfailoutputstatfile "$2" "$3" 1145s done 1145s echo '#### test output ####' 1145s elif [ "$1" = 'cmp' ]; then 1145s echo >&2 1145s while [ -n "$2" ]; do 1145s echo "#### Complete file: $2 ####" 1145s catfile "$2" 1145s shift 1145s done 1145s echo '#### cmp output ####' 1145s elif [ "$1" = 'rm' ]; then 1145s echo "#### Directory listing of: $(pwd) ####" 1145s ls -l 1145s fi 1145s catfile "$OUTPUT" 1145s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 1145s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 1145s local COREEXE='' 1145s for CORENAME in 'core' 'core.pid'; do 1145s if [ -s "$CORENAME" ]; then 1145s cp -a ${CORENAME} "$COREDUMP" 1145s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 1145s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 1145s else 1145s continue 1145s fi 1145s break 1145s done 1145s if [ -s "$COREDUMP" ]; then 1145s true # found already as a file 1145s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 1145s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 1145s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 1145s else 1145s echo '### core dump not found ###' 1145s cat /proc/sys/kernel/core_pattern 1145s fi 1145s if [ -s "$COREDUMP" ]; then 1145s if [ -z "$COREEXE" ]; then 1145s case "$CMD" in 1145s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1145s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 1145s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 1145s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 1145s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 1145s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1145s esac 1145s fi 1145s 1145s if [ -d "${ARTIFACTSDIR}" ]; then 1145s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 1145s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 1145s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 1145s fi 1145s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 1145s echo "#### gdb backtrace ####" 1145s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 1145s fi 1145s fi 1145s rm -f "$COREDUMP" 1145s fi 1145s msgfail "$MSG" 1145s } 1145s 1145s testsuccesswithglobalerror() { 1145s local TYPE="$1" 1145s local ERRORS="$2" 1145s shift 2 1145s msggroup "$TYPE" 1145s if [ "$1" = '--nomsg' ]; then 1145s shift 1145s else 1145s msgtest 'Test for successful execution of' "$*" 1145s fi 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 1145s if "$@" >"${OUTPUT}" 2>&1; then 1145s if expr match "$1" '^apt.*' >/dev/null; then 1145s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1145s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1145s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 1145s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 1145s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 1145s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1145s msgpass 1145s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 1145s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1145s msgpass 1145s else 1145s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1145s fi 1145s else 1145s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1145s fi 1145s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 1145s if grep -q -E "^N: " "$OUTPUT"; then 1145s msgpass 1145s else 1145s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 1145s fi 1145s else 1145s msgpass 1145s fi 1145s else 1145s msgpass 1145s fi 1145s else 1145s local EXITCODE=$? 1145s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1145s fi 1145s aptautotest "$TYPE" "$@" 1145s msggroup 1145s } 1145s testsuccesswithnotice() { 1145s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 1145s } 1145s testsuccess() { 1145s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 1145s } 1145s testwarning() { 1145s msggroup 'testwarning' 1145s if [ "$1" = '--nomsg' ]; then 1145s shift 1145s else 1145s msgtest 'Test for successful execution with warnings of' "$*" 1145s fi 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 1145s if "$@" >"${OUTPUT}" 2>&1; then 1145s if expr match "$1" '^apt.*' >/dev/null; then 1145s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1145s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1145s elif grep -q -E '^E: ' "$OUTPUT"; then 1145s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 1145s elif ! grep -q -E '^W: ' "$OUTPUT"; then 1145s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 1145s else 1145s msgpass 1145s fi 1145s else 1145s msgpass 1145s fi 1145s else 1145s local EXITCODE=$? 1145s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1145s fi 1145s aptautotest 'testwarning' "$@" 1145s msggroup 1145s } 1145s testfailure() { 1145s msggroup 'testfailure' 1145s if [ "$1" = '--nomsg' ]; then 1145s shift 1145s else 1145s msgtest 'Test for failure in execution of' "$*" 1145s fi 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 1145s if "$@" >"${OUTPUT}" 2>&1; then 1145s local EXITCODE=$? 1145s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1145s else 1145s local EXITCODE=$? 1145s if expr match "$1" '^apt.*' >/dev/null; then 1145s if [ "$1" = 'aptkey' ]; then 1145s if grep -q " Can't check signature: 1145s BAD signature from 1145s signature could not be verified" "$OUTPUT"; then 1145s msgpass 1145s else 1145s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 1145s fi 1145s else 1145s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1145s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1145s elif grep -q -E '==ERROR' "$OUTPUT"; then 1145s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 1145s elif ! grep -q -E '^E: ' "$OUTPUT"; then 1145s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 1145s else 1145s msgpass 1145s fi 1145s fi 1145s else 1145s msgpass 1145s fi 1145s fi 1145s aptautotest 'testfailure' "$@" 1145s msggroup 1145s } 1145s 1145s testreturnstateequal() { 1145s local STATE="$1" 1145s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 1145s local STATE="$2" 1145s local TYPE="$3" 1145s shift 3 1145s msggroup "${STATE}equal" 1145s if [ "$1" != '--nomsg' ]; then 1145s local CMP="$1" 1145s shift 1145s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1145s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1145s else 1145s local CMP="$2" 1145s shift 2 1145s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1145s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1145s fi 1145s else 1145s msggroup "${STATE}equal" 1145s if [ "$2" != '--nomsg' ]; then 1145s local CMP="$2" 1145s shift 2 1145s "$STATE" "$@" 1145s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1145s else 1145s local CMP="$3" 1145s shift 3 1145s "$STATE" --nomsg "$@" 1145s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1145s fi 1145s fi 1145s msggroup 1145s } 1145s testsuccessequal() { 1145s # we compare output, so we know perfectly well about N: 1145s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 1145s } 1145s testwarningequal() { 1145s testreturnstateequal 'testwarning' "$@" 1145s } 1145s testfailureequal() { 1145s testreturnstateequal 'testfailure' "$@" 1145s } 1145s 1145s testfailuremsg() { 1145s msggroup 'testfailuremsg' 1145s local CMP="$1" 1145s shift 1145s testfailure "$@" 1145s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 1145s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 1145s testoutputequal "$COMPAREFILE" echo "$CMP" 1145s msggroup 1145s } 1145s testwarningmsg() { 1145s msggroup 'testwarningmsg' 1145s local CMP="$1" 1145s shift 1145s testwarning "$@" 1145s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 1145s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 1145s testoutputequal "$COMPAREFILE" echo "$CMP" 1145s msggroup 1145s } 1145s 1145s testfilestats() { 1145s msggroup 'testfilestats' 1145s msgtest "Test that file $1 has $2 $3" "$4" 1145s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 1145s msgpass 1145s else 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 1145s { 1145s echo 1145s ls -ld "$1" || true 1145s echo -n "stat(1) reports for $2: " 1145s stat --format "$2" "$1" || true 1145s } >"$OUTPUT" 2>&1 1145s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 1145s fi 1145s msggroup 1145s } 1145s testaccessrights() { 1145s msggroup 'testaccessrights' 1145s testfilestats "$1" '%a' '=' "$2" 1145s msggroup 1145s } 1145s 1145s testwebserverlaststatuscode() { 1145s msggroup 'testwebserverlaststatuscode' 1145s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 1145s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 1145s rm -f "$DOWNLOG" "$STATUS" 1145s msgtest 'Test last status code from the webserver was' "$1" 1145s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 1145s msgpass 1145s else 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 1145s { 1145s if [ -n "$2" ]; then 1145s shift 1145s echo >&2 '#### Additionally provided output files contain:' 1145s cat >&2 "$@" 1145s fi 1145s echo >&2 '#### Download log of the status code:' 1145s cat >&2 "$DOWNLOG" 1145s } >"$OUTPUT" 2>&1 1145s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 1145s fi 1145s msggroup 1145s } 1145s 1145s mapkeynametokeyid() { 1145s while [ -n "$1" ]; do 1145s case "$1" in 1145s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 1145s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 1145s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 1145s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 1145s oldarchive) echo 'FDD2DB85F68C85A3';; 1145s *) echo 'UNKNOWN KEY';; 1145s esac 1145s shift 1145s done 1145s } 1145s testaptkeys() { 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 1145s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 1145s echo -n > "$OUTPUT" 1145s fi 1145s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 1145s } 1145s 1145s pause() { 1145s echo "STOPPED execution. Press enter to continue" 1145s local IGNORE 1145s read IGNORE 1145s } 1145s 1145s logcurrentarchivedirectory() { 1145s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 1145s stat --format '%U:%G:%a:%n' "$line" 1145s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 1145s } 1145s listcurrentlistsdirectory() { 1145s { 1145s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 1145s stat --format '%U:%G:%a:%n' "$line" 1145s done 1145s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 1145s stat --format '%U:%G:%a:%s:%y:%n' "$line" 1145s done 1145s } | sort 1145s } 1145s forallsupportedcompressors() { 1145s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1145s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1145s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 1145s "$@" "$COMP" 1145s done 1145s } 1145s 1145s breakfiles() { 1145s while [ -n "$1" ]; do 1145s mv -f "${1}" "${1}.bak" 1145s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 1145s shift 1145s done 1145s } 1145s unbreakfiles() { 1145s while [ -n "$1" ]; do 1145s mv -f "${1}.bak" "${1}" 1145s shift 1145s done 1145s } 1145s 1145s ### convenience hacks ### 1145s mkdir() { 1145s # creating some directories by hand is a tedious task, so make it look simple 1145s local PARAMS="$*" 1145s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 1145s # only the last directory created by mkdir is effected by the -m ! 1145s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 1145s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 1145s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1145s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1145s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 1145s if [ "$(id -u)" = '0' ]; then 1145s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1145s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1145s fi 1145s else 1145s command mkdir "$@" 1145s fi 1145s } 1145s 1145s ### The following tests are run by most test methods automatically to check 1145s ### general things about commands executed without writing the test every time. 1145s 1145s aptautotest() { 1145s if [ $# -lt 3 ]; then return; fi 1145s local TESTCALL="$1" 1145s local CMD="$2" 1145s local FIRSTOPT="$3" 1145s shift 2 1145s for i in "$@"; do 1145s if ! expr match "$i" '^-' >/dev/null 2>&1; then 1145s FIRSTOPT="$i" 1145s break 1145s fi 1145s done 1145s shift 1145s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 1145s if command -v $AUTOTEST >/dev/null; then 1145s # save and restore the *.output files from other tests 1145s # as we might otherwise override them in these automatic tests 1145s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1145s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1145s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1145s $AUTOTEST "$TESTCALL" "$@" 1145s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1145s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1145s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1145s fi 1145s } 1145s 1145s cdfind() { 1145s ( cd /; find "$@" ) 1145s } 1145s aptautotest_aptget_update() { 1145s local TESTCALL="$1" 1145s while [ -n "$2" ]; do 1145s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 1145s shift 1145s done 1145s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 1145s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1145s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1145s # all copied files are properly chmodded 1145s local backupIFS="$IFS" 1145s IFS="$(printf "\n\b")" 1145s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 1145s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 1145s done 1145s IFS="$backupIFS" 1145s if [ "$TESTCALL" = 'testsuccess' ]; then 1145s # failure cases can retain partial files and such 1145s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 1145s fi 1145s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 1145s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 1145s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 1145s fi 1145s } 1145s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 1145s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 1145s 1145s testaptautotestnodpkgwarning() { 1145s local TESTCALL="$1" 1145s while [ -n "$2" ]; do 1145s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 1145s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 1145s shift 1145s done 1145s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 1145s } 1145s 1145s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 1145s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 1145s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 1145s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 1145s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 1145s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 1145s 1145s testaptmarknodefaultsections() { 1145s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 1145s } 1145s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 1145s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 1145s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 1145s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 1145s cat: ./downloaded/foo1: No such file or directory 1145s cmp: ./downloaded/foo1: No such file or directory 1145s FAIL: exitcode 2 1145s 1145s cat: ./downloaded/foo1: No such file or directory 1145s #!/bin/sh -- # no runable script, just for vi 1145s 1145s EXIT_CODE=0 1145s 1145s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 1145s if [ "$1" = "-q" ]; then 1145s export MSGLEVEL=2 1145s elif [ "$1" = "-qq" ]; then 1145s export MSGLEVEL=1 1145s elif [ "$1" = "-v" ]; then 1145s export MSGLEVEL=4 1145s elif [ "$1" = '--color=no' ]; then 1145s export MSGCOLOR='NO' 1145s elif [ "$1" = '--color=yes' ]; then 1145s export MSGCOLOR='YES' 1145s elif [ "$1" = '--color' ]; then 1145s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 1145s shift 1145s elif [ "$1" = '--level' ]; then 1145s export MSGLEVEL=$2 1145s shift 1145s else 1145s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 1145s fi 1145s shift 1145s done 1145s export MSGLEVEL="${MSGLEVEL:-3}" 1145s 1145s # we all like colorful messages 1145s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 1145s if [ ! -t 1 ]; then # but check that we output to a terminal 1145s export MSGCOLOR='NO' 1145s fi 1145s fi 1145s 1145s if [ "$MSGCOLOR" != 'NO' ]; then 1145s CERROR="\033[1;31m" # red 1145s CWARNING="\033[1;33m" # yellow 1145s CMSG="\033[1;32m" # green 1145s CINFO="\033[1;96m" # light blue 1145s CDEBUG="\033[1;94m" # blue 1145s CNORMAL="\033[0;39m" # default system console color 1145s CDONE="\033[1;32m" # green 1145s CPASS="\033[1;32m" # green 1145s CFAIL="\033[1;31m" # red 1145s CCMD="\033[1;35m" # pink 1145s fi 1145s 1145s msgprintf() { 1145s local START="$1" 1145s local MIDDLE="$2" 1145s local END="$3" 1145s shift 3 1145s if [ -n "$1" ]; then 1145s printf "$START " "$1" 1145s shift 1145s while [ -n "$1" ]; do 1145s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 1145s shift 1145s done 1145s fi 1145s printf "${END}" 1145s } 1145s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 1145s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 1145s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 1145s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 1145s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 1145s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 1145s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 1145s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 1145s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 1145s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 1145s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 1145s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 1145s msgreportheader() { 1145s if [ -n "$MSGTEST_MSG" ]; then 1145s test "$1" != 'msgfailoutput' || echo 1145s if [ -n "$MSGTEST_MSGMSG" ]; then 1145s echo "$MSGTEST_MSGMSG" 1145s fi 1145s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 1145s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 1145s fi 1145s echo -n "$MSGTEST_MSG" 1145s unset MSGTEST_MSG 1145s fi 1145s } 1145s msgskip() { 1145s msgreportheader 'msgskip' 1145s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 1145s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 1145s } 1145s msgfail() { 1145s msgreportheader 'msgfail' 1145s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 1145s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 1145s if [ -n "$APT_DEBUG_TESTS" ]; then 1145s runapt $SHELL 1145s fi 1145s EXIT_CODE=$((EXIT_CODE+1)); 1145s } 1145s MSGGROUP_LEVEL=0 1145s msggroup() { 1145s if [ -n "$1" ]; then 1145s if [ $MSGGROUP_LEVEL = 0 ]; then 1145s MSGTEST_GRP='NEXT' 1145s fi 1145s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 1145s else 1145s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 1145s if [ $MSGGROUP_LEVEL = 0 ]; then 1145s unset MSGTEST_GRP 1145s fi 1145s fi 1145s } 1145s 1145s # enable / disable Debugging 1145s if [ $MSGLEVEL -le 0 ]; then 1145s msgdie() { true; } 1145s fi 1145s if [ $MSGLEVEL -le 1 ]; then 1145s msgwarn() { true; } 1145s msgnwarn() { true; } 1145s fi 1145s if [ $MSGLEVEL -le 2 ]; then 1145s msgmsg() { 1145s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 1145s } 1145s msgnmsg() { true; } 1145s msgtest() { 1145s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 1145s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 1145s MSGTEST_GRP="$MSGTEST_MSG" 1145s fi 1145s } 1145s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 1145s fi 1145s if [ $MSGLEVEL -le 3 ]; then 1145s msginfo() { true; } 1145s msgninfo() { true; } 1145s fi 1145s if [ $MSGLEVEL -le 4 ]; then 1145s msgdebug() { true; } 1145s msgndebug() { true; } 1145s fi 1145s if [ $MSGLEVEL -le 1 ]; then 1145s msgpass() { true; } 1145s fi 1145s msgdone() { 1145s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 1145s [ "$1" = "info" -a $MSGLEVEL -le 3 ] || 1145s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 1145s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 1145s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 1145s true; 1145s else 1145s printf "${CDONE}DONE${CNORMAL}\n"; 1145s fi 1145s } 1145s getaptconfig() { 1145s if [ -f ./aptconfig.conf ]; then 1145s echo "$(readlink -f ./aptconfig.conf)" 1145s elif [ -f ../aptconfig.conf ]; then 1145s echo "$(readlink -f ../aptconfig.conf)" 1145s elif [ -f ../../aptconfig.conf ]; then 1145s echo "$(readlink -f ../../aptconfig.conf)" 1145s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 1145s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 1145s fi 1145s } 1145s runapt() { 1145s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 1145s local CMD="$1" 1145s shift 1145s case "$CMD" in 1145s sh|aptitude|*/*|command) ;; 1145s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 1145s esac 1145s if [ "$CMD" = 'aptitude' ]; then 1145s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 1145s else 1145s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 1145s fi 1145s } 1145s runpython3() { runapt command python3 "$@"; } 1145s aptconfig() { runapt apt-config "$@"; } 1145s aptcache() { runapt apt-cache "$@"; } 1145s aptcdrom() { runapt apt-cdrom "$@"; } 1145s aptget() { runapt apt-get "$@"; } 1145s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 1145s aptkey() { runapt apt-key "$@"; } 1145s aptmark() { runapt apt-mark "$@"; } 1145s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 1145s apt() { runapt apt "$@"; } 1145s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 1145s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 1145s aptitude() { runapt aptitude "$@"; } 1145s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 1145s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 1145s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 1145s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 1145s 1145s dpkg() { 1145s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 1145s } 1145s dpkgquery() { 1145s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1145s } 1145s dpkg_version() { 1145s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 1145s } 1145s dpkgcheckbuilddeps() { 1145s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1145s } 1145s gdb() { 1145s local CMD 1145s case "$1" in 1145s aptget) CMD="apt-get";; 1145s aptcache) CMD="apt-cache";; 1145s aptcdrom) CMD="apt-cdrom";; 1145s aptconfig) CMD="apt-config";; 1145s aptmark) CMD="apt-mark";; 1145s apthelper) CMD="apt-helper";; 1145s aptftparchive) CMD="apt-ftparchive";; 1145s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1145s *) CMD="$1";; 1145s esac 1145s shift 1145s if [ "${CMD##*/}" = "$CMD" ]; then 1145s CMD="${APTCMDLINEBINDIR}/${CMD}" 1145s fi 1145s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 1145s } 1145s 1145s valgrind() { 1145s local CMD 1145s case "$1" in 1145s aptget) CMD="apt-get";; 1145s aptcache) CMD="apt-cache";; 1145s aptcdrom) CMD="apt-cdrom";; 1145s aptconfig) CMD="apt-config";; 1145s aptmark) CMD="apt-mark";; 1145s apthelper) CMD="apt-helper";; 1145s aptftparchive) CMD="apt-ftparchive";; 1145s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1145s *) CMD="$1";; 1145s esac 1145s shift 1145s if [ "$CMD" = "apt-ftparchive" ]; then 1145s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 1145s fi 1145s if [ "${CMD##*/}" = "$CMD" ]; then 1145s CMD="${APTCMDLINEBINDIR}/${CMD}" 1145s fi 1145s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 1145s } 1145s 1145s lastmodification() { 1145s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 1145s } 1145s releasefiledate() { 1145s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 1145s } 1145s 1145s exitwithstatus() { 1145s # error if we about to overflow, but ... 1145s # "255 failures ought to be enough for everybody" 1145s if [ $EXIT_CODE -gt 255 ]; then 1145s msgdie "Total failure count $EXIT_CODE too big" 1145s fi 1145s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 1145s } 1145s 1145s shellsetedetector() { 1145s local exit_status=$? 1145s if [ "$exit_status" != '0' ]; then 1145s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 1145s if [ "$EXIT_CODE" = '0' ]; then 1145s EXIT_CODE="$exit_status" 1145s fi 1145s fi 1145s } 1145s 1145s addtrap() { 1145s if [ "$1" = 'prefix' ]; then 1145s CURRENTTRAP="$2 $CURRENTTRAP" 1145s else 1145s CURRENTTRAP="$CURRENTTRAP $1" 1145s fi 1145s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1145s } 1145s 1145s escape_shell() { 1145s echo "$@" | sed -e "s#'#'\"'\"'#g" 1145s } 1145s 1145s find_project_binary_dir() { 1145s if [ -z "$PROJECT_BINARY_DIR" ]; then 1145s PROJECT_BINARY_DIR= 1145s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 1145s test -e "$dir/CMakeCache.txt" || continue 1145s if [ -z "$PROJECT_BINARY_DIR" ] || 1145s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 1145s PROJECT_BINARY_DIR="$dir" 1145s fi 1145s done 1145s if [ -z "$PROJECT_BINARY_DIR" ]; then 1145s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 1145s exit 1 1145s fi 1145s export PROJECT_BINARY_DIR 1145s fi 1145s } 1145s _removetmpworkingdirectory() { 1145s cd / 1145s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 1145s rm -rf "$TMPWORKINGDIRECTORY" 1145s fi 1145s TMPWORKINGDIRECTORY='' 1145s } 1145s setupenvironment() { 1145s # cleanup the environment a bit 1145s export LC_ALL=C 1145s unset LANGUAGE COLUMNS NLSPATH 1145s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 1145s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 1145s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 1145s unset GREP_OPTIONS POSIXLY_CORRECT 1145s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 1145s export GCOV_ERROR_FILE=/dev/null 1145s 1145s # Next check needs a gnu stat, let's figure that out early. 1145s stat=stat 1145s if command -v gnustat >/dev/null 2>&1; then 1145s stat=gnustat 1145s fi 1145s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 1145s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 1145s unset TMPDIR 1145s fi 1145s if [ -z "$TMPWORKINGDIRECTORY" ]; then 1145s addtrap '_removetmpworkingdirectory;' 1145s TMPWORKINGDIRECTORY="$(mktemp -d)" 1145s fi 1145s if [ -n "$TMPDIR_ADD" ]; then 1145s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 1145s mkdir -p "$TMPWORKINGDIRECTORY" 1145s unset TMPDIR_ADD 1145s export TMPDIR="$TMPWORKINGDIRECTORY" 1145s fi 1145s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 1145s 1145s # Setup coreutils on BSD systems 1145s mkdir "${TMPWORKINGDIRECTORY}/bin" 1145s for prefix in gnu g; do 1145s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 1145s if command -v $prefix$command 2>/dev/null >/dev/null; then 1145s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 1145s fi 1145s done 1145s done 1145s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 1145s 1145s if [ -z "$TESTDIRECTORY" ]; then 1145s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 1145s fi 1145s cd "$TMPWORKINGDIRECTORY" 1145s 1145s mkdir -m 700 'downloaded' 1145s if [ "$(id -u)" = '0' ]; then 1145s # relax permissions so that running as root with user switching works 1145s umask 022 1145s chmod 711 "$TMPWORKINGDIRECTORY" 1145s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 1145s fi 1145s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 1145s 1145s _setupprojectenvironment 1145s 1145s # create some files in /tmp and look at user/group to get what this means 1145s TEST_DEFAULT_USER="$(id -un)" 1145s touch "${TMPWORKINGDIRECTORY}/test-file" 1145s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 1145s 1145s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 1145s . "${TESTDIRECTORY}/extra-environment" 1145s fi 1145s 1145s msgdone "info" 1145s } 1145s _setupprojectenvironment() { 1145s # allow overriding the default BUILDDIR locations 1145s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 1145s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 1145s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 1145s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 1145s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1145s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 1145s APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 1145s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1145s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 1145s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 1145s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 1145s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 1145s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 1145s 1145s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 1145s mkdir aptarchive keys 1145s cd rootdir 1145s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 1145s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 1145s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 1145s touch var/lib/dpkg/available var/lib/dpkg/lock 1145s echo '1' > var/lib/dpkg/info/format 1145s ln -s "${METHODSDIR}" usr/lib/apt/methods 1145s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 1145s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 1145s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 1145s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 1145s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 1145s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 1145s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 1145s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 1145s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 1145s else 1145s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 1145s fi 1145s cd .. 1145s local BASENAME="${0##*/}" 1145s local PACKAGESFILE="Packages-${BASENAME#*-}" 1145s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 1145s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 1145s fi 1145s local SOURCESSFILE="Sources-${BASENAME#*-}" 1145s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 1145s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 1145s fi 1145s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 1145s chmod 644 keys/* 1145s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 1145s 1145s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 1145s echo "Dir::Etc \"etc\";" >> aptconfig.conf 1145s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 1145s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 1145s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 1145s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 1145s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 1145s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 1145s # either store apt-key were we can access it, even if we run it as a different user 1145s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 1145s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 1145s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 1145s # destroys coverage reporting though, so we disable changing user for the calling gpgv 1145s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 1145s if [ "$(id -u)" = '0' ]; then 1145s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 1145s # same for the solver executables 1145s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 1145s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 1145s fi 1145s 1145s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 1145s EXEC='' 1145s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 1145s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 1145s restoredpkgstatus() { 1145s if [ -n "\$BACKUP" ]; then 1145s if [ -e "\$BACKUP" ]; then 1145s mv -f "\$BACKUP" "\$ORIGINAL" 1145s else 1145s rm -f "\$ORIGINAL" 1145s fi 1145s BACKUP='' 1145s fi 1145s } 1145s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1145s if [ -e "\$ORIGINAL" ]; then 1145s cp -a "\$ORIGINAL" "\$BACKUP" 1145s fi 1145s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 1145s 1145s Package: dpkg 1145s Architecture: all 1145s Version: ${DPKG_VERSION}+fake 1145s Status: install ok installed 1145s Maintainer: Joe Sixpack 1145s Installed-Size: 42 1145s Description: tells dpkg it supports what we need 1145s Some versions of dpkg check its own version from the status file 1145s to know if it supports multi-arch and stuff in --assert-*. 1145s 1145s EOS 1145s fi 1145s EOF 1145s fi 1145s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 1145s 1145s { 1145s echo 'quiet "0";' 1145s echo 'quiet::NoUpdate "true";' 1145s echo 'quiet::NoStatistic "true";' 1145s # too distracting for users, but helpful to detect changes 1145s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 1145s echo 'Acquire::Progress::Diffpercent "true";' 1145s # in testcases, it can appear as if localhost has a rotation setup, 1145s # hide this as we can't really deal with it properly 1145s echo 'Acquire::Failure::ShowIP "false";' 1145s # randomess and tests don't play well together 1145s echo 'Acquire::IndexTargets::Randomized "false";' 1145s # fakeroot can't fake everything, so disabled in production but good for tests 1145s echo 'APT::Sandbox::Verify "true";' 1145s } >> aptconfig.conf 1145s 1145s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1145s if [ "$(id -u)" = '0' ]; then 1145s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1145s fi 1145s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 1145s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 1145s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 1145s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 1145s # Allow release files to be 10 hours in the future, rather than 10 seconds 1145s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 1145s 1145s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 1145s 1145s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 1145s confighashes 'SHA256' # these are tests, not security best-practices 1145s 1145s # Make dpkg inherit testing path 1145s echo 'DPkg::Path "";' >> aptconfig.conf 1145s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 1145s 1145s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 1145s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 1145s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 1145s fi 1145s 1145s # most tests just need one signed Release file, not both 1145s export APT_DONT_SIGN='Release.gpg' 1145s 1145s # prefer our apt binaries over the system apt binaries 1145s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 1145s } 1145s 1145s getarchitecture() { 1145s if [ "$1" = "native" -o -z "$1" ]; then 1145s eval `aptconfig shell ARCH APT::Architecture` 1145s if [ -n "$ARCH" ]; then 1145s echo $ARCH 1145s else 1145s dpkg --print-architecture 1145s fi 1145s else 1145s echo $1 1145s fi 1145s } 1145s 1145s getarchitectures() { 1145s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 1145s } 1145s 1145s getarchitecturesfromcommalist() { 1145s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 1145s } 1145s 1145s configarchitecture() { 1145s { 1145s echo "APT::Architecture \"$(getarchitecture $1)\";" 1145s while [ -n "$1" ]; do 1145s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 1145s shift 1145s done 1145s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 1145s configdpkg 1145s } 1145s 1145s configdpkg() { 1145s if [ ! -e rootdir/var/lib/dpkg/status ]; then 1145s local BASENAME="${0##*/}" 1145s local STATUSFILE="status-${BASENAME#*-}" 1145s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 1145s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 1145s # Add an empty line to the end if there is none 1145s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 1145s echo >> rootdir/var/lib/dpkg/status 1145s fi 1145s fi 1145s fi 1145s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 1145s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 1145s local ARCHS="$(getarchitectures)" 1145s local DPKGARCH="$(dpkg --print-architecture)" 1145s # this ensures that even if multi-arch isn't active in the view 1145s # of apt, given that dpkg can't be told which arch is native 1145s # the arch apt treats as native might be foreign for dpkg 1145s for ARCH in ${ARCHS}; do 1145s if [ "${ARCH}" != "${DPKGARCH}" ]; then 1145s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 1145s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 1145s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 1145s else 1145s # old-style used e.g. in Ubuntu-P – and as it seems travis 1145s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1145s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1145s fi 1145s fi 1145s fi 1145s done 1145s else 1145s # test multiarch before dpkg is ready for it… 1145s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 1145s fi 1145s } 1145s 1145s configdpkgnoopchroot() { 1145s # create a library to noop chroot() and rewrite maintainer script executions 1145s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 1145s # chroot directory dpkg could chroot into to execute the maintainer scripts 1145s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 1145s cat > noopchroot.c << EOF 1145s #define _GNU_SOURCE 1145s #include 1145s #include 1145s #include 1145s #include 1145s 1145s static char * chrootdir = NULL; 1145s 1145s int chroot(const char *path) { 1145s printf("WARNING: CHROOTing to %s was ignored!\n", path); 1145s free(chrootdir); 1145s chrootdir = strdup(path); 1145s return 0; 1145s } 1145s int execvp(const char *file, char *const argv[]) { 1145s static int (*func_execvp) (const char *, char * const []) = NULL; 1145s if (func_execvp == NULL) 1145s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 1145s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 1145s return func_execvp(file, argv); 1145s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 1145s char *newfile; 1145s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 1145s perror("asprintf"); 1145s return -1; 1145s } 1145s char const * const baseadmindir = "/var/lib/dpkg"; 1145s char *admindir; 1145s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 1145s perror("asprintf"); 1145s return -1; 1145s } 1145s setenv("DPKG_ADMINDIR", admindir, 1); 1145s return func_execvp(newfile, argv); 1145s } 1145s EOF 1145s if cc -ldl 2>&1 | grep -q dl; then 1145s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 1145s else 1145s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 1145s fi 1145s } 1145s configcompression() { 1145s if [ "$1" = 'ALL' ]; then 1145s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 1145s return 1145s fi 1145s local CMD='apthelper cat-file -C' 1145s while [ -n "$1" ]; do 1145s case "$1" in 1145s '.') printf ".\t.\tcat\n";; 1145s 'gz') printf "gzip\tgz\t$CMD $1\n";; 1145s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 1145s 'zst') printf "zstd\tzst\t$CMD $1\n";; 1145s *) printf "$1\t$1\t$CMD $1\n";; 1145s esac 1145s shift 1145s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1145s } 1145s confighashes() { 1145s { 1145s echo 'APT::FTPArchive {' 1145s { 1145s while [ -n "$1" ]; do 1145s printf "$1" | tr 'a-z' 'A-Z' 1145s printf "\t\"true\";\n" 1145s shift 1145s done 1145s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 1145s printf "$h\t\"false\";\n" 1145s done 1145s } | awk '!x[$1]++' 1145s echo '};' 1145s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 1145s } 1145s forcecompressor() { 1145s COMPRESSOR="$1" 1145s COMPRESS="$1" 1145s COMPRESSOR_CMD="apthelper cat-file -C $1" 1145s case $COMPRESSOR in 1145s gzip) COMPRESS='gz';; 1145s bzip2) COMPRESS='bz2';; 1145s zstd) COMPRESS='zst';; 1145s esac 1145s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1145s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 1145s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 1145s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1145s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 1145s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 1145s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 1145s done 1145s } 1145s 1145s _setupsimplenativepackage() { 1145s local NAME="$1" 1145s local ARCH="$2" 1145s local VERSION="$3" 1145s local RELEASE="${4:-unstable}" 1145s local DEPENDENCIES="$5" 1145s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 1145s If you find such a package installed on your system, 1145s something went horribly wrong! They are autogenerated 1145s and used only by testcases and serve no other purpose…}" 1145s 1145s local SECTION="${7:-others}" 1145s local PRIORITY="${8:-optional}" 1145s local FILE_TREE="$9" 1145s local COMPRESS_TYPE="${10:-gzip}" 1145s local DISTSECTION 1145s if [ "$SECTION" = "${SECTION#*/}" ]; then 1145s DISTSECTION="main" 1145s else 1145s DISTSECTION="${SECTION%/*}" 1145s fi 1145s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1145s 1145s mkdir -p "$BUILDDIR/debian/source" 1145s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 1145s echo "#!/bin/sh 1145s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 1145s 1145s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 1145s echo "$NAME ($VERSION) $RELEASE; urgency=low 1145s 1145s * Initial release 1145s 1145s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 1145s { 1145s echo "Source: $NAME 1145s Priority: $PRIORITY 1145s Maintainer: Joe Sixpack 1145s Standards-Version: 4.3.1 1145s Rules-Requires-Root: no" 1145s if [ "$SECTION" != '' ]; then 1145s echo "Section: $SECTION" 1145s fi 1145s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 1145s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 1145s echo " 1145s Package: $NAME" 1145s 1145s if [ "$ARCH" = 'all' ]; then 1145s echo "Architecture: all" 1145s else 1145s echo "Architecture: any" 1145s fi 1145s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 1145s test -z "$DEPS" || echo "$DEPS" 1145s printf "%b\n" "Description: $DESCRIPTION" 1145s } > "${BUILDDIR}/debian/control" 1145s 1145s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 1145s } 1145s 1145s make_tiny_rules() { 1145s local OUT="$1" 1145s if command -v gmake >/dev/null 2>&1; then 1145s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 1145s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 1145s else 1145s echo '#!/usr/bin/make -f' > "$OUT" 1145s fi 1145s echo '%:' >> "$OUT" 1145s echo ' dh $@' >> "$OUT" 1145s } 1145s 1145s setupsimplenativepackage() { 1145s _setupsimplenativepackage "$@" 1145s local NAME="$1" 1145s local VERSION="$3" 1145s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1145s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 1145s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 1145s } 1145s 1145s buildsimplenativepackage() { 1145s local NAME="$1" 1145s local ARCH="$2" 1145s local VERSION="$3" 1145s local RELEASE="${4:-unstable}" 1145s local DEPENDENCIES="$5" 1145s local DESCRIPTION="$6" 1145s local SECTION="${7:-others}" 1145s local PRIORITY="${8:-optional}" 1145s local FILE_TREE="$9" 1145s local COMPRESS_TYPE="${10:-gzip}" 1145s local DISTSECTION 1145s if [ "$SECTION" = "${SECTION#*/}" ]; then 1145s DISTSECTION="main" 1145s else 1145s DISTSECTION="${SECTION%/*}" 1145s fi 1145s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1145s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 1145s _setupsimplenativepackage "$@" 1145s cd "${BUILDDIR}/.." 1145s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 1145s cd - >/dev/null 1145s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 1145s | while read SRC; do 1145s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 1145s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 1145s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 1145s # adv --yes --default-key 'Joe Sixpack' \ 1145s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1145s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1145s # fi 1145s done 1145s 1145s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1145s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 1145s rm -rf "${BUILDDIR}/debian/tmp" 1145s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 1145s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 1145s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 1145s if [ -n "$FILE_TREE" ]; then 1145s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 1145s fi 1145s 1145s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 1145s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 1145s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 1145s # ensure the right permissions as dpkg-deb insists 1145s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 1145s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 1145s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 1145s done 1145s 1145s local NM 1145s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 1145s NM="$(echo "$NAME" | cut -c 1-4)" 1145s else 1145s NM="$(echo "$NAME" | cut -c 1)" 1145s fi 1145s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 1145s mkdir -p "$CHANGEPATH" 1145s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 1145s rm -rf "${BUILDDIR}" 1145s msgdone "info" 1145s } 1145s 1145s buildpackage() { 1145s local BUILDDIR=$1 1145s local RELEASE=$2 1145s local SECTION=$3 1145s local ARCH=$(getarchitecture $4) 1145s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 1145s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 1145s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 1145s cd "$BUILDDIR" 1145s if [ "$ARCH" = "all" ]; then 1145s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 1145s fi 1145s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 1145s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 1145s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 1145s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 1145s cd - > /dev/null 1145s for PKG in $PKGS; do 1145s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 1145s done 1145s for SRC in $SRCS; do 1145s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 1145s done 1145s } 1145s 1145s buildaptarchive() { 1145s if [ -d incoming ]; then 1145s buildaptarchivefromincoming "$@" 1145s else 1145s buildaptarchivefromfiles "$@" 1145s fi 1145s } 1145s 1145s createaptftparchiveconfig() { 1145s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 1145s local COMPRESSORS="${COMPRESSORS%* }" 1145s local ARCHS="$(getarchitectures)" 1145s cat > ftparchive.conf <> ftparchive.conf 1145s } 1145s 1145s buildaptftparchivedirectorystructure() { 1145s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 1145s for DIST in $DISTS; do 1145s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 1145s for SECTION in $SECTIONS; do 1145s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 1145s for ARCH in $ARCHS; do 1145s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 1145s done 1145s mkdir -p "dists/${DIST}/${SECTION}/source" 1145s mkdir -p "dists/${DIST}/${SECTION}/i18n" 1145s done 1145s done 1145s } 1145s 1145s insertpackage() { 1145s local RELEASES="$1" 1145s local NAME="$2" 1145s local ARCH="$3" 1145s local VERSION="$4" 1145s local DEPENDENCIES="$5" 1145s local PRIORITY="${6:-optional}" 1145s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 1145s If you find such a package installed on your system, 1145s something went horribly wrong! They are autogenerated 1145s and used only by testcases and serve no other purpose…}" 1145s local SECTION="${8:-other}" 1145s 1145s if [ "$SECTION" = "${SECTION#*/}" ]; then 1145s DISTSECTION="main" 1145s else 1145s DISTSECTION="${SECTION%/*}" 1145s fi 1145s local ARCHS="" 1145s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1145s if [ "$RELEASE" = 'installed' ]; then 1145s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 1145s continue 1145s fi 1145s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1145s if [ "$arch" = 'none' ]; then 1145s ARCHS="$(getarchitectures)" 1145s else 1145s ARCHS="$arch" 1145s fi 1145s for BUILDARCH in $ARCHS; do 1145s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 1145s mkdir -p "$PPATH" 1145s { 1145s echo "Package: $NAME 1145s Priority: $PRIORITY 1145s Section: $SECTION 1145s Installed-Size: 42 1145s Size: 42" 1145s if echo "$DEPENDENCIES" | grep -q SHA256:; then 1145s : 1145s else 1145s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 1145s fi 1145s echo "Maintainer: Joe Sixpack " 1145s test "$arch" = 'none' || echo "Architecture: $arch" 1145s echo "Version: $VERSION 1145s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 1145s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 1145s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 1145s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 1145s echo 1145s } >> "${PPATH}/Packages" 1145s done 1145s done 1145s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 1145s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 1145s echo "Package: $NAME 1145s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 1145s Description-en: $DESCRIPTION 1145s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 1145s done 1145s } 1145s 1145s insertsource() { 1145s local RELEASES="$1" 1145s local NAME="$2" 1145s local ARCH="$3" 1145s local VERSION="$4" 1145s local DEPENDENCIES="$5" 1145s local BINARY="${6:-$NAME}" 1145s local ARCHS="" 1145s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1145s local SPATH="aptarchive/dists/${RELEASE}/main/source" 1145s mkdir -p $SPATH 1145s local FILE="${SPATH}/Sources" 1145s local DSCFILE="${NAME}_${VERSION}.dsc" 1145s local TARFILE="${NAME}_${VERSION}.tar.gz" 1145s echo "Package: $NAME 1145s Binary: $BINARY 1145s Version: $VERSION 1145s Maintainer: Joe Sixpack 1145s Architecture: $ARCH" >> $FILE 1145s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1145s echo "Files: 1145s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1145s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1145s Checksums-Sha256: 1145s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1145s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1145s " >> "$FILE" 1145s done 1145s } 1145s 1145s insertinstalledpackage() { 1145s local NAME="$1" 1145s local ARCH="$2" 1145s local VERSION="$3" 1145s local DEPENDENCIES="$4" 1145s local PRIORITY="${5:-optional}" 1145s local STATUS="${6:-install ok installed}" 1145s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 1145s If you find such a package installed on your system, 1145s something went horribly wrong! They are autogenerated 1145s and used only by testcases and serve no other purpose…}" 1145s local SECTION="${8:-other}" 1145s 1145s local FILE='rootdir/var/lib/dpkg/status' 1145s local INFO='rootdir/var/lib/dpkg/info' 1145s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1145s echo "Package: $NAME 1145s Status: $STATUS 1145s Priority: $PRIORITY 1145s Section: $SECTION 1145s Installed-Size: 42 1145s Maintainer: Joe Sixpack 1145s Version: $VERSION" >> "$FILE" 1145s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 1145s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1145s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 1145s echo >> "$FILE" 1145s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 1145s echo -n > "${INFO}/${NAME}:${arch}.list" 1145s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 1145s else 1145s echo -n > "${INFO}/${NAME}.list" 1145s echo -n > "${INFO}/${NAME}.md5sums" 1145s fi 1145s done 1145s } 1145s 1145s 1145s buildaptarchivefromincoming() { 1145s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 1145s cd aptarchive 1145s [ -e pool ] || ln -s ../incoming pool 1145s [ -e ftparchive.conf ] || createaptftparchiveconfig 1145s [ -e dists ] || buildaptftparchivedirectorystructure 1145s msgninfo "\tGenerate Packages, Sources and Contents files… " 1145s testsuccess aptftparchive generate ftparchive.conf 1145s cd - > /dev/null 1145s msgdone "info" 1145s generatereleasefiles "$@" 1145s } 1145s 1145s buildaptarchivefromfiles() { 1145s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 1145s local DIR='aptarchive' 1145s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 1145s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 1145s msgninfo "\t${line} file… " 1145s compressfile "$line" "$1" 1145s msgdone "info" 1145s done 1145s generatereleasefiles "$@" 1145s } 1145s 1145s compressfile() { 1145s while read compressor extension command; do 1145s if [ "$compressor" = '.' ]; then 1145s if [ -n "$2" ]; then 1145s touch -d "$2" "$1" 1145s fi 1145s continue 1145s fi 1145s cat "$1" | $command > "${1}.${extension}" 1145s if [ -n "$2" ]; then 1145s touch -d "$2" "${1}.${extension}" 1145s fi 1145s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1145s } 1145s 1145s # can be overridden by testcases for their pleasure 1145s getcodenamefromsuite() { 1145s case "$1" in 1145s unstable) echo 'sid';; 1145s *) echo -n "$1";; 1145s esac 1145s } 1145s getreleaseversionfromsuite() { true; } 1145s getlabelfromsuite() { true; } 1145s getoriginfromsuite() { true; } 1145s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 1145s getnotautomaticfromsuite() { 1145s case "$1" in 1145s experimental|experimental2) echo "yes";; 1145s esac 1145s } 1145s getbutautomaticupgradesfromsuite() { true; } 1145s 1145s aptftparchiverelease() { 1145s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 1145s } 1145s generatereleasefiles() { 1145s # $1 is the Date header and $2 is the ValidUntil header to be set 1145s # both should be given in notation date/touch can understand 1145s local DATE="$1" 1145s local VALIDUNTIL="$2" 1145s if [ -e aptarchive/dists ]; then 1145s msgninfo "\tGenerate Release files for dists… " 1145s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 1145s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 1145s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 1145s local CODENAME="$(getcodenamefromsuite $SUITE)" 1145s local VERSION="$(getreleaseversionfromsuite $SUITE)" 1145s local LABEL="$(getlabelfromsuite $SUITE)" 1145s local ORIGIN="$(getoriginfromsuite $SUITE)" 1145s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 1145s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 1145s aptftparchiverelease "$dir" \ 1145s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 1145s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 1145s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 1145s -o APT::FTPArchive::Release::Label="${LABEL}" \ 1145s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 1145s -o APT::FTPArchive::Release::Version="${VERSION}" \ 1145s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 1145s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 1145s > "$dir/Release" 1145s done 1145s else 1145s msgninfo "\tGenerate Release files for flat… " 1145s aptftparchiverelease ./aptarchive > aptarchive/Release 1145s fi 1145s if [ -n "$VALIDUNTIL" ]; then 1145s sed -i "/^Date: / a\ 1145s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 1145s fi 1145s if [ -n "$DATE" -a "$DATE" != "now" ]; then 1145s for release in $(find ./aptarchive -name 'Release'); do 1145s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 1145s touch -d "$DATE" "$release" 1145s done 1145s fi 1145s msgdone "info" 1145s } 1145s 1145s setupdistsaptarchive() { 1145s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1145s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 1145s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 1145s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 1145s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 1145s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 1145s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 1145s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 1145s msgdone "info" 1145s done 1145s } 1145s 1145s setupflataptarchive() { 1145s local APTARCHIVE="$(readlink -f ./aptarchive)" 1145s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1145s if [ -f "${APTARCHIVE}/Packages" ]; then 1145s msgninfo "\tadd deb sources.list line… " 1145s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1145s msgdone 'info' 1145s else 1145s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1145s fi 1145s if [ -f "${APTARCHIVE}/Sources" ]; then 1145s msgninfo "\tadd deb-src sources.list line… " 1145s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1145s msgdone 'info' 1145s else 1145s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1145s fi 1145s } 1145s 1145s setupaptarchive() { 1145s local NOUPDATE=0 1145s if [ "$1" = '--no-update' ]; then 1145s NOUPDATE=1 1145s shift 1145s fi 1145s buildaptarchive "$@" 1145s if [ -e aptarchive/dists ]; then 1145s setupdistsaptarchive 1145s else 1145s setupflataptarchive 1145s fi 1145s signreleasefiles 'Joe Sixpack' 1145s if [ "1" != "$NOUPDATE" ]; then 1145s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 1145s fi 1145s } 1145s 1145s killgpgagent() { 1145s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 1145s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1145s if [ ! -e "${GPGHOME}" ]; then return; fi 1145s # ensure the agent dies quickly as different versions have different suicide heuristics 1145s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 1145s rm -rf "$GPGHOME" 1145s } 1145s dosigning() { 1145s local KEY="$1" 1145s shift 1145s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1145s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 1145s GPGHOME="$APT_TEST_SIGNINGHOME" 1145s else 1145s if [ ! -e "$GPGHOME" ]; then 1145s mkdir -p --mode=700 "${GPGHOME}" 1145s addtrap 'prefix' 'killgpgagent;' 1145s fi 1145s fi 1145s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 1145s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1145s "$@" 1145s } 1145s signreleasefiles() { 1145s local SIGNERS="${1:-Joe Sixpack}" 1145s local REPODIR="${2:-aptarchive}" 1145s if [ -n "$1" ]; then shift; fi 1145s if [ -n "$1" ]; then shift; fi 1145s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1145s msgninfo "\tSign archive with $SIGNERS key $KEY… " 1145s local REXKEY='keys/rexexpired' 1145s local SECEXPIREBAK="${REXKEY}.sec.bak" 1145s local PUBEXPIREBAK="${REXKEY}.pub.bak" 1145s local SIGUSERS="" 1145s while [ -n "${SIGNERS%%,*}" ]; do 1145s local SIGNER="${SIGNERS%%,*}" 1145s if [ "${SIGNERS}" = "${SIGNER}" ]; then 1145s SIGNERS="" 1145s fi 1145s SIGNERS="${SIGNERS#*,}" 1145s # FIXME: This should be the full name, but we can't encode the space properly currently 1145s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 1145s if [ "${SIGNER}" = 'Rex Expired' ]; then 1145s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 1145s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 1145s # therefore we 'temporary' make the key not expired and restore a backup after signing 1145s cp "${REXKEY}.sec" "$SECEXPIREBAK" 1145s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 1145s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 1145s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 1145s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 1145s cp "$SECUNEXPIRED" "${REXKEY}.sec" 1145s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 1145s else 1145s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 1145s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1145s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 1145s cat setexpire.gpg 1145s exit 1 1145s fi 1145s cp "${REXKEY}.sec" "$SECUNEXPIRED" 1145s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 1145s fi 1145s fi 1145s if [ ! -e "${KEY}.pub" ]; then 1145s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1145s cat "${K}.pub" >> "${KEY}.new.pub" 1145s cat "${K}.sec" >> "${KEY}.new.sec" 1145s fi 1145s done 1145s if [ ! -e "${KEY}.pub" ]; then 1145s mv "${KEY}.new.pub" "${KEY}.pub" 1145s mv "${KEY}.new.sec" "${KEY}.sec" 1145s fi 1145s for RELEASE in $(find "${REPODIR}/" -name Release); do 1145s # we might have set a specific date for the Release file, so copy it 1145s local DATE="$(stat --format "%y" "${RELEASE}")" 1145s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 1145s rm -f "${RELEASE}.gpg" 1145s else 1145s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 1145s touch -d "$DATE" "${RELEASE}.gpg" 1145s fi 1145s local INRELEASE="${RELEASE%/*}/InRelease" 1145s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 1145s rm -f "$INRELEASE" 1145s else 1145s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 1145s touch -d "$DATE" "${INRELEASE}" 1145s fi 1145s done 1145s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 1145s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 1145s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 1145s fi 1145s msgdone 'info' 1145s } 1145s 1145s redatereleasefiles() { 1145s local DATE="$(date -u -d "$1" -R)" 1145s for release in $(find aptarchive/ -name 'Release'); do 1145s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 1145s touch -d "$DATE" "$release" 1145s done 1145s signreleasefiles "${2:-Joe Sixpack}" 1145s } 1145s 1145s webserverconfig() { 1145s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 1145s local NOCHECK=false 1145s if [ "$1" = '--no-check' ]; then 1145s NOCHECK=true 1145s shift 1145s fi 1145s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 1145s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 1145s rm -f "$STATUS" "$DOWNLOG" 1145s local URI 1145s if [ -n "$2" ]; then 1145s msgtest "Set webserver config option '${1}' to" "$2" 1145s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 1145s else 1145s msgtest 'Clear webserver config option' "${1}" 1145s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 1145s fi 1145s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 1145s msgpass 1145s else 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 1145s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 1145s msgfailoutput '' "$OUTPUT" 1145s fi 1145s $NOCHECK || testwebserverlaststatuscode '200' 1145s } 1145s 1145s rewritesourceslist() { 1145s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 1145s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 1145s sed -i $LIST \ 1145s -e "s#file://$APTARCHIVE#${1}#" \ 1145s -e "s#file:$APTARCHIVE#${1}#" \ 1145s -e "s#copy://$APTARCHIVE#${1}#" \ 1145s -e "s#copy:$APTARCHIVE#${1}#" \ 1145s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 1145s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 1145s done 1145s } 1145s 1145s # wait for up to 10s for a pid file to appear to avoid possible race 1145s # when a helper is started and doesn't write the PID quick enough 1145s waitforpidfile() { 1145s local PIDFILE="$1" 1145s for i in $(seq 10); do 1145s if test -s "$PIDFILE"; then 1145s return 0 1145s fi 1145s sleep 1 1145s done 1145s msgdie "waiting for $PIDFILE failed" 1145s return 1 1145s } 1145s 1145s changetowebserver() { 1145s local REWRITE='yes' 1145s if [ "$1" = '--no-rewrite' ]; then 1145s REWRITE='no' 1145s shift 1145s fi 1145s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 1145s cd aptarchive 1145s local LOG="webserver.log" 1145s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 1145s cat "$LOG" 1145s false 1145s fi 1145s waitforpidfile aptwebserver.pid 1145s local PID="$(cat aptwebserver.pid)" 1145s if [ -z "$PID" ]; then 1145s msgdie 'Could not fork aptwebserver successfully' 1145s fi 1145s addtrap "kill $PID;" 1145s waitforpidfile aptwebserver.port 1145s APTHTTPPORT="$(cat aptwebserver.port)" 1145s if [ -z "$APTHTTPPORT" ]; then 1145s msgdie 'Could not get port for aptwebserver successfully' 1145s fi 1145s cd - > /dev/null 1145s else 1145s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 1145s fi 1145s if [ "$REWRITE" != 'no' ]; then 1145s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 1145s fi 1145s } 1145s 1145s changetohttpswebserver() { 1145s local REWRITE='yes' 1145s if [ "$1" = '--no-rewrite' ]; then 1145s REWRITE='no' 1145s shift 1145s fi 1145s local stunnel4 1145s if command -v stunnel4 >/dev/null 2>&1; then 1145s stunnel4=stunnel4 1145s elif command -v stunnel >/dev/null 2>&1; then 1145s stunnel4=stunnel 1145s else 1145s msgdie 'You need to install stunnel4 for https testcases' 1145s fi 1145s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 1145s changetowebserver --no-rewrite "$@" 1145s fi 1145s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 1145s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 1145s output = /dev/null 1145s 1145s [https] 1145s accept = 127.0.0.1:0 1145s connect = $APTHTTPPORT 1145s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 1145s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 1145s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 1145s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 1145s if [ -z "$PID" ]; then 1145s msgdie 'Could not fork $stunnel4 successfully' 1145s fi 1145s addtrap 'prefix' "kill ${PID};" 1145s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 1145s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 1145s if [ "$REWRITE" != 'no' ]; then 1145s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 1145s fi 1145s } 1145s 1145s changetocdrom() { 1145s mkdir -p rootdir/media/cdrom/.disk 1145s local CD="$(readlink -f rootdir/media/cdrom)" 1145s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 1145s if [ ! -d aptarchive/dists ]; then 1145s msgdie 'Flat file archive cdroms can not be created currently' 1145s return 1 1145s fi 1145s mv aptarchive/dists "$CD" 1145s ln -s "$(readlink -f ./incoming)" "$CD/pool" 1145s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 1145s # start with an unmounted disk 1145s mv "${CD}" "${CD}-unmounted" 1145s # we don't want the disk to be modifiable 1145s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 1145s chmod -R 555 rootdir/media/cdrom-unmounted/dists 1145s } 1145s 1145s downloadfile() { 1145s local PROTO="${1%%:*}" 1145s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 1145s download-file "$1" "$2" "$3" 2>&1 ; then 1145s return 1 1145s fi 1145s # only if the file exists the download was successful 1145s if [ -r "$2" ]; then 1145s return 0 1145s else 1145s return 1 1145s fi 1145s } 1145s 1145s cleanup_output() { 1145s cat "$1" | sed \ 1145s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 1145s -e '/^profiling:/ d' \ 1145s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 1145s >"$2" 1145s } 1145s 1145s checkdiff() { 1145s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 1145s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 1145s touch "$TMPFILE1" "$TMPFILE2" 1145s 1145s cleanup_output "$1" "$TMPFILE1" 1145s cleanup_output "$2" "$TMPFILE2" 1145s 1145s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 1145s if [ -n "$DIFFTEXT" ]; then 1145s echo >&2 1145s echo >&2 "$DIFFTEXT" 1145s return 1 1145s else 1145s return 0 1145s fi 1145s } 1145s 1145s testoutputequal() { 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 1145s local COMPAREFILE="$1" 1145s shift 1145s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 1145s msgpass 1145s else 1145s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 1145s cat "$COMPAREFILE" >>"${OUTPUT}" 1145s msgfailoutput '' "$OUTPUT" "$@" 1145s fi 1145s } 1145s 1145s testfileequal() { 1145s msggroup 'testfileequal' 1145s local MSG='Test for correctness of file' 1145s if [ "$1" = '--nomsg' ]; then 1145s MSG='' 1145s shift 1145s fi 1145s local FILE="$1" 1145s shift 1145s if [ -n "$MSG" ]; then 1145s msgtest "$MSG" "$FILE" 1145s fi 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 1145s if [ -z "$*" ]; then 1145s testoutputequal "$FILE" echo -n '' 1145s else 1145s testoutputequal "$FILE" echo "$*" 1145s fi 1145s msggroup 1145s } 1145s 1145s testempty() { 1145s msggroup 'testempty' 1145s if [ "$1" = '--nomsg' ]; then 1145s shift 1145s else 1145s msgtest "Test for no output of" "$*" 1145s fi 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 1145s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 1145s msgpass 1145s else 1145s msgfailoutput '' "$COMPAREFILE" "$@" 1145s fi 1145s aptautotest 'testempty' "$@" 1145s msggroup 1145s } 1145s testwarningempty() { 1145s testwarning "$@" 1145s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 1145s } 1145s testnotempty() { 1145s msggroup 'testnotempty' 1145s msgtest "Test for some output of" "$*" 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 1145s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 1145s msgpass 1145s else 1145s msgfailoutput '' "$COMPAREFILE" "$@" 1145s fi 1145s aptautotest 'testnotempty' "$@" 1145s msggroup 1145s } 1145s 1145s testequal() { 1145s msggroup 'testequal' 1145s local MSG='Test of equality of' 1145s if [ "$1" = '--nomsg' ]; then 1145s MSG='' 1145s shift 1145s fi 1145s 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 1145s echo "$1" > "$COMPAREFILE" 1145s shift 1145s 1145s if [ -n "$MSG" ]; then 1145s msgtest "$MSG" "$*" 1145s fi 1145s testoutputequal "$COMPAREFILE" "$@" 1145s aptautotest 'testequal' "$@" 1145s msggroup 1145s } 1145s 1145s testequalor2() { 1145s msggroup 'testequalor2' 1145s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 1145s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 1145s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 1145s echo "$1" > "$COMPAREFILE1" 1145s echo "$2" > "$COMPAREFILE2" 1145s shift 2 1145s msgtest "Test for equality OR of" "$*" 1145s "$@" >"$COMPAREAGAINST" 2>&1 || true 1145s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 1145s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 1145s then 1145s msgpass 1145s else 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 1145s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 1145s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1145s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 1145s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1145s msgfailoutput '' "$OUTPUT" 1145s fi 1145s aptautotest 'testequalor2' "$@" 1145s msggroup 1145s } 1145s 1145s testshowvirtual() { 1145s msggroup 'testshowvirtual' 1145s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 1145s local PACKAGE="$1" 1145s shift 1145s while [ -n "$1" ]; do 1145s VIRTUAL="${VIRTUAL} 1145s N: Can't select versions from package '$1' as it is purely virtual" 1145s PACKAGE="${PACKAGE} $1" 1145s shift 1145s done 1145s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 1145s VIRTUAL="${VIRTUAL} 1145s N: No packages found" 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 1145s local ARCH="$(getarchitecture 'native')" 1145s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 1145s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 1145s msggroup 1145s } 1145s 1145s testnopackage() { 1145s msggroup 'testnopackage' 1145s msgtest "Test for non-existent packages" "apt-cache show $*" 1145s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 1145s if [ -n "$SHOWPKG" ]; then 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1145s echo "$SHOWPKG" >"$OUTPUT" 1145s msgfailoutput '' "$OUTPUT" 1145s else 1145s msgpass 1145s fi 1145s msggroup 1145s } 1145s testnosrcpackage() { 1145s msggroup 'testnosrcpackage' 1145s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 1145s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 1145s if [ -n "$SHOWPKG" ]; then 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 1145s echo "$SHOWPKG" >"$OUTPUT" 1145s msgfailoutput '' "$OUTPUT" 1145s else 1145s msgpass 1145s fi 1145s msggroup 1145s } 1145s 1145s testdpkgstatus() { 1145s msggroup 'testdpkgstatus' 1145s local STATE="$1" 1145s local NR="$2" 1145s shift 2 1145s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 1145s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 1145s if [ "$PKGS" != $NR ]; then 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1145s echo "$PKGS" >"$OUTPUT" 1145s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 1145s msgfailoutput '' "$OUTPUT" 1145s else 1145s msgpass 1145s fi 1145s msggroup 1145s } 1145s 1145s testdpkginstalled() { 1145s msggroup 'testdpkginstalled' 1145s testdpkgstatus 'ii' "$#" "$@" 1145s msggroup 1145s } 1145s 1145s testdpkgnotinstalled() { 1145s msggroup 'testdpkgnotinstalled' 1145s testdpkgstatus 'ii' '0' "$@" 1145s msggroup 1145s } 1145s 1145s testmarkedauto() { 1145s msggroup 'testmarkedauto' 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 1145s if [ -n "$1" ]; then 1145s msgtest 'Test for correctly marked as auto-installed' "$*" 1145s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1145s else 1145s msgtest 'Test for correctly marked as auto-installed' 'no package' 1145s echo -n > "$COMPAREFILE" 1145s fi 1145s testoutputequal "$COMPAREFILE" aptmark showauto 1145s msggroup 1145s } 1145s testmarkedmanual() { 1145s msggroup 'testmarkedmanual' 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 1145s if [ -n "$1" ]; then 1145s msgtest 'Test for correctly marked as manually installed' "$*" 1145s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1145s else 1145s msgtest 'Test for correctly marked as manually installed' 'no package' 1145s echo -n > "$COMPAREFILE" 1145s fi 1145s testoutputequal "$COMPAREFILE" aptmark showmanual 1145s msggroup 1145s } 1145s 1145s catfile() { 1145s if [ "${1##*.}" = 'deb' ]; then 1145s stat >&2 "$1" || true 1145s file >&2 "$1" || true 1145s else 1145s cat >&2 "$1" || true 1145s fi 1145s } 1145s msgfailoutput() { 1145s msgreportheader 'msgfailoutput' 1145s local MSG="$1" 1145s local OUTPUT="$2" 1145s shift 2 1145s local CMD="$1" 1145s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 1145s echo >&2 1145s while [ -n "$2" ]; do shift; done 1145s echo "#### Complete file: $1 ####" 1145s catfile "$1" 1145s echo "#### $CMD output ####" 1145s elif [ "$1" = 'test' ]; then 1145s echo >&2 1145s # doesn't support ! or non-file flags 1145s msgfailoutputstatfile() { 1145s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 1145s if expr match "$1" "$FILEFLAGS" >/dev/null; then 1145s echo "#### stat(2) of file: $2 ####" 1145s stat "$2" || true 1145s if test -d "$2"; then 1145s echo "#### The directory contains: $2 ####" 1145s ls >&2 "$2" || true 1145s elif test -e "$2"; then 1145s echo "#### Complete file: $2 ####" 1145s catfile "$2" 1145s fi 1145s fi 1145s } 1145s msgfailoutputstatfile "$2" "$3" 1145s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 1145s shift 3 1145s msgfailoutputstatfile "$2" "$3" 1145s done 1145s echo '#### test output ####' 1145s elif [ "$1" = 'cmp' ]; then 1145s echo >&2 1145s while [ -n "$2" ]; do 1145s echo "#### Complete file: $2 ####" 1145s catfile "$2" 1145s shift 1145s done 1145s echo '#### cmp output ####' 1145s elif [ "$1" = 'rm' ]; then 1145s echo "#### Directory listing of: $(pwd) ####" 1145s ls -l 1145s fi 1145s catfile "$OUTPUT" 1145s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 1145s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 1145s local COREEXE='' 1145s for CORENAME in 'core' 'core.pid'; do 1145s if [ -s "$CORENAME" ]; then 1145s cp -a ${CORENAME} "$COREDUMP" 1145s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 1145s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 1145s else 1145s continue 1145s fi 1145s break 1145s done 1145s if [ -s "$COREDUMP" ]; then 1145s true # found already as a file 1145s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 1145s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 1145s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 1145s else 1145s echo '### core dump not found ###' 1145s cat /proc/sys/kernel/core_pattern 1145s fi 1145s if [ -s "$COREDUMP" ]; then 1145s if [ -z "$COREEXE" ]; then 1145s case "$CMD" in 1145s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1145s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 1145s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 1145s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 1145s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 1145s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1145s esac 1145s fi 1145s 1145s if [ -d "${ARTIFACTSDIR}" ]; then 1145s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 1145s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 1145s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 1145s fi 1145s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 1145s echo "#### gdb backtrace ####" 1145s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 1145s fi 1145s fi 1145s rm -f "$COREDUMP" 1145s fi 1145s msgfail "$MSG" 1145s } 1145s 1145s testsuccesswithglobalerror() { 1145s local TYPE="$1" 1145s local ERRORS="$2" 1145s shift 2 1145s msggroup "$TYPE" 1145s if [ "$1" = '--nomsg' ]; then 1145s shift 1145s else 1145s msgtest 'Test for successful execution of' "$*" 1145s fi 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 1145s if "$@" >"${OUTPUT}" 2>&1; then 1145s if expr match "$1" '^apt.*' >/dev/null; then 1145s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1145s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1145s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 1145s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 1145s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 1145s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1145s msgpass 1145s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 1145s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1145s msgpass 1145s else 1145s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1145s fi 1145s else 1145s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1145s fi 1145s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 1145s if grep -q -E "^N: " "$OUTPUT"; then 1145s msgpass 1145s else 1145s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 1145s fi 1145s else 1145s msgpass 1145s fi 1145s else 1145s msgpass 1145s fi 1145s else 1145s local EXITCODE=$? 1145s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1145s fi 1145s aptautotest "$TYPE" "$@" 1145s msggroup 1145s } 1145s testsuccesswithnotice() { 1145s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 1145s } 1145s testsuccess() { 1145s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 1145s } 1145s testwarning() { 1145s msggroup 'testwarning' 1145s if [ "$1" = '--nomsg' ]; then 1145s shift 1145s else 1145s msgtest 'Test for successful execution with warnings of' "$*" 1145s fi 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 1145s if "$@" >"${OUTPUT}" 2>&1; then 1145s if expr match "$1" '^apt.*' >/dev/null; then 1145s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1145s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1145s elif grep -q -E '^E: ' "$OUTPUT"; then 1145s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 1145s elif ! grep -q -E '^W: ' "$OUTPUT"; then 1145s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 1145s else 1145s msgpass 1145s fi 1145s else 1145s msgpass 1145s fi 1145s else 1145s local EXITCODE=$? 1145s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1145s fi 1145s aptautotest 'testwarning' "$@" 1145s msggroup 1145s } 1145s testfailure() { 1145s msggroup 'testfailure' 1145s if [ "$1" = '--nomsg' ]; then 1145s shift 1145s else 1145s msgtest 'Test for failure in execution of' "$*" 1145s fi 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 1145s if "$@" >"${OUTPUT}" 2>&1; then 1145s local EXITCODE=$? 1145s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1145s else 1145s local EXITCODE=$? 1145s if expr match "$1" '^apt.*' >/dev/null; then 1145s if [ "$1" = 'aptkey' ]; then 1145s if grep -q " Can't check signature: 1145s BAD signature from 1145s signature could not be verified" "$OUTPUT"; then 1145s msgpass 1145s else 1145s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 1145s fi 1145s else 1145s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1145s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1145s elif grep -q -E '==ERROR' "$OUTPUT"; then 1145s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 1145s elif ! grep -q -E '^E: ' "$OUTPUT"; then 1145s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 1145s else 1145s msgpass 1145s fi 1145s fi 1145s else 1145s msgpass 1145s fi 1145s fi 1145s aptautotest 'testfailure' "$@" 1145s msggroup 1145s } 1145s 1145s testreturnstateequal() { 1145s local STATE="$1" 1145s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 1145s local STATE="$2" 1145s local TYPE="$3" 1145s shift 3 1145s msggroup "${STATE}equal" 1145s if [ "$1" != '--nomsg' ]; then 1145s local CMP="$1" 1145s shift 1145s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1145s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1145s else 1145s local CMP="$2" 1145s shift 2 1145s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1145s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1145s fi 1145s else 1145s msggroup "${STATE}equal" 1145s if [ "$2" != '--nomsg' ]; then 1145s local CMP="$2" 1145s shift 2 1145s "$STATE" "$@" 1145s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1145s else 1145s local CMP="$3" 1145s shift 3 1145s "$STATE" --nomsg "$@" 1145s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1145s fi 1145s fi 1145s msggroup 1145s } 1145s testsuccessequal() { 1145s # we compare output, so we know perfectly well about N: 1145s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 1145s } 1145s testwarningequal() { 1145s testreturnstateequal 'testwarning' "$@" 1145s } 1145s testfailureequal() { 1145s testreturnstateequal 'testfailure' "$@" 1145s } 1145s 1145s testfailuremsg() { 1145s msggroup 'testfailuremsg' 1145s local CMP="$1" 1145s shift 1145s testfailure "$@" 1145s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 1145s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 1145s testoutputequal "$COMPAREFILE" echo "$CMP" 1145s msggroup 1145s } 1145s testwarningmsg() { 1145s msggroup 'testwarningmsg' 1145s local CMP="$1" 1145s shift 1145s testwarning "$@" 1145s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 1145s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 1145s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 1145s testoutputequal "$COMPAREFILE" echo "$CMP" 1145s msggroup 1145s } 1145s 1145s testfilestats() { 1145s msggroup 'testfilestats' 1145s msgtest "Test that file $1 has $2 $3" "$4" 1145s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 1145s msgpass 1145s else 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 1145s { 1145s echo 1145s ls -ld "$1" || true 1145s echo -n "stat(1) reports for $2: " 1145s stat --format "$2" "$1" || true 1145s } >"$OUTPUT" 2>&1 1145s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 1145s fi 1145s msggroup 1145s } 1145s testaccessrights() { 1145s msggroup 'testaccessrights' 1145s testfilestats "$1" '%a' '=' "$2" 1145s msggroup 1145s } 1145s 1145s testwebserverlaststatuscode() { 1145s msggroup 'testwebserverlaststatuscode' 1145s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 1145s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 1145s rm -f "$DOWNLOG" "$STATUS" 1145s msgtest 'Test last status code from the webserver was' "$1" 1145s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 1145s msgpass 1145s else 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 1145s { 1145s if [ -n "$2" ]; then 1145s shift 1145s echo >&2 '#### Additionally provided output files contain:' 1145s cat >&2 "$@" 1145s fi 1145s echo >&2 '#### Download log of the status code:' 1145s cat >&2 "$DOWNLOG" 1145s } >"$OUTPUT" 2>&1 1145s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 1145s fi 1145s msggroup 1145s } 1145s 1145s mapkeynametokeyid() { 1145s while [ -n "$1" ]; do 1145s case "$1" in 1145s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 1145s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 1145s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 1145s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 1145s oldarchive) echo 'FDD2DB85F68C85A3';; 1145s *) echo 'UNKNOWN KEY';; 1145s esac 1145s shift 1145s done 1145s } 1145s testaptkeys() { 1145s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 1145s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 1145s echo -n > "$OUTPUT" 1145s fi 1145s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 1145s } 1145s 1145s pause() { 1145s echo "STOPPED execution. Press enter to continue" 1145s local IGNORE 1145s read IGNORE 1145s } 1145s 1145s logcurrentarchivedirectory() { 1145s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 1145s stat --format '%U:%G:%a:%n' "$line" 1145s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 1145s } 1145s listcurrentlistsdirectory() { 1145s { 1145s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 1145s stat --format '%U:%G:%a:%n' "$line" 1145s done 1145s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 1145s stat --format '%U:%G:%a:%s:%y:%n' "$line" 1145s done 1145s } | sort 1145s } 1145s forallsupportedcompressors() { 1145s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1145s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1145s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 1145s "$@" "$COMP" 1145s done 1145s } 1145s 1145s breakfiles() { 1145s while [ -n "$1" ]; do 1145s mv -f "${1}" "${1}.bak" 1145s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 1145s shift 1145s done 1145s } 1145s unbreakfiles() { 1145s while [ -n "$1" ]; do 1145s mv -f "${1}.bak" "${1}" 1145s shift 1145s done 1145s } 1145s 1145s ### convenience hacks ### 1145s mkdir() { 1145s # creating some directories by hand is a tedious task, so make it look simple 1145s local PARAMS="$*" 1145s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 1145s # only the last directory created by mkdir is effected by the -m ! 1145s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 1145s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 1145s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1145s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1145s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 1145s if [ "$(id -u)" = '0' ]; then 1145s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1145s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1145s fi 1145s else 1145s command mkdir "$@" 1145s fi 1145s } 1145s 1145s ### The following tests are run by most test methods automatically to check 1145s ### general things about commands executed without writing the test every time. 1145s 1145s aptautotest() { 1145s if [ $# -lt 3 ]; then return; fi 1145s local TESTCALL="$1" 1145s local CMD="$2" 1145s local FIRSTOPT="$3" 1145s shift 2 1145s for i in "$@"; do 1145s if ! expr match "$i" '^-' >/dev/null 2>&1; then 1145s FIRSTOPT="$i" 1145s break 1145s fi 1145s done 1145s shift 1145s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 1145s if command -v $AUTOTEST >/dev/null; then 1145s # save and restore the *.output files from other tests 1145s # as we might otherwise override them in these automatic tests 1145s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1145s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1145s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1145s $AUTOTEST "$TESTCALL" "$@" 1145s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1145s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1145s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1145s fi 1145s } 1145s 1145s cdfind() { 1145s ( cd /; find "$@" ) 1145s } 1145s aptautotest_aptget_update() { 1145s local TESTCALL="$1" 1145s while [ -n "$2" ]; do 1145s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 1145s shift 1145s done 1145s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 1145s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1145s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1145s # all copied files are properly chmodded 1145s local backupIFS="$IFS" 1145s IFS="$(printf "\n\b")" 1145s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 1145s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 1145s done 1145s IFS="$backupIFS" 1145s if [ "$TESTCALL" = 'testsuccess' ]; then 1145s # failure cases can retain partial files and such 1145s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 1145s fi 1145s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 1145s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 1145s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 1145s fi 1145s } 1145s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 1145s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 1145s 1145s testaptautotestnodpkgwarning() { 1145s local TESTCALL="$1" 1145s while [ -n "$2" ]; do 1145s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 1145s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 1145s shift 1145s done 1145s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 1145s } 1145s 1145s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 1145s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 1145s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 1145s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 1145s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 1145s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 1145s 1145s testaptmarknodefaultsections() { 1145s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 1145s } 1145s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 1145s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 1145s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 1145s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 1145s cmp: ./downloaded/foo1: No such file or directory 1145s FAIL: exitcode 2 1272s 1272s Redirect leads first URI to the second URI … Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 1272s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1272s Configured access method http 1272s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1272s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 1272s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1272s Configured access method http 1272s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1272s -> http:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpk 1272s Test for successful execution of cmp /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework ./downloaded/foo1 … #### Complete file: /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework #### 1272s #### Complete file: ./downloaded/foo1 #### 1272s #### cmp output #### 1273s 1273s Test for successful execution of cmp ./downloaded/foo1 ./downloaded/foo2 … #### Complete file: ./downloaded/foo1 #### 1273s #### Complete file: ./downloaded/foo2 #### 1273s #### cmp output #### 1273s Pg=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 1273s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo2%0aFilename:%20./downloaded/foo1%0a%0a 1273s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo%0aFilename:%20./downloaded/foo2%0a%0a 1273s GET /foo2 HTTP/1.1 1273s Host: localhost:44339 1273s Accept: text/* 1273s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 1273s 1273s 1273s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20http://localhost:44339/foo2 1273s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 1273s <- http:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 1273s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo2 1273s Answer for: http://localhost:44339/foo2 1273s HTTP/1.1 301 Moved Permanently 1273s Content-Length: 357 1273s Location: https://localhost:44339/foo 1273s Content-Type: text/html; charset=utf-8 1273s Server: APT webserver 1273s Accept-Ranges: bytes 1273s Date: Fri, 13 Jun 2025 00:18:34 GMT 1273s 1273s GET /foo HTTP/1.1 1273s Host: localhost:44339 1273s Accept: text/* 1273s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 1273s 1273s 1273s <- http:103%20Redirect%0aNew-URI:%20https://localhost:44339/foo%0aURI:%20http://localhost:44339/foo2 1273s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 1273s Answer for: http://localhost:44339/foo 1273s HTTP/1.1 200 OK 1273s Content-Length: 77417 1273s Last-Modified: Fri, 13 Jun 2025 00:07:57 GMT 1273s Server: APT webserver 1273s Accept-Ranges: bytes 1273s Date: Fri, 13 Jun 2025 00:18:34 GMT 1273s 1273s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1273s Configured access method https 1273s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1273s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 1273s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1273s Configured access method https 1273s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1273s -> https:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpkg=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 1273s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1273s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo 1273s <- http:200%20URI%20Start%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aURI:%20http://localhost:44339/foo 1273s Get:2 http://localhost:44339/foo [77.4 kB] 1273s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20https://localhost:44339/foo 1273s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1273s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1273s <- http:201%20URI%20Done%0aChecksum-FileSize-Hash:%2077417%0aSHA512-Hash:%2099758b98725ee45110a374044902230c8b056c97567d3ec249dc4add195e13a8d07d7d5d5081938286c2c21ec0841528b6cee8986d16a3a9d0abd4c570dd7dce%0aSHA256-Hash:%2072d18d223dc239300d7548396ef9409ee2e4ff5163d55557a87d9852c098e15e%0aSHA1-Hash:%20357fe7a44e62f7a01e1b4c96ee33675f03223500%0aMD5Sum-Hash:%20582a51e7590162e00495e35c882c4b44%0aMD5-Hash:%20582a51e7590162e00495e35c882c4b44%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aFilename:%20./downloaded/foo2%0aURI:%20http://localhost:44339/foo 1273s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1273s Ign:1 http://localhost:44339/foo2 1273s Could not wait for server fd - select (11: Resource temporarily unavailable) 1273s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1273s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1273s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1273s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1273s Ign:1 http://localhost:44339/foo2 1273s Could not wait for server fd - select (11: Resource temporarily unavailable) 1273s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1273s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1273s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1273s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1273s Ign:1 http://localhost:44339/foo2 1273s Could not wait for server fd - select (11: Resource temporarily unavailable) 1273s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1273s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1273s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1273s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1273s Err:1 http://localhost:44339/foo2 1273s Could not wait for server fd - select (11: Resource temporarily unavailable) 1273s E: Failed to fetch https://localhost:44339/foo Could not wait for server fd - select (11: Resource temporarily unavailable) 1273s E: Download Failed 1273s FAIL: exitcode 100 1273s 1273s #!/bin/sh -- # no runable script, just for vi 1273s 1273s EXIT_CODE=0 1273s 1273s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 1273s if [ "$1" = "-q" ]; then 1273s export MSGLEVEL=2 1273s elif [ "$1" = "-qq" ]; then 1273s export MSGLEVEL=1 1273s elif [ "$1" = "-v" ]; then 1273s export MSGLEVEL=4 1273s elif [ "$1" = '--color=no' ]; then 1273s export MSGCOLOR='NO' 1273s elif [ "$1" = '--color=yes' ]; then 1273s export MSGCOLOR='YES' 1273s elif [ "$1" = '--color' ]; then 1273s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 1273s shift 1273s elif [ "$1" = '--level' ]; then 1273s export MSGLEVEL=$2 1273s shift 1273s else 1273s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 1273s fi 1273s shift 1273s done 1273s export MSGLEVEL="${MSGLEVEL:-3}" 1273s 1273s # we all like colorful messages 1273s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 1273s if [ ! -t 1 ]; then # but check that we output to a terminal 1273s export MSGCOLOR='NO' 1273s fi 1273s fi 1273s 1273s if [ "$MSGCOLOR" != 'NO' ]; then 1273s CERROR="\033[1;31m" # red 1273s CWARNING="\033[1;33m" # yellow 1273s CMSG="\033[1;32m" # green 1273s CINFO="\033[1;96m" # light blue 1273s CDEBUG="\033[1;94m" # blue 1273s CNORMAL="\033[0;39m" # default system console color 1273s CDONE="\033[1;32m" # green 1273s CPASS="\033[1;32m" # green 1273s CFAIL="\033[1;31m" # red 1273s CCMD="\033[1;35m" # pink 1273s fi 1273s 1273s msgprintf() { 1273s local START="$1" 1273s local MIDDLE="$2" 1273s local END="$3" 1273s shift 3 1273s if [ -n "$1" ]; then 1273s printf "$START " "$1" 1273s shift 1273s while [ -n "$1" ]; do 1273s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 1273s shift 1273s done 1273s fi 1273s printf "${END}" 1273s } 1273s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 1273s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 1273s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 1273s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 1273s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 1273s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 1273s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 1273s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 1273s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 1273s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 1273s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 1273s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 1273s msgreportheader() { 1273s if [ -n "$MSGTEST_MSG" ]; then 1273s test "$1" != 'msgfailoutput' || echo 1273s if [ -n "$MSGTEST_MSGMSG" ]; then 1273s echo "$MSGTEST_MSGMSG" 1273s fi 1273s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 1273s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 1273s fi 1273s echo -n "$MSGTEST_MSG" 1273s unset MSGTEST_MSG 1273s fi 1273s } 1273s msgskip() { 1273s msgreportheader 'msgskip' 1273s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 1273s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 1273s } 1273s msgfail() { 1273s msgreportheader 'msgfail' 1273s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 1273s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 1273s if [ -n "$APT_DEBUG_TESTS" ]; then 1273s runapt $SHELL 1273s fi 1273s EXIT_CODE=$((EXIT_CODE+1)); 1273s } 1273s MSGGROUP_LEVEL=0 1273s msggroup() { 1273s if [ -n "$1" ]; then 1273s if [ $MSGGROUP_LEVEL = 0 ]; then 1273s MSGTEST_GRP='NEXT' 1273s fi 1273s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 1273s else 1273s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 1273s if [ $MSGGROUP_LEVEL = 0 ]; then 1273s unset MSGTEST_GRP 1273s fi 1273s fi 1273s } 1273s 1273s # enable / disable Debugging 1273s if [ $MSGLEVEL -le 0 ]; then 1273s msgdie() { true; } 1273s fi 1273s if [ $MSGLEVEL -le 1 ]; then 1273s msgwarn() { true; } 1273s msgnwarn() { true; } 1273s fi 1273s if [ $MSGLEVEL -le 2 ]; then 1273s msgmsg() { 1273s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 1273s } 1273s msgnmsg() { true; } 1273s msgtest() { 1273s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 1273s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 1273s MSGTEST_GRP="$MSGTEST_MSG" 1273s fi 1273s } 1273s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 1273s fi 1273s if [ $MSGLEVEL -le 3 ]; then 1273s msginfo() { true; } 1273s msgninfo() { true; } 1273s fi 1273s if [ $MSGLEVEL -le 4 ]; then 1273s msgdebug() { true; } 1273s msgndebug() { true; } 1273s fi 1273s if [ $MSGLEVEL -le 1 ]; then 1273s msgpass() { true; } 1273s fi 1273s msgdone() { 1273s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 1273s [ "$1" = "info" -a $MSGLEVEL -le 3 ] || 1273s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 1273s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 1273s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 1273s true; 1273s else 1273s printf "${CDONE}DONE${CNORMAL}\n"; 1273s fi 1273s } 1273s getaptconfig() { 1273s if [ -f ./aptconfig.conf ]; then 1273s echo "$(readlink -f ./aptconfig.conf)" 1273s elif [ -f ../aptconfig.conf ]; then 1273s echo "$(readlink -f ../aptconfig.conf)" 1273s elif [ -f ../../aptconfig.conf ]; then 1273s echo "$(readlink -f ../../aptconfig.conf)" 1273s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 1273s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 1273s fi 1273s } 1273s runapt() { 1273s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 1273s local CMD="$1" 1273s shift 1273s case "$CMD" in 1273s sh|aptitude|*/*|command) ;; 1273s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 1273s esac 1273s if [ "$CMD" = 'aptitude' ]; then 1273s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 1273s else 1273s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 1273s fi 1273s } 1273s runpython3() { runapt command python3 "$@"; } 1273s aptconfig() { runapt apt-config "$@"; } 1273s aptcache() { runapt apt-cache "$@"; } 1273s aptcdrom() { runapt apt-cdrom "$@"; } 1273s aptget() { runapt apt-get "$@"; } 1273s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 1273s aptkey() { runapt apt-key "$@"; } 1273s aptmark() { runapt apt-mark "$@"; } 1273s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 1273s apt() { runapt apt "$@"; } 1273s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 1273s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 1273s aptitude() { runapt aptitude "$@"; } 1273s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 1273s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 1273s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 1273s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 1273s 1273s dpkg() { 1273s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 1273s } 1273s dpkgquery() { 1273s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1273s } 1273s dpkg_version() { 1273s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 1273s } 1273s dpkgcheckbuilddeps() { 1273s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1273s } 1273s gdb() { 1273s local CMD 1273s case "$1" in 1273s aptget) CMD="apt-get";; 1273s aptcache) CMD="apt-cache";; 1273s aptcdrom) CMD="apt-cdrom";; 1273s aptconfig) CMD="apt-config";; 1273s aptmark) CMD="apt-mark";; 1273s apthelper) CMD="apt-helper";; 1273s aptftparchive) CMD="apt-ftparchive";; 1273s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1273s *) CMD="$1";; 1273s esac 1273s shift 1273s if [ "${CMD##*/}" = "$CMD" ]; then 1273s CMD="${APTCMDLINEBINDIR}/${CMD}" 1273s fi 1273s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 1273s } 1273s 1273s valgrind() { 1273s local CMD 1273s case "$1" in 1273s aptget) CMD="apt-get";; 1273s aptcache) CMD="apt-cache";; 1273s aptcdrom) CMD="apt-cdrom";; 1273s aptconfig) CMD="apt-config";; 1273s aptmark) CMD="apt-mark";; 1273s apthelper) CMD="apt-helper";; 1273s aptftparchive) CMD="apt-ftparchive";; 1273s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1273s *) CMD="$1";; 1273s esac 1273s shift 1273s if [ "$CMD" = "apt-ftparchive" ]; then 1273s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 1273s fi 1273s if [ "${CMD##*/}" = "$CMD" ]; then 1273s CMD="${APTCMDLINEBINDIR}/${CMD}" 1273s fi 1273s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 1273s } 1273s 1273s lastmodification() { 1273s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 1273s } 1273s releasefiledate() { 1273s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 1273s } 1273s 1273s exitwithstatus() { 1273s # error if we about to overflow, but ... 1273s # "255 failures ought to be enough for everybody" 1273s if [ $EXIT_CODE -gt 255 ]; then 1273s msgdie "Total failure count $EXIT_CODE too big" 1273s fi 1273s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 1273s } 1273s 1273s shellsetedetector() { 1273s local exit_status=$? 1273s if [ "$exit_status" != '0' ]; then 1273s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 1273s if [ "$EXIT_CODE" = '0' ]; then 1273s EXIT_CODE="$exit_status" 1273s fi 1273s fi 1273s } 1273s 1273s addtrap() { 1273s if [ "$1" = 'prefix' ]; then 1273s CURRENTTRAP="$2 $CURRENTTRAP" 1273s else 1273s CURRENTTRAP="$CURRENTTRAP $1" 1273s fi 1273s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1273s } 1273s 1273s escape_shell() { 1273s echo "$@" | sed -e "s#'#'\"'\"'#g" 1273s } 1273s 1273s find_project_binary_dir() { 1273s if [ -z "$PROJECT_BINARY_DIR" ]; then 1273s PROJECT_BINARY_DIR= 1273s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 1273s test -e "$dir/CMakeCache.txt" || continue 1273s if [ -z "$PROJECT_BINARY_DIR" ] || 1273s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 1273s PROJECT_BINARY_DIR="$dir" 1273s fi 1273s done 1273s if [ -z "$PROJECT_BINARY_DIR" ]; then 1273s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 1273s exit 1 1273s fi 1273s export PROJECT_BINARY_DIR 1273s fi 1273s } 1273s _removetmpworkingdirectory() { 1273s cd / 1273s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 1273s rm -rf "$TMPWORKINGDIRECTORY" 1273s fi 1273s TMPWORKINGDIRECTORY='' 1273s } 1273s setupenvironment() { 1273s # cleanup the environment a bit 1273s export LC_ALL=C 1273s unset LANGUAGE COLUMNS NLSPATH 1273s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 1273s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 1273s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 1273s unset GREP_OPTIONS POSIXLY_CORRECT 1273s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 1273s export GCOV_ERROR_FILE=/dev/null 1273s 1273s # Next check needs a gnu stat, let's figure that out early. 1273s stat=stat 1273s if command -v gnustat >/dev/null 2>&1; then 1273s stat=gnustat 1273s fi 1273s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 1273s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 1273s unset TMPDIR 1273s fi 1273s if [ -z "$TMPWORKINGDIRECTORY" ]; then 1273s addtrap '_removetmpworkingdirectory;' 1273s TMPWORKINGDIRECTORY="$(mktemp -d)" 1273s fi 1273s if [ -n "$TMPDIR_ADD" ]; then 1273s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 1273s mkdir -p "$TMPWORKINGDIRECTORY" 1273s unset TMPDIR_ADD 1273s export TMPDIR="$TMPWORKINGDIRECTORY" 1273s fi 1273s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 1273s 1273s # Setup coreutils on BSD systems 1273s mkdir "${TMPWORKINGDIRECTORY}/bin" 1273s for prefix in gnu g; do 1273s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 1273s if command -v $prefix$command 2>/dev/null >/dev/null; then 1273s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 1273s fi 1273s done 1273s done 1273s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 1273s 1273s if [ -z "$TESTDIRECTORY" ]; then 1273s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 1273s fi 1273s cd "$TMPWORKINGDIRECTORY" 1273s 1273s mkdir -m 700 'downloaded' 1273s if [ "$(id -u)" = '0' ]; then 1273s # relax permissions so that running as root with user switching works 1273s umask 022 1273s chmod 711 "$TMPWORKINGDIRECTORY" 1273s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 1273s fi 1273s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 1273s 1273s _setupprojectenvironment 1273s 1273s # create some files in /tmp and look at user/group to get what this means 1273s TEST_DEFAULT_USER="$(id -un)" 1273s touch "${TMPWORKINGDIRECTORY}/test-file" 1273s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 1273s 1273s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 1273s . "${TESTDIRECTORY}/extra-environment" 1273s fi 1273s 1273s msgdone "info" 1273s } 1273s _setupprojectenvironment() { 1273s # allow overriding the default BUILDDIR locations 1273s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 1273s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 1273s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 1273s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 1273s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1273s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 1273s APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 1273s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1273s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 1273s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 1273s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 1273s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 1273s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 1273s 1273s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 1273s mkdir aptarchive keys 1273s cd rootdir 1273s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 1273s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 1273s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 1273s touch var/lib/dpkg/available var/lib/dpkg/lock 1273s echo '1' > var/lib/dpkg/info/format 1273s ln -s "${METHODSDIR}" usr/lib/apt/methods 1273s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 1273s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 1273s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 1273s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 1273s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 1273s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 1273s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 1273s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 1273s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 1273s else 1273s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 1273s fi 1273s cd .. 1273s local BASENAME="${0##*/}" 1273s local PACKAGESFILE="Packages-${BASENAME#*-}" 1273s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 1273s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 1273s fi 1273s local SOURCESSFILE="Sources-${BASENAME#*-}" 1273s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 1273s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 1273s fi 1273s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 1273s chmod 644 keys/* 1273s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 1273s 1273s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 1273s echo "Dir::Etc \"etc\";" >> aptconfig.conf 1273s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 1273s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 1273s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 1273s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 1273s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 1273s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 1273s # either store apt-key were we can access it, even if we run it as a different user 1273s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 1273s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 1273s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 1273s # destroys coverage reporting though, so we disable changing user for the calling gpgv 1273s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 1273s if [ "$(id -u)" = '0' ]; then 1273s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 1273s # same for the solver executables 1273s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 1273s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 1273s fi 1273s 1273s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 1273s EXEC='' 1273s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 1273s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 1273s restoredpkgstatus() { 1273s if [ -n "\$BACKUP" ]; then 1273s if [ -e "\$BACKUP" ]; then 1273s mv -f "\$BACKUP" "\$ORIGINAL" 1273s else 1273s rm -f "\$ORIGINAL" 1273s fi 1273s BACKUP='' 1273s fi 1273s } 1273s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1273s if [ -e "\$ORIGINAL" ]; then 1273s cp -a "\$ORIGINAL" "\$BACKUP" 1273s fi 1273s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 1273s 1273s Package: dpkg 1273s Architecture: all 1273s Version: ${DPKG_VERSION}+fake 1273s Status: install ok installed 1273s Maintainer: Joe Sixpack 1273s Installed-Size: 42 1273s Description: tells dpkg it supports what we need 1273s Some versions of dpkg check its own version from the status file 1273s to know if it supports multi-arch and stuff in --assert-*. 1273s 1273s EOS 1273s fi 1273s EOF 1273s fi 1273s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 1273s 1273s { 1273s echo 'quiet "0";' 1273s echo 'quiet::NoUpdate "true";' 1273s echo 'quiet::NoStatistic "true";' 1273s # too distracting for users, but helpful to detect changes 1273s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 1273s echo 'Acquire::Progress::Diffpercent "true";' 1273s # in testcases, it can appear as if localhost has a rotation setup, 1273s # hide this as we can't really deal with it properly 1273s echo 'Acquire::Failure::ShowIP "false";' 1273s # randomess and tests don't play well together 1273s echo 'Acquire::IndexTargets::Randomized "false";' 1273s # fakeroot can't fake everything, so disabled in production but good for tests 1273s echo 'APT::Sandbox::Verify "true";' 1273s } >> aptconfig.conf 1273s 1273s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1273s if [ "$(id -u)" = '0' ]; then 1273s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1273s fi 1273s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 1273s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 1273s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 1273s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 1273s # Allow release files to be 10 hours in the future, rather than 10 seconds 1273s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 1273s 1273s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 1273s 1273s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 1273s confighashes 'SHA256' # these are tests, not security best-practices 1273s 1273s # Make dpkg inherit testing path 1273s echo 'DPkg::Path "";' >> aptconfig.conf 1273s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 1273s 1273s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 1273s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 1273s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 1273s fi 1273s 1273s # most tests just need one signed Release file, not both 1273s export APT_DONT_SIGN='Release.gpg' 1273s 1273s # prefer our apt binaries over the system apt binaries 1273s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 1273s } 1273s 1273s getarchitecture() { 1273s if [ "$1" = "native" -o -z "$1" ]; then 1273s eval `aptconfig shell ARCH APT::Architecture` 1273s if [ -n "$ARCH" ]; then 1273s echo $ARCH 1273s else 1273s dpkg --print-architecture 1273s fi 1273s else 1273s echo $1 1273s fi 1273s } 1273s 1273s getarchitectures() { 1273s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 1273s } 1273s 1273s getarchitecturesfromcommalist() { 1273s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 1273s } 1273s 1273s configarchitecture() { 1273s { 1273s echo "APT::Architecture \"$(getarchitecture $1)\";" 1273s while [ -n "$1" ]; do 1273s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 1273s shift 1273s done 1273s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 1273s configdpkg 1273s } 1273s 1273s configdpkg() { 1273s if [ ! -e rootdir/var/lib/dpkg/status ]; then 1273s local BASENAME="${0##*/}" 1273s local STATUSFILE="status-${BASENAME#*-}" 1273s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 1273s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 1273s # Add an empty line to the end if there is none 1273s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 1273s echo >> rootdir/var/lib/dpkg/status 1273s fi 1273s fi 1273s fi 1273s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 1273s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 1273s local ARCHS="$(getarchitectures)" 1273s local DPKGARCH="$(dpkg --print-architecture)" 1273s # this ensures that even if multi-arch isn't active in the view 1273s # of apt, given that dpkg can't be told which arch is native 1273s # the arch apt treats as native might be foreign for dpkg 1273s for ARCH in ${ARCHS}; do 1273s if [ "${ARCH}" != "${DPKGARCH}" ]; then 1273s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 1273s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 1273s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 1273s else 1273s # old-style used e.g. in Ubuntu-P – and as it seems travis 1273s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1273s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1273s fi 1273s fi 1273s fi 1273s done 1273s else 1273s # test multiarch before dpkg is ready for it… 1273s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 1273s fi 1273s } 1273s 1273s configdpkgnoopchroot() { 1273s # create a library to noop chroot() and rewrite maintainer script executions 1273s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 1273s # chroot directory dpkg could chroot into to execute the maintainer scripts 1273s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 1273s cat > noopchroot.c << EOF 1273s #define _GNU_SOURCE 1273s #include 1273s #include 1273s #include 1273s #include 1273s 1273s static char * chrootdir = NULL; 1273s 1273s int chroot(const char *path) { 1273s printf("WARNING: CHROOTing to %s was ignored!\n", path); 1273s free(chrootdir); 1273s chrootdir = strdup(path); 1273s return 0; 1273s } 1273s int execvp(const char *file, char *const argv[]) { 1273s static int (*func_execvp) (const char *, char * const []) = NULL; 1273s if (func_execvp == NULL) 1273s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 1273s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 1273s return func_execvp(file, argv); 1273s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 1273s char *newfile; 1273s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 1273s perror("asprintf"); 1273s return -1; 1273s } 1273s char const * const baseadmindir = "/var/lib/dpkg"; 1273s char *admindir; 1273s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 1273s perror("asprintf"); 1273s return -1; 1273s } 1273s setenv("DPKG_ADMINDIR", admindir, 1); 1273s return func_execvp(newfile, argv); 1273s } 1273s EOF 1273s if cc -ldl 2>&1 | grep -q dl; then 1273s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 1273s else 1273s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 1273s fi 1273s } 1273s configcompression() { 1273s if [ "$1" = 'ALL' ]; then 1273s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 1273s return 1273s fi 1273s local CMD='apthelper cat-file -C' 1273s while [ -n "$1" ]; do 1273s case "$1" in 1273s '.') printf ".\t.\tcat\n";; 1273s 'gz') printf "gzip\tgz\t$CMD $1\n";; 1273s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 1273s 'zst') printf "zstd\tzst\t$CMD $1\n";; 1273s *) printf "$1\t$1\t$CMD $1\n";; 1273s esac 1273s shift 1273s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1273s } 1273s confighashes() { 1273s { 1273s echo 'APT::FTPArchive {' 1273s { 1273s while [ -n "$1" ]; do 1273s printf "$1" | tr 'a-z' 'A-Z' 1273s printf "\t\"true\";\n" 1273s shift 1273s done 1273s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 1273s printf "$h\t\"false\";\n" 1273s done 1273s } | awk '!x[$1]++' 1273s echo '};' 1273s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 1273s } 1273s forcecompressor() { 1273s COMPRESSOR="$1" 1273s COMPRESS="$1" 1273s COMPRESSOR_CMD="apthelper cat-file -C $1" 1273s case $COMPRESSOR in 1273s gzip) COMPRESS='gz';; 1273s bzip2) COMPRESS='bz2';; 1273s zstd) COMPRESS='zst';; 1273s esac 1273s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1273s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 1273s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 1273s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1273s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 1273s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 1273s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 1273s done 1273s } 1273s 1273s _setupsimplenativepackage() { 1273s local NAME="$1" 1273s local ARCH="$2" 1273s local VERSION="$3" 1273s local RELEASE="${4:-unstable}" 1273s local DEPENDENCIES="$5" 1273s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 1273s If you find such a package installed on your system, 1273s something went horribly wrong! They are autogenerated 1273s and used only by testcases and serve no other purpose…}" 1273s 1273s local SECTION="${7:-others}" 1273s local PRIORITY="${8:-optional}" 1273s local FILE_TREE="$9" 1273s local COMPRESS_TYPE="${10:-gzip}" 1273s local DISTSECTION 1273s if [ "$SECTION" = "${SECTION#*/}" ]; then 1273s DISTSECTION="main" 1273s else 1273s DISTSECTION="${SECTION%/*}" 1273s fi 1273s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1273s 1273s mkdir -p "$BUILDDIR/debian/source" 1273s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 1273s echo "#!/bin/sh 1273s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 1273s 1273s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 1273s echo "$NAME ($VERSION) $RELEASE; urgency=low 1273s 1273s * Initial release 1273s 1273s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 1273s { 1273s echo "Source: $NAME 1273s Priority: $PRIORITY 1273s Maintainer: Joe Sixpack 1273s Standards-Version: 4.3.1 1273s Rules-Requires-Root: no" 1273s if [ "$SECTION" != '' ]; then 1273s echo "Section: $SECTION" 1273s fi 1273s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 1273s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 1273s echo " 1273s Package: $NAME" 1273s 1273s if [ "$ARCH" = 'all' ]; then 1273s echo "Architecture: all" 1273s else 1273s echo "Architecture: any" 1273s fi 1273s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 1273s test -z "$DEPS" || echo "$DEPS" 1273s printf "%b\n" "Description: $DESCRIPTION" 1273s } > "${BUILDDIR}/debian/control" 1273s 1273s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 1273s } 1273s 1273s make_tiny_rules() { 1273s local OUT="$1" 1273s if command -v gmake >/dev/null 2>&1; then 1273s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 1273s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 1273s else 1273s echo '#!/usr/bin/make -f' > "$OUT" 1273s fi 1273s echo '%:' >> "$OUT" 1273s echo ' dh $@' >> "$OUT" 1273s } 1273s 1273s setupsimplenativepackage() { 1273s _setupsimplenativepackage "$@" 1273s local NAME="$1" 1273s local VERSION="$3" 1273s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1273s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 1273s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 1273s } 1273s 1273s buildsimplenativepackage() { 1273s local NAME="$1" 1273s local ARCH="$2" 1273s local VERSION="$3" 1273s local RELEASE="${4:-unstable}" 1273s local DEPENDENCIES="$5" 1273s local DESCRIPTION="$6" 1273s local SECTION="${7:-others}" 1273s local PRIORITY="${8:-optional}" 1273s local FILE_TREE="$9" 1273s local COMPRESS_TYPE="${10:-gzip}" 1273s local DISTSECTION 1273s if [ "$SECTION" = "${SECTION#*/}" ]; then 1273s DISTSECTION="main" 1273s else 1273s DISTSECTION="${SECTION%/*}" 1273s fi 1273s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1273s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 1273s _setupsimplenativepackage "$@" 1273s cd "${BUILDDIR}/.." 1273s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 1273s cd - >/dev/null 1273s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 1273s | while read SRC; do 1273s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 1273s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 1273s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 1273s # adv --yes --default-key 'Joe Sixpack' \ 1273s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1273s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1273s # fi 1273s done 1273s 1273s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1273s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 1273s rm -rf "${BUILDDIR}/debian/tmp" 1273s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 1273s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 1273s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 1273s if [ -n "$FILE_TREE" ]; then 1273s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 1273s fi 1273s 1273s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 1273s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 1273s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 1273s # ensure the right permissions as dpkg-deb insists 1273s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 1273s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 1273s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 1273s done 1273s 1273s local NM 1273s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 1273s NM="$(echo "$NAME" | cut -c 1-4)" 1273s else 1273s NM="$(echo "$NAME" | cut -c 1)" 1273s fi 1273s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 1273s mkdir -p "$CHANGEPATH" 1273s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 1273s rm -rf "${BUILDDIR}" 1273s msgdone "info" 1273s } 1273s 1273s buildpackage() { 1273s local BUILDDIR=$1 1273s local RELEASE=$2 1273s local SECTION=$3 1273s local ARCH=$(getarchitecture $4) 1273s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 1273s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 1273s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 1273s cd "$BUILDDIR" 1273s if [ "$ARCH" = "all" ]; then 1273s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 1273s fi 1273s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 1273s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 1273s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 1273s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 1273s cd - > /dev/null 1273s for PKG in $PKGS; do 1273s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 1273s done 1273s for SRC in $SRCS; do 1273s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 1273s done 1273s } 1273s 1273s buildaptarchive() { 1273s if [ -d incoming ]; then 1273s buildaptarchivefromincoming "$@" 1273s else 1273s buildaptarchivefromfiles "$@" 1273s fi 1273s } 1273s 1273s createaptftparchiveconfig() { 1273s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 1273s local COMPRESSORS="${COMPRESSORS%* }" 1273s local ARCHS="$(getarchitectures)" 1273s cat > ftparchive.conf <> ftparchive.conf 1273s } 1273s 1273s buildaptftparchivedirectorystructure() { 1273s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 1273s for DIST in $DISTS; do 1273s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 1273s for SECTION in $SECTIONS; do 1273s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 1273s for ARCH in $ARCHS; do 1273s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 1273s done 1273s mkdir -p "dists/${DIST}/${SECTION}/source" 1273s mkdir -p "dists/${DIST}/${SECTION}/i18n" 1273s done 1273s done 1273s } 1273s 1273s insertpackage() { 1273s local RELEASES="$1" 1273s local NAME="$2" 1273s local ARCH="$3" 1273s local VERSION="$4" 1273s local DEPENDENCIES="$5" 1273s local PRIORITY="${6:-optional}" 1273s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 1273s If you find such a package installed on your system, 1273s something went horribly wrong! They are autogenerated 1273s and used only by testcases and serve no other purpose…}" 1273s local SECTION="${8:-other}" 1273s 1273s if [ "$SECTION" = "${SECTION#*/}" ]; then 1273s DISTSECTION="main" 1273s else 1273s DISTSECTION="${SECTION%/*}" 1273s fi 1273s local ARCHS="" 1273s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1273s if [ "$RELEASE" = 'installed' ]; then 1273s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 1273s continue 1273s fi 1273s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1273s if [ "$arch" = 'none' ]; then 1273s ARCHS="$(getarchitectures)" 1273s else 1273s ARCHS="$arch" 1273s fi 1273s for BUILDARCH in $ARCHS; do 1273s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 1273s mkdir -p "$PPATH" 1273s { 1273s echo "Package: $NAME 1273s Priority: $PRIORITY 1273s Section: $SECTION 1273s Installed-Size: 42 1273s Size: 42" 1273s if echo "$DEPENDENCIES" | grep -q SHA256:; then 1273s : 1273s else 1273s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 1273s fi 1273s echo "Maintainer: Joe Sixpack " 1273s test "$arch" = 'none' || echo "Architecture: $arch" 1273s echo "Version: $VERSION 1273s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 1273s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 1273s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 1273s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 1273s echo 1273s } >> "${PPATH}/Packages" 1273s done 1273s done 1273s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 1273s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 1273s echo "Package: $NAME 1273s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 1273s Description-en: $DESCRIPTION 1273s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 1273s done 1273s } 1273s 1273s insertsource() { 1273s local RELEASES="$1" 1273s local NAME="$2" 1273s local ARCH="$3" 1273s local VERSION="$4" 1273s local DEPENDENCIES="$5" 1273s local BINARY="${6:-$NAME}" 1273s local ARCHS="" 1273s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1273s local SPATH="aptarchive/dists/${RELEASE}/main/source" 1273s mkdir -p $SPATH 1273s local FILE="${SPATH}/Sources" 1273s local DSCFILE="${NAME}_${VERSION}.dsc" 1273s local TARFILE="${NAME}_${VERSION}.tar.gz" 1273s echo "Package: $NAME 1273s Binary: $BINARY 1273s Version: $VERSION 1273s Maintainer: Joe Sixpack 1273s Architecture: $ARCH" >> $FILE 1273s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1273s echo "Files: 1273s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1273s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1273s Checksums-Sha256: 1273s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1273s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1273s " >> "$FILE" 1273s done 1273s } 1273s 1273s insertinstalledpackage() { 1273s local NAME="$1" 1273s local ARCH="$2" 1273s local VERSION="$3" 1273s local DEPENDENCIES="$4" 1273s local PRIORITY="${5:-optional}" 1273s local STATUS="${6:-install ok installed}" 1273s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 1273s If you find such a package installed on your system, 1273s something went horribly wrong! They are autogenerated 1273s and used only by testcases and serve no other purpose…}" 1273s local SECTION="${8:-other}" 1273s 1273s local FILE='rootdir/var/lib/dpkg/status' 1273s local INFO='rootdir/var/lib/dpkg/info' 1273s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1273s echo "Package: $NAME 1273s Status: $STATUS 1273s Priority: $PRIORITY 1273s Section: $SECTION 1273s Installed-Size: 42 1273s Maintainer: Joe Sixpack 1273s Version: $VERSION" >> "$FILE" 1273s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 1273s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1273s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 1273s echo >> "$FILE" 1273s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 1273s echo -n > "${INFO}/${NAME}:${arch}.list" 1273s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 1273s else 1273s echo -n > "${INFO}/${NAME}.list" 1273s echo -n > "${INFO}/${NAME}.md5sums" 1273s fi 1273s done 1273s } 1273s 1273s 1273s buildaptarchivefromincoming() { 1273s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 1273s cd aptarchive 1273s [ -e pool ] || ln -s ../incoming pool 1273s [ -e ftparchive.conf ] || createaptftparchiveconfig 1273s [ -e dists ] || buildaptftparchivedirectorystructure 1273s msgninfo "\tGenerate Packages, Sources and Contents files… " 1273s testsuccess aptftparchive generate ftparchive.conf 1273s cd - > /dev/null 1273s msgdone "info" 1273s generatereleasefiles "$@" 1273s } 1273s 1273s buildaptarchivefromfiles() { 1273s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 1273s local DIR='aptarchive' 1273s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 1273s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 1273s msgninfo "\t${line} file… " 1273s compressfile "$line" "$1" 1273s msgdone "info" 1273s done 1273s generatereleasefiles "$@" 1273s } 1273s 1273s compressfile() { 1273s while read compressor extension command; do 1273s if [ "$compressor" = '.' ]; then 1273s if [ -n "$2" ]; then 1273s touch -d "$2" "$1" 1273s fi 1273s continue 1273s fi 1273s cat "$1" | $command > "${1}.${extension}" 1273s if [ -n "$2" ]; then 1273s touch -d "$2" "${1}.${extension}" 1273s fi 1273s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1273s } 1273s 1273s # can be overridden by testcases for their pleasure 1273s getcodenamefromsuite() { 1273s case "$1" in 1273s unstable) echo 'sid';; 1273s *) echo -n "$1";; 1273s esac 1273s } 1273s getreleaseversionfromsuite() { true; } 1273s getlabelfromsuite() { true; } 1273s getoriginfromsuite() { true; } 1273s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 1273s getnotautomaticfromsuite() { 1273s case "$1" in 1273s experimental|experimental2) echo "yes";; 1273s esac 1273s } 1273s getbutautomaticupgradesfromsuite() { true; } 1273s 1273s aptftparchiverelease() { 1273s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 1273s } 1273s generatereleasefiles() { 1273s # $1 is the Date header and $2 is the ValidUntil header to be set 1273s # both should be given in notation date/touch can understand 1273s local DATE="$1" 1273s local VALIDUNTIL="$2" 1273s if [ -e aptarchive/dists ]; then 1273s msgninfo "\tGenerate Release files for dists… " 1273s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 1273s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 1273s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 1273s local CODENAME="$(getcodenamefromsuite $SUITE)" 1273s local VERSION="$(getreleaseversionfromsuite $SUITE)" 1273s local LABEL="$(getlabelfromsuite $SUITE)" 1273s local ORIGIN="$(getoriginfromsuite $SUITE)" 1273s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 1273s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 1273s aptftparchiverelease "$dir" \ 1273s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 1273s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 1273s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 1273s -o APT::FTPArchive::Release::Label="${LABEL}" \ 1273s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 1273s -o APT::FTPArchive::Release::Version="${VERSION}" \ 1273s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 1273s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 1273s > "$dir/Release" 1273s done 1273s else 1273s msgninfo "\tGenerate Release files for flat… " 1273s aptftparchiverelease ./aptarchive > aptarchive/Release 1273s fi 1273s if [ -n "$VALIDUNTIL" ]; then 1273s sed -i "/^Date: / a\ 1273s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 1273s fi 1273s if [ -n "$DATE" -a "$DATE" != "now" ]; then 1273s for release in $(find ./aptarchive -name 'Release'); do 1273s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 1273s touch -d "$DATE" "$release" 1273s done 1273s fi 1273s msgdone "info" 1273s } 1273s 1273s setupdistsaptarchive() { 1273s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1273s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 1273s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 1273s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 1273s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 1273s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 1273s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 1273s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 1273s msgdone "info" 1273s done 1273s } 1273s 1273s setupflataptarchive() { 1273s local APTARCHIVE="$(readlink -f ./aptarchive)" 1273s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1273s if [ -f "${APTARCHIVE}/Packages" ]; then 1273s msgninfo "\tadd deb sources.list line… " 1273s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1273s msgdone 'info' 1273s else 1273s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1273s fi 1273s if [ -f "${APTARCHIVE}/Sources" ]; then 1273s msgninfo "\tadd deb-src sources.list line… " 1273s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1273s msgdone 'info' 1273s else 1273s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1273s fi 1273s } 1273s 1273s setupaptarchive() { 1273s local NOUPDATE=0 1273s if [ "$1" = '--no-update' ]; then 1273s NOUPDATE=1 1273s shift 1273s fi 1273s buildaptarchive "$@" 1273s if [ -e aptarchive/dists ]; then 1273s setupdistsaptarchive 1273s else 1273s setupflataptarchive 1273s fi 1273s signreleasefiles 'Joe Sixpack' 1273s if [ "1" != "$NOUPDATE" ]; then 1273s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 1273s fi 1273s } 1273s 1273s killgpgagent() { 1273s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 1273s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1273s if [ ! -e "${GPGHOME}" ]; then return; fi 1273s # ensure the agent dies quickly as different versions have different suicide heuristics 1273s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 1273s rm -rf "$GPGHOME" 1273s } 1273s dosigning() { 1273s local KEY="$1" 1273s shift 1273s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1273s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 1273s GPGHOME="$APT_TEST_SIGNINGHOME" 1273s else 1273s if [ ! -e "$GPGHOME" ]; then 1273s mkdir -p --mode=700 "${GPGHOME}" 1273s addtrap 'prefix' 'killgpgagent;' 1273s fi 1273s fi 1273s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 1273s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1273s "$@" 1273s } 1273s signreleasefiles() { 1273s local SIGNERS="${1:-Joe Sixpack}" 1273s local REPODIR="${2:-aptarchive}" 1273s if [ -n "$1" ]; then shift; fi 1273s if [ -n "$1" ]; then shift; fi 1273s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1273s msgninfo "\tSign archive with $SIGNERS key $KEY… " 1273s local REXKEY='keys/rexexpired' 1273s local SECEXPIREBAK="${REXKEY}.sec.bak" 1273s local PUBEXPIREBAK="${REXKEY}.pub.bak" 1273s local SIGUSERS="" 1273s while [ -n "${SIGNERS%%,*}" ]; do 1273s local SIGNER="${SIGNERS%%,*}" 1273s if [ "${SIGNERS}" = "${SIGNER}" ]; then 1273s SIGNERS="" 1273s fi 1273s SIGNERS="${SIGNERS#*,}" 1273s # FIXME: This should be the full name, but we can't encode the space properly currently 1273s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 1273s if [ "${SIGNER}" = 'Rex Expired' ]; then 1273s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 1273s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 1273s # therefore we 'temporary' make the key not expired and restore a backup after signing 1273s cp "${REXKEY}.sec" "$SECEXPIREBAK" 1273s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 1273s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 1273s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 1273s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 1273s cp "$SECUNEXPIRED" "${REXKEY}.sec" 1273s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 1273s else 1273s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 1273s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1273s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 1273s cat setexpire.gpg 1273s exit 1 1273s fi 1273s cp "${REXKEY}.sec" "$SECUNEXPIRED" 1273s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 1273s fi 1273s fi 1273s if [ ! -e "${KEY}.pub" ]; then 1273s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1273s cat "${K}.pub" >> "${KEY}.new.pub" 1273s cat "${K}.sec" >> "${KEY}.new.sec" 1273s fi 1273s done 1273s if [ ! -e "${KEY}.pub" ]; then 1273s mv "${KEY}.new.pub" "${KEY}.pub" 1273s mv "${KEY}.new.sec" "${KEY}.sec" 1273s fi 1273s for RELEASE in $(find "${REPODIR}/" -name Release); do 1273s # we might have set a specific date for the Release file, so copy it 1273s local DATE="$(stat --format "%y" "${RELEASE}")" 1273s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 1273s rm -f "${RELEASE}.gpg" 1273s else 1273s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 1273s touch -d "$DATE" "${RELEASE}.gpg" 1273s fi 1273s local INRELEASE="${RELEASE%/*}/InRelease" 1273s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 1273s rm -f "$INRELEASE" 1273s else 1273s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 1273s touch -d "$DATE" "${INRELEASE}" 1273s fi 1273s done 1273s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 1273s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 1273s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 1273s fi 1273s msgdone 'info' 1273s } 1273s 1273s redatereleasefiles() { 1273s local DATE="$(date -u -d "$1" -R)" 1273s for release in $(find aptarchive/ -name 'Release'); do 1273s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 1273s touch -d "$DATE" "$release" 1273s done 1273s signreleasefiles "${2:-Joe Sixpack}" 1273s } 1273s 1273s webserverconfig() { 1273s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 1273s local NOCHECK=false 1273s if [ "$1" = '--no-check' ]; then 1273s NOCHECK=true 1273s shift 1273s fi 1273s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 1273s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 1273s rm -f "$STATUS" "$DOWNLOG" 1273s local URI 1273s if [ -n "$2" ]; then 1273s msgtest "Set webserver config option '${1}' to" "$2" 1273s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 1273s else 1273s msgtest 'Clear webserver config option' "${1}" 1273s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 1273s fi 1273s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 1273s msgpass 1273s else 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 1273s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 1273s msgfailoutput '' "$OUTPUT" 1273s fi 1273s $NOCHECK || testwebserverlaststatuscode '200' 1273s } 1273s 1273s rewritesourceslist() { 1273s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 1273s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 1273s sed -i $LIST \ 1273s -e "s#file://$APTARCHIVE#${1}#" \ 1273s -e "s#file:$APTARCHIVE#${1}#" \ 1273s -e "s#copy://$APTARCHIVE#${1}#" \ 1273s -e "s#copy:$APTARCHIVE#${1}#" \ 1273s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 1273s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 1273s done 1273s } 1273s 1273s # wait for up to 10s for a pid file to appear to avoid possible race 1273s # when a helper is started and doesn't write the PID quick enough 1273s waitforpidfile() { 1273s local PIDFILE="$1" 1273s for i in $(seq 10); do 1273s if test -s "$PIDFILE"; then 1273s return 0 1273s fi 1273s sleep 1 1273s done 1273s msgdie "waiting for $PIDFILE failed" 1273s return 1 1273s } 1273s 1273s changetowebserver() { 1273s local REWRITE='yes' 1273s if [ "$1" = '--no-rewrite' ]; then 1273s REWRITE='no' 1273s shift 1273s fi 1273s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 1273s cd aptarchive 1273s local LOG="webserver.log" 1273s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 1273s cat "$LOG" 1273s false 1273s fi 1273s waitforpidfile aptwebserver.pid 1273s local PID="$(cat aptwebserver.pid)" 1273s if [ -z "$PID" ]; then 1273s msgdie 'Could not fork aptwebserver successfully' 1273s fi 1273s addtrap "kill $PID;" 1273s waitforpidfile aptwebserver.port 1273s APTHTTPPORT="$(cat aptwebserver.port)" 1273s if [ -z "$APTHTTPPORT" ]; then 1273s msgdie 'Could not get port for aptwebserver successfully' 1273s fi 1273s cd - > /dev/null 1273s else 1273s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 1273s fi 1273s if [ "$REWRITE" != 'no' ]; then 1273s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 1273s fi 1273s } 1273s 1273s changetohttpswebserver() { 1273s local REWRITE='yes' 1273s if [ "$1" = '--no-rewrite' ]; then 1273s REWRITE='no' 1273s shift 1273s fi 1273s local stunnel4 1273s if command -v stunnel4 >/dev/null 2>&1; then 1273s stunnel4=stunnel4 1273s elif command -v stunnel >/dev/null 2>&1; then 1273s stunnel4=stunnel 1273s else 1273s msgdie 'You need to install stunnel4 for https testcases' 1273s fi 1273s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 1273s changetowebserver --no-rewrite "$@" 1273s fi 1273s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 1273s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 1273s output = /dev/null 1273s 1273s [https] 1273s accept = 127.0.0.1:0 1273s connect = $APTHTTPPORT 1273s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 1273s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 1273s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 1273s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 1273s if [ -z "$PID" ]; then 1273s msgdie 'Could not fork $stunnel4 successfully' 1273s fi 1273s addtrap 'prefix' "kill ${PID};" 1273s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 1273s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 1273s if [ "$REWRITE" != 'no' ]; then 1273s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 1273s fi 1273s } 1273s 1273s changetocdrom() { 1273s mkdir -p rootdir/media/cdrom/.disk 1273s local CD="$(readlink -f rootdir/media/cdrom)" 1273s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 1273s if [ ! -d aptarchive/dists ]; then 1273s msgdie 'Flat file archive cdroms can not be created currently' 1273s return 1 1273s fi 1273s mv aptarchive/dists "$CD" 1273s ln -s "$(readlink -f ./incoming)" "$CD/pool" 1273s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 1273s # start with an unmounted disk 1273s mv "${CD}" "${CD}-unmounted" 1273s # we don't want the disk to be modifiable 1273s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 1273s chmod -R 555 rootdir/media/cdrom-unmounted/dists 1273s } 1273s 1273s downloadfile() { 1273s local PROTO="${1%%:*}" 1273s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 1273s download-file "$1" "$2" "$3" 2>&1 ; then 1273s return 1 1273s fi 1273s # only if the file exists the download was successful 1273s if [ -r "$2" ]; then 1273s return 0 1273s else 1273s return 1 1273s fi 1273s } 1273s 1273s cleanup_output() { 1273s cat "$1" | sed \ 1273s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 1273s -e '/^profiling:/ d' \ 1273s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 1273s >"$2" 1273s } 1273s 1273s checkdiff() { 1273s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 1273s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 1273s touch "$TMPFILE1" "$TMPFILE2" 1273s 1273s cleanup_output "$1" "$TMPFILE1" 1273s cleanup_output "$2" "$TMPFILE2" 1273s 1273s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 1273s if [ -n "$DIFFTEXT" ]; then 1273s echo >&2 1273s echo >&2 "$DIFFTEXT" 1273s return 1 1273s else 1273s return 0 1273s fi 1273s } 1273s 1273s testoutputequal() { 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 1273s local COMPAREFILE="$1" 1273s shift 1273s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 1273s msgpass 1273s else 1273s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 1273s cat "$COMPAREFILE" >>"${OUTPUT}" 1273s msgfailoutput '' "$OUTPUT" "$@" 1273s fi 1273s } 1273s 1273s testfileequal() { 1273s msggroup 'testfileequal' 1273s local MSG='Test for correctness of file' 1273s if [ "$1" = '--nomsg' ]; then 1273s MSG='' 1273s shift 1273s fi 1273s local FILE="$1" 1273s shift 1273s if [ -n "$MSG" ]; then 1273s msgtest "$MSG" "$FILE" 1273s fi 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 1273s if [ -z "$*" ]; then 1273s testoutputequal "$FILE" echo -n '' 1273s else 1273s testoutputequal "$FILE" echo "$*" 1273s fi 1273s msggroup 1273s } 1273s 1273s testempty() { 1273s msggroup 'testempty' 1273s if [ "$1" = '--nomsg' ]; then 1273s shift 1273s else 1273s msgtest "Test for no output of" "$*" 1273s fi 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 1273s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 1273s msgpass 1273s else 1273s msgfailoutput '' "$COMPAREFILE" "$@" 1273s fi 1273s aptautotest 'testempty' "$@" 1273s msggroup 1273s } 1273s testwarningempty() { 1273s testwarning "$@" 1273s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 1273s } 1273s testnotempty() { 1273s msggroup 'testnotempty' 1273s msgtest "Test for some output of" "$*" 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 1273s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 1273s msgpass 1273s else 1273s msgfailoutput '' "$COMPAREFILE" "$@" 1273s fi 1273s aptautotest 'testnotempty' "$@" 1273s msggroup 1273s } 1273s 1273s testequal() { 1273s msggroup 'testequal' 1273s local MSG='Test of equality of' 1273s if [ "$1" = '--nomsg' ]; then 1273s MSG='' 1273s shift 1273s fi 1273s 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 1273s echo "$1" > "$COMPAREFILE" 1273s shift 1273s 1273s if [ -n "$MSG" ]; then 1273s msgtest "$MSG" "$*" 1273s fi 1273s testoutputequal "$COMPAREFILE" "$@" 1273s aptautotest 'testequal' "$@" 1273s msggroup 1273s } 1273s 1273s testequalor2() { 1273s msggroup 'testequalor2' 1273s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 1273s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 1273s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 1273s echo "$1" > "$COMPAREFILE1" 1273s echo "$2" > "$COMPAREFILE2" 1273s shift 2 1273s msgtest "Test for equality OR of" "$*" 1273s "$@" >"$COMPAREAGAINST" 2>&1 || true 1273s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 1273s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 1273s then 1273s msgpass 1273s else 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 1273s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 1273s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1273s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 1273s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1273s msgfailoutput '' "$OUTPUT" 1273s fi 1273s aptautotest 'testequalor2' "$@" 1273s msggroup 1273s } 1273s 1273s testshowvirtual() { 1273s msggroup 'testshowvirtual' 1273s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 1273s local PACKAGE="$1" 1273s shift 1273s while [ -n "$1" ]; do 1273s VIRTUAL="${VIRTUAL} 1273s N: Can't select versions from package '$1' as it is purely virtual" 1273s PACKAGE="${PACKAGE} $1" 1273s shift 1273s done 1273s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 1273s VIRTUAL="${VIRTUAL} 1273s N: No packages found" 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 1273s local ARCH="$(getarchitecture 'native')" 1273s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 1273s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 1273s msggroup 1273s } 1273s 1273s testnopackage() { 1273s msggroup 'testnopackage' 1273s msgtest "Test for non-existent packages" "apt-cache show $*" 1273s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 1273s if [ -n "$SHOWPKG" ]; then 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1273s echo "$SHOWPKG" >"$OUTPUT" 1273s msgfailoutput '' "$OUTPUT" 1273s else 1273s msgpass 1273s fi 1273s msggroup 1273s } 1273s testnosrcpackage() { 1273s msggroup 'testnosrcpackage' 1273s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 1273s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 1273s if [ -n "$SHOWPKG" ]; then 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 1273s echo "$SHOWPKG" >"$OUTPUT" 1273s msgfailoutput '' "$OUTPUT" 1273s else 1273s msgpass 1273s fi 1273s msggroup 1273s } 1273s 1273s testdpkgstatus() { 1273s msggroup 'testdpkgstatus' 1273s local STATE="$1" 1273s local NR="$2" 1273s shift 2 1273s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 1273s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 1273s if [ "$PKGS" != $NR ]; then 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1273s echo "$PKGS" >"$OUTPUT" 1273s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 1273s msgfailoutput '' "$OUTPUT" 1273s else 1273s msgpass 1273s fi 1273s msggroup 1273s } 1273s 1273s testdpkginstalled() { 1273s msggroup 'testdpkginstalled' 1273s testdpkgstatus 'ii' "$#" "$@" 1273s msggroup 1273s } 1273s 1273s testdpkgnotinstalled() { 1273s msggroup 'testdpkgnotinstalled' 1273s testdpkgstatus 'ii' '0' "$@" 1273s msggroup 1273s } 1273s 1273s testmarkedauto() { 1273s msggroup 'testmarkedauto' 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 1273s if [ -n "$1" ]; then 1273s msgtest 'Test for correctly marked as auto-installed' "$*" 1273s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1273s else 1273s msgtest 'Test for correctly marked as auto-installed' 'no package' 1273s echo -n > "$COMPAREFILE" 1273s fi 1273s testoutputequal "$COMPAREFILE" aptmark showauto 1273s msggroup 1273s } 1273s testmarkedmanual() { 1273s msggroup 'testmarkedmanual' 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 1273s if [ -n "$1" ]; then 1273s msgtest 'Test for correctly marked as manually installed' "$*" 1273s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1273s else 1273s msgtest 'Test for correctly marked as manually installed' 'no package' 1273s echo -n > "$COMPAREFILE" 1273s fi 1273s testoutputequal "$COMPAREFILE" aptmark showmanual 1273s msggroup 1273s } 1273s 1273s catfile() { 1273s if [ "${1##*.}" = 'deb' ]; then 1273s stat >&2 "$1" || true 1273s file >&2 "$1" || true 1273s else 1273s cat >&2 "$1" || true 1273s fi 1273s } 1273s msgfailoutput() { 1273s msgreportheader 'msgfailoutput' 1273s local MSG="$1" 1273s local OUTPUT="$2" 1273s shift 2 1273s local CMD="$1" 1273s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 1273s echo >&2 1273s while [ -n "$2" ]; do shift; done 1273s echo "#### Complete file: $1 ####" 1273s catfile "$1" 1273s echo "#### $CMD output ####" 1273s elif [ "$1" = 'test' ]; then 1273s echo >&2 1273s # doesn't support ! or non-file flags 1273s msgfailoutputstatfile() { 1273s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 1273s if expr match "$1" "$FILEFLAGS" >/dev/null; then 1273s echo "#### stat(2) of file: $2 ####" 1273s stat "$2" || true 1273s if test -d "$2"; then 1273s echo "#### The directory contains: $2 ####" 1273s ls >&2 "$2" || true 1273s elif test -e "$2"; then 1273s echo "#### Complete file: $2 ####" 1273s catfile "$2" 1273s fi 1273s fi 1273s } 1273s msgfailoutputstatfile "$2" "$3" 1273s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 1273s shift 3 1273s msgfailoutputstatfile "$2" "$3" 1273s done 1273s echo '#### test output ####' 1273s elif [ "$1" = 'cmp' ]; then 1273s echo >&2 1273s while [ -n "$2" ]; do 1273s echo "#### Complete file: $2 ####" 1273s catfile "$2" 1273s shift 1273s done 1273s echo '#### cmp output ####' 1273s elif [ "$1" = 'rm' ]; then 1273s echo "#### Directory listing of: $(pwd) ####" 1273s ls -l 1273s fi 1273s catfile "$OUTPUT" 1273s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 1273s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 1273s local COREEXE='' 1273s for CORENAME in 'core' 'core.pid'; do 1273s if [ -s "$CORENAME" ]; then 1273s cp -a ${CORENAME} "$COREDUMP" 1273s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 1273s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 1273s else 1273s continue 1273s fi 1273s break 1273s done 1273s if [ -s "$COREDUMP" ]; then 1273s true # found already as a file 1273s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 1273s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 1273s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 1273s else 1273s echo '### core dump not found ###' 1273s cat /proc/sys/kernel/core_pattern 1273s fi 1273s if [ -s "$COREDUMP" ]; then 1273s if [ -z "$COREEXE" ]; then 1273s case "$CMD" in 1273s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1273s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 1273s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 1273s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 1273s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 1273s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1273s esac 1273s fi 1273s 1273s if [ -d "${ARTIFACTSDIR}" ]; then 1273s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 1273s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 1273s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 1273s fi 1273s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 1273s echo "#### gdb backtrace ####" 1273s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 1273s fi 1273s fi 1273s rm -f "$COREDUMP" 1273s fi 1273s msgfail "$MSG" 1273s } 1273s 1273s testsuccesswithglobalerror() { 1273s local TYPE="$1" 1273s local ERRORS="$2" 1273s shift 2 1273s msggroup "$TYPE" 1273s if [ "$1" = '--nomsg' ]; then 1273s shift 1273s else 1273s msgtest 'Test for successful execution of' "$*" 1273s fi 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 1273s if "$@" >"${OUTPUT}" 2>&1; then 1273s if expr match "$1" '^apt.*' >/dev/null; then 1273s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1273s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1273s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 1273s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 1273s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 1273s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1273s msgpass 1273s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 1273s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1273s msgpass 1273s else 1273s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1273s fi 1273s else 1273s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1273s fi 1273s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 1273s if grep -q -E "^N: " "$OUTPUT"; then 1273s msgpass 1273s else 1273s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 1273s fi 1273s else 1273s msgpass 1273s fi 1273s else 1273s msgpass 1273s fi 1273s else 1273s local EXITCODE=$? 1273s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1273s fi 1273s aptautotest "$TYPE" "$@" 1273s msggroup 1273s } 1273s testsuccesswithnotice() { 1273s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 1273s } 1273s testsuccess() { 1273s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 1273s } 1273s testwarning() { 1273s msggroup 'testwarning' 1273s if [ "$1" = '--nomsg' ]; then 1273s shift 1273s else 1273s msgtest 'Test for successful execution with warnings of' "$*" 1273s fi 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 1273s if "$@" >"${OUTPUT}" 2>&1; then 1273s if expr match "$1" '^apt.*' >/dev/null; then 1273s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1273s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1273s elif grep -q -E '^E: ' "$OUTPUT"; then 1273s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 1273s elif ! grep -q -E '^W: ' "$OUTPUT"; then 1273s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 1273s else 1273s msgpass 1273s fi 1273s else 1273s msgpass 1273s fi 1273s else 1273s local EXITCODE=$? 1273s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1273s fi 1273s aptautotest 'testwarning' "$@" 1273s msggroup 1273s } 1273s testfailure() { 1273s msggroup 'testfailure' 1273s if [ "$1" = '--nomsg' ]; then 1273s shift 1273s else 1273s msgtest 'Test for failure in execution of' "$*" 1273s fi 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 1273s if "$@" >"${OUTPUT}" 2>&1; then 1273s local EXITCODE=$? 1273s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1273s else 1273s local EXITCODE=$? 1273s if expr match "$1" '^apt.*' >/dev/null; then 1273s if [ "$1" = 'aptkey' ]; then 1273s if grep -q " Can't check signature: 1273s BAD signature from 1273s signature could not be verified" "$OUTPUT"; then 1273s msgpass 1273s else 1273s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 1273s fi 1273s else 1273s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1273s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1273s elif grep -q -E '==ERROR' "$OUTPUT"; then 1273s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 1273s elif ! grep -q -E '^E: ' "$OUTPUT"; then 1273s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 1273s else 1273s msgpass 1273s fi 1273s fi 1273s else 1273s msgpass 1273s fi 1273s fi 1273s aptautotest 'testfailure' "$@" 1273s msggroup 1273s } 1273s 1273s testreturnstateequal() { 1273s local STATE="$1" 1273s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 1273s local STATE="$2" 1273s local TYPE="$3" 1273s shift 3 1273s msggroup "${STATE}equal" 1273s if [ "$1" != '--nomsg' ]; then 1273s local CMP="$1" 1273s shift 1273s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1273s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1273s else 1273s local CMP="$2" 1273s shift 2 1273s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1273s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1273s fi 1273s else 1273s msggroup "${STATE}equal" 1273s if [ "$2" != '--nomsg' ]; then 1273s local CMP="$2" 1273s shift 2 1273s "$STATE" "$@" 1273s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1273s else 1273s local CMP="$3" 1273s shift 3 1273s "$STATE" --nomsg "$@" 1273s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1273s fi 1273s fi 1273s msggroup 1273s } 1273s testsuccessequal() { 1273s # we compare output, so we know perfectly well about N: 1273s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 1273s } 1273s testwarningequal() { 1273s testreturnstateequal 'testwarning' "$@" 1273s } 1273s testfailureequal() { 1273s testreturnstateequal 'testfailure' "$@" 1273s } 1273s 1273s testfailuremsg() { 1273s msggroup 'testfailuremsg' 1273s local CMP="$1" 1273s shift 1273s testfailure "$@" 1273s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 1273s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 1273s testoutputequal "$COMPAREFILE" echo "$CMP" 1273s msggroup 1273s } 1273s testwarningmsg() { 1273s msggroup 'testwarningmsg' 1273s local CMP="$1" 1273s shift 1273s testwarning "$@" 1273s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 1273s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 1273s testoutputequal "$COMPAREFILE" echo "$CMP" 1273s msggroup 1273s } 1273s 1273s testfilestats() { 1273s msggroup 'testfilestats' 1273s msgtest "Test that file $1 has $2 $3" "$4" 1273s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 1273s msgpass 1273s else 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 1273s { 1273s echo 1273s ls -ld "$1" || true 1273s echo -n "stat(1) reports for $2: " 1273s stat --format "$2" "$1" || true 1273s } >"$OUTPUT" 2>&1 1273s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 1273s fi 1273s msggroup 1273s } 1273s testaccessrights() { 1273s msggroup 'testaccessrights' 1273s testfilestats "$1" '%a' '=' "$2" 1273s msggroup 1273s } 1273s 1273s testwebserverlaststatuscode() { 1273s msggroup 'testwebserverlaststatuscode' 1273s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 1273s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 1273s rm -f "$DOWNLOG" "$STATUS" 1273s msgtest 'Test last status code from the webserver was' "$1" 1273s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 1273s msgpass 1273s else 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 1273s { 1273s if [ -n "$2" ]; then 1273s shift 1273s echo >&2 '#### Additionally provided output files contain:' 1273s cat >&2 "$@" 1273s fi 1273s echo >&2 '#### Download log of the status code:' 1273s cat >&2 "$DOWNLOG" 1273s } >"$OUTPUT" 2>&1 1273s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 1273s fi 1273s msggroup 1273s } 1273s 1273s mapkeynametokeyid() { 1273s while [ -n "$1" ]; do 1273s case "$1" in 1273s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 1273s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 1273s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 1273s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 1273s oldarchive) echo 'FDD2DB85F68C85A3';; 1273s *) echo 'UNKNOWN KEY';; 1273s esac 1273s shift 1273s done 1273s } 1273s testaptkeys() { 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 1273s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 1273s echo -n > "$OUTPUT" 1273s fi 1273s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 1273s } 1273s 1273s pause() { 1273s echo "STOPPED execution. Press enter to continue" 1273s local IGNORE 1273s read IGNORE 1273s } 1273s 1273s logcurrentarchivedirectory() { 1273s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 1273s stat --format '%U:%G:%a:%n' "$line" 1273s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 1273s } 1273s listcurrentlistsdirectory() { 1273s { 1273s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 1273s stat --format '%U:%G:%a:%n' "$line" 1273s done 1273s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 1273s stat --format '%U:%G:%a:%s:%y:%n' "$line" 1273s done 1273s } | sort 1273s } 1273s forallsupportedcompressors() { 1273s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1273s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1273s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 1273s "$@" "$COMP" 1273s done 1273s } 1273s 1273s breakfiles() { 1273s while [ -n "$1" ]; do 1273s mv -f "${1}" "${1}.bak" 1273s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 1273s shift 1273s done 1273s } 1273s unbreakfiles() { 1273s while [ -n "$1" ]; do 1273s mv -f "${1}.bak" "${1}" 1273s shift 1273s done 1273s } 1273s 1273s ### convenience hacks ### 1273s mkdir() { 1273s # creating some directories by hand is a tedious task, so make it look simple 1273s local PARAMS="$*" 1273s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 1273s # only the last directory created by mkdir is effected by the -m ! 1273s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 1273s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 1273s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1273s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1273s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 1273s if [ "$(id -u)" = '0' ]; then 1273s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1273s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1273s fi 1273s else 1273s command mkdir "$@" 1273s fi 1273s } 1273s 1273s ### The following tests are run by most test methods automatically to check 1273s ### general things about commands executed without writing the test every time. 1273s 1273s aptautotest() { 1273s if [ $# -lt 3 ]; then return; fi 1273s local TESTCALL="$1" 1273s local CMD="$2" 1273s local FIRSTOPT="$3" 1273s shift 2 1273s for i in "$@"; do 1273s if ! expr match "$i" '^-' >/dev/null 2>&1; then 1273s FIRSTOPT="$i" 1273s break 1273s fi 1273s done 1273s shift 1273s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 1273s if command -v $AUTOTEST >/dev/null; then 1273s # save and restore the *.output files from other tests 1273s # as we might otherwise override them in these automatic tests 1273s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1273s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1273s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1273s $AUTOTEST "$TESTCALL" "$@" 1273s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1273s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1273s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1273s fi 1273s } 1273s 1273s cdfind() { 1273s ( cd /; find "$@" ) 1273s } 1273s aptautotest_aptget_update() { 1273s local TESTCALL="$1" 1273s while [ -n "$2" ]; do 1273s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 1273s shift 1273s done 1273s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 1273s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1273s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1273s # all copied files are properly chmodded 1273s local backupIFS="$IFS" 1273s IFS="$(printf "\n\b")" 1273s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 1273s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 1273s done 1273s IFS="$backupIFS" 1273s if [ "$TESTCALL" = 'testsuccess' ]; then 1273s # failure cases can retain partial files and such 1273s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 1273s fi 1273s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 1273s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 1273s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 1273s fi 1273s } 1273s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 1273s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 1273s 1273s testaptautotestnodpkgwarning() { 1273s local TESTCALL="$1" 1273s while [ -n "$2" ]; do 1273s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 1273s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 1273s shift 1273s done 1273s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 1273s } 1273s 1273s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 1273s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 1273s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 1273s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 1273s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 1273s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 1273s 1273s testaptmarknodefaultsections() { 1273s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 1273s } 1273s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 1273s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 1273s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 1273s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 1273s cat: ./downloaded/foo1: No such file or directory 1273s cmp: ./downloaded/foo1: No such file or directory 1273s FAIL: exitcode 2 1273s 1273s cat: ./downloaded/foo1: No such file or directory 1273s #!/bin/sh -- # no runable script, just for vi 1273s 1273s EXIT_CODE=0 1273s 1273s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 1273s if [ "$1" = "-q" ]; then 1273s export MSGLEVEL=2 1273s elif [ "$1" = "-qq" ]; then 1273s export MSGLEVEL=1 1273s elif [ "$1" = "-v" ]; then 1273s export MSGLEVEL=4 1273s elif [ "$1" = '--color=no' ]; then 1273s export MSGCOLOR='NO' 1273s elif [ "$1" = '--color=yes' ]; then 1273s export MSGCOLOR='YES' 1273s elif [ "$1" = '--color' ]; then 1273s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 1273s shift 1273s elif [ "$1" = '--level' ]; then 1273s export MSGLEVEL=$2 1273s shift 1273s else 1273s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 1273s fi 1273s shift 1273s done 1273s export MSGLEVEL="${MSGLEVEL:-3}" 1273s 1273s # we all like colorful messages 1273s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 1273s if [ ! -t 1 ]; then # but check that we output to a terminal 1273s export MSGCOLOR='NO' 1273s fi 1273s fi 1273s 1273s if [ "$MSGCOLOR" != 'NO' ]; then 1273s CERROR="\033[1;31m" # red 1273s CWARNING="\033[1;33m" # yellow 1273s CMSG="\033[1;32m" # green 1273s CINFO="\033[1;96m" # light blue 1273s CDEBUG="\033[1;94m" # blue 1273s CNORMAL="\033[0;39m" # default system console color 1273s CDONE="\033[1;32m" # green 1273s CPASS="\033[1;32m" # green 1273s CFAIL="\033[1;31m" # red 1273s CCMD="\033[1;35m" # pink 1273s fi 1273s 1273s msgprintf() { 1273s local START="$1" 1273s local MIDDLE="$2" 1273s local END="$3" 1273s shift 3 1273s if [ -n "$1" ]; then 1273s printf "$START " "$1" 1273s shift 1273s while [ -n "$1" ]; do 1273s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 1273s shift 1273s done 1273s fi 1273s printf "${END}" 1273s } 1273s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 1273s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 1273s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 1273s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 1273s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 1273s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 1273s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 1273s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 1273s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 1273s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 1273s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 1273s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 1273s msgreportheader() { 1273s if [ -n "$MSGTEST_MSG" ]; then 1273s test "$1" != 'msgfailoutput' || echo 1273s if [ -n "$MSGTEST_MSGMSG" ]; then 1273s echo "$MSGTEST_MSGMSG" 1273s fi 1273s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 1273s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 1273s fi 1273s echo -n "$MSGTEST_MSG" 1273s unset MSGTEST_MSG 1273s fi 1273s } 1273s msgskip() { 1273s msgreportheader 'msgskip' 1273s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 1273s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 1273s } 1273s msgfail() { 1273s msgreportheader 'msgfail' 1273s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 1273s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 1273s if [ -n "$APT_DEBUG_TESTS" ]; then 1273s runapt $SHELL 1273s fi 1273s EXIT_CODE=$((EXIT_CODE+1)); 1273s } 1273s MSGGROUP_LEVEL=0 1273s msggroup() { 1273s if [ -n "$1" ]; then 1273s if [ $MSGGROUP_LEVEL = 0 ]; then 1273s MSGTEST_GRP='NEXT' 1273s fi 1273s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 1273s else 1273s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 1273s if [ $MSGGROUP_LEVEL = 0 ]; then 1273s unset MSGTEST_GRP 1273s fi 1273s fi 1273s } 1273s 1273s # enable / disable Debugging 1273s if [ $MSGLEVEL -le 0 ]; then 1273s msgdie() { true; } 1273s fi 1273s if [ $MSGLEVEL -le 1 ]; then 1273s msgwarn() { true; } 1273s msgnwarn() { true; } 1273s fi 1273s if [ $MSGLEVEL -le 2 ]; then 1273s msgmsg() { 1273s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 1273s } 1273s msgnmsg() { true; } 1273s msgtest() { 1273s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 1273s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 1273s MSGTEST_GRP="$MSGTEST_MSG" 1273s fi 1273s } 1273s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 1273s fi 1273s if [ $MSGLEVEL -le 3 ]; then 1273s msginfo() { true; } 1273s msgninfo() { true; } 1273s fi 1273s if [ $MSGLEVEL -le 4 ]; then 1273s msgdebug() { true; } 1273s msgndebug() { true; } 1273s fi 1273s if [ $MSGLEVEL -le 1 ]; then 1273s msgpass() { true; } 1273s fi 1273s msgdone() { 1273s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 1273s [ "$1" = "info" -a $MSGLEVEL -le 3 ] || 1273s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 1273s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 1273s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 1273s true; 1273s else 1273s printf "${CDONE}DONE${CNORMAL}\n"; 1273s fi 1273s } 1273s getaptconfig() { 1273s if [ -f ./aptconfig.conf ]; then 1273s echo "$(readlink -f ./aptconfig.conf)" 1273s elif [ -f ../aptconfig.conf ]; then 1273s echo "$(readlink -f ../aptconfig.conf)" 1273s elif [ -f ../../aptconfig.conf ]; then 1273s echo "$(readlink -f ../../aptconfig.conf)" 1273s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 1273s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 1273s fi 1273s } 1273s runapt() { 1273s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 1273s local CMD="$1" 1273s shift 1273s case "$CMD" in 1273s sh|aptitude|*/*|command) ;; 1273s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 1273s esac 1273s if [ "$CMD" = 'aptitude' ]; then 1273s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 1273s else 1273s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 1273s fi 1273s } 1273s runpython3() { runapt command python3 "$@"; } 1273s aptconfig() { runapt apt-config "$@"; } 1273s aptcache() { runapt apt-cache "$@"; } 1273s aptcdrom() { runapt apt-cdrom "$@"; } 1273s aptget() { runapt apt-get "$@"; } 1273s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 1273s aptkey() { runapt apt-key "$@"; } 1273s aptmark() { runapt apt-mark "$@"; } 1273s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 1273s apt() { runapt apt "$@"; } 1273s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 1273s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 1273s aptitude() { runapt aptitude "$@"; } 1273s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 1273s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 1273s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 1273s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 1273s 1273s dpkg() { 1273s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 1273s } 1273s dpkgquery() { 1273s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1273s } 1273s dpkg_version() { 1273s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 1273s } 1273s dpkgcheckbuilddeps() { 1273s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1273s } 1273s gdb() { 1273s local CMD 1273s case "$1" in 1273s aptget) CMD="apt-get";; 1273s aptcache) CMD="apt-cache";; 1273s aptcdrom) CMD="apt-cdrom";; 1273s aptconfig) CMD="apt-config";; 1273s aptmark) CMD="apt-mark";; 1273s apthelper) CMD="apt-helper";; 1273s aptftparchive) CMD="apt-ftparchive";; 1273s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1273s *) CMD="$1";; 1273s esac 1273s shift 1273s if [ "${CMD##*/}" = "$CMD" ]; then 1273s CMD="${APTCMDLINEBINDIR}/${CMD}" 1273s fi 1273s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 1273s } 1273s 1273s valgrind() { 1273s local CMD 1273s case "$1" in 1273s aptget) CMD="apt-get";; 1273s aptcache) CMD="apt-cache";; 1273s aptcdrom) CMD="apt-cdrom";; 1273s aptconfig) CMD="apt-config";; 1273s aptmark) CMD="apt-mark";; 1273s apthelper) CMD="apt-helper";; 1273s aptftparchive) CMD="apt-ftparchive";; 1273s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1273s *) CMD="$1";; 1273s esac 1273s shift 1273s if [ "$CMD" = "apt-ftparchive" ]; then 1273s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 1273s fi 1273s if [ "${CMD##*/}" = "$CMD" ]; then 1273s CMD="${APTCMDLINEBINDIR}/${CMD}" 1273s fi 1273s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 1273s } 1273s 1273s lastmodification() { 1273s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 1273s } 1273s releasefiledate() { 1273s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 1273s } 1273s 1273s exitwithstatus() { 1273s # error if we about to overflow, but ... 1273s # "255 failures ought to be enough for everybody" 1273s if [ $EXIT_CODE -gt 255 ]; then 1273s msgdie "Total failure count $EXIT_CODE too big" 1273s fi 1273s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 1273s } 1273s 1273s shellsetedetector() { 1273s local exit_status=$? 1273s if [ "$exit_status" != '0' ]; then 1273s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 1273s if [ "$EXIT_CODE" = '0' ]; then 1273s EXIT_CODE="$exit_status" 1273s fi 1273s fi 1273s } 1273s 1273s addtrap() { 1273s if [ "$1" = 'prefix' ]; then 1273s CURRENTTRAP="$2 $CURRENTTRAP" 1273s else 1273s CURRENTTRAP="$CURRENTTRAP $1" 1273s fi 1273s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1273s } 1273s 1273s escape_shell() { 1273s echo "$@" | sed -e "s#'#'\"'\"'#g" 1273s } 1273s 1273s find_project_binary_dir() { 1273s if [ -z "$PROJECT_BINARY_DIR" ]; then 1273s PROJECT_BINARY_DIR= 1273s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 1273s test -e "$dir/CMakeCache.txt" || continue 1273s if [ -z "$PROJECT_BINARY_DIR" ] || 1273s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 1273s PROJECT_BINARY_DIR="$dir" 1273s fi 1273s done 1273s if [ -z "$PROJECT_BINARY_DIR" ]; then 1273s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 1273s exit 1 1273s fi 1273s export PROJECT_BINARY_DIR 1273s fi 1273s } 1273s _removetmpworkingdirectory() { 1273s cd / 1273s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 1273s rm -rf "$TMPWORKINGDIRECTORY" 1273s fi 1273s TMPWORKINGDIRECTORY='' 1273s } 1273s setupenvironment() { 1273s # cleanup the environment a bit 1273s export LC_ALL=C 1273s unset LANGUAGE COLUMNS NLSPATH 1273s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 1273s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 1273s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 1273s unset GREP_OPTIONS POSIXLY_CORRECT 1273s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 1273s export GCOV_ERROR_FILE=/dev/null 1273s 1273s # Next check needs a gnu stat, let's figure that out early. 1273s stat=stat 1273s if command -v gnustat >/dev/null 2>&1; then 1273s stat=gnustat 1273s fi 1273s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 1273s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 1273s unset TMPDIR 1273s fi 1273s if [ -z "$TMPWORKINGDIRECTORY" ]; then 1273s addtrap '_removetmpworkingdirectory;' 1273s TMPWORKINGDIRECTORY="$(mktemp -d)" 1273s fi 1273s if [ -n "$TMPDIR_ADD" ]; then 1273s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 1273s mkdir -p "$TMPWORKINGDIRECTORY" 1273s unset TMPDIR_ADD 1273s export TMPDIR="$TMPWORKINGDIRECTORY" 1273s fi 1273s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 1273s 1273s # Setup coreutils on BSD systems 1273s mkdir "${TMPWORKINGDIRECTORY}/bin" 1273s for prefix in gnu g; do 1273s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 1273s if command -v $prefix$command 2>/dev/null >/dev/null; then 1273s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 1273s fi 1273s done 1273s done 1273s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 1273s 1273s if [ -z "$TESTDIRECTORY" ]; then 1273s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 1273s fi 1273s cd "$TMPWORKINGDIRECTORY" 1273s 1273s mkdir -m 700 'downloaded' 1273s if [ "$(id -u)" = '0' ]; then 1273s # relax permissions so that running as root with user switching works 1273s umask 022 1273s chmod 711 "$TMPWORKINGDIRECTORY" 1273s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 1273s fi 1273s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 1273s 1273s _setupprojectenvironment 1273s 1273s # create some files in /tmp and look at user/group to get what this means 1273s TEST_DEFAULT_USER="$(id -un)" 1273s touch "${TMPWORKINGDIRECTORY}/test-file" 1273s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 1273s 1273s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 1273s . "${TESTDIRECTORY}/extra-environment" 1273s fi 1273s 1273s msgdone "info" 1273s } 1273s _setupprojectenvironment() { 1273s # allow overriding the default BUILDDIR locations 1273s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 1273s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 1273s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 1273s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 1273s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1273s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 1273s APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 1273s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1273s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 1273s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 1273s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 1273s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 1273s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 1273s 1273s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 1273s mkdir aptarchive keys 1273s cd rootdir 1273s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 1273s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 1273s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 1273s touch var/lib/dpkg/available var/lib/dpkg/lock 1273s echo '1' > var/lib/dpkg/info/format 1273s ln -s "${METHODSDIR}" usr/lib/apt/methods 1273s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 1273s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 1273s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 1273s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 1273s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 1273s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 1273s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 1273s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 1273s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 1273s else 1273s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 1273s fi 1273s cd .. 1273s local BASENAME="${0##*/}" 1273s local PACKAGESFILE="Packages-${BASENAME#*-}" 1273s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 1273s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 1273s fi 1273s local SOURCESSFILE="Sources-${BASENAME#*-}" 1273s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 1273s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 1273s fi 1273s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 1273s chmod 644 keys/* 1273s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 1273s 1273s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 1273s echo "Dir::Etc \"etc\";" >> aptconfig.conf 1273s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 1273s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 1273s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 1273s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 1273s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 1273s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 1273s # either store apt-key were we can access it, even if we run it as a different user 1273s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 1273s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 1273s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 1273s # destroys coverage reporting though, so we disable changing user for the calling gpgv 1273s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 1273s if [ "$(id -u)" = '0' ]; then 1273s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 1273s # same for the solver executables 1273s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 1273s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 1273s fi 1273s 1273s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 1273s EXEC='' 1273s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 1273s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 1273s restoredpkgstatus() { 1273s if [ -n "\$BACKUP" ]; then 1273s if [ -e "\$BACKUP" ]; then 1273s mv -f "\$BACKUP" "\$ORIGINAL" 1273s else 1273s rm -f "\$ORIGINAL" 1273s fi 1273s BACKUP='' 1273s fi 1273s } 1273s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1273s if [ -e "\$ORIGINAL" ]; then 1273s cp -a "\$ORIGINAL" "\$BACKUP" 1273s fi 1273s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 1273s 1273s Package: dpkg 1273s Architecture: all 1273s Version: ${DPKG_VERSION}+fake 1273s Status: install ok installed 1273s Maintainer: Joe Sixpack 1273s Installed-Size: 42 1273s Description: tells dpkg it supports what we need 1273s Some versions of dpkg check its own version from the status file 1273s to know if it supports multi-arch and stuff in --assert-*. 1273s 1273s EOS 1273s fi 1273s EOF 1273s fi 1273s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 1273s 1273s { 1273s echo 'quiet "0";' 1273s echo 'quiet::NoUpdate "true";' 1273s echo 'quiet::NoStatistic "true";' 1273s # too distracting for users, but helpful to detect changes 1273s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 1273s echo 'Acquire::Progress::Diffpercent "true";' 1273s # in testcases, it can appear as if localhost has a rotation setup, 1273s # hide this as we can't really deal with it properly 1273s echo 'Acquire::Failure::ShowIP "false";' 1273s # randomess and tests don't play well together 1273s echo 'Acquire::IndexTargets::Randomized "false";' 1273s # fakeroot can't fake everything, so disabled in production but good for tests 1273s echo 'APT::Sandbox::Verify "true";' 1273s } >> aptconfig.conf 1273s 1273s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1273s if [ "$(id -u)" = '0' ]; then 1273s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1273s fi 1273s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 1273s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 1273s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 1273s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 1273s # Allow release files to be 10 hours in the future, rather than 10 seconds 1273s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 1273s 1273s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 1273s 1273s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 1273s confighashes 'SHA256' # these are tests, not security best-practices 1273s 1273s # Make dpkg inherit testing path 1273s echo 'DPkg::Path "";' >> aptconfig.conf 1273s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 1273s 1273s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 1273s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 1273s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 1273s fi 1273s 1273s # most tests just need one signed Release file, not both 1273s export APT_DONT_SIGN='Release.gpg' 1273s 1273s # prefer our apt binaries over the system apt binaries 1273s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 1273s } 1273s 1273s getarchitecture() { 1273s if [ "$1" = "native" -o -z "$1" ]; then 1273s eval `aptconfig shell ARCH APT::Architecture` 1273s if [ -n "$ARCH" ]; then 1273s echo $ARCH 1273s else 1273s dpkg --print-architecture 1273s fi 1273s else 1273s echo $1 1273s fi 1273s } 1273s 1273s getarchitectures() { 1273s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 1273s } 1273s 1273s getarchitecturesfromcommalist() { 1273s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 1273s } 1273s 1273s configarchitecture() { 1273s { 1273s echo "APT::Architecture \"$(getarchitecture $1)\";" 1273s while [ -n "$1" ]; do 1273s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 1273s shift 1273s done 1273s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 1273s configdpkg 1273s } 1273s 1273s configdpkg() { 1273s if [ ! -e rootdir/var/lib/dpkg/status ]; then 1273s local BASENAME="${0##*/}" 1273s local STATUSFILE="status-${BASENAME#*-}" 1273s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 1273s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 1273s # Add an empty line to the end if there is none 1273s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 1273s echo >> rootdir/var/lib/dpkg/status 1273s fi 1273s fi 1273s fi 1273s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 1273s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 1273s local ARCHS="$(getarchitectures)" 1273s local DPKGARCH="$(dpkg --print-architecture)" 1273s # this ensures that even if multi-arch isn't active in the view 1273s # of apt, given that dpkg can't be told which arch is native 1273s # the arch apt treats as native might be foreign for dpkg 1273s for ARCH in ${ARCHS}; do 1273s if [ "${ARCH}" != "${DPKGARCH}" ]; then 1273s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 1273s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 1273s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 1273s else 1273s # old-style used e.g. in Ubuntu-P – and as it seems travis 1273s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1273s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1273s fi 1273s fi 1273s fi 1273s done 1273s else 1273s # test multiarch before dpkg is ready for it… 1273s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 1273s fi 1273s } 1273s 1273s configdpkgnoopchroot() { 1273s # create a library to noop chroot() and rewrite maintainer script executions 1273s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 1273s # chroot directory dpkg could chroot into to execute the maintainer scripts 1273s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 1273s cat > noopchroot.c << EOF 1273s #define _GNU_SOURCE 1273s #include 1273s #include 1273s #include 1273s #include 1273s 1273s static char * chrootdir = NULL; 1273s 1273s int chroot(const char *path) { 1273s printf("WARNING: CHROOTing to %s was ignored!\n", path); 1273s free(chrootdir); 1273s chrootdir = strdup(path); 1273s return 0; 1273s } 1273s int execvp(const char *file, char *const argv[]) { 1273s static int (*func_execvp) (const char *, char * const []) = NULL; 1273s if (func_execvp == NULL) 1273s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 1273s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 1273s return func_execvp(file, argv); 1273s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 1273s char *newfile; 1273s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 1273s perror("asprintf"); 1273s return -1; 1273s } 1273s char const * const baseadmindir = "/var/lib/dpkg"; 1273s char *admindir; 1273s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 1273s perror("asprintf"); 1273s return -1; 1273s } 1273s setenv("DPKG_ADMINDIR", admindir, 1); 1273s return func_execvp(newfile, argv); 1273s } 1273s EOF 1273s if cc -ldl 2>&1 | grep -q dl; then 1273s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 1273s else 1273s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 1273s fi 1273s } 1273s configcompression() { 1273s if [ "$1" = 'ALL' ]; then 1273s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 1273s return 1273s fi 1273s local CMD='apthelper cat-file -C' 1273s while [ -n "$1" ]; do 1273s case "$1" in 1273s '.') printf ".\t.\tcat\n";; 1273s 'gz') printf "gzip\tgz\t$CMD $1\n";; 1273s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 1273s 'zst') printf "zstd\tzst\t$CMD $1\n";; 1273s *) printf "$1\t$1\t$CMD $1\n";; 1273s esac 1273s shift 1273s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1273s } 1273s confighashes() { 1273s { 1273s echo 'APT::FTPArchive {' 1273s { 1273s while [ -n "$1" ]; do 1273s printf "$1" | tr 'a-z' 'A-Z' 1273s printf "\t\"true\";\n" 1273s shift 1273s done 1273s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 1273s printf "$h\t\"false\";\n" 1273s done 1273s } | awk '!x[$1]++' 1273s echo '};' 1273s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 1273s } 1273s forcecompressor() { 1273s COMPRESSOR="$1" 1273s COMPRESS="$1" 1273s COMPRESSOR_CMD="apthelper cat-file -C $1" 1273s case $COMPRESSOR in 1273s gzip) COMPRESS='gz';; 1273s bzip2) COMPRESS='bz2';; 1273s zstd) COMPRESS='zst';; 1273s esac 1273s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1273s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 1273s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 1273s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1273s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 1273s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 1273s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 1273s done 1273s } 1273s 1273s _setupsimplenativepackage() { 1273s local NAME="$1" 1273s local ARCH="$2" 1273s local VERSION="$3" 1273s local RELEASE="${4:-unstable}" 1273s local DEPENDENCIES="$5" 1273s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 1273s If you find such a package installed on your system, 1273s something went horribly wrong! They are autogenerated 1273s and used only by testcases and serve no other purpose…}" 1273s 1273s local SECTION="${7:-others}" 1273s local PRIORITY="${8:-optional}" 1273s local FILE_TREE="$9" 1273s local COMPRESS_TYPE="${10:-gzip}" 1273s local DISTSECTION 1273s if [ "$SECTION" = "${SECTION#*/}" ]; then 1273s DISTSECTION="main" 1273s else 1273s DISTSECTION="${SECTION%/*}" 1273s fi 1273s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1273s 1273s mkdir -p "$BUILDDIR/debian/source" 1273s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 1273s echo "#!/bin/sh 1273s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 1273s 1273s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 1273s echo "$NAME ($VERSION) $RELEASE; urgency=low 1273s 1273s * Initial release 1273s 1273s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 1273s { 1273s echo "Source: $NAME 1273s Priority: $PRIORITY 1273s Maintainer: Joe Sixpack 1273s Standards-Version: 4.3.1 1273s Rules-Requires-Root: no" 1273s if [ "$SECTION" != '' ]; then 1273s echo "Section: $SECTION" 1273s fi 1273s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 1273s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 1273s echo " 1273s Package: $NAME" 1273s 1273s if [ "$ARCH" = 'all' ]; then 1273s echo "Architecture: all" 1273s else 1273s echo "Architecture: any" 1273s fi 1273s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 1273s test -z "$DEPS" || echo "$DEPS" 1273s printf "%b\n" "Description: $DESCRIPTION" 1273s } > "${BUILDDIR}/debian/control" 1273s 1273s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 1273s } 1273s 1273s make_tiny_rules() { 1273s local OUT="$1" 1273s if command -v gmake >/dev/null 2>&1; then 1273s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 1273s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 1273s else 1273s echo '#!/usr/bin/make -f' > "$OUT" 1273s fi 1273s echo '%:' >> "$OUT" 1273s echo ' dh $@' >> "$OUT" 1273s } 1273s 1273s setupsimplenativepackage() { 1273s _setupsimplenativepackage "$@" 1273s local NAME="$1" 1273s local VERSION="$3" 1273s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1273s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 1273s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 1273s } 1273s 1273s buildsimplenativepackage() { 1273s local NAME="$1" 1273s local ARCH="$2" 1273s local VERSION="$3" 1273s local RELEASE="${4:-unstable}" 1273s local DEPENDENCIES="$5" 1273s local DESCRIPTION="$6" 1273s local SECTION="${7:-others}" 1273s local PRIORITY="${8:-optional}" 1273s local FILE_TREE="$9" 1273s local COMPRESS_TYPE="${10:-gzip}" 1273s local DISTSECTION 1273s if [ "$SECTION" = "${SECTION#*/}" ]; then 1273s DISTSECTION="main" 1273s else 1273s DISTSECTION="${SECTION%/*}" 1273s fi 1273s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1273s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 1273s _setupsimplenativepackage "$@" 1273s cd "${BUILDDIR}/.." 1273s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 1273s cd - >/dev/null 1273s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 1273s | while read SRC; do 1273s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 1273s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 1273s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 1273s # adv --yes --default-key 'Joe Sixpack' \ 1273s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1273s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1273s # fi 1273s done 1273s 1273s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1273s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 1273s rm -rf "${BUILDDIR}/debian/tmp" 1273s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 1273s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 1273s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 1273s if [ -n "$FILE_TREE" ]; then 1273s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 1273s fi 1273s 1273s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 1273s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 1273s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 1273s # ensure the right permissions as dpkg-deb insists 1273s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 1273s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 1273s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 1273s done 1273s 1273s local NM 1273s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 1273s NM="$(echo "$NAME" | cut -c 1-4)" 1273s else 1273s NM="$(echo "$NAME" | cut -c 1)" 1273s fi 1273s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 1273s mkdir -p "$CHANGEPATH" 1273s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 1273s rm -rf "${BUILDDIR}" 1273s msgdone "info" 1273s } 1273s 1273s buildpackage() { 1273s local BUILDDIR=$1 1273s local RELEASE=$2 1273s local SECTION=$3 1273s local ARCH=$(getarchitecture $4) 1273s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 1273s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 1273s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 1273s cd "$BUILDDIR" 1273s if [ "$ARCH" = "all" ]; then 1273s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 1273s fi 1273s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 1273s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 1273s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 1273s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 1273s cd - > /dev/null 1273s for PKG in $PKGS; do 1273s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 1273s done 1273s for SRC in $SRCS; do 1273s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 1273s done 1273s } 1273s 1273s buildaptarchive() { 1273s if [ -d incoming ]; then 1273s buildaptarchivefromincoming "$@" 1273s else 1273s buildaptarchivefromfiles "$@" 1273s fi 1273s } 1273s 1273s createaptftparchiveconfig() { 1273s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 1273s local COMPRESSORS="${COMPRESSORS%* }" 1273s local ARCHS="$(getarchitectures)" 1273s cat > ftparchive.conf <> ftparchive.conf 1273s } 1273s 1273s buildaptftparchivedirectorystructure() { 1273s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 1273s for DIST in $DISTS; do 1273s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 1273s for SECTION in $SECTIONS; do 1273s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 1273s for ARCH in $ARCHS; do 1273s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 1273s done 1273s mkdir -p "dists/${DIST}/${SECTION}/source" 1273s mkdir -p "dists/${DIST}/${SECTION}/i18n" 1273s done 1273s done 1273s } 1273s 1273s insertpackage() { 1273s local RELEASES="$1" 1273s local NAME="$2" 1273s local ARCH="$3" 1273s local VERSION="$4" 1273s local DEPENDENCIES="$5" 1273s local PRIORITY="${6:-optional}" 1273s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 1273s If you find such a package installed on your system, 1273s something went horribly wrong! They are autogenerated 1273s and used only by testcases and serve no other purpose…}" 1273s local SECTION="${8:-other}" 1273s 1273s if [ "$SECTION" = "${SECTION#*/}" ]; then 1273s DISTSECTION="main" 1273s else 1273s DISTSECTION="${SECTION%/*}" 1273s fi 1273s local ARCHS="" 1273s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1273s if [ "$RELEASE" = 'installed' ]; then 1273s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 1273s continue 1273s fi 1273s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1273s if [ "$arch" = 'none' ]; then 1273s ARCHS="$(getarchitectures)" 1273s else 1273s ARCHS="$arch" 1273s fi 1273s for BUILDARCH in $ARCHS; do 1273s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 1273s mkdir -p "$PPATH" 1273s { 1273s echo "Package: $NAME 1273s Priority: $PRIORITY 1273s Section: $SECTION 1273s Installed-Size: 42 1273s Size: 42" 1273s if echo "$DEPENDENCIES" | grep -q SHA256:; then 1273s : 1273s else 1273s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 1273s fi 1273s echo "Maintainer: Joe Sixpack " 1273s test "$arch" = 'none' || echo "Architecture: $arch" 1273s echo "Version: $VERSION 1273s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 1273s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 1273s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 1273s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 1273s echo 1273s } >> "${PPATH}/Packages" 1273s done 1273s done 1273s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 1273s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 1273s echo "Package: $NAME 1273s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 1273s Description-en: $DESCRIPTION 1273s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 1273s done 1273s } 1273s 1273s insertsource() { 1273s local RELEASES="$1" 1273s local NAME="$2" 1273s local ARCH="$3" 1273s local VERSION="$4" 1273s local DEPENDENCIES="$5" 1273s local BINARY="${6:-$NAME}" 1273s local ARCHS="" 1273s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1273s local SPATH="aptarchive/dists/${RELEASE}/main/source" 1273s mkdir -p $SPATH 1273s local FILE="${SPATH}/Sources" 1273s local DSCFILE="${NAME}_${VERSION}.dsc" 1273s local TARFILE="${NAME}_${VERSION}.tar.gz" 1273s echo "Package: $NAME 1273s Binary: $BINARY 1273s Version: $VERSION 1273s Maintainer: Joe Sixpack 1273s Architecture: $ARCH" >> $FILE 1273s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1273s echo "Files: 1273s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1273s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1273s Checksums-Sha256: 1273s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1273s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1273s " >> "$FILE" 1273s done 1273s } 1273s 1273s insertinstalledpackage() { 1273s local NAME="$1" 1273s local ARCH="$2" 1273s local VERSION="$3" 1273s local DEPENDENCIES="$4" 1273s local PRIORITY="${5:-optional}" 1273s local STATUS="${6:-install ok installed}" 1273s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 1273s If you find such a package installed on your system, 1273s something went horribly wrong! They are autogenerated 1273s and used only by testcases and serve no other purpose…}" 1273s local SECTION="${8:-other}" 1273s 1273s local FILE='rootdir/var/lib/dpkg/status' 1273s local INFO='rootdir/var/lib/dpkg/info' 1273s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1273s echo "Package: $NAME 1273s Status: $STATUS 1273s Priority: $PRIORITY 1273s Section: $SECTION 1273s Installed-Size: 42 1273s Maintainer: Joe Sixpack 1273s Version: $VERSION" >> "$FILE" 1273s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 1273s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1273s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 1273s echo >> "$FILE" 1273s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 1273s echo -n > "${INFO}/${NAME}:${arch}.list" 1273s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 1273s else 1273s echo -n > "${INFO}/${NAME}.list" 1273s echo -n > "${INFO}/${NAME}.md5sums" 1273s fi 1273s done 1273s } 1273s 1273s 1273s buildaptarchivefromincoming() { 1273s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 1273s cd aptarchive 1273s [ -e pool ] || ln -s ../incoming pool 1273s [ -e ftparchive.conf ] || createaptftparchiveconfig 1273s [ -e dists ] || buildaptftparchivedirectorystructure 1273s msgninfo "\tGenerate Packages, Sources and Contents files… " 1273s testsuccess aptftparchive generate ftparchive.conf 1273s cd - > /dev/null 1273s msgdone "info" 1273s generatereleasefiles "$@" 1273s } 1273s 1273s buildaptarchivefromfiles() { 1273s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 1273s local DIR='aptarchive' 1273s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 1273s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 1273s msgninfo "\t${line} file… " 1273s compressfile "$line" "$1" 1273s msgdone "info" 1273s done 1273s generatereleasefiles "$@" 1273s } 1273s 1273s compressfile() { 1273s while read compressor extension command; do 1273s if [ "$compressor" = '.' ]; then 1273s if [ -n "$2" ]; then 1273s touch -d "$2" "$1" 1273s fi 1273s continue 1273s fi 1273s cat "$1" | $command > "${1}.${extension}" 1273s if [ -n "$2" ]; then 1273s touch -d "$2" "${1}.${extension}" 1273s fi 1273s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1273s } 1273s 1273s # can be overridden by testcases for their pleasure 1273s getcodenamefromsuite() { 1273s case "$1" in 1273s unstable) echo 'sid';; 1273s *) echo -n "$1";; 1273s esac 1273s } 1273s getreleaseversionfromsuite() { true; } 1273s getlabelfromsuite() { true; } 1273s getoriginfromsuite() { true; } 1273s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 1273s getnotautomaticfromsuite() { 1273s case "$1" in 1273s experimental|experimental2) echo "yes";; 1273s esac 1273s } 1273s getbutautomaticupgradesfromsuite() { true; } 1273s 1273s aptftparchiverelease() { 1273s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 1273s } 1273s generatereleasefiles() { 1273s # $1 is the Date header and $2 is the ValidUntil header to be set 1273s # both should be given in notation date/touch can understand 1273s local DATE="$1" 1273s local VALIDUNTIL="$2" 1273s if [ -e aptarchive/dists ]; then 1273s msgninfo "\tGenerate Release files for dists… " 1273s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 1273s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 1273s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 1273s local CODENAME="$(getcodenamefromsuite $SUITE)" 1273s local VERSION="$(getreleaseversionfromsuite $SUITE)" 1273s local LABEL="$(getlabelfromsuite $SUITE)" 1273s local ORIGIN="$(getoriginfromsuite $SUITE)" 1273s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 1273s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 1273s aptftparchiverelease "$dir" \ 1273s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 1273s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 1273s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 1273s -o APT::FTPArchive::Release::Label="${LABEL}" \ 1273s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 1273s -o APT::FTPArchive::Release::Version="${VERSION}" \ 1273s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 1273s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 1273s > "$dir/Release" 1273s done 1273s else 1273s msgninfo "\tGenerate Release files for flat… " 1273s aptftparchiverelease ./aptarchive > aptarchive/Release 1273s fi 1273s if [ -n "$VALIDUNTIL" ]; then 1273s sed -i "/^Date: / a\ 1273s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 1273s fi 1273s if [ -n "$DATE" -a "$DATE" != "now" ]; then 1273s for release in $(find ./aptarchive -name 'Release'); do 1273s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 1273s touch -d "$DATE" "$release" 1273s done 1273s fi 1273s msgdone "info" 1273s } 1273s 1273s setupdistsaptarchive() { 1273s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1273s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 1273s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 1273s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 1273s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 1273s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 1273s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 1273s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 1273s msgdone "info" 1273s done 1273s } 1273s 1273s setupflataptarchive() { 1273s local APTARCHIVE="$(readlink -f ./aptarchive)" 1273s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1273s if [ -f "${APTARCHIVE}/Packages" ]; then 1273s msgninfo "\tadd deb sources.list line… " 1273s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1273s msgdone 'info' 1273s else 1273s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1273s fi 1273s if [ -f "${APTARCHIVE}/Sources" ]; then 1273s msgninfo "\tadd deb-src sources.list line… " 1273s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1273s msgdone 'info' 1273s else 1273s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1273s fi 1273s } 1273s 1273s setupaptarchive() { 1273s local NOUPDATE=0 1273s if [ "$1" = '--no-update' ]; then 1273s NOUPDATE=1 1273s shift 1273s fi 1273s buildaptarchive "$@" 1273s if [ -e aptarchive/dists ]; then 1273s setupdistsaptarchive 1273s else 1273s setupflataptarchive 1273s fi 1273s signreleasefiles 'Joe Sixpack' 1273s if [ "1" != "$NOUPDATE" ]; then 1273s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 1273s fi 1273s } 1273s 1273s killgpgagent() { 1273s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 1273s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1273s if [ ! -e "${GPGHOME}" ]; then return; fi 1273s # ensure the agent dies quickly as different versions have different suicide heuristics 1273s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 1273s rm -rf "$GPGHOME" 1273s } 1273s dosigning() { 1273s local KEY="$1" 1273s shift 1273s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1273s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 1273s GPGHOME="$APT_TEST_SIGNINGHOME" 1273s else 1273s if [ ! -e "$GPGHOME" ]; then 1273s mkdir -p --mode=700 "${GPGHOME}" 1273s addtrap 'prefix' 'killgpgagent;' 1273s fi 1273s fi 1273s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 1273s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1273s "$@" 1273s } 1273s signreleasefiles() { 1273s local SIGNERS="${1:-Joe Sixpack}" 1273s local REPODIR="${2:-aptarchive}" 1273s if [ -n "$1" ]; then shift; fi 1273s if [ -n "$1" ]; then shift; fi 1273s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1273s msgninfo "\tSign archive with $SIGNERS key $KEY… " 1273s local REXKEY='keys/rexexpired' 1273s local SECEXPIREBAK="${REXKEY}.sec.bak" 1273s local PUBEXPIREBAK="${REXKEY}.pub.bak" 1273s local SIGUSERS="" 1273s while [ -n "${SIGNERS%%,*}" ]; do 1273s local SIGNER="${SIGNERS%%,*}" 1273s if [ "${SIGNERS}" = "${SIGNER}" ]; then 1273s SIGNERS="" 1273s fi 1273s SIGNERS="${SIGNERS#*,}" 1273s # FIXME: This should be the full name, but we can't encode the space properly currently 1273s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 1273s if [ "${SIGNER}" = 'Rex Expired' ]; then 1273s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 1273s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 1273s # therefore we 'temporary' make the key not expired and restore a backup after signing 1273s cp "${REXKEY}.sec" "$SECEXPIREBAK" 1273s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 1273s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 1273s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 1273s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 1273s cp "$SECUNEXPIRED" "${REXKEY}.sec" 1273s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 1273s else 1273s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 1273s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1273s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 1273s cat setexpire.gpg 1273s exit 1 1273s fi 1273s cp "${REXKEY}.sec" "$SECUNEXPIRED" 1273s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 1273s fi 1273s fi 1273s if [ ! -e "${KEY}.pub" ]; then 1273s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1273s cat "${K}.pub" >> "${KEY}.new.pub" 1273s cat "${K}.sec" >> "${KEY}.new.sec" 1273s fi 1273s done 1273s if [ ! -e "${KEY}.pub" ]; then 1273s mv "${KEY}.new.pub" "${KEY}.pub" 1273s mv "${KEY}.new.sec" "${KEY}.sec" 1273s fi 1273s for RELEASE in $(find "${REPODIR}/" -name Release); do 1273s # we might have set a specific date for the Release file, so copy it 1273s local DATE="$(stat --format "%y" "${RELEASE}")" 1273s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 1273s rm -f "${RELEASE}.gpg" 1273s else 1273s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 1273s touch -d "$DATE" "${RELEASE}.gpg" 1273s fi 1273s local INRELEASE="${RELEASE%/*}/InRelease" 1273s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 1273s rm -f "$INRELEASE" 1273s else 1273s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 1273s touch -d "$DATE" "${INRELEASE}" 1273s fi 1273s done 1273s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 1273s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 1273s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 1273s fi 1273s msgdone 'info' 1273s } 1273s 1273s redatereleasefiles() { 1273s local DATE="$(date -u -d "$1" -R)" 1273s for release in $(find aptarchive/ -name 'Release'); do 1273s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 1273s touch -d "$DATE" "$release" 1273s done 1273s signreleasefiles "${2:-Joe Sixpack}" 1273s } 1273s 1273s webserverconfig() { 1273s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 1273s local NOCHECK=false 1273s if [ "$1" = '--no-check' ]; then 1273s NOCHECK=true 1273s shift 1273s fi 1273s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 1273s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 1273s rm -f "$STATUS" "$DOWNLOG" 1273s local URI 1273s if [ -n "$2" ]; then 1273s msgtest "Set webserver config option '${1}' to" "$2" 1273s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 1273s else 1273s msgtest 'Clear webserver config option' "${1}" 1273s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 1273s fi 1273s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 1273s msgpass 1273s else 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 1273s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 1273s msgfailoutput '' "$OUTPUT" 1273s fi 1273s $NOCHECK || testwebserverlaststatuscode '200' 1273s } 1273s 1273s rewritesourceslist() { 1273s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 1273s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 1273s sed -i $LIST \ 1273s -e "s#file://$APTARCHIVE#${1}#" \ 1273s -e "s#file:$APTARCHIVE#${1}#" \ 1273s -e "s#copy://$APTARCHIVE#${1}#" \ 1273s -e "s#copy:$APTARCHIVE#${1}#" \ 1273s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 1273s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 1273s done 1273s } 1273s 1273s # wait for up to 10s for a pid file to appear to avoid possible race 1273s # when a helper is started and doesn't write the PID quick enough 1273s waitforpidfile() { 1273s local PIDFILE="$1" 1273s for i in $(seq 10); do 1273s if test -s "$PIDFILE"; then 1273s return 0 1273s fi 1273s sleep 1 1273s done 1273s msgdie "waiting for $PIDFILE failed" 1273s return 1 1273s } 1273s 1273s changetowebserver() { 1273s local REWRITE='yes' 1273s if [ "$1" = '--no-rewrite' ]; then 1273s REWRITE='no' 1273s shift 1273s fi 1273s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 1273s cd aptarchive 1273s local LOG="webserver.log" 1273s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 1273s cat "$LOG" 1273s false 1273s fi 1273s waitforpidfile aptwebserver.pid 1273s local PID="$(cat aptwebserver.pid)" 1273s if [ -z "$PID" ]; then 1273s msgdie 'Could not fork aptwebserver successfully' 1273s fi 1273s addtrap "kill $PID;" 1273s waitforpidfile aptwebserver.port 1273s APTHTTPPORT="$(cat aptwebserver.port)" 1273s if [ -z "$APTHTTPPORT" ]; then 1273s msgdie 'Could not get port for aptwebserver successfully' 1273s fi 1273s cd - > /dev/null 1273s else 1273s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 1273s fi 1273s if [ "$REWRITE" != 'no' ]; then 1273s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 1273s fi 1273s } 1273s 1273s changetohttpswebserver() { 1273s local REWRITE='yes' 1273s if [ "$1" = '--no-rewrite' ]; then 1273s REWRITE='no' 1273s shift 1273s fi 1273s local stunnel4 1273s if command -v stunnel4 >/dev/null 2>&1; then 1273s stunnel4=stunnel4 1273s elif command -v stunnel >/dev/null 2>&1; then 1273s stunnel4=stunnel 1273s else 1273s msgdie 'You need to install stunnel4 for https testcases' 1273s fi 1273s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 1273s changetowebserver --no-rewrite "$@" 1273s fi 1273s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 1273s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 1273s output = /dev/null 1273s 1273s [https] 1273s accept = 127.0.0.1:0 1273s connect = $APTHTTPPORT 1273s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 1273s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 1273s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 1273s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 1273s if [ -z "$PID" ]; then 1273s msgdie 'Could not fork $stunnel4 successfully' 1273s fi 1273s addtrap 'prefix' "kill ${PID};" 1273s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 1273s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 1273s if [ "$REWRITE" != 'no' ]; then 1273s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 1273s fi 1273s } 1273s 1273s changetocdrom() { 1273s mkdir -p rootdir/media/cdrom/.disk 1273s local CD="$(readlink -f rootdir/media/cdrom)" 1273s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 1273s if [ ! -d aptarchive/dists ]; then 1273s msgdie 'Flat file archive cdroms can not be created currently' 1273s return 1 1273s fi 1273s mv aptarchive/dists "$CD" 1273s ln -s "$(readlink -f ./incoming)" "$CD/pool" 1273s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 1273s # start with an unmounted disk 1273s mv "${CD}" "${CD}-unmounted" 1273s # we don't want the disk to be modifiable 1273s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 1273s chmod -R 555 rootdir/media/cdrom-unmounted/dists 1273s } 1273s 1273s downloadfile() { 1273s local PROTO="${1%%:*}" 1273s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 1273s download-file "$1" "$2" "$3" 2>&1 ; then 1273s return 1 1273s fi 1273s # only if the file exists the download was successful 1273s if [ -r "$2" ]; then 1273s return 0 1273s else 1273s return 1 1273s fi 1273s } 1273s 1273s cleanup_output() { 1273s cat "$1" | sed \ 1273s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 1273s -e '/^profiling:/ d' \ 1273s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 1273s >"$2" 1273s } 1273s 1273s checkdiff() { 1273s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 1273s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 1273s touch "$TMPFILE1" "$TMPFILE2" 1273s 1273s cleanup_output "$1" "$TMPFILE1" 1273s cleanup_output "$2" "$TMPFILE2" 1273s 1273s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 1273s if [ -n "$DIFFTEXT" ]; then 1273s echo >&2 1273s echo >&2 "$DIFFTEXT" 1273s return 1 1273s else 1273s return 0 1273s fi 1273s } 1273s 1273s testoutputequal() { 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 1273s local COMPAREFILE="$1" 1273s shift 1273s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 1273s msgpass 1273s else 1273s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 1273s cat "$COMPAREFILE" >>"${OUTPUT}" 1273s msgfailoutput '' "$OUTPUT" "$@" 1273s fi 1273s } 1273s 1273s testfileequal() { 1273s msggroup 'testfileequal' 1273s local MSG='Test for correctness of file' 1273s if [ "$1" = '--nomsg' ]; then 1273s MSG='' 1273s shift 1273s fi 1273s local FILE="$1" 1273s shift 1273s if [ -n "$MSG" ]; then 1273s msgtest "$MSG" "$FILE" 1273s fi 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 1273s if [ -z "$*" ]; then 1273s testoutputequal "$FILE" echo -n '' 1273s else 1273s testoutputequal "$FILE" echo "$*" 1273s fi 1273s msggroup 1273s } 1273s 1273s testempty() { 1273s msggroup 'testempty' 1273s if [ "$1" = '--nomsg' ]; then 1273s shift 1273s else 1273s msgtest "Test for no output of" "$*" 1273s fi 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 1273s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 1273s msgpass 1273s else 1273s msgfailoutput '' "$COMPAREFILE" "$@" 1273s fi 1273s aptautotest 'testempty' "$@" 1273s msggroup 1273s } 1273s testwarningempty() { 1273s testwarning "$@" 1273s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 1273s } 1273s testnotempty() { 1273s msggroup 'testnotempty' 1273s msgtest "Test for some output of" "$*" 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 1273s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 1273s msgpass 1273s else 1273s msgfailoutput '' "$COMPAREFILE" "$@" 1273s fi 1273s aptautotest 'testnotempty' "$@" 1273s msggroup 1273s } 1273s 1273s testequal() { 1273s msggroup 'testequal' 1273s local MSG='Test of equality of' 1273s if [ "$1" = '--nomsg' ]; then 1273s MSG='' 1273s shift 1273s fi 1273s 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 1273s echo "$1" > "$COMPAREFILE" 1273s shift 1273s 1273s if [ -n "$MSG" ]; then 1273s msgtest "$MSG" "$*" 1273s fi 1273s testoutputequal "$COMPAREFILE" "$@" 1273s aptautotest 'testequal' "$@" 1273s msggroup 1273s } 1273s 1273s testequalor2() { 1273s msggroup 'testequalor2' 1273s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 1273s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 1273s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 1273s echo "$1" > "$COMPAREFILE1" 1273s echo "$2" > "$COMPAREFILE2" 1273s shift 2 1273s msgtest "Test for equality OR of" "$*" 1273s "$@" >"$COMPAREAGAINST" 2>&1 || true 1273s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 1273s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 1273s then 1273s msgpass 1273s else 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 1273s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 1273s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1273s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 1273s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1273s msgfailoutput '' "$OUTPUT" 1273s fi 1273s aptautotest 'testequalor2' "$@" 1273s msggroup 1273s } 1273s 1273s testshowvirtual() { 1273s msggroup 'testshowvirtual' 1273s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 1273s local PACKAGE="$1" 1273s shift 1273s while [ -n "$1" ]; do 1273s VIRTUAL="${VIRTUAL} 1273s N: Can't select versions from package '$1' as it is purely virtual" 1273s PACKAGE="${PACKAGE} $1" 1273s shift 1273s done 1273s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 1273s VIRTUAL="${VIRTUAL} 1273s N: No packages found" 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 1273s local ARCH="$(getarchitecture 'native')" 1273s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 1273s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 1273s msggroup 1273s } 1273s 1273s testnopackage() { 1273s msggroup 'testnopackage' 1273s msgtest "Test for non-existent packages" "apt-cache show $*" 1273s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 1273s if [ -n "$SHOWPKG" ]; then 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1273s echo "$SHOWPKG" >"$OUTPUT" 1273s msgfailoutput '' "$OUTPUT" 1273s else 1273s msgpass 1273s fi 1273s msggroup 1273s } 1273s testnosrcpackage() { 1273s msggroup 'testnosrcpackage' 1273s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 1273s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 1273s if [ -n "$SHOWPKG" ]; then 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 1273s echo "$SHOWPKG" >"$OUTPUT" 1273s msgfailoutput '' "$OUTPUT" 1273s else 1273s msgpass 1273s fi 1273s msggroup 1273s } 1273s 1273s testdpkgstatus() { 1273s msggroup 'testdpkgstatus' 1273s local STATE="$1" 1273s local NR="$2" 1273s shift 2 1273s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 1273s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 1273s if [ "$PKGS" != $NR ]; then 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1273s echo "$PKGS" >"$OUTPUT" 1273s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 1273s msgfailoutput '' "$OUTPUT" 1273s else 1273s msgpass 1273s fi 1273s msggroup 1273s } 1273s 1273s testdpkginstalled() { 1273s msggroup 'testdpkginstalled' 1273s testdpkgstatus 'ii' "$#" "$@" 1273s msggroup 1273s } 1273s 1273s testdpkgnotinstalled() { 1273s msggroup 'testdpkgnotinstalled' 1273s testdpkgstatus 'ii' '0' "$@" 1273s msggroup 1273s } 1273s 1273s testmarkedauto() { 1273s msggroup 'testmarkedauto' 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 1273s if [ -n "$1" ]; then 1273s msgtest 'Test for correctly marked as auto-installed' "$*" 1273s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1273s else 1273s msgtest 'Test for correctly marked as auto-installed' 'no package' 1273s echo -n > "$COMPAREFILE" 1273s fi 1273s testoutputequal "$COMPAREFILE" aptmark showauto 1273s msggroup 1273s } 1273s testmarkedmanual() { 1273s msggroup 'testmarkedmanual' 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 1273s if [ -n "$1" ]; then 1273s msgtest 'Test for correctly marked as manually installed' "$*" 1273s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1273s else 1273s msgtest 'Test for correctly marked as manually installed' 'no package' 1273s echo -n > "$COMPAREFILE" 1273s fi 1273s testoutputequal "$COMPAREFILE" aptmark showmanual 1273s msggroup 1273s } 1273s 1273s catfile() { 1273s if [ "${1##*.}" = 'deb' ]; then 1273s stat >&2 "$1" || true 1273s file >&2 "$1" || true 1273s else 1273s cat >&2 "$1" || true 1273s fi 1273s } 1273s msgfailoutput() { 1273s msgreportheader 'msgfailoutput' 1273s local MSG="$1" 1273s local OUTPUT="$2" 1273s shift 2 1273s local CMD="$1" 1273s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 1273s echo >&2 1273s while [ -n "$2" ]; do shift; done 1273s echo "#### Complete file: $1 ####" 1273s catfile "$1" 1273s echo "#### $CMD output ####" 1273s elif [ "$1" = 'test' ]; then 1273s echo >&2 1273s # doesn't support ! or non-file flags 1273s msgfailoutputstatfile() { 1273s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 1273s if expr match "$1" "$FILEFLAGS" >/dev/null; then 1273s echo "#### stat(2) of file: $2 ####" 1273s stat "$2" || true 1273s if test -d "$2"; then 1273s echo "#### The directory contains: $2 ####" 1273s ls >&2 "$2" || true 1273s elif test -e "$2"; then 1273s echo "#### Complete file: $2 ####" 1273s catfile "$2" 1273s fi 1273s fi 1273s } 1273s msgfailoutputstatfile "$2" "$3" 1273s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 1273s shift 3 1273s msgfailoutputstatfile "$2" "$3" 1273s done 1273s echo '#### test output ####' 1273s elif [ "$1" = 'cmp' ]; then 1273s echo >&2 1273s while [ -n "$2" ]; do 1273s echo "#### Complete file: $2 ####" 1273s catfile "$2" 1273s shift 1273s done 1273s echo '#### cmp output ####' 1273s elif [ "$1" = 'rm' ]; then 1273s echo "#### Directory listing of: $(pwd) ####" 1273s ls -l 1273s fi 1273s catfile "$OUTPUT" 1273s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 1273s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 1273s local COREEXE='' 1273s for CORENAME in 'core' 'core.pid'; do 1273s if [ -s "$CORENAME" ]; then 1273s cp -a ${CORENAME} "$COREDUMP" 1273s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 1273s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 1273s else 1273s continue 1273s fi 1273s break 1273s done 1273s if [ -s "$COREDUMP" ]; then 1273s true # found already as a file 1273s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 1273s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 1273s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 1273s else 1273s echo '### core dump not found ###' 1273s cat /proc/sys/kernel/core_pattern 1273s fi 1273s if [ -s "$COREDUMP" ]; then 1273s if [ -z "$COREEXE" ]; then 1273s case "$CMD" in 1273s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1273s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 1273s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 1273s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 1273s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 1273s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1273s esac 1273s fi 1273s 1273s if [ -d "${ARTIFACTSDIR}" ]; then 1273s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 1273s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 1273s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 1273s fi 1273s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 1273s echo "#### gdb backtrace ####" 1273s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 1273s fi 1273s fi 1273s rm -f "$COREDUMP" 1273s fi 1273s msgfail "$MSG" 1273s } 1273s 1273s testsuccesswithglobalerror() { 1273s local TYPE="$1" 1273s local ERRORS="$2" 1273s shift 2 1273s msggroup "$TYPE" 1273s if [ "$1" = '--nomsg' ]; then 1273s shift 1273s else 1273s msgtest 'Test for successful execution of' "$*" 1273s fi 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 1273s if "$@" >"${OUTPUT}" 2>&1; then 1273s if expr match "$1" '^apt.*' >/dev/null; then 1273s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1273s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1273s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 1273s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 1273s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 1273s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1273s msgpass 1273s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 1273s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1273s msgpass 1273s else 1273s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1273s fi 1273s else 1273s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1273s fi 1273s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 1273s if grep -q -E "^N: " "$OUTPUT"; then 1273s msgpass 1273s else 1273s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 1273s fi 1273s else 1273s msgpass 1273s fi 1273s else 1273s msgpass 1273s fi 1273s else 1273s local EXITCODE=$? 1273s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1273s fi 1273s aptautotest "$TYPE" "$@" 1273s msggroup 1273s } 1273s testsuccesswithnotice() { 1273s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 1273s } 1273s testsuccess() { 1273s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 1273s } 1273s testwarning() { 1273s msggroup 'testwarning' 1273s if [ "$1" = '--nomsg' ]; then 1273s shift 1273s else 1273s msgtest 'Test for successful execution with warnings of' "$*" 1273s fi 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 1273s if "$@" >"${OUTPUT}" 2>&1; then 1273s if expr match "$1" '^apt.*' >/dev/null; then 1273s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1273s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1273s elif grep -q -E '^E: ' "$OUTPUT"; then 1273s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 1273s elif ! grep -q -E '^W: ' "$OUTPUT"; then 1273s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 1273s else 1273s msgpass 1273s fi 1273s else 1273s msgpass 1273s fi 1273s else 1273s local EXITCODE=$? 1273s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1273s fi 1273s aptautotest 'testwarning' "$@" 1273s msggroup 1273s } 1273s testfailure() { 1273s msggroup 'testfailure' 1273s if [ "$1" = '--nomsg' ]; then 1273s shift 1273s else 1273s msgtest 'Test for failure in execution of' "$*" 1273s fi 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 1273s if "$@" >"${OUTPUT}" 2>&1; then 1273s local EXITCODE=$? 1273s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1273s else 1273s local EXITCODE=$? 1273s if expr match "$1" '^apt.*' >/dev/null; then 1273s if [ "$1" = 'aptkey' ]; then 1273s if grep -q " Can't check signature: 1273s BAD signature from 1273s signature could not be verified" "$OUTPUT"; then 1273s msgpass 1273s else 1273s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 1273s fi 1273s else 1273s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1273s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1273s elif grep -q -E '==ERROR' "$OUTPUT"; then 1273s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 1273s elif ! grep -q -E '^E: ' "$OUTPUT"; then 1273s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 1273s else 1273s msgpass 1273s fi 1273s fi 1273s else 1273s msgpass 1273s fi 1273s fi 1273s aptautotest 'testfailure' "$@" 1273s msggroup 1273s } 1273s 1273s testreturnstateequal() { 1273s local STATE="$1" 1273s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 1273s local STATE="$2" 1273s local TYPE="$3" 1273s shift 3 1273s msggroup "${STATE}equal" 1273s if [ "$1" != '--nomsg' ]; then 1273s local CMP="$1" 1273s shift 1273s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1273s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1273s else 1273s local CMP="$2" 1273s shift 2 1273s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1273s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1273s fi 1273s else 1273s msggroup "${STATE}equal" 1273s if [ "$2" != '--nomsg' ]; then 1273s local CMP="$2" 1273s shift 2 1273s "$STATE" "$@" 1273s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1273s else 1273s local CMP="$3" 1273s shift 3 1273s "$STATE" --nomsg "$@" 1273s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1273s fi 1273s fi 1273s msggroup 1273s } 1273s testsuccessequal() { 1273s # we compare output, so we know perfectly well about N: 1273s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 1273s } 1273s testwarningequal() { 1273s testreturnstateequal 'testwarning' "$@" 1273s } 1273s testfailureequal() { 1273s testreturnstateequal 'testfailure' "$@" 1273s } 1273s 1273s testfailuremsg() { 1273s msggroup 'testfailuremsg' 1273s local CMP="$1" 1273s shift 1273s testfailure "$@" 1273s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 1273s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 1273s testoutputequal "$COMPAREFILE" echo "$CMP" 1273s msggroup 1273s } 1273s testwarningmsg() { 1273s msggroup 'testwarningmsg' 1273s local CMP="$1" 1273s shift 1273s testwarning "$@" 1273s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 1273s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 1273s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 1273s testoutputequal "$COMPAREFILE" echo "$CMP" 1273s msggroup 1273s } 1273s 1273s testfilestats() { 1273s msggroup 'testfilestats' 1273s msgtest "Test that file $1 has $2 $3" "$4" 1273s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 1273s msgpass 1273s else 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 1273s { 1273s echo 1273s ls -ld "$1" || true 1273s echo -n "stat(1) reports for $2: " 1273s stat --format "$2" "$1" || true 1273s } >"$OUTPUT" 2>&1 1273s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 1273s fi 1273s msggroup 1273s } 1273s testaccessrights() { 1273s msggroup 'testaccessrights' 1273s testfilestats "$1" '%a' '=' "$2" 1273s msggroup 1273s } 1273s 1273s testwebserverlaststatuscode() { 1273s msggroup 'testwebserverlaststatuscode' 1273s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 1273s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 1273s rm -f "$DOWNLOG" "$STATUS" 1273s msgtest 'Test last status code from the webserver was' "$1" 1273s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 1273s msgpass 1273s else 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 1273s { 1273s if [ -n "$2" ]; then 1273s shift 1273s echo >&2 '#### Additionally provided output files contain:' 1273s cat >&2 "$@" 1273s fi 1273s echo >&2 '#### Download log of the status code:' 1273s cat >&2 "$DOWNLOG" 1273s } >"$OUTPUT" 2>&1 1273s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 1273s fi 1273s msggroup 1273s } 1273s 1273s mapkeynametokeyid() { 1273s while [ -n "$1" ]; do 1273s case "$1" in 1273s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 1273s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 1273s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 1273s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 1273s oldarchive) echo 'FDD2DB85F68C85A3';; 1273s *) echo 'UNKNOWN KEY';; 1273s esac 1273s shift 1273s done 1273s } 1273s testaptkeys() { 1273s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 1273s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 1273s echo -n > "$OUTPUT" 1273s fi 1273s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 1273s } 1273s 1273s pause() { 1273s echo "STOPPED execution. Press enter to continue" 1273s local IGNORE 1273s read IGNORE 1273s } 1273s 1273s logcurrentarchivedirectory() { 1273s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 1273s stat --format '%U:%G:%a:%n' "$line" 1273s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 1273s } 1273s listcurrentlistsdirectory() { 1273s { 1273s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 1273s stat --format '%U:%G:%a:%n' "$line" 1273s done 1273s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 1273s stat --format '%U:%G:%a:%s:%y:%n' "$line" 1273s done 1273s } | sort 1273s } 1273s forallsupportedcompressors() { 1273s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1273s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1273s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 1273s "$@" "$COMP" 1273s done 1273s } 1273s 1273s breakfiles() { 1273s while [ -n "$1" ]; do 1273s mv -f "${1}" "${1}.bak" 1273s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 1273s shift 1273s done 1273s } 1273s unbreakfiles() { 1273s while [ -n "$1" ]; do 1273s mv -f "${1}.bak" "${1}" 1273s shift 1273s done 1273s } 1273s 1273s ### convenience hacks ### 1273s mkdir() { 1273s # creating some directories by hand is a tedious task, so make it look simple 1273s local PARAMS="$*" 1273s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 1273s # only the last directory created by mkdir is effected by the -m ! 1273s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 1273s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 1273s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1273s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1273s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 1273s if [ "$(id -u)" = '0' ]; then 1273s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1273s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1273s fi 1273s else 1273s command mkdir "$@" 1273s fi 1273s } 1273s 1273s ### The following tests are run by most test methods automatically to check 1273s ### general things about commands executed without writing the test every time. 1273s 1273s aptautotest() { 1273s if [ $# -lt 3 ]; then return; fi 1273s local TESTCALL="$1" 1273s local CMD="$2" 1273s local FIRSTOPT="$3" 1273s shift 2 1273s for i in "$@"; do 1273s if ! expr match "$i" '^-' >/dev/null 2>&1; then 1273s FIRSTOPT="$i" 1273s break 1273s fi 1273s done 1273s shift 1273s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 1273s if command -v $AUTOTEST >/dev/null; then 1273s # save and restore the *.output files from other tests 1273s # as we might otherwise override them in these automatic tests 1273s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1273s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1273s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1273s $AUTOTEST "$TESTCALL" "$@" 1273s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1273s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1273s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1273s fi 1273s } 1273s 1273s cdfind() { 1273s ( cd /; find "$@" ) 1273s } 1273s aptautotest_aptget_update() { 1273s local TESTCALL="$1" 1273s while [ -n "$2" ]; do 1273s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 1273s shift 1273s done 1273s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 1273s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1273s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1273s # all copied files are properly chmodded 1273s local backupIFS="$IFS" 1273s IFS="$(printf "\n\b")" 1273s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 1273s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 1273s done 1273s IFS="$backupIFS" 1273s if [ "$TESTCALL" = 'testsuccess' ]; then 1273s # failure cases can retain partial files and such 1273s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 1273s fi 1273s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 1273s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 1273s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 1273s fi 1273s } 1273s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 1273s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 1273s 1273s testaptautotestnodpkgwarning() { 1273s local TESTCALL="$1" 1273s while [ -n "$2" ]; do 1273s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 1273s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 1273s shift 1273s done 1273s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 1273s } 1273s 1273s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 1273s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 1273s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 1273s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 1273s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 1273s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 1273s 1273s testaptmarknodefaultsections() { 1273s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 1273s } 1273s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 1273s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 1273s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 1273s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 1273s cmp: ./downloaded/foo1: No such file or directory 1273s FAIL: exitcode 2 1400s 1400s Redirect leads first URI to the second URI … Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 1400s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1400s Configured access method http 1400s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1400s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/http' 1400s <- http:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1400s Configured access method http 1400s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1400s -> http:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpk 1400s Test for successful execution of cmp /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework ./downloaded/foo1 … #### Complete file: /tmp/autopkgtest.5jqyde/build.ScX/src/test/integration/framework #### 1400s #### Complete file: ./downloaded/foo1 #### 1400s #### cmp output #### 1400s 1400s Test for successful execution of cmp ./downloaded/foo1 ./downloaded/foo2 … #### Complete file: ./downloaded/foo1 #### 1400s #### Complete file: ./downloaded/foo2 #### 1400s #### cmp output #### 1400s g=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 1400s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo2%0aFilename:%20./downloaded/foo1%0a%0a 1400s -> http:600%20URI%20Acquire%0aURI:%20http://localhost:44339/foo%0aFilename:%20./downloaded/foo2%0a%0a 1400s GET /foo2 HTTP/1.1 1400s Host: localhost:44339 1400s Accept: text/* 1400s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 1400s 1400s 1400s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20http://localhost:44339/foo2 1400s <- http:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 1400s <- http:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20http://localhost:44339/foo2 1400s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo2 1400s Answer for: http://localhost:44339/foo2 1400s HTTP/1.1 301 Moved Permanently 1400s Content-Length: 357 1400s Location: https://localhost:44339/foo 1400s Content-Type: text/html; charset=utf-8 1400s Server: APT webserver 1400s Accept-Ranges: bytes 1400s Date: Fri, 13 Jun 2025 00:20:42 GMT 1400s 1400s GET /foo HTTP/1.1 1400s Host: localhost:44339 1400s Accept: text/* 1400s User-Agent: Debian APT-HTTP/1.3 (2.8.3) 1400s 1400s 1400s <- http:103%20Redirect%0aNew-URI:%20https://localhost:44339/foo%0aURI:%20http://localhost:44339/foo2 1400s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 1400s Answer for: http://localhost:44339/foo 1400s HTTP/1.1 200 OK 1400s Content-Length: 77417 1400s Last-Modified: Fri, 13 Jun 2025 00:07:57 GMT 1400s Server: APT webserver 1400s Accept-Ranges: bytes 1400s Date: Fri, 13 Jun 2025 00:20:42 GMT 1400s 1400s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1400s Configured access method https 1400s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1400s Starting method '/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods/https' 1400s <- https:100%20Capabilities%0aSend-URI-Encoded:%20true%0aSend-Config:%20true%0aPipeline:%20true%0aVersion:%201.2 1400s Configured access method https 1400s Version:1.2 SingleInstance:0 Pipeline:1 SendConfig:1 LocalOnly: 0 NeedsCleanup: 0 Removable: 0 AuxRequests: 0 SendURIEncoded: 1 1400s -> https:601%20Configuration%0aConfig-Item:%20Acquire::Send-URI-Encoded=1%0aConfig-Item:%20APT::Architecture=amd64%0aConfig-Item:%20APT::Build-Essential::=build-essential%0aConfig-Item:%20APT::Install-Recommends=1%0aConfig-Item:%20APT::Install-Suggests=0%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo=>%253drsa1024,ed25519,ed448,nistp256,nistp384,nistp512,brainpoolP256r1,brainpoolP320r1,brainpoolP384r1,brainpoolP512r1,secp256k1%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Next=>%253drsa2048,ed25519,ed448,nistp256,nistp384,nistp512%0aConfig-Item:%20APT::Key::Assert-Pubkey-Algo::Future=>%253drsa3072,ed25519,ed448%0aConfig-Item:%20APT::Sandbox::User=_apt%0aConfig-Item:%20APT::Sandbox::Verify=true%0aConfig-Item:%20APT::Get::Show-User-Simulation-Note=false%0aConfig-Item:%20APT::NeverAutoRemove::=^firmware-linux.*%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-firmware$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*$%0aConfig-Item:%20APT::NeverAutoRemove::=^linux-image-[a-z0-9]*-[a-z0-9]*$%0aConfig-Item:%20APT::VersionedKernelPackages::=linux-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=kfreebsd-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=gnumach-.*%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-modules%0aConfig-Item:%20APT::VersionedKernelPackages::=.*-kernel%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=metapackages%0aConfig-Item:%20APT::Never-MarkAuto-Sections::=tasks%0aConfig-Item:%20APT::Move-Autobit-Sections::=oldlibs%0aConfig-Item:%20APT::Architectures::=amd64%0aConfig-Item:%20APT::Cmd::Disable-Script-Warning=1%0aConfig-Item:%20APT::FTPArchive::SHA256=true%0aConfig-Item:%20APT::FTPArchive::MD5=false%0aConfig-Item:%20APT::FTPArchive::SHA1=false%0aConfig-Item:%20APT::FTPArchive::SHA512=false%0aConfig-Item:%20APT::Machine-ID=912e43bd1c1d4ba481f9f8ccab25f9ee%0aConfig-Item:%20APT::Color=0%0aConfig-Item:%20Dir=/tmp/tmp.rnOWa9o3HI/rootdir%0aConfig-Item:%20Dir::State=var/lib/apt%0aConfig-Item:%20Dir::State::lists=lists/%0aConfig-Item:%20Dir::State::cdroms=cdroms.list%0aConfig-Item:%20Dir::State::extended_states=extended_states%0aConfig-Item:%20Dir::State::status=/tmp/tmp.rnOWa9o3HI/rootdir/var/lib/dpkg/status%0aConfig-Item:%20Dir::Cache=var/cache/apt%0aConfig-Item:%20Dir::Cache::archives=archives/%0aConfig-Item:%20Dir::Cache::srcpkgcache=srcpkgcache.bin%0aConfig-Item:%20Dir::Cache::pkgcache=pkgcache.bin%0aConfig-Item:%20Dir::Etc=etc/apt%0aConfig-Item:%20Dir::Etc::sourcelist=sources.list%0aConfig-Item:%20Dir::Etc::sourceparts=sources.list.d%0aConfig-Item:%20Dir::Etc::main=apt.conf%0aConfig-Item:%20Dir::Etc::netrc=auth.conf%0aConfig-Item:%20Dir::Etc::netrcparts=auth.conf.d%0aConfig-Item:%20Dir::Etc::parts=apt.conf.d%0aConfig-Item:%20Dir::Etc::preferences=preferences%0aConfig-Item:%20Dir::Etc::preferencesparts=preferences.d%0aConfig-Item:%20Dir::Etc::trusted=trusted.gpg%0aConfig-Item:%20Dir::Etc::trustedparts=trusted.gpg.d%0aConfig-Item:%20Dir::Bin::methods=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/methods%0aConfig-Item:%20Dir::Bin::solvers=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::solvers::=/usr/lib/apt/solvers%0aConfig-Item:%20Dir::Bin::planners=/tmp/tmp.rnOWa9o3HI/rootdir/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::planners::=/usr/lib/apt/planners%0aConfig-Item:%20Dir::Bin::apt-key=/usr/bin/apt-key%0aConfig-Item:%20Dir::Bin::ischroot=/bin/false%0aConfig-Item:%20Dir::Bin::dpkg=/tmp/tmp.rnOWa9o3HI/rootdir/usr/bin/dpkg%0aConfig-Item:%20Dir::Media::MountPath=/media/apt%0aConfig-Item:%20Dir::Log=var/log/apt%0aConfig-Item:%20Dir::Log::Terminal=term.log%0aConfig-Item:%20Dir::Log::History=history.log%0aConfig-Item:%20Dir::Log::Planner=eipp.log.xz%0aConfig-Item:%20Dir::Ignore-Files-Silently::=~$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.disabled$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.bak$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.dpkg-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.ucf-[a-z]+$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.save$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.orig$%0aConfig-Item:%20Dir::Ignore-Files-Silently::=\.distUpgrade$%0aConfig-Item:%20Acquire::AllowInsecureRepositories=0%0aConfig-Item:%20Acquire::AllowWeakRepositories=0%0aConfig-Item:%20Acquire::AllowDowngradeToInsecureRepositories=0%0aConfig-Item:%20Acquire::cdrom::mount=/media/cdrom/%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::MetaKey=$(COMPONENT)/binary-$(ARCHITECTURE)/Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatMetaKey=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::ShortDescription=Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Description=$(RELEASE)/$(COMPONENT)%2520$(ARCHITECTURE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::flatDescription=$(RELEASE)%2520Packages%0aConfig-Item:%20Acquire::IndexTargets::deb::Packages::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::MetaKey=$(COMPONENT)/i18n/Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatMetaKey=$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::ShortDescription=Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::Description=$(RELEASE)/$(COMPONENT)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb::Translations::flatDescription=$(RELEASE)%2520Translation-$(LANGUAGE)%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::MetaKey=$(COMPONENT)/source/Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatMetaKey=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::ShortDescription=Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Description=$(RELEASE)/$(COMPONENT)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::flatDescription=$(RELEASE)%2520Sources%0aConfig-Item:%20Acquire::IndexTargets::deb-src::Sources::Optional=0%0aConfig-Item:%20Acquire::IndexTargets::Randomized=false%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Debian=https://metadata.ftp-master.debian.org/changelogs/@CHANGEPATH@_changelog%0aConfig-Item:%20Acquire::Changelogs::URI::Origin::Ubuntu=https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog%0aConfig-Item:%20Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu=1%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Debian=https://snapshot.debian.org/archive/debian/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Origin::Ubuntu=https://snapshot.ubuntu.com/ubuntu/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Override::Label::Debian-Security=https://snapshot.debian.org/archive/debian-security/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::deb.debian.org=https://snapshot.debian.org/archive/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::.archive.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::security.ubuntu.com=https://snapshot.ubuntu.com/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpadcontent.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Snapshots::URI::Host::ppa.launchpad.net=https://snapshot.ppa.launchpadcontent.net/@PATH@/@SNAPSHOTID@/%0aConfig-Item:%20Acquire::Progress::Ignore::ShowErrorText=true%0aConfig-Item:%20Acquire::Progress::Diffpercent=true%0aConfig-Item:%20Acquire::Failure::ShowIP=false%0aConfig-Item:%20Acquire::https::CaInfo=/tmp/tmp.rnOWa9o3HI/rootdir/etc/webserver.pem%0aConfig-Item:%20Acquire::Connect::AddrConfig=false%0aConfig-Item:%20Acquire::Max-FutureTime=36000%0aConfig-Item:%20Acquire::gpgv::Options::=--weak-digest%0aConfig-Item:%20Acquire::gpgv::Options::=sha1%0aConfig-Item:%20quiet=0%0aConfig-Item:%20quiet::NoUpdate=true%0aConfig-Item:%20quiet::NoStatistic=true%0aConfig-Item:%20Binary=apt-helper%0aConfig-Item:%20Debug::pkgAcquire::Worker=1%0aConfig-Item:%20Debug::Acquire::http=1%0aConfig-Item:%20CommandLine::AsString=/usr/lib/apt//apt-helper%2520download-file%2520http://localhost:44339/foo2%2520./downloaded/foo1%2520%2520http://localhost:44339/foo%2520./downloaded/foo2%2520%2520-o%2520Debug::pkgAcquire::Worker%253d1%2520-o%2520Debug::Acquire::http%253d1%0a%0a 1400s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1400s <- http:102%20Status%0aMessage:%20Waiting%20for%20headers%0aURI:%20http://localhost:44339/foo 1400s <- http:200%20URI%20Start%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aURI:%20http://localhost:44339/foo 1400s Get:2 http://localhost:44339/foo [77.4 kB] 1400s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%0aURI:%20https://localhost:44339/foo 1400s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1400s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1400s <- http:201%20URI%20Done%0aChecksum-FileSize-Hash:%2077417%0aSHA512-Hash:%2099758b98725ee45110a374044902230c8b056c97567d3ec249dc4add195e13a8d07d7d5d5081938286c2c21ec0841528b6cee8986d16a3a9d0abd4c570dd7dce%0aSHA256-Hash:%2072d18d223dc239300d7548396ef9409ee2e4ff5163d55557a87d9852c098e15e%0aSHA1-Hash:%20357fe7a44e62f7a01e1b4c96ee33675f03223500%0aMD5Sum-Hash:%20582a51e7590162e00495e35c882c4b44%0aMD5-Hash:%20582a51e7590162e00495e35c882c4b44%0aLast-Modified:%20Fri,%2013%20Jun%202025%2000:07:57%20+0000%0aSize:%2077417%0aFilename:%20./downloaded/foo2%0aURI:%20http://localhost:44339/foo 1400s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1400s Ign:1 http://localhost:44339/foo2 1400s Could not wait for server fd - select (11: Resource temporarily unavailable) 1400s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1400s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1400s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1400s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1400s Ign:1 http://localhost:44339/foo2 1400s Could not wait for server fd - select (11: Resource temporarily unavailable) 1400s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1400s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1400s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1400s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1400s Ign:1 http://localhost:44339/foo2 1400s Could not wait for server fd - select (11: Resource temporarily unavailable) 1400s -> https:600%20URI%20Acquire%0aURI:%20https://localhost:44339/foo%0aFilename:%20./downloaded/foo1%0a%0a 1400s <- https:102%20Status%0aMessage:%20Connecting%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1400s <- https:102%20Status%0aMessage:%20Connected%20to%20localhost%20(127.0.0.1)%0aURI:%20https://localhost:44339/foo 1400s <- https:400%20URI%20Failure%0aTransient-Failure:%20true%0aMessage:%20Could%20not%20wait%20for%20server%20fd%20-%20select%20(11:%20Resource%20temporarily%20unavailable)%0aURI:%20https://localhost:44339/foo 1400s Err:1 http://localhost:44339/foo2 1400s Could not wait for server fd - select (11: Resource temporarily unavailable) 1400s E: Failed to fetch https://localhost:44339/foo Could not wait for server fd - select (11: Resource temporarily unavailable) 1400s E: Download Failed 1400s FAIL: exitcode 100 1400s 1400s #!/bin/sh -- # no runable script, just for vi 1400s 1400s EXIT_CODE=0 1400s 1400s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 1400s if [ "$1" = "-q" ]; then 1400s export MSGLEVEL=2 1400s elif [ "$1" = "-qq" ]; then 1400s export MSGLEVEL=1 1400s elif [ "$1" = "-v" ]; then 1400s export MSGLEVEL=4 1400s elif [ "$1" = '--color=no' ]; then 1400s export MSGCOLOR='NO' 1400s elif [ "$1" = '--color=yes' ]; then 1400s export MSGCOLOR='YES' 1400s elif [ "$1" = '--color' ]; then 1400s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 1400s shift 1400s elif [ "$1" = '--level' ]; then 1400s export MSGLEVEL=$2 1400s shift 1400s else 1400s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 1400s fi 1400s shift 1400s done 1400s export MSGLEVEL="${MSGLEVEL:-3}" 1400s 1400s # we all like colorful messages 1400s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 1400s if [ ! -t 1 ]; then # but check that we output to a terminal 1400s export MSGCOLOR='NO' 1400s fi 1400s fi 1400s 1400s if [ "$MSGCOLOR" != 'NO' ]; then 1400s CERROR="\033[1;31m" # red 1400s CWARNING="\033[1;33m" # yellow 1400s CMSG="\033[1;32m" # green 1400s CINFO="\033[1;96m" # light blue 1400s CDEBUG="\033[1;94m" # blue 1400s CNORMAL="\033[0;39m" # default system console color 1400s CDONE="\033[1;32m" # green 1400s CPASS="\033[1;32m" # green 1400s CFAIL="\033[1;31m" # red 1400s CCMD="\033[1;35m" # pink 1400s fi 1400s 1400s msgprintf() { 1400s local START="$1" 1400s local MIDDLE="$2" 1400s local END="$3" 1400s shift 3 1400s if [ -n "$1" ]; then 1400s printf "$START " "$1" 1400s shift 1400s while [ -n "$1" ]; do 1400s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 1400s shift 1400s done 1400s fi 1400s printf "${END}" 1400s } 1400s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 1400s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 1400s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 1400s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 1400s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 1400s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 1400s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 1400s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 1400s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 1400s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 1400s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 1400s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 1400s msgreportheader() { 1400s if [ -n "$MSGTEST_MSG" ]; then 1400s test "$1" != 'msgfailoutput' || echo 1400s if [ -n "$MSGTEST_MSGMSG" ]; then 1400s echo "$MSGTEST_MSGMSG" 1400s fi 1400s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 1400s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 1400s fi 1400s echo -n "$MSGTEST_MSG" 1400s unset MSGTEST_MSG 1400s fi 1400s } 1400s msgskip() { 1400s msgreportheader 'msgskip' 1400s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 1400s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 1400s } 1400s msgfail() { 1400s msgreportheader 'msgfail' 1400s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 1400s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 1400s if [ -n "$APT_DEBUG_TESTS" ]; then 1400s runapt $SHELL 1400s fi 1400s EXIT_CODE=$((EXIT_CODE+1)); 1400s } 1400s MSGGROUP_LEVEL=0 1400s msggroup() { 1400s if [ -n "$1" ]; then 1400s if [ $MSGGROUP_LEVEL = 0 ]; then 1400s MSGTEST_GRP='NEXT' 1400s fi 1400s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 1400s else 1400s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 1400s if [ $MSGGROUP_LEVEL = 0 ]; then 1400s unset MSGTEST_GRP 1400s fi 1400s fi 1400s } 1400s 1400s # enable / disable Debugging 1400s if [ $MSGLEVEL -le 0 ]; then 1400s msgdie() { true; } 1400s fi 1400s if [ $MSGLEVEL -le 1 ]; then 1400s msgwarn() { true; } 1400s msgnwarn() { true; } 1400s fi 1400s if [ $MSGLEVEL -le 2 ]; then 1400s msgmsg() { 1400s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 1400s } 1400s msgnmsg() { true; } 1400s msgtest() { 1400s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 1400s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 1400s MSGTEST_GRP="$MSGTEST_MSG" 1400s fi 1400s } 1400s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 1400s fi 1400s if [ $MSGLEVEL -le 3 ]; then 1400s msginfo() { true; } 1400s msgninfo() { true; } 1400s fi 1400s if [ $MSGLEVEL -le 4 ]; then 1400s msgdebug() { true; } 1400s msgndebug() { true; } 1400s fi 1400s if [ $MSGLEVEL -le 1 ]; then 1400s msgpass() { true; } 1400s fi 1400s msgdone() { 1400s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 1400s [ "$1" = "info" -a $MSGLEVEL -le 3 ] || 1400s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 1400s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 1400s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 1400s true; 1400s else 1400s printf "${CDONE}DONE${CNORMAL}\n"; 1400s fi 1400s } 1400s getaptconfig() { 1400s if [ -f ./aptconfig.conf ]; then 1400s echo "$(readlink -f ./aptconfig.conf)" 1400s elif [ -f ../aptconfig.conf ]; then 1400s echo "$(readlink -f ../aptconfig.conf)" 1400s elif [ -f ../../aptconfig.conf ]; then 1400s echo "$(readlink -f ../../aptconfig.conf)" 1400s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 1400s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 1400s fi 1400s } 1400s runapt() { 1400s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 1400s local CMD="$1" 1400s shift 1400s case "$CMD" in 1400s sh|aptitude|*/*|command) ;; 1400s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 1400s esac 1400s if [ "$CMD" = 'aptitude' ]; then 1400s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 1400s else 1400s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 1400s fi 1400s } 1400s runpython3() { runapt command python3 "$@"; } 1400s aptconfig() { runapt apt-config "$@"; } 1400s aptcache() { runapt apt-cache "$@"; } 1400s aptcdrom() { runapt apt-cdrom "$@"; } 1400s aptget() { runapt apt-get "$@"; } 1400s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 1400s aptkey() { runapt apt-key "$@"; } 1400s aptmark() { runapt apt-mark "$@"; } 1400s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 1400s apt() { runapt apt "$@"; } 1400s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 1400s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 1400s aptitude() { runapt aptitude "$@"; } 1400s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 1400s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 1400s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 1400s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 1400s 1400s dpkg() { 1400s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 1400s } 1400s dpkgquery() { 1400s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1400s } 1400s dpkg_version() { 1400s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 1400s } 1400s dpkgcheckbuilddeps() { 1400s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1400s } 1400s gdb() { 1400s local CMD 1400s case "$1" in 1400s aptget) CMD="apt-get";; 1400s aptcache) CMD="apt-cache";; 1400s aptcdrom) CMD="apt-cdrom";; 1400s aptconfig) CMD="apt-config";; 1400s aptmark) CMD="apt-mark";; 1400s apthelper) CMD="apt-helper";; 1400s aptftparchive) CMD="apt-ftparchive";; 1400s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1400s *) CMD="$1";; 1400s esac 1400s shift 1400s if [ "${CMD##*/}" = "$CMD" ]; then 1400s CMD="${APTCMDLINEBINDIR}/${CMD}" 1400s fi 1400s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 1400s } 1400s 1400s valgrind() { 1400s local CMD 1400s case "$1" in 1400s aptget) CMD="apt-get";; 1400s aptcache) CMD="apt-cache";; 1400s aptcdrom) CMD="apt-cdrom";; 1400s aptconfig) CMD="apt-config";; 1400s aptmark) CMD="apt-mark";; 1400s apthelper) CMD="apt-helper";; 1400s aptftparchive) CMD="apt-ftparchive";; 1400s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1400s *) CMD="$1";; 1400s esac 1400s shift 1400s if [ "$CMD" = "apt-ftparchive" ]; then 1400s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 1400s fi 1400s if [ "${CMD##*/}" = "$CMD" ]; then 1400s CMD="${APTCMDLINEBINDIR}/${CMD}" 1400s fi 1400s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 1400s } 1400s 1400s lastmodification() { 1400s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 1400s } 1400s releasefiledate() { 1400s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 1400s } 1400s 1400s exitwithstatus() { 1400s # error if we about to overflow, but ... 1400s # "255 failures ought to be enough for everybody" 1400s if [ $EXIT_CODE -gt 255 ]; then 1400s msgdie "Total failure count $EXIT_CODE too big" 1400s fi 1400s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 1400s } 1400s 1400s shellsetedetector() { 1400s local exit_status=$? 1400s if [ "$exit_status" != '0' ]; then 1400s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 1400s if [ "$EXIT_CODE" = '0' ]; then 1400s EXIT_CODE="$exit_status" 1400s fi 1400s fi 1400s } 1400s 1400s addtrap() { 1400s if [ "$1" = 'prefix' ]; then 1400s CURRENTTRAP="$2 $CURRENTTRAP" 1400s else 1400s CURRENTTRAP="$CURRENTTRAP $1" 1400s fi 1400s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1400s } 1400s 1400s escape_shell() { 1400s echo "$@" | sed -e "s#'#'\"'\"'#g" 1400s } 1400s 1400s find_project_binary_dir() { 1400s if [ -z "$PROJECT_BINARY_DIR" ]; then 1400s PROJECT_BINARY_DIR= 1400s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 1400s test -e "$dir/CMakeCache.txt" || continue 1400s if [ -z "$PROJECT_BINARY_DIR" ] || 1400s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 1400s PROJECT_BINARY_DIR="$dir" 1400s fi 1400s done 1400s if [ -z "$PROJECT_BINARY_DIR" ]; then 1400s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 1400s exit 1 1400s fi 1400s export PROJECT_BINARY_DIR 1400s fi 1400s } 1400s _removetmpworkingdirectory() { 1400s cd / 1400s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 1400s rm -rf "$TMPWORKINGDIRECTORY" 1400s fi 1400s TMPWORKINGDIRECTORY='' 1400s } 1400s setupenvironment() { 1400s # cleanup the environment a bit 1400s export LC_ALL=C 1400s unset LANGUAGE COLUMNS NLSPATH 1400s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 1400s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 1400s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 1400s unset GREP_OPTIONS POSIXLY_CORRECT 1400s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 1400s export GCOV_ERROR_FILE=/dev/null 1400s 1400s # Next check needs a gnu stat, let's figure that out early. 1400s stat=stat 1400s if command -v gnustat >/dev/null 2>&1; then 1400s stat=gnustat 1400s fi 1400s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 1400s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 1400s unset TMPDIR 1400s fi 1400s if [ -z "$TMPWORKINGDIRECTORY" ]; then 1400s addtrap '_removetmpworkingdirectory;' 1400s TMPWORKINGDIRECTORY="$(mktemp -d)" 1400s fi 1400s if [ -n "$TMPDIR_ADD" ]; then 1400s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 1400s mkdir -p "$TMPWORKINGDIRECTORY" 1400s unset TMPDIR_ADD 1400s export TMPDIR="$TMPWORKINGDIRECTORY" 1400s fi 1400s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 1400s 1400s # Setup coreutils on BSD systems 1400s mkdir "${TMPWORKINGDIRECTORY}/bin" 1400s for prefix in gnu g; do 1400s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 1400s if command -v $prefix$command 2>/dev/null >/dev/null; then 1400s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 1400s fi 1400s done 1400s done 1400s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 1400s 1400s if [ -z "$TESTDIRECTORY" ]; then 1400s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 1400s fi 1400s cd "$TMPWORKINGDIRECTORY" 1400s 1400s mkdir -m 700 'downloaded' 1400s if [ "$(id -u)" = '0' ]; then 1400s # relax permissions so that running as root with user switching works 1400s umask 022 1400s chmod 711 "$TMPWORKINGDIRECTORY" 1400s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 1400s fi 1400s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 1400s 1400s _setupprojectenvironment 1400s 1400s # create some files in /tmp and look at user/group to get what this means 1400s TEST_DEFAULT_USER="$(id -un)" 1400s touch "${TMPWORKINGDIRECTORY}/test-file" 1400s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 1400s 1400s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 1400s . "${TESTDIRECTORY}/extra-environment" 1400s fi 1400s 1400s msgdone "info" 1400s } 1400s _setupprojectenvironment() { 1400s # allow overriding the default BUILDDIR locations 1400s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 1400s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 1400s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 1400s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 1400s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1400s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 1400s APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 1400s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1400s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 1400s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 1400s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 1400s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 1400s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 1400s 1400s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 1400s mkdir aptarchive keys 1400s cd rootdir 1400s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 1400s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 1400s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 1400s touch var/lib/dpkg/available var/lib/dpkg/lock 1400s echo '1' > var/lib/dpkg/info/format 1400s ln -s "${METHODSDIR}" usr/lib/apt/methods 1400s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 1400s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 1400s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 1400s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 1400s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 1400s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 1400s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 1400s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 1400s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 1400s else 1400s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 1400s fi 1400s cd .. 1400s local BASENAME="${0##*/}" 1400s local PACKAGESFILE="Packages-${BASENAME#*-}" 1400s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 1400s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 1400s fi 1400s local SOURCESSFILE="Sources-${BASENAME#*-}" 1400s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 1400s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 1400s fi 1400s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 1400s chmod 644 keys/* 1400s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 1400s 1400s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 1400s echo "Dir::Etc \"etc\";" >> aptconfig.conf 1400s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 1400s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 1400s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 1400s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 1400s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 1400s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 1400s # either store apt-key were we can access it, even if we run it as a different user 1400s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 1400s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 1400s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 1400s # destroys coverage reporting though, so we disable changing user for the calling gpgv 1400s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 1400s if [ "$(id -u)" = '0' ]; then 1400s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 1400s # same for the solver executables 1400s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 1400s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 1400s fi 1400s 1400s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 1400s EXEC='' 1400s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 1400s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 1400s restoredpkgstatus() { 1400s if [ -n "\$BACKUP" ]; then 1400s if [ -e "\$BACKUP" ]; then 1400s mv -f "\$BACKUP" "\$ORIGINAL" 1400s else 1400s rm -f "\$ORIGINAL" 1400s fi 1400s BACKUP='' 1400s fi 1400s } 1400s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1400s if [ -e "\$ORIGINAL" ]; then 1400s cp -a "\$ORIGINAL" "\$BACKUP" 1400s fi 1400s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 1400s 1400s Package: dpkg 1400s Architecture: all 1400s Version: ${DPKG_VERSION}+fake 1400s Status: install ok installed 1400s Maintainer: Joe Sixpack 1400s Installed-Size: 42 1400s Description: tells dpkg it supports what we need 1400s Some versions of dpkg check its own version from the status file 1400s to know if it supports multi-arch and stuff in --assert-*. 1400s 1400s EOS 1400s fi 1400s EOF 1400s fi 1400s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 1400s 1400s { 1400s echo 'quiet "0";' 1400s echo 'quiet::NoUpdate "true";' 1400s echo 'quiet::NoStatistic "true";' 1400s # too distracting for users, but helpful to detect changes 1400s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 1400s echo 'Acquire::Progress::Diffpercent "true";' 1400s # in testcases, it can appear as if localhost has a rotation setup, 1400s # hide this as we can't really deal with it properly 1400s echo 'Acquire::Failure::ShowIP "false";' 1400s # randomess and tests don't play well together 1400s echo 'Acquire::IndexTargets::Randomized "false";' 1400s # fakeroot can't fake everything, so disabled in production but good for tests 1400s echo 'APT::Sandbox::Verify "true";' 1400s } >> aptconfig.conf 1400s 1400s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1400s if [ "$(id -u)" = '0' ]; then 1400s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1400s fi 1400s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 1400s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 1400s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 1400s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 1400s # Allow release files to be 10 hours in the future, rather than 10 seconds 1400s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 1400s 1400s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 1400s 1400s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 1400s confighashes 'SHA256' # these are tests, not security best-practices 1400s 1400s # Make dpkg inherit testing path 1400s echo 'DPkg::Path "";' >> aptconfig.conf 1400s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 1400s 1400s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 1400s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 1400s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 1400s fi 1400s 1400s # most tests just need one signed Release file, not both 1400s export APT_DONT_SIGN='Release.gpg' 1400s 1400s # prefer our apt binaries over the system apt binaries 1400s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 1400s } 1400s 1400s getarchitecture() { 1400s if [ "$1" = "native" -o -z "$1" ]; then 1400s eval `aptconfig shell ARCH APT::Architecture` 1400s if [ -n "$ARCH" ]; then 1400s echo $ARCH 1400s else 1400s dpkg --print-architecture 1400s fi 1400s else 1400s echo $1 1400s fi 1400s } 1400s 1400s getarchitectures() { 1400s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 1400s } 1400s 1400s getarchitecturesfromcommalist() { 1400s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 1400s } 1400s 1400s configarchitecture() { 1400s { 1400s echo "APT::Architecture \"$(getarchitecture $1)\";" 1400s while [ -n "$1" ]; do 1400s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 1400s shift 1400s done 1400s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 1400s configdpkg 1400s } 1400s 1400s configdpkg() { 1400s if [ ! -e rootdir/var/lib/dpkg/status ]; then 1400s local BASENAME="${0##*/}" 1400s local STATUSFILE="status-${BASENAME#*-}" 1400s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 1400s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 1400s # Add an empty line to the end if there is none 1400s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 1400s echo >> rootdir/var/lib/dpkg/status 1400s fi 1400s fi 1400s fi 1400s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 1400s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 1400s local ARCHS="$(getarchitectures)" 1400s local DPKGARCH="$(dpkg --print-architecture)" 1400s # this ensures that even if multi-arch isn't active in the view 1400s # of apt, given that dpkg can't be told which arch is native 1400s # the arch apt treats as native might be foreign for dpkg 1400s for ARCH in ${ARCHS}; do 1400s if [ "${ARCH}" != "${DPKGARCH}" ]; then 1400s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 1400s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 1400s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 1400s else 1400s # old-style used e.g. in Ubuntu-P – and as it seems travis 1400s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1400s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1400s fi 1400s fi 1400s fi 1400s done 1400s else 1400s # test multiarch before dpkg is ready for it… 1400s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 1400s fi 1400s } 1400s 1400s configdpkgnoopchroot() { 1400s # create a library to noop chroot() and rewrite maintainer script executions 1400s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 1400s # chroot directory dpkg could chroot into to execute the maintainer scripts 1400s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 1400s cat > noopchroot.c << EOF 1400s #define _GNU_SOURCE 1400s #include 1400s #include 1400s #include 1400s #include 1400s 1400s static char * chrootdir = NULL; 1400s 1400s int chroot(const char *path) { 1400s printf("WARNING: CHROOTing to %s was ignored!\n", path); 1400s free(chrootdir); 1400s chrootdir = strdup(path); 1400s return 0; 1400s } 1400s int execvp(const char *file, char *const argv[]) { 1400s static int (*func_execvp) (const char *, char * const []) = NULL; 1400s if (func_execvp == NULL) 1400s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 1400s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 1400s return func_execvp(file, argv); 1400s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 1400s char *newfile; 1400s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 1400s perror("asprintf"); 1400s return -1; 1400s } 1400s char const * const baseadmindir = "/var/lib/dpkg"; 1400s char *admindir; 1400s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 1400s perror("asprintf"); 1400s return -1; 1400s } 1400s setenv("DPKG_ADMINDIR", admindir, 1); 1400s return func_execvp(newfile, argv); 1400s } 1400s EOF 1400s if cc -ldl 2>&1 | grep -q dl; then 1400s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 1400s else 1400s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 1400s fi 1400s } 1400s configcompression() { 1400s if [ "$1" = 'ALL' ]; then 1400s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 1400s return 1400s fi 1400s local CMD='apthelper cat-file -C' 1400s while [ -n "$1" ]; do 1400s case "$1" in 1400s '.') printf ".\t.\tcat\n";; 1400s 'gz') printf "gzip\tgz\t$CMD $1\n";; 1400s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 1400s 'zst') printf "zstd\tzst\t$CMD $1\n";; 1400s *) printf "$1\t$1\t$CMD $1\n";; 1400s esac 1400s shift 1400s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1400s } 1400s confighashes() { 1400s { 1400s echo 'APT::FTPArchive {' 1400s { 1400s while [ -n "$1" ]; do 1400s printf "$1" | tr 'a-z' 'A-Z' 1400s printf "\t\"true\";\n" 1400s shift 1400s done 1400s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 1400s printf "$h\t\"false\";\n" 1400s done 1400s } | awk '!x[$1]++' 1400s echo '};' 1400s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 1400s } 1400s forcecompressor() { 1400s COMPRESSOR="$1" 1400s COMPRESS="$1" 1400s COMPRESSOR_CMD="apthelper cat-file -C $1" 1400s case $COMPRESSOR in 1400s gzip) COMPRESS='gz';; 1400s bzip2) COMPRESS='bz2';; 1400s zstd) COMPRESS='zst';; 1400s esac 1400s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1400s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 1400s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 1400s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1400s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 1400s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 1400s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 1400s done 1400s } 1400s 1400s _setupsimplenativepackage() { 1400s local NAME="$1" 1400s local ARCH="$2" 1400s local VERSION="$3" 1400s local RELEASE="${4:-unstable}" 1400s local DEPENDENCIES="$5" 1400s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 1400s If you find such a package installed on your system, 1400s something went horribly wrong! They are autogenerated 1400s and used only by testcases and serve no other purpose…}" 1400s 1400s local SECTION="${7:-others}" 1400s local PRIORITY="${8:-optional}" 1400s local FILE_TREE="$9" 1400s local COMPRESS_TYPE="${10:-gzip}" 1400s local DISTSECTION 1400s if [ "$SECTION" = "${SECTION#*/}" ]; then 1400s DISTSECTION="main" 1400s else 1400s DISTSECTION="${SECTION%/*}" 1400s fi 1400s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1400s 1400s mkdir -p "$BUILDDIR/debian/source" 1400s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 1400s echo "#!/bin/sh 1400s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 1400s 1400s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 1400s echo "$NAME ($VERSION) $RELEASE; urgency=low 1400s 1400s * Initial release 1400s 1400s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 1400s { 1400s echo "Source: $NAME 1400s Priority: $PRIORITY 1400s Maintainer: Joe Sixpack 1400s Standards-Version: 4.3.1 1400s Rules-Requires-Root: no" 1400s if [ "$SECTION" != '' ]; then 1400s echo "Section: $SECTION" 1400s fi 1400s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 1400s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 1400s echo " 1400s Package: $NAME" 1400s 1400s if [ "$ARCH" = 'all' ]; then 1400s echo "Architecture: all" 1400s else 1400s echo "Architecture: any" 1400s fi 1400s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 1400s test -z "$DEPS" || echo "$DEPS" 1400s printf "%b\n" "Description: $DESCRIPTION" 1400s } > "${BUILDDIR}/debian/control" 1400s 1400s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 1400s } 1400s 1400s make_tiny_rules() { 1400s local OUT="$1" 1400s if command -v gmake >/dev/null 2>&1; then 1400s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 1400s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 1400s else 1400s echo '#!/usr/bin/make -f' > "$OUT" 1400s fi 1400s echo '%:' >> "$OUT" 1400s echo ' dh $@' >> "$OUT" 1400s } 1400s 1400s setupsimplenativepackage() { 1400s _setupsimplenativepackage "$@" 1400s local NAME="$1" 1400s local VERSION="$3" 1400s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1400s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 1400s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 1400s } 1400s 1400s buildsimplenativepackage() { 1400s local NAME="$1" 1400s local ARCH="$2" 1400s local VERSION="$3" 1400s local RELEASE="${4:-unstable}" 1400s local DEPENDENCIES="$5" 1400s local DESCRIPTION="$6" 1400s local SECTION="${7:-others}" 1400s local PRIORITY="${8:-optional}" 1400s local FILE_TREE="$9" 1400s local COMPRESS_TYPE="${10:-gzip}" 1400s local DISTSECTION 1400s if [ "$SECTION" = "${SECTION#*/}" ]; then 1400s DISTSECTION="main" 1400s else 1400s DISTSECTION="${SECTION%/*}" 1400s fi 1400s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1400s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 1400s _setupsimplenativepackage "$@" 1400s cd "${BUILDDIR}/.." 1400s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 1400s cd - >/dev/null 1400s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 1400s | while read SRC; do 1400s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 1400s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 1400s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 1400s # adv --yes --default-key 'Joe Sixpack' \ 1400s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1400s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1400s # fi 1400s done 1400s 1400s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1400s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 1400s rm -rf "${BUILDDIR}/debian/tmp" 1400s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 1400s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 1400s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 1400s if [ -n "$FILE_TREE" ]; then 1400s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 1400s fi 1400s 1400s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 1400s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 1400s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 1400s # ensure the right permissions as dpkg-deb insists 1400s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 1400s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 1400s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 1400s done 1400s 1400s local NM 1400s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 1400s NM="$(echo "$NAME" | cut -c 1-4)" 1400s else 1400s NM="$(echo "$NAME" | cut -c 1)" 1400s fi 1400s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 1400s mkdir -p "$CHANGEPATH" 1400s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 1400s rm -rf "${BUILDDIR}" 1400s msgdone "info" 1400s } 1400s 1400s buildpackage() { 1400s local BUILDDIR=$1 1400s local RELEASE=$2 1400s local SECTION=$3 1400s local ARCH=$(getarchitecture $4) 1400s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 1400s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 1400s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 1400s cd "$BUILDDIR" 1400s if [ "$ARCH" = "all" ]; then 1400s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 1400s fi 1400s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 1400s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 1400s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 1400s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 1400s cd - > /dev/null 1400s for PKG in $PKGS; do 1400s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 1400s done 1400s for SRC in $SRCS; do 1400s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 1400s done 1400s } 1400s 1400s buildaptarchive() { 1400s if [ -d incoming ]; then 1400s buildaptarchivefromincoming "$@" 1400s else 1400s buildaptarchivefromfiles "$@" 1400s fi 1400s } 1400s 1400s createaptftparchiveconfig() { 1400s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 1400s local COMPRESSORS="${COMPRESSORS%* }" 1400s local ARCHS="$(getarchitectures)" 1400s cat > ftparchive.conf <> ftparchive.conf 1400s } 1400s 1400s buildaptftparchivedirectorystructure() { 1400s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 1400s for DIST in $DISTS; do 1400s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 1400s for SECTION in $SECTIONS; do 1400s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 1400s for ARCH in $ARCHS; do 1400s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 1400s done 1400s mkdir -p "dists/${DIST}/${SECTION}/source" 1400s mkdir -p "dists/${DIST}/${SECTION}/i18n" 1400s done 1400s done 1400s } 1400s 1400s insertpackage() { 1400s local RELEASES="$1" 1400s local NAME="$2" 1400s local ARCH="$3" 1400s local VERSION="$4" 1400s local DEPENDENCIES="$5" 1400s local PRIORITY="${6:-optional}" 1400s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 1400s If you find such a package installed on your system, 1400s something went horribly wrong! They are autogenerated 1400s and used only by testcases and serve no other purpose…}" 1400s local SECTION="${8:-other}" 1400s 1400s if [ "$SECTION" = "${SECTION#*/}" ]; then 1400s DISTSECTION="main" 1400s else 1400s DISTSECTION="${SECTION%/*}" 1400s fi 1400s local ARCHS="" 1400s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1400s if [ "$RELEASE" = 'installed' ]; then 1400s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 1400s continue 1400s fi 1400s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1400s if [ "$arch" = 'none' ]; then 1400s ARCHS="$(getarchitectures)" 1400s else 1400s ARCHS="$arch" 1400s fi 1400s for BUILDARCH in $ARCHS; do 1400s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 1400s mkdir -p "$PPATH" 1400s { 1400s echo "Package: $NAME 1400s Priority: $PRIORITY 1400s Section: $SECTION 1400s Installed-Size: 42 1400s Size: 42" 1400s if echo "$DEPENDENCIES" | grep -q SHA256:; then 1400s : 1400s else 1400s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 1400s fi 1400s echo "Maintainer: Joe Sixpack " 1400s test "$arch" = 'none' || echo "Architecture: $arch" 1400s echo "Version: $VERSION 1400s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 1400s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 1400s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 1400s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 1400s echo 1400s } >> "${PPATH}/Packages" 1400s done 1400s done 1400s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 1400s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 1400s echo "Package: $NAME 1400s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 1400s Description-en: $DESCRIPTION 1400s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 1400s done 1400s } 1400s 1400s insertsource() { 1400s local RELEASES="$1" 1400s local NAME="$2" 1400s local ARCH="$3" 1400s local VERSION="$4" 1400s local DEPENDENCIES="$5" 1400s local BINARY="${6:-$NAME}" 1400s local ARCHS="" 1400s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1400s local SPATH="aptarchive/dists/${RELEASE}/main/source" 1400s mkdir -p $SPATH 1400s local FILE="${SPATH}/Sources" 1400s local DSCFILE="${NAME}_${VERSION}.dsc" 1400s local TARFILE="${NAME}_${VERSION}.tar.gz" 1400s echo "Package: $NAME 1400s Binary: $BINARY 1400s Version: $VERSION 1400s Maintainer: Joe Sixpack 1400s Architecture: $ARCH" >> $FILE 1400s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1400s echo "Files: 1400s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1400s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1400s Checksums-Sha256: 1400s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1400s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1400s " >> "$FILE" 1400s done 1400s } 1400s 1400s insertinstalledpackage() { 1400s local NAME="$1" 1400s local ARCH="$2" 1400s local VERSION="$3" 1400s local DEPENDENCIES="$4" 1400s local PRIORITY="${5:-optional}" 1400s local STATUS="${6:-install ok installed}" 1400s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 1400s If you find such a package installed on your system, 1400s something went horribly wrong! They are autogenerated 1400s and used only by testcases and serve no other purpose…}" 1400s local SECTION="${8:-other}" 1400s 1400s local FILE='rootdir/var/lib/dpkg/status' 1400s local INFO='rootdir/var/lib/dpkg/info' 1400s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1400s echo "Package: $NAME 1400s Status: $STATUS 1400s Priority: $PRIORITY 1400s Section: $SECTION 1400s Installed-Size: 42 1400s Maintainer: Joe Sixpack 1400s Version: $VERSION" >> "$FILE" 1400s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 1400s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1400s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 1400s echo >> "$FILE" 1400s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 1400s echo -n > "${INFO}/${NAME}:${arch}.list" 1400s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 1400s else 1400s echo -n > "${INFO}/${NAME}.list" 1400s echo -n > "${INFO}/${NAME}.md5sums" 1400s fi 1400s done 1400s } 1400s 1400s 1400s buildaptarchivefromincoming() { 1400s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 1400s cd aptarchive 1400s [ -e pool ] || ln -s ../incoming pool 1400s [ -e ftparchive.conf ] || createaptftparchiveconfig 1400s [ -e dists ] || buildaptftparchivedirectorystructure 1400s msgninfo "\tGenerate Packages, Sources and Contents files… " 1400s testsuccess aptftparchive generate ftparchive.conf 1400s cd - > /dev/null 1400s msgdone "info" 1400s generatereleasefiles "$@" 1400s } 1400s 1400s buildaptarchivefromfiles() { 1400s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 1400s local DIR='aptarchive' 1400s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 1400s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 1400s msgninfo "\t${line} file… " 1400s compressfile "$line" "$1" 1400s msgdone "info" 1400s done 1400s generatereleasefiles "$@" 1400s } 1400s 1400s compressfile() { 1400s while read compressor extension command; do 1400s if [ "$compressor" = '.' ]; then 1400s if [ -n "$2" ]; then 1400s touch -d "$2" "$1" 1400s fi 1400s continue 1400s fi 1400s cat "$1" | $command > "${1}.${extension}" 1400s if [ -n "$2" ]; then 1400s touch -d "$2" "${1}.${extension}" 1400s fi 1400s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1400s } 1400s 1400s # can be overridden by testcases for their pleasure 1400s getcodenamefromsuite() { 1400s case "$1" in 1400s unstable) echo 'sid';; 1400s *) echo -n "$1";; 1400s esac 1400s } 1400s getreleaseversionfromsuite() { true; } 1400s getlabelfromsuite() { true; } 1400s getoriginfromsuite() { true; } 1400s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 1400s getnotautomaticfromsuite() { 1400s case "$1" in 1400s experimental|experimental2) echo "yes";; 1400s esac 1400s } 1400s getbutautomaticupgradesfromsuite() { true; } 1400s 1400s aptftparchiverelease() { 1400s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 1400s } 1400s generatereleasefiles() { 1400s # $1 is the Date header and $2 is the ValidUntil header to be set 1400s # both should be given in notation date/touch can understand 1400s local DATE="$1" 1400s local VALIDUNTIL="$2" 1400s if [ -e aptarchive/dists ]; then 1400s msgninfo "\tGenerate Release files for dists… " 1400s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 1400s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 1400s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 1400s local CODENAME="$(getcodenamefromsuite $SUITE)" 1400s local VERSION="$(getreleaseversionfromsuite $SUITE)" 1400s local LABEL="$(getlabelfromsuite $SUITE)" 1400s local ORIGIN="$(getoriginfromsuite $SUITE)" 1400s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 1400s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 1400s aptftparchiverelease "$dir" \ 1400s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 1400s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 1400s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 1400s -o APT::FTPArchive::Release::Label="${LABEL}" \ 1400s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 1400s -o APT::FTPArchive::Release::Version="${VERSION}" \ 1400s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 1400s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 1400s > "$dir/Release" 1400s done 1400s else 1400s msgninfo "\tGenerate Release files for flat… " 1400s aptftparchiverelease ./aptarchive > aptarchive/Release 1400s fi 1400s if [ -n "$VALIDUNTIL" ]; then 1400s sed -i "/^Date: / a\ 1400s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 1400s fi 1400s if [ -n "$DATE" -a "$DATE" != "now" ]; then 1400s for release in $(find ./aptarchive -name 'Release'); do 1400s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 1400s touch -d "$DATE" "$release" 1400s done 1400s fi 1400s msgdone "info" 1400s } 1400s 1400s setupdistsaptarchive() { 1400s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1400s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 1400s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 1400s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 1400s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 1400s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 1400s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 1400s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 1400s msgdone "info" 1400s done 1400s } 1400s 1400s setupflataptarchive() { 1400s local APTARCHIVE="$(readlink -f ./aptarchive)" 1400s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1400s if [ -f "${APTARCHIVE}/Packages" ]; then 1400s msgninfo "\tadd deb sources.list line… " 1400s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1400s msgdone 'info' 1400s else 1400s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1400s fi 1400s if [ -f "${APTARCHIVE}/Sources" ]; then 1400s msgninfo "\tadd deb-src sources.list line… " 1400s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1400s msgdone 'info' 1400s else 1400s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1400s fi 1400s } 1400s 1400s setupaptarchive() { 1400s local NOUPDATE=0 1400s if [ "$1" = '--no-update' ]; then 1400s NOUPDATE=1 1400s shift 1400s fi 1400s buildaptarchive "$@" 1400s if [ -e aptarchive/dists ]; then 1400s setupdistsaptarchive 1400s else 1400s setupflataptarchive 1400s fi 1400s signreleasefiles 'Joe Sixpack' 1400s if [ "1" != "$NOUPDATE" ]; then 1400s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 1400s fi 1400s } 1400s 1400s killgpgagent() { 1400s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 1400s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1400s if [ ! -e "${GPGHOME}" ]; then return; fi 1400s # ensure the agent dies quickly as different versions have different suicide heuristics 1400s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 1400s rm -rf "$GPGHOME" 1400s } 1400s dosigning() { 1400s local KEY="$1" 1400s shift 1400s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1400s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 1400s GPGHOME="$APT_TEST_SIGNINGHOME" 1400s else 1400s if [ ! -e "$GPGHOME" ]; then 1400s mkdir -p --mode=700 "${GPGHOME}" 1400s addtrap 'prefix' 'killgpgagent;' 1400s fi 1400s fi 1400s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 1400s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1400s "$@" 1400s } 1400s signreleasefiles() { 1400s local SIGNERS="${1:-Joe Sixpack}" 1400s local REPODIR="${2:-aptarchive}" 1400s if [ -n "$1" ]; then shift; fi 1400s if [ -n "$1" ]; then shift; fi 1400s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1400s msgninfo "\tSign archive with $SIGNERS key $KEY… " 1400s local REXKEY='keys/rexexpired' 1400s local SECEXPIREBAK="${REXKEY}.sec.bak" 1400s local PUBEXPIREBAK="${REXKEY}.pub.bak" 1400s local SIGUSERS="" 1400s while [ -n "${SIGNERS%%,*}" ]; do 1400s local SIGNER="${SIGNERS%%,*}" 1400s if [ "${SIGNERS}" = "${SIGNER}" ]; then 1400s SIGNERS="" 1400s fi 1400s SIGNERS="${SIGNERS#*,}" 1400s # FIXME: This should be the full name, but we can't encode the space properly currently 1400s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 1400s if [ "${SIGNER}" = 'Rex Expired' ]; then 1400s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 1400s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 1400s # therefore we 'temporary' make the key not expired and restore a backup after signing 1400s cp "${REXKEY}.sec" "$SECEXPIREBAK" 1400s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 1400s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 1400s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 1400s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 1400s cp "$SECUNEXPIRED" "${REXKEY}.sec" 1400s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 1400s else 1400s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 1400s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1400s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 1400s cat setexpire.gpg 1400s exit 1 1400s fi 1400s cp "${REXKEY}.sec" "$SECUNEXPIRED" 1400s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 1400s fi 1400s fi 1400s if [ ! -e "${KEY}.pub" ]; then 1400s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1400s cat "${K}.pub" >> "${KEY}.new.pub" 1400s cat "${K}.sec" >> "${KEY}.new.sec" 1400s fi 1400s done 1400s if [ ! -e "${KEY}.pub" ]; then 1400s mv "${KEY}.new.pub" "${KEY}.pub" 1400s mv "${KEY}.new.sec" "${KEY}.sec" 1400s fi 1400s for RELEASE in $(find "${REPODIR}/" -name Release); do 1400s # we might have set a specific date for the Release file, so copy it 1400s local DATE="$(stat --format "%y" "${RELEASE}")" 1400s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 1400s rm -f "${RELEASE}.gpg" 1400s else 1400s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 1400s touch -d "$DATE" "${RELEASE}.gpg" 1400s fi 1400s local INRELEASE="${RELEASE%/*}/InRelease" 1400s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 1400s rm -f "$INRELEASE" 1400s else 1400s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 1400s touch -d "$DATE" "${INRELEASE}" 1400s fi 1400s done 1400s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 1400s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 1400s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 1400s fi 1400s msgdone 'info' 1400s } 1400s 1400s redatereleasefiles() { 1400s local DATE="$(date -u -d "$1" -R)" 1400s for release in $(find aptarchive/ -name 'Release'); do 1400s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 1400s touch -d "$DATE" "$release" 1400s done 1400s signreleasefiles "${2:-Joe Sixpack}" 1400s } 1400s 1400s webserverconfig() { 1400s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 1400s local NOCHECK=false 1400s if [ "$1" = '--no-check' ]; then 1400s NOCHECK=true 1400s shift 1400s fi 1400s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 1400s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 1400s rm -f "$STATUS" "$DOWNLOG" 1400s local URI 1400s if [ -n "$2" ]; then 1400s msgtest "Set webserver config option '${1}' to" "$2" 1400s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 1400s else 1400s msgtest 'Clear webserver config option' "${1}" 1400s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 1400s fi 1400s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 1400s msgpass 1400s else 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 1400s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 1400s msgfailoutput '' "$OUTPUT" 1400s fi 1400s $NOCHECK || testwebserverlaststatuscode '200' 1400s } 1400s 1400s rewritesourceslist() { 1400s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 1400s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 1400s sed -i $LIST \ 1400s -e "s#file://$APTARCHIVE#${1}#" \ 1400s -e "s#file:$APTARCHIVE#${1}#" \ 1400s -e "s#copy://$APTARCHIVE#${1}#" \ 1400s -e "s#copy:$APTARCHIVE#${1}#" \ 1400s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 1400s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 1400s done 1400s } 1400s 1400s # wait for up to 10s for a pid file to appear to avoid possible race 1400s # when a helper is started and doesn't write the PID quick enough 1400s waitforpidfile() { 1400s local PIDFILE="$1" 1400s for i in $(seq 10); do 1400s if test -s "$PIDFILE"; then 1400s return 0 1400s fi 1400s sleep 1 1400s done 1400s msgdie "waiting for $PIDFILE failed" 1400s return 1 1400s } 1400s 1400s changetowebserver() { 1400s local REWRITE='yes' 1400s if [ "$1" = '--no-rewrite' ]; then 1400s REWRITE='no' 1400s shift 1400s fi 1400s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 1400s cd aptarchive 1400s local LOG="webserver.log" 1400s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 1400s cat "$LOG" 1400s false 1400s fi 1400s waitforpidfile aptwebserver.pid 1400s local PID="$(cat aptwebserver.pid)" 1400s if [ -z "$PID" ]; then 1400s msgdie 'Could not fork aptwebserver successfully' 1400s fi 1400s addtrap "kill $PID;" 1400s waitforpidfile aptwebserver.port 1400s APTHTTPPORT="$(cat aptwebserver.port)" 1400s if [ -z "$APTHTTPPORT" ]; then 1400s msgdie 'Could not get port for aptwebserver successfully' 1400s fi 1400s cd - > /dev/null 1400s else 1400s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 1400s fi 1400s if [ "$REWRITE" != 'no' ]; then 1400s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 1400s fi 1400s } 1400s 1400s changetohttpswebserver() { 1400s local REWRITE='yes' 1400s if [ "$1" = '--no-rewrite' ]; then 1400s REWRITE='no' 1400s shift 1400s fi 1400s local stunnel4 1400s if command -v stunnel4 >/dev/null 2>&1; then 1400s stunnel4=stunnel4 1400s elif command -v stunnel >/dev/null 2>&1; then 1400s stunnel4=stunnel 1400s else 1400s msgdie 'You need to install stunnel4 for https testcases' 1400s fi 1400s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 1400s changetowebserver --no-rewrite "$@" 1400s fi 1400s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 1400s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 1400s output = /dev/null 1400s 1400s [https] 1400s accept = 127.0.0.1:0 1400s connect = $APTHTTPPORT 1400s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 1400s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 1400s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 1400s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 1400s if [ -z "$PID" ]; then 1400s msgdie 'Could not fork $stunnel4 successfully' 1400s fi 1400s addtrap 'prefix' "kill ${PID};" 1400s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 1400s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 1400s if [ "$REWRITE" != 'no' ]; then 1400s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 1400s fi 1400s } 1400s 1400s changetocdrom() { 1400s mkdir -p rootdir/media/cdrom/.disk 1400s local CD="$(readlink -f rootdir/media/cdrom)" 1400s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 1400s if [ ! -d aptarchive/dists ]; then 1400s msgdie 'Flat file archive cdroms can not be created currently' 1400s return 1 1400s fi 1400s mv aptarchive/dists "$CD" 1400s ln -s "$(readlink -f ./incoming)" "$CD/pool" 1400s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 1400s # start with an unmounted disk 1400s mv "${CD}" "${CD}-unmounted" 1400s # we don't want the disk to be modifiable 1400s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 1400s chmod -R 555 rootdir/media/cdrom-unmounted/dists 1400s } 1400s 1400s downloadfile() { 1400s local PROTO="${1%%:*}" 1400s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 1400s download-file "$1" "$2" "$3" 2>&1 ; then 1400s return 1 1400s fi 1400s # only if the file exists the download was successful 1400s if [ -r "$2" ]; then 1400s return 0 1400s else 1400s return 1 1400s fi 1400s } 1400s 1400s cleanup_output() { 1400s cat "$1" | sed \ 1400s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 1400s -e '/^profiling:/ d' \ 1400s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 1400s >"$2" 1400s } 1400s 1400s checkdiff() { 1400s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 1400s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 1400s touch "$TMPFILE1" "$TMPFILE2" 1400s 1400s cleanup_output "$1" "$TMPFILE1" 1400s cleanup_output "$2" "$TMPFILE2" 1400s 1400s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 1400s if [ -n "$DIFFTEXT" ]; then 1400s echo >&2 1400s echo >&2 "$DIFFTEXT" 1400s return 1 1400s else 1400s return 0 1400s fi 1400s } 1400s 1400s testoutputequal() { 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 1400s local COMPAREFILE="$1" 1400s shift 1400s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 1400s msgpass 1400s else 1400s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 1400s cat "$COMPAREFILE" >>"${OUTPUT}" 1400s msgfailoutput '' "$OUTPUT" "$@" 1400s fi 1400s } 1400s 1400s testfileequal() { 1400s msggroup 'testfileequal' 1400s local MSG='Test for correctness of file' 1400s if [ "$1" = '--nomsg' ]; then 1400s MSG='' 1400s shift 1400s fi 1400s local FILE="$1" 1400s shift 1400s if [ -n "$MSG" ]; then 1400s msgtest "$MSG" "$FILE" 1400s fi 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 1400s if [ -z "$*" ]; then 1400s testoutputequal "$FILE" echo -n '' 1400s else 1400s testoutputequal "$FILE" echo "$*" 1400s fi 1400s msggroup 1400s } 1400s 1400s testempty() { 1400s msggroup 'testempty' 1400s if [ "$1" = '--nomsg' ]; then 1400s shift 1400s else 1400s msgtest "Test for no output of" "$*" 1400s fi 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 1400s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 1400s msgpass 1400s else 1400s msgfailoutput '' "$COMPAREFILE" "$@" 1400s fi 1400s aptautotest 'testempty' "$@" 1400s msggroup 1400s } 1400s testwarningempty() { 1400s testwarning "$@" 1400s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 1400s } 1400s testnotempty() { 1400s msggroup 'testnotempty' 1400s msgtest "Test for some output of" "$*" 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 1400s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 1400s msgpass 1400s else 1400s msgfailoutput '' "$COMPAREFILE" "$@" 1400s fi 1400s aptautotest 'testnotempty' "$@" 1400s msggroup 1400s } 1400s 1400s testequal() { 1400s msggroup 'testequal' 1400s local MSG='Test of equality of' 1400s if [ "$1" = '--nomsg' ]; then 1400s MSG='' 1400s shift 1400s fi 1400s 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 1400s echo "$1" > "$COMPAREFILE" 1400s shift 1400s 1400s if [ -n "$MSG" ]; then 1400s msgtest "$MSG" "$*" 1400s fi 1400s testoutputequal "$COMPAREFILE" "$@" 1400s aptautotest 'testequal' "$@" 1400s msggroup 1400s } 1400s 1400s testequalor2() { 1400s msggroup 'testequalor2' 1400s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 1400s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 1400s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 1400s echo "$1" > "$COMPAREFILE1" 1400s echo "$2" > "$COMPAREFILE2" 1400s shift 2 1400s msgtest "Test for equality OR of" "$*" 1400s "$@" >"$COMPAREAGAINST" 2>&1 || true 1400s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 1400s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 1400s then 1400s msgpass 1400s else 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 1400s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 1400s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1400s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 1400s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1400s msgfailoutput '' "$OUTPUT" 1400s fi 1400s aptautotest 'testequalor2' "$@" 1400s msggroup 1400s } 1400s 1400s testshowvirtual() { 1400s msggroup 'testshowvirtual' 1400s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 1400s local PACKAGE="$1" 1400s shift 1400s while [ -n "$1" ]; do 1400s VIRTUAL="${VIRTUAL} 1400s N: Can't select versions from package '$1' as it is purely virtual" 1400s PACKAGE="${PACKAGE} $1" 1400s shift 1400s done 1400s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 1400s VIRTUAL="${VIRTUAL} 1400s N: No packages found" 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 1400s local ARCH="$(getarchitecture 'native')" 1400s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 1400s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 1400s msggroup 1400s } 1400s 1400s testnopackage() { 1400s msggroup 'testnopackage' 1400s msgtest "Test for non-existent packages" "apt-cache show $*" 1400s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 1400s if [ -n "$SHOWPKG" ]; then 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1400s echo "$SHOWPKG" >"$OUTPUT" 1400s msgfailoutput '' "$OUTPUT" 1400s else 1400s msgpass 1400s fi 1400s msggroup 1400s } 1400s testnosrcpackage() { 1400s msggroup 'testnosrcpackage' 1400s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 1400s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 1400s if [ -n "$SHOWPKG" ]; then 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 1400s echo "$SHOWPKG" >"$OUTPUT" 1400s msgfailoutput '' "$OUTPUT" 1400s else 1400s msgpass 1400s fi 1400s msggroup 1400s } 1400s 1400s testdpkgstatus() { 1400s msggroup 'testdpkgstatus' 1400s local STATE="$1" 1400s local NR="$2" 1400s shift 2 1400s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 1400s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 1400s if [ "$PKGS" != $NR ]; then 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1400s echo "$PKGS" >"$OUTPUT" 1400s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 1400s msgfailoutput '' "$OUTPUT" 1400s else 1400s msgpass 1400s fi 1400s msggroup 1400s } 1400s 1400s testdpkginstalled() { 1400s msggroup 'testdpkginstalled' 1400s testdpkgstatus 'ii' "$#" "$@" 1400s msggroup 1400s } 1400s 1400s testdpkgnotinstalled() { 1400s msggroup 'testdpkgnotinstalled' 1400s testdpkgstatus 'ii' '0' "$@" 1400s msggroup 1400s } 1400s 1400s testmarkedauto() { 1400s msggroup 'testmarkedauto' 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 1400s if [ -n "$1" ]; then 1400s msgtest 'Test for correctly marked as auto-installed' "$*" 1400s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1400s else 1400s msgtest 'Test for correctly marked as auto-installed' 'no package' 1400s echo -n > "$COMPAREFILE" 1400s fi 1400s testoutputequal "$COMPAREFILE" aptmark showauto 1400s msggroup 1400s } 1400s testmarkedmanual() { 1400s msggroup 'testmarkedmanual' 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 1400s if [ -n "$1" ]; then 1400s msgtest 'Test for correctly marked as manually installed' "$*" 1400s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1400s else 1400s msgtest 'Test for correctly marked as manually installed' 'no package' 1400s echo -n > "$COMPAREFILE" 1400s fi 1400s testoutputequal "$COMPAREFILE" aptmark showmanual 1400s msggroup 1400s } 1400s 1400s catfile() { 1400s if [ "${1##*.}" = 'deb' ]; then 1400s stat >&2 "$1" || true 1400s file >&2 "$1" || true 1400s else 1400s cat >&2 "$1" || true 1400s fi 1400s } 1400s msgfailoutput() { 1400s msgreportheader 'msgfailoutput' 1400s local MSG="$1" 1400s local OUTPUT="$2" 1400s shift 2 1400s local CMD="$1" 1400s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 1400s echo >&2 1400s while [ -n "$2" ]; do shift; done 1400s echo "#### Complete file: $1 ####" 1400s catfile "$1" 1400s echo "#### $CMD output ####" 1400s elif [ "$1" = 'test' ]; then 1400s echo >&2 1400s # doesn't support ! or non-file flags 1400s msgfailoutputstatfile() { 1400s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 1400s if expr match "$1" "$FILEFLAGS" >/dev/null; then 1400s echo "#### stat(2) of file: $2 ####" 1400s stat "$2" || true 1400s if test -d "$2"; then 1400s echo "#### The directory contains: $2 ####" 1400s ls >&2 "$2" || true 1400s elif test -e "$2"; then 1400s echo "#### Complete file: $2 ####" 1400s catfile "$2" 1400s fi 1400s fi 1400s } 1400s msgfailoutputstatfile "$2" "$3" 1400s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 1400s shift 3 1400s msgfailoutputstatfile "$2" "$3" 1400s done 1400s echo '#### test output ####' 1400s elif [ "$1" = 'cmp' ]; then 1400s echo >&2 1400s while [ -n "$2" ]; do 1400s echo "#### Complete file: $2 ####" 1400s catfile "$2" 1400s shift 1400s done 1400s echo '#### cmp output ####' 1400s elif [ "$1" = 'rm' ]; then 1400s echo "#### Directory listing of: $(pwd) ####" 1400s ls -l 1400s fi 1400s catfile "$OUTPUT" 1400s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 1400s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 1400s local COREEXE='' 1400s for CORENAME in 'core' 'core.pid'; do 1400s if [ -s "$CORENAME" ]; then 1400s cp -a ${CORENAME} "$COREDUMP" 1400s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 1400s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 1400s else 1400s continue 1400s fi 1400s break 1400s done 1400s if [ -s "$COREDUMP" ]; then 1400s true # found already as a file 1400s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 1400s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 1400s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 1400s else 1400s echo '### core dump not found ###' 1400s cat /proc/sys/kernel/core_pattern 1400s fi 1400s if [ -s "$COREDUMP" ]; then 1400s if [ -z "$COREEXE" ]; then 1400s case "$CMD" in 1400s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1400s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 1400s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 1400s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 1400s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 1400s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1400s esac 1400s fi 1400s 1400s if [ -d "${ARTIFACTSDIR}" ]; then 1400s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 1400s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 1400s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 1400s fi 1400s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 1400s echo "#### gdb backtrace ####" 1400s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 1400s fi 1400s fi 1400s rm -f "$COREDUMP" 1400s fi 1400s msgfail "$MSG" 1400s } 1400s 1400s testsuccesswithglobalerror() { 1400s local TYPE="$1" 1400s local ERRORS="$2" 1400s shift 2 1400s msggroup "$TYPE" 1400s if [ "$1" = '--nomsg' ]; then 1400s shift 1400s else 1400s msgtest 'Test for successful execution of' "$*" 1400s fi 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 1400s if "$@" >"${OUTPUT}" 2>&1; then 1400s if expr match "$1" '^apt.*' >/dev/null; then 1400s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1400s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1400s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 1400s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 1400s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 1400s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1400s msgpass 1400s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 1400s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1400s msgpass 1400s else 1400s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1400s fi 1400s else 1400s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1400s fi 1400s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 1400s if grep -q -E "^N: " "$OUTPUT"; then 1400s msgpass 1400s else 1400s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 1400s fi 1400s else 1400s msgpass 1400s fi 1400s else 1400s msgpass 1400s fi 1400s else 1400s local EXITCODE=$? 1400s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1400s fi 1400s aptautotest "$TYPE" "$@" 1400s msggroup 1400s } 1400s testsuccesswithnotice() { 1400s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 1400s } 1400s testsuccess() { 1400s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 1400s } 1400s testwarning() { 1400s msggroup 'testwarning' 1400s if [ "$1" = '--nomsg' ]; then 1400s shift 1400s else 1400s msgtest 'Test for successful execution with warnings of' "$*" 1400s fi 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 1400s if "$@" >"${OUTPUT}" 2>&1; then 1400s if expr match "$1" '^apt.*' >/dev/null; then 1400s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1400s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1400s elif grep -q -E '^E: ' "$OUTPUT"; then 1400s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 1400s elif ! grep -q -E '^W: ' "$OUTPUT"; then 1400s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 1400s else 1400s msgpass 1400s fi 1400s else 1400s msgpass 1400s fi 1400s else 1400s local EXITCODE=$? 1400s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1400s fi 1400s aptautotest 'testwarning' "$@" 1400s msggroup 1400s } 1400s testfailure() { 1400s msggroup 'testfailure' 1400s if [ "$1" = '--nomsg' ]; then 1400s shift 1400s else 1400s msgtest 'Test for failure in execution of' "$*" 1400s fi 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 1400s if "$@" >"${OUTPUT}" 2>&1; then 1400s local EXITCODE=$? 1400s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1400s else 1400s local EXITCODE=$? 1400s if expr match "$1" '^apt.*' >/dev/null; then 1400s if [ "$1" = 'aptkey' ]; then 1400s if grep -q " Can't check signature: 1400s BAD signature from 1400s signature could not be verified" "$OUTPUT"; then 1400s msgpass 1400s else 1400s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 1400s fi 1400s else 1400s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1400s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1400s elif grep -q -E '==ERROR' "$OUTPUT"; then 1400s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 1400s elif ! grep -q -E '^E: ' "$OUTPUT"; then 1400s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 1400s else 1400s msgpass 1400s fi 1400s fi 1400s else 1400s msgpass 1400s fi 1400s fi 1400s aptautotest 'testfailure' "$@" 1400s msggroup 1400s } 1400s 1400s testreturnstateequal() { 1400s local STATE="$1" 1400s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 1400s local STATE="$2" 1400s local TYPE="$3" 1400s shift 3 1400s msggroup "${STATE}equal" 1400s if [ "$1" != '--nomsg' ]; then 1400s local CMP="$1" 1400s shift 1400s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1400s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1400s else 1400s local CMP="$2" 1400s shift 2 1400s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1400s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1400s fi 1400s else 1400s msggroup "${STATE}equal" 1400s if [ "$2" != '--nomsg' ]; then 1400s local CMP="$2" 1400s shift 2 1400s "$STATE" "$@" 1400s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1400s else 1400s local CMP="$3" 1400s shift 3 1400s "$STATE" --nomsg "$@" 1400s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1400s fi 1400s fi 1400s msggroup 1400s } 1400s testsuccessequal() { 1400s # we compare output, so we know perfectly well about N: 1400s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 1400s } 1400s testwarningequal() { 1400s testreturnstateequal 'testwarning' "$@" 1400s } 1400s testfailureequal() { 1400s testreturnstateequal 'testfailure' "$@" 1400s } 1400s 1400s testfailuremsg() { 1400s msggroup 'testfailuremsg' 1400s local CMP="$1" 1400s shift 1400s testfailure "$@" 1400s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 1400s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 1400s testoutputequal "$COMPAREFILE" echo "$CMP" 1400s msggroup 1400s } 1400s testwarningmsg() { 1400s msggroup 'testwarningmsg' 1400s local CMP="$1" 1400s shift 1400s testwarning "$@" 1400s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 1400s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 1400s testoutputequal "$COMPAREFILE" echo "$CMP" 1400s msggroup 1400s } 1400s 1400s testfilestats() { 1400s msggroup 'testfilestats' 1400s msgtest "Test that file $1 has $ P2 $3" "$4" 1400s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 1400s msgpass 1400s else 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 1400s { 1400s echo 1400s ls -ld "$1" || true 1400s echo -n "stat(1) reports for $2: " 1400s stat --format "$2" "$1" || true 1400s } >"$OUTPUT" 2>&1 1400s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 1400s fi 1400s msggroup 1400s } 1400s testaccessrights() { 1400s msggroup 'testaccessrights' 1400s testfilestats "$1" '%a' '=' "$2" 1400s msggroup 1400s } 1400s 1400s testwebserverlaststatuscode() { 1400s msggroup 'testwebserverlaststatuscode' 1400s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 1400s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 1400s rm -f "$DOWNLOG" "$STATUS" 1400s msgtest 'Test last status code from the webserver was' "$1" 1400s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 1400s msgpass 1400s else 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 1400s { 1400s if [ -n "$2" ]; then 1400s shift 1400s echo >&2 '#### Additionally provided output files contain:' 1400s cat >&2 "$@" 1400s fi 1400s echo >&2 '#### Download log of the status code:' 1400s cat >&2 "$DOWNLOG" 1400s } >"$OUTPUT" 2>&1 1400s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 1400s fi 1400s msggroup 1400s } 1400s 1400s mapkeynametokeyid() { 1400s while [ -n "$1" ]; do 1400s case "$1" in 1400s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 1400s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 1400s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 1400s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 1400s oldarchive) echo 'FDD2DB85F68C85A3';; 1400s *) echo 'UNKNOWN KEY';; 1400s esac 1400s shift 1400s done 1400s } 1400s testaptkeys() { 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 1400s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 1400s echo -n > "$OUTPUT" 1400s fi 1400s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 1400s } 1400s 1400s pause() { 1400s echo "STOPPED execution. Press enter to continue" 1400s local IGNORE 1400s read IGNORE 1400s } 1400s 1400s logcurrentarchivedirectory() { 1400s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 1400s stat --format '%U:%G:%a:%n' "$line" 1400s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 1400s } 1400s listcurrentlistsdirectory() { 1400s { 1400s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 1400s stat --format '%U:%G:%a:%n' "$line" 1400s done 1400s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 1400s stat --format '%U:%G:%a:%s:%y:%n' "$line" 1400s done 1400s } | sort 1400s } 1400s forallsupportedcompressors() { 1400s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1400s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1400s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 1400s "$@" "$COMP" 1400s done 1400s } 1400s 1400s breakfiles() { 1400s while [ -n "$1" ]; do 1400s mv -f "${1}" "${1}.bak" 1400s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 1400s shift 1400s done 1400s } 1400s unbreakfiles() { 1400s while [ -n "$1" ]; do 1400s mv -f "${1}.bak" "${1}" 1400s shift 1400s done 1400s } 1400s 1400s ### convenience hacks ### 1400s mkdir() { 1400s # creating some directories by hand is a tedious task, so make it look simple 1400s local PARAMS="$*" 1400s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 1400s # only the last directory created by mkdir is effected by the -m ! 1400s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 1400s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 1400s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1400s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1400s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 1400s if [ "$(id -u)" = '0' ]; then 1400s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1400s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1400s fi 1400s else 1400s command mkdir "$@" 1400s fi 1400s } 1400s 1400s ### The following tests are run by most test methods automatically to check 1400s ### general things about commands executed without writing the test every time. 1400s 1400s aptautotest() { 1400s if [ $# -lt 3 ]; then return; fi 1400s local TESTCALL="$1" 1400s local CMD="$2" 1400s local FIRSTOPT="$3" 1400s shift 2 1400s for i in "$@"; do 1400s if ! expr match "$i" '^-' >/dev/null 2>&1; then 1400s FIRSTOPT="$i" 1400s break 1400s fi 1400s done 1400s shift 1400s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 1400s if command -v $AUTOTEST >/dev/null; then 1400s # save and restore the *.output files from other tests 1400s # as we might otherwise override them in these automatic tests 1400s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1400s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1400s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1400s $AUTOTEST "$TESTCALL" "$@" 1400s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1400s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1400s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1400s fi 1400s } 1400s 1400s cdfind() { 1400s ( cd /; find "$@" ) 1400s } 1400s aptautotest_aptget_update() { 1400s local TESTCALL="$1" 1400s while [ -n "$2" ]; do 1400s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 1400s shift 1400s done 1400s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 1400s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1400s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1400s # all copied files are properly chmodded 1400s local backupIFS="$IFS" 1400s IFS="$(printf "\n\b")" 1400s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 1400s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 1400s done 1400s IFS="$backupIFS" 1400s if [ "$TESTCALL" = 'testsuccess' ]; then 1400s # failure cases can retain partial files and such 1400s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 1400s fi 1400s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 1400s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 1400s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 1400s fi 1400s } 1400s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 1400s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 1400s 1400s testaptautotestnodpkgwarning() { 1400s local TESTCALL="$1" 1400s while [ -n "$2" ]; do 1400s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 1400s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 1400s shift 1400s done 1400s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 1400s } 1400s 1400s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 1400s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 1400s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 1400s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 1400s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 1400s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 1400s 1400s testaptmarknodefaultsections() { 1400s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 1400s } 1400s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 1400s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 1400s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 1400s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 1400s cat: ./downloaded/foo1: No such file or directory 1400s cmp: ./downloaded/foo1: No such file or directory 1400s FAIL: exitcode 2 1400s 1400s cat: ./downloaded/foo1: No such file or directory 1400s #!/bin/sh -- # no runable script, just for vi 1400s 1400s EXIT_CODE=0 1400s 1400s while [ -n "$1" -a -z "$CHECK_ARGS" ]; do 1400s if [ "$1" = "-q" ]; then 1400s export MSGLEVEL=2 1400s elif [ "$1" = "-qq" ]; then 1400s export MSGLEVEL=1 1400s elif [ "$1" = "-v" ]; then 1400s export MSGLEVEL=4 1400s elif [ "$1" = '--color=no' ]; then 1400s export MSGCOLOR='NO' 1400s elif [ "$1" = '--color=yes' ]; then 1400s export MSGCOLOR='YES' 1400s elif [ "$1" = '--color' ]; then 1400s export MSGCOLOR="$(echo "$2" | tr 'a-z' 'A-Z')" 1400s shift 1400s elif [ "$1" = '--level' ]; then 1400s export MSGLEVEL=$2 1400s shift 1400s else 1400s echo >&2 "WARNING: Unknown parameter »$1« will be ignored" 1400s fi 1400s shift 1400s done 1400s export MSGLEVEL="${MSGLEVEL:-3}" 1400s 1400s # we all like colorful messages 1400s if [ "${MSGCOLOR:-YES}" = 'YES' ]; then 1400s if [ ! -t 1 ]; then # but check that we output to a terminal 1400s export MSGCOLOR='NO' 1400s fi 1400s fi 1400s 1400s if [ "$MSGCOLOR" != 'NO' ]; then 1400s CERROR="\033[1;31m" # red 1400s CWARNING="\033[1;33m" # yellow 1400s CMSG="\033[1;32m" # green 1400s CINFO="\033[1;96m" # light blue 1400s CDEBUG="\033[1;94m" # blue 1400s CNORMAL="\033[0;39m" # default system console color 1400s CDONE="\033[1;32m" # green 1400s CPASS="\033[1;32m" # green 1400s CFAIL="\033[1;31m" # red 1400s CCMD="\033[1;35m" # pink 1400s fi 1400s 1400s msgprintf() { 1400s local START="$1" 1400s local MIDDLE="$2" 1400s local END="$3" 1400s shift 3 1400s if [ -n "$1" ]; then 1400s printf "$START " "$1" 1400s shift 1400s while [ -n "$1" ]; do 1400s printf "$MIDDLE " "$(echo "$1" | sed -e 's#^apt\([cfghks]\)#apt-\1#')" 1400s shift 1400s done 1400s fi 1400s printf "${END}" 1400s } 1400s msgdie() { msgprintf "${CERROR}E: %s" '%s' "${CNORMAL}\n" "$@" >&2; exit 1; } 1400s msgwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}\n" "$@" >&2; } 1400s msgmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}\n" "$@"; } 1400s msginfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}\n" "$@"; } 1400s msgdebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}\n" "$@"; } 1400s msgdone() { msgprintf "${CDONE}DONE" '%s' "${CNORMAL}\n" "$@"; } 1400s msgnwarn() { msgprintf "${CWARNING}W: %s" '%s' "${CNORMAL}" "$@" >&2; } 1400s msgnmsg() { msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@"; } 1400s msgninfo() { msgprintf "${CINFO}I: %s" '%s' "${CNORMAL}" "$@"; } 1400s msgndebug() { msgprintf "${CDEBUG}D: %s" '%s' "${CNORMAL}" "$@"; } 1400s msgtest() { msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@"; } 1400s msgpass() { printf "${CPASS}PASS${CNORMAL}\n"; } 1400s msgreportheader() { 1400s if [ -n "$MSGTEST_MSG" ]; then 1400s test "$1" != 'msgfailoutput' || echo 1400s if [ -n "$MSGTEST_MSGMSG" ]; then 1400s echo "$MSGTEST_MSGMSG" 1400s fi 1400s if [ -n "$MSGTEST_GRP" ] && [ "$MSGTEST_GRP" != 'NEXT' ] && [ "$MSGTEST_GRP" != "$MSGTEST_MSG" ]; then 1400s echo "${CFAIL}Part of the test group: $MSGTEST_GRP" 1400s fi 1400s echo -n "$MSGTEST_MSG" 1400s unset MSGTEST_MSG 1400s fi 1400s } 1400s msgskip() { 1400s msgreportheader 'msgskip' 1400s if [ $# -gt 0 ]; then printf "${CWARNING}SKIP: $*${CNORMAL}\n" >&2; 1400s else printf "${CWARNING}SKIP${CNORMAL}\n" >&2; fi 1400s } 1400s msgfail() { 1400s msgreportheader 'msgfail' 1400s if [ $# -gt 0 ] && [ -n "$1" ]; then printf "${CFAIL}FAIL: $*${CNORMAL}\n" >&2; 1400s else printf "${CFAIL}FAIL${CNORMAL}\n" >&2; fi 1400s if [ -n "$APT_DEBUG_TESTS" ]; then 1400s runapt $SHELL 1400s fi 1400s EXIT_CODE=$((EXIT_CODE+1)); 1400s } 1400s MSGGROUP_LEVEL=0 1400s msggroup() { 1400s if [ -n "$1" ]; then 1400s if [ $MSGGROUP_LEVEL = 0 ]; then 1400s MSGTEST_GRP='NEXT' 1400s fi 1400s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL+1)); 1400s else 1400s MSGGROUP_LEVEL=$((MSGGROUP_LEVEL-1)); 1400s if [ $MSGGROUP_LEVEL = 0 ]; then 1400s unset MSGTEST_GRP 1400s fi 1400s fi 1400s } 1400s 1400s # enable / disable Debugging 1400s if [ $MSGLEVEL -le 0 ]; then 1400s msgdie() { true; } 1400s fi 1400s if [ $MSGLEVEL -le 1 ]; then 1400s msgwarn() { true; } 1400s msgnwarn() { true; } 1400s fi 1400s if [ $MSGLEVEL -le 2 ]; then 1400s msgmsg() { 1400s MSGTEST_MSGMSG="$(msgprintf "${CMSG}%s" '%s' "${CNORMAL}" "$@")" 1400s } 1400s msgnmsg() { true; } 1400s msgtest() { 1400s MSGTEST_MSG="$(msgprintf "${CINFO}%s" "${CCMD}%s${CINFO}" "…${CNORMAL} " "$@")" 1400s if [ "$MSGTEST_GRP" = 'NEXT' ]; then 1400s MSGTEST_GRP="$MSGTEST_MSG" 1400s fi 1400s } 1400s msgpass() { printf " ${CPASS}P${CNORMAL}"; } 1400s fi 1400s if [ $MSGLEVEL -le 3 ]; then 1400s msginfo() { true; } 1400s msgninfo() { true; } 1400s fi 1400s if [ $MSGLEVEL -le 4 ]; then 1400s msgdebug() { true; } 1400s msgndebug() { true; } 1400s fi 1400s if [ $MSGLEVEL -le 1 ]; then 1400s msgpass() { true; } 1400s fi 1400s msgdone() { 1400s if [ "$1" = "debug" -a $MSGLEVEL -le 4 ] || 1400s [ "$1" = "info" -a $MSGLEVEL -le 3 ] || 1400s [ "$1" = "msg" -a $MSGLEVEL -le 2 ] || 1400s [ "$1" = "warn" -a $MSGLEVEL -le 1 ] || 1400s [ "$1" = "die" -a $MSGLEVEL -le 0 ]; then 1400s true; 1400s else 1400s printf "${CDONE}DONE${CNORMAL}\n"; 1400s fi 1400s } 1400s getaptconfig() { 1400s if [ -f ./aptconfig.conf ]; then 1400s echo "$(readlink -f ./aptconfig.conf)" 1400s elif [ -f ../aptconfig.conf ]; then 1400s echo "$(readlink -f ../aptconfig.conf)" 1400s elif [ -f ../../aptconfig.conf ]; then 1400s echo "$(readlink -f ../../aptconfig.conf)" 1400s elif [ -f "${TMPWORKINGDIRECTORY}/aptconfig.conf" ]; then 1400s echo "$(readlink -f "${TMPWORKINGDIRECTORY}/aptconfig.conf")" 1400s fi 1400s } 1400s runapt() { 1400s msgdebug "Executing: ${CCMD}$*${CDEBUG} " 1400s local CMD="$1" 1400s shift 1400s case "$CMD" in 1400s sh|aptitude|*/*|command) ;; 1400s *) CMD="${APTCMDLINEBINDIR}/$CMD";; 1400s esac 1400s if [ "$CMD" = 'aptitude' ]; then 1400s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" command "$CMD" "$@" 1400s else 1400s MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG="$(getaptconfig)" LD_LIBRARY_PATH="${LIBRARYPATH}:${LD_LIBRARY_PATH}" "$CMD" "$@" 1400s fi 1400s } 1400s runpython3() { runapt command python3 "$@"; } 1400s aptconfig() { runapt apt-config "$@"; } 1400s aptcache() { runapt apt-cache "$@"; } 1400s aptcdrom() { runapt apt-cdrom "$@"; } 1400s aptget() { runapt apt-get "$@"; } 1400s aptftparchive() { runapt "${APTFTPARCHIVEBINDIR}/apt-ftparchive" "$@"; } 1400s aptkey() { runapt apt-key "$@"; } 1400s aptmark() { runapt apt-mark "$@"; } 1400s aptsortpkgs() { runapt apt-sortpkgs "$@"; } 1400s apt() { runapt apt "$@"; } 1400s apthelper() { runapt "${APTHELPERBINDIR}/apt-helper" "$@"; } 1400s aptwebserver() { runapt "${APTTESTHELPERSBINDIR}/aptwebserver" "$@"; } 1400s aptitude() { runapt aptitude "$@"; } 1400s aptextracttemplates() { runapt apt-extracttemplates "$@"; } 1400s aptinternalsolver() { runapt "${APTINTERNALSOLVER}" "$@"; } 1400s aptdumpsolver() { runapt "${APTDUMPSOLVER}" "$@"; } 1400s aptinternalplanner() { runapt "${APTINTERNALPLANNER}" "$@"; } 1400s 1400s dpkg() { 1400s "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" "$@" 1400s } 1400s dpkgquery() { 1400s command dpkg-query --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1400s } 1400s dpkg_version() { 1400s command perl -MDpkg -E 'say $Dpkg::PROGVERSION' 1400s } 1400s dpkgcheckbuilddeps() { 1400s command dpkg-checkbuilddeps --admindir="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg" "$@" 1400s } 1400s gdb() { 1400s local CMD 1400s case "$1" in 1400s aptget) CMD="apt-get";; 1400s aptcache) CMD="apt-cache";; 1400s aptcdrom) CMD="apt-cdrom";; 1400s aptconfig) CMD="apt-config";; 1400s aptmark) CMD="apt-mark";; 1400s apthelper) CMD="apt-helper";; 1400s aptftparchive) CMD="apt-ftparchive";; 1400s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1400s *) CMD="$1";; 1400s esac 1400s shift 1400s if [ "${CMD##*/}" = "$CMD" ]; then 1400s CMD="${APTCMDLINEBINDIR}/${CMD}" 1400s fi 1400s runapt command gdb --quiet -ex "directory '$SOURCEDIRECTORY'" -ex run "$CMD" --args "$CMD" "$@" 1400s } 1400s 1400s valgrind() { 1400s local CMD 1400s case "$1" in 1400s aptget) CMD="apt-get";; 1400s aptcache) CMD="apt-cache";; 1400s aptcdrom) CMD="apt-cdrom";; 1400s aptconfig) CMD="apt-config";; 1400s aptmark) CMD="apt-mark";; 1400s apthelper) CMD="apt-helper";; 1400s aptftparchive) CMD="apt-ftparchive";; 1400s dpkg) shift; runapt "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" "$@"; return;; 1400s *) CMD="$1";; 1400s esac 1400s shift 1400s if [ "$CMD" = "apt-ftparchive" ]; then 1400s CMD="${APTFTPARCHIVEBINDIR}/${CMD}" 1400s fi 1400s if [ "${CMD##*/}" = "$CMD" ]; then 1400s CMD="${APTCMDLINEBINDIR}/${CMD}" 1400s fi 1400s runapt command valgrind -q --error-exitcode=7 "$CMD" "$@" 1400s } 1400s 1400s lastmodification() { 1400s date -u -d "@$(stat -c '%Y' "${TMPWORKINGDIRECTORY}/$1")" -R 1400s } 1400s releasefiledate() { 1400s grep "^${2:-Date}:" "$1" | cut -d' ' -f 2- 1400s } 1400s 1400s exitwithstatus() { 1400s # error if we about to overflow, but ... 1400s # "255 failures ought to be enough for everybody" 1400s if [ $EXIT_CODE -gt 255 ]; then 1400s msgdie "Total failure count $EXIT_CODE too big" 1400s fi 1400s exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255)); 1400s } 1400s 1400s shellsetedetector() { 1400s local exit_status=$? 1400s if [ "$exit_status" != '0' ]; then 1400s printf >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}\n" 1400s if [ "$EXIT_CODE" = '0' ]; then 1400s EXIT_CODE="$exit_status" 1400s fi 1400s fi 1400s } 1400s 1400s addtrap() { 1400s if [ "$1" = 'prefix' ]; then 1400s CURRENTTRAP="$2 $CURRENTTRAP" 1400s else 1400s CURRENTTRAP="$CURRENTTRAP $1" 1400s fi 1400s trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1400s } 1400s 1400s escape_shell() { 1400s echo "$@" | sed -e "s#'#'\"'\"'#g" 1400s } 1400s 1400s find_project_binary_dir() { 1400s if [ -z "$PROJECT_BINARY_DIR" ]; then 1400s PROJECT_BINARY_DIR= 1400s for dir in ${TESTDIRECTORY}/../../ ${TESTDIRECTORY}/../../*; do 1400s test -e "$dir/CMakeCache.txt" || continue 1400s if [ -z "$PROJECT_BINARY_DIR" ] || 1400s [ "$dir/CMakeCache.txt" -nt "$PROJECT_BINARY_DIR/CMakeCache.txt" ]; then 1400s PROJECT_BINARY_DIR="$dir" 1400s fi 1400s done 1400s if [ -z "$PROJECT_BINARY_DIR" ]; then 1400s echo "Cannot find build directory, you might want to set PROJECT_BINARY_DIR" >&2 1400s exit 1 1400s fi 1400s export PROJECT_BINARY_DIR 1400s fi 1400s } 1400s _removetmpworkingdirectory() { 1400s cd / 1400s if [ -n "$TMPWORKINGDIRECTORY" -a -d "$TMPWORKINGDIRECTORY" ]; then 1400s rm -rf "$TMPWORKINGDIRECTORY" 1400s fi 1400s TMPWORKINGDIRECTORY='' 1400s } 1400s setupenvironment() { 1400s # cleanup the environment a bit 1400s export LC_ALL=C 1400s unset LANGUAGE COLUMNS NLSPATH 1400s unset APT_CONFIG DPKG_ADMINDIR DPKG_COLORS 1400s unset DEB_CHECK_COMMAND DEB_SIGN_KEYID DEB_BUILD_OPTIONS DEB_BUILD_PROFILES 1400s unset DH_VERBOSE DH_QUIET DH_COMPAT DH_NO_ACT DH_OPTIONS DH_EXTRA_ADDONS 1400s unset GREP_OPTIONS POSIXLY_CORRECT 1400s unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY no_proxy 1400s export GCOV_ERROR_FILE=/dev/null 1400s 1400s # Next check needs a gnu stat, let's figure that out early. 1400s stat=stat 1400s if command -v gnustat >/dev/null 2>&1; then 1400s stat=gnustat 1400s fi 1400s # privilege dropping and testing doesn't work if /tmp isn't world-writeable (as e.g. with libpam-tmpdir) 1400s if [ -n "$TMPDIR" ] && [ "$(id -u)" = '0' ] && [ "$($stat --format '%a' "$TMPDIR")" != '1777' ]; then 1400s unset TMPDIR 1400s fi 1400s if [ -z "$TMPWORKINGDIRECTORY" ]; then 1400s addtrap '_removetmpworkingdirectory;' 1400s TMPWORKINGDIRECTORY="$(mktemp -d)" 1400s fi 1400s if [ -n "$TMPDIR_ADD" ]; then 1400s TMPWORKINGDIRECTORY="${TMPWORKINGDIRECTORY}/${TMPDIR_ADD}" 1400s mkdir -p "$TMPWORKINGDIRECTORY" 1400s unset TMPDIR_ADD 1400s export TMPDIR="$TMPWORKINGDIRECTORY" 1400s fi 1400s msgninfo "Preparing environment for ${0##*/} in ${TMPWORKINGDIRECTORY}…" 1400s 1400s # Setup coreutils on BSD systems 1400s mkdir "${TMPWORKINGDIRECTORY}/bin" 1400s for prefix in gnu g; do 1400s for command in stat touch sed cp tr sha1sum sha256sum md5sum sha512sum grep date wc chmod head readlink tar expr base64; do 1400s if command -v $prefix$command 2>/dev/null >/dev/null; then 1400s [ -e "${TMPWORKINGDIRECTORY}/bin/$command" ] || ln -sf $(command -v $prefix$command) "${TMPWORKINGDIRECTORY}/bin/$command" 1400s fi 1400s done 1400s done 1400s export PATH="${TMPWORKINGDIRECTORY}/bin/:$PATH" 1400s 1400s if [ -z "$TESTDIRECTORY" ]; then 1400s TESTDIRECTORY="$(readlink -f "$(dirname $0)")" 1400s fi 1400s cd "$TMPWORKINGDIRECTORY" 1400s 1400s mkdir -m 700 'downloaded' 1400s if [ "$(id -u)" = '0' ]; then 1400s # relax permissions so that running as root with user switching works 1400s umask 022 1400s chmod 711 "$TMPWORKINGDIRECTORY" 1400s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/downloaded" 1400s fi 1400s mkdir -p 'rootdir/usr/bin' 'rootdir/var/cache' 'rootdir/var/lib' 'rootdir/var/log' 'rootdir/var/crash' 'rootdir/tmp' 1400s 1400s _setupprojectenvironment 1400s 1400s # create some files in /tmp and look at user/group to get what this means 1400s TEST_DEFAULT_USER="$(id -un)" 1400s touch "${TMPWORKINGDIRECTORY}/test-file" 1400s TEST_DEFAULT_GROUP=$(stat --format '%G' "${TMPWORKINGDIRECTORY}/test-file") 1400s 1400s if [ -r "${TESTDIRECTORY}/extra-environment" ]; then 1400s . "${TESTDIRECTORY}/extra-environment" 1400s fi 1400s 1400s msgdone "info" 1400s } 1400s _setupprojectenvironment() { 1400s # allow overriding the default BUILDDIR locations 1400s SOURCEDIRECTORY="${APT_INTEGRATION_TESTS_SOURCE_DIR:-"${TESTDIRECTORY}/../../"}" 1400s BUILDDIRECTORY="${APT_INTEGRATION_TESTS_BUILD_DIR:-"$(find_project_binary_dir; printf '%s' "$PROJECT_BINARY_DIR")"}" 1400s LIBRARYPATH="${APT_INTEGRATION_TESTS_LIBRARY_PATH:-"${BUILDDIRECTORY}/apt-pkg"}" 1400s METHODSDIR="${APT_INTEGRATION_TESTS_METHODS_DIR:-"${BUILDDIRECTORY}/methods"}" 1400s APTHELPERBINDIR="${APT_INTEGRATION_TESTS_LIBEXEC_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1400s APTTESTHELPERSBINDIR="${APT_INTEGRATION_TESTS_HELPERS_BIN_DIR:-"${BUILDDIRECTORY}/test/interactive-helper"}" 1400s APTFTPARCHIVEBINDIR="${APT_INTEGRATION_TESTS_FTPARCHIVE_BIN_DIR:-"${BUILDDIRECTORY}/ftparchive"}" 1400s APTCMDLINEBINDIR="${APT_INTEGRATION_TESTS_CMDLINE_BIN_DIR:-"${BUILDDIRECTORY}/cmdline"}" 1400s APTINTERNALSOLVER="${APT_INTEGRATION_TESTS_INTERNAL_SOLVER:-"${APTCMDLINEBINDIR}/solvers/apt"}" 1400s APTDUMPSOLVER="${APT_INTEGRATION_TESTS_DUMP_SOLVER:-"${APTCMDLINEBINDIR}/solvers/dump"}" 1400s APTINTERNALPLANNER="${APT_INTEGRATION_TESTS_INTERNAL_PLANNER:-"${APTCMDLINEBINDIR}/planners/apt"}" 1400s ARTIFACTSDIR="${APT_INTEGRATION_TESTS_ARTIFACTS_DIR:-"${BUILDDIRECTORY}/artifacts"}" 1400s test -x "${APTCMDLINEBINDIR}/apt-get" || msgdie 'You need to build tree first' 1400s 1400s echo "#x-apt-configure-index \"${SOURCEDIRECTORY}/doc/examples/configure-index\";" > aptconfig.conf 1400s mkdir aptarchive keys 1400s cd rootdir 1400s mkdir -p etc/apt/apt.conf.d etc/apt/sources.list.d etc/apt/trusted.gpg.d etc/apt/preferences.d 1400s mkdir -p var/lib/dpkg/info var/lib/dpkg/updates var/lib/dpkg/triggers 1400s mkdir -p usr/lib/apt/solvers usr/lib/apt/planners 1400s touch var/lib/dpkg/available var/lib/dpkg/lock 1400s echo '1' > var/lib/dpkg/info/format 1400s ln -s "${METHODSDIR}" usr/lib/apt/methods 1400s ln -s "${APTDUMPSOLVER}" usr/lib/apt/solvers/dump 1400s ln -s "${APTDUMPSOLVER}" usr/lib/apt/planners/dump 1400s ln -s "${APTINTERNALSOLVER}" usr/lib/apt/solvers/apt 1400s ln -s "${APTINTERNALPLANNER}" usr/lib/apt/planners/apt 1400s echo "Dir::Bin::Solvers \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/solvers\";" >> ../aptconfig.conf 1400s echo "Dir::Bin::Planners \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/planners\";" >> ../aptconfig.conf 1400s # use the autoremove from the BUILDDIRECTORY if its there, otherwise system 1400s if [ -z "${APT_INTEGRATION_TESTS_SOURCE_DIR}" ]; then 1400s ln -s "${SOURCEDIRECTORY}/debian/apt.conf.autoremove" etc/apt/apt.conf.d/01autoremove 1400s else 1400s ln -s /etc/apt/apt.conf.d/01autoremove etc/apt/apt.conf.d/01autoremove 1400s fi 1400s cd .. 1400s local BASENAME="${0##*/}" 1400s local PACKAGESFILE="Packages-${BASENAME#*-}" 1400s if [ -f "${TESTDIRECTORY}/${PACKAGESFILE}" ]; then 1400s cp "${TESTDIRECTORY}/${PACKAGESFILE}" aptarchive/Packages 1400s fi 1400s local SOURCESSFILE="Sources-${BASENAME#*-}" 1400s if [ -f "${TESTDIRECTORY}/${SOURCESSFILE}" ]; then 1400s cp "${TESTDIRECTORY}/${SOURCESSFILE}" aptarchive/Sources 1400s fi 1400s find "$TESTDIRECTORY" \( -name '*.pub' -o -name '*.sec' \) -exec cp '{}' keys/ \; 1400s chmod 644 keys/* 1400s ln -s "${TMPWORKINGDIRECTORY}/keys/joesixpack.pub" rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg 1400s 1400s echo "Dir \"${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf 1400s echo "Dir::Etc \"etc\";" >> aptconfig.conf 1400s echo "Dir::State \"var/lib/apt\";" >> aptconfig.conf 1400s echo "Dir::Cache \"var/cache/apt\";" >> aptconfig.conf 1400s echo "Dir::Etc \"etc/apt\";" >> aptconfig.conf 1400s echo "Dir::Log \"var/log/apt\";" >> aptconfig.conf 1400s echo "APT::Get::Show-User-Simulation-Note \"false\";" >> aptconfig.conf 1400s echo "Dir::Bin::Methods \"${TMPWORKINGDIRECTORY}/rootdir/usr/lib/apt/methods\";" >> aptconfig.conf 1400s # either store apt-key were we can access it, even if we run it as a different user 1400s #cp "${APTCMDLINEBINDIR}/apt-key" "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/" 1400s #chmod o+rx "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key" 1400s #echo "Dir::Bin::apt-key \"${TMPWORKINGDIRECTORY}/rootdir/usr/bin/apt-key\";" >> aptconfig.conf 1400s # destroys coverage reporting though, so we disable changing user for the calling gpgv 1400s echo "Dir::Bin::apt-key \"${APTCMDLINEBINDIR}/apt-key\";" >> aptconfig.conf 1400s if [ "$(id -u)" = '0' ]; then 1400s echo 'Binary::gpgv::APT::Sandbox::User "root";' >> aptconfig.conf 1400s # same for the solver executables 1400s echo 'APT::Solver::RunAsUser "root";' >> aptconfig.conf 1400s echo 'APT::Planner::RunAsUser "root";' >> aptconfig.conf 1400s fi 1400s 1400s cat > "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" </dev/null 2>&1; then 1400s EXEC='' 1400s ORIGINAL="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" 1400s BACKUP="${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status.apt-backup" 1400s restoredpkgstatus() { 1400s if [ -n "\$BACKUP" ]; then 1400s if [ -e "\$BACKUP" ]; then 1400s mv -f "\$BACKUP" "\$ORIGINAL" 1400s else 1400s rm -f "\$ORIGINAL" 1400s fi 1400s BACKUP='' 1400s fi 1400s } 1400s trap "restoredpkgstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM 1400s if [ -e "\$ORIGINAL" ]; then 1400s cp -a "\$ORIGINAL" "\$BACKUP" 1400s fi 1400s cat >> "${TMPWORKINGDIRECTORY}/rootdir/var/lib/dpkg/status" << EOS 1400s 1400s Package: dpkg 1400s Architecture: all 1400s Version: ${DPKG_VERSION}+fake 1400s Status: install ok installed 1400s Maintainer: Joe Sixpack 1400s Installed-Size: 42 1400s Description: tells dpkg it supports what we need 1400s Some versions of dpkg check its own version from the status file 1400s to know if it supports multi-arch and stuff in --assert-*. 1400s 1400s EOS 1400s fi 1400s EOF 1400s fi 1400s cat >> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/dpkg" <> "${TMPWORKINGDIRECTORY}/rootdir/usr/bin/gdb-dpkg" < rootdir/etc/apt/apt.conf.d/99dpkg 1400s 1400s { 1400s echo 'quiet "0";' 1400s echo 'quiet::NoUpdate "true";' 1400s echo 'quiet::NoStatistic "true";' 1400s # too distracting for users, but helpful to detect changes 1400s echo 'Acquire::Progress::Ignore::ShowErrorText "true";' 1400s echo 'Acquire::Progress::Diffpercent "true";' 1400s # in testcases, it can appear as if localhost has a rotation setup, 1400s # hide this as we can't really deal with it properly 1400s echo 'Acquire::Failure::ShowIP "false";' 1400s # randomess and tests don't play well together 1400s echo 'Acquire::IndexTargets::Randomized "false";' 1400s # fakeroot can't fake everything, so disabled in production but good for tests 1400s echo 'APT::Sandbox::Verify "true";' 1400s } >> aptconfig.conf 1400s 1400s cp "${TESTDIRECTORY}/apt.pem" "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1400s if [ "$(id -u)" = '0' ]; then 1400s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem" 1400s fi 1400s echo "Acquire::https::CaInfo \"${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem\";" > rootdir/etc/apt/apt.conf.d/99https 1400s echo "Apt::Cmd::Disable-Script-Warning \"1\";" > rootdir/etc/apt/apt.conf.d/apt-binary 1400s export APT_KEY_DONT_WARN_ON_DANGEROUS_USAGE=no 1400s echo 'Acquire::Connect::AddrConfig "false";' > rootdir/etc/apt/apt.conf.d/connect-addrconfig 1400s # Allow release files to be 10 hours in the future, rather than 10 seconds 1400s echo 'Acquire::Max-FutureTime "'$((10 * 60 * 60))'";' > rootdir/etc/apt/apt.conf.d/future-time 1400s 1400s echo 'APT::Machine-ID "912e43bd1c1d4ba481f9f8ccab25f9ee";' > rootdir/etc/apt/apt.conf.d/machine-id 1400s 1400s configcompression '.' 'gz' #'bz2' 'lzma' 'xz' 1400s confighashes 'SHA256' # these are tests, not security best-practices 1400s 1400s # Make dpkg inherit testing path 1400s echo 'DPkg::Path "";' >> aptconfig.conf 1400s echo 'Dir::Bin::ischroot "/bin/false";' >> aptconfig.conf 1400s 1400s # If gpgv supports --weak-digest, pass it to make sure we can disable SHA1 1400s if aptkey verify --weak-digest SHA1 --help 2>/dev/null >/dev/null; then 1400s echo 'Acquire::gpgv::Options { "--weak-digest"; "sha1"; };' > rootdir/etc/apt/apt.conf.d/no-sha1 1400s fi 1400s 1400s # most tests just need one signed Release file, not both 1400s export APT_DONT_SIGN='Release.gpg' 1400s 1400s # prefer our apt binaries over the system apt binaries 1400s export PATH="${APTCMDLINEBINDIR}:${PATH}:/usr/sbin:/sbin" 1400s } 1400s 1400s getarchitecture() { 1400s if [ "$1" = "native" -o -z "$1" ]; then 1400s eval `aptconfig shell ARCH APT::Architecture` 1400s if [ -n "$ARCH" ]; then 1400s echo $ARCH 1400s else 1400s dpkg --print-architecture 1400s fi 1400s else 1400s echo $1 1400s fi 1400s } 1400s 1400s getarchitectures() { 1400s aptconfig dump --no-empty --format '%v%n' APT::Architecture APT::Architectures | sort -u | tr '\n' ' ' 1400s } 1400s 1400s getarchitecturesfromcommalist() { 1400s echo "$1" | sed -e 's#,#\n#g' | sed -e "s/^native\$/$(getarchitecture 'native')/" 1400s } 1400s 1400s configarchitecture() { 1400s { 1400s echo "APT::Architecture \"$(getarchitecture $1)\";" 1400s while [ -n "$1" ]; do 1400s echo "APT::Architectures:: \"$(getarchitecture $1)\";" 1400s shift 1400s done 1400s } >rootdir/etc/apt/apt.conf.d/01multiarch.conf 1400s configdpkg 1400s } 1400s 1400s configdpkg() { 1400s if [ ! -e rootdir/var/lib/dpkg/status ]; then 1400s local BASENAME="${0##*/}" 1400s local STATUSFILE="status-${BASENAME#*-}" 1400s if [ -f "${TESTDIRECTORY}/${STATUSFILE}" ]; then 1400s cp "${TESTDIRECTORY}/${STATUSFILE}" rootdir/var/lib/dpkg/status 1400s # Add an empty line to the end if there is none 1400s if tail -1 rootdir/var/lib/dpkg/status | grep -q .; then 1400s echo >> rootdir/var/lib/dpkg/status 1400s fi 1400s fi 1400s fi 1400s rm -f rootdir/etc/apt/apt.conf.d/00foreigndpkg 1400s if dpkg --assert-multi-arch >/dev/null 2>&1 ; then 1400s local ARCHS="$(getarchitectures)" 1400s local DPKGARCH="$(dpkg --print-architecture)" 1400s # this ensures that even if multi-arch isn't active in the view 1400s # of apt, given that dpkg can't be told which arch is native 1400s # the arch apt treats as native might be foreign for dpkg 1400s for ARCH in ${ARCHS}; do 1400s if [ "${ARCH}" != "${DPKGARCH}" ]; then 1400s if ! dpkg --add-architecture ${ARCH} >rootdir/tmp/dpkgaddarch.output 2>&1; then 1400s if grep -q 'pkg-config-dpkghook' rootdir/tmp/dpkgaddarch.output; then 1400s msgwarn 'Ignoring failure of dpkg --add-architecture as it is likely due to pkg-config-dpkghook (see #824774)' 1400s else 1400s # old-style used e.g. in Ubuntu-P – and as it seems travis 1400s echo "DPKG::options:: \"--foreign-architecture\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1400s echo "DPKG::options:: \"${ARCH}\";" >> rootdir/etc/apt/apt.conf.d/00foreigndpkg 1400s fi 1400s fi 1400s fi 1400s done 1400s else 1400s # test multiarch before dpkg is ready for it… 1400s echo "DPKG::options:: \"--force-architecture\";" > rootdir/etc/apt/apt.conf.d/00foreigndpkg 1400s fi 1400s } 1400s 1400s configdpkgnoopchroot() { 1400s # create a library to noop chroot() and rewrite maintainer script executions 1400s # via execvp() as used by dpkg as we don't want our rootdir to be a fullblown 1400s # chroot directory dpkg could chroot into to execute the maintainer scripts 1400s msgtest 'Building library to preload to make maintainerscript work in' 'dpkg' 1400s cat > noopchroot.c << EOF 1400s #define _GNU_SOURCE 1400s #include 1400s #include 1400s #include 1400s #include 1400s 1400s static char * chrootdir = NULL; 1400s 1400s int chroot(const char *path) { 1400s printf("WARNING: CHROOTing to %s was ignored!\n", path); 1400s free(chrootdir); 1400s chrootdir = strdup(path); 1400s return 0; 1400s } 1400s int execvp(const char *file, char *const argv[]) { 1400s static int (*func_execvp) (const char *, char * const []) = NULL; 1400s if (func_execvp == NULL) 1400s func_execvp = (int (*) (const char *, char * const [])) dlsym(RTLD_NEXT, "execvp"); 1400s if (chrootdir == NULL || strncmp(file, "/var/lib/dpkg/", strlen("/var/lib/dpkg/")) != 0) 1400s return func_execvp(file, argv); 1400s printf("REWRITE execvp call %s into %s\n", file, chrootdir); 1400s char *newfile; 1400s if (asprintf(&newfile, "%s%s", chrootdir, file) == -1) { 1400s perror("asprintf"); 1400s return -1; 1400s } 1400s char const * const baseadmindir = "/var/lib/dpkg"; 1400s char *admindir; 1400s if (asprintf(&admindir, "%s%s", chrootdir, baseadmindir) == -1) { 1400s perror("asprintf"); 1400s return -1; 1400s } 1400s setenv("DPKG_ADMINDIR", admindir, 1); 1400s return func_execvp(newfile, argv); 1400s } 1400s EOF 1400s if cc -ldl 2>&1 | grep -q dl; then 1400s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c 1400s else 1400s testempty --nomsg cc -Wall -Wextra -fPIC -shared -o noopchroot.so noopchroot.c -ldl 1400s fi 1400s } 1400s configcompression() { 1400s if [ "$1" = 'ALL' ]; then 1400s configcompression '.' $(aptconfig dump APT::Compressor --format '%t %v%n' | sed -n 's#^Extension \.\(.*\)$#\1#p') 1400s return 1400s fi 1400s local CMD='apthelper cat-file -C' 1400s while [ -n "$1" ]; do 1400s case "$1" in 1400s '.') printf ".\t.\tcat\n";; 1400s 'gz') printf "gzip\tgz\t$CMD $1\n";; 1400s 'bz2') printf "bzip2\tbz2\t$CMD $1\n";; 1400s 'zst') printf "zstd\tzst\t$CMD $1\n";; 1400s *) printf "$1\t$1\t$CMD $1\n";; 1400s esac 1400s shift 1400s done > "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1400s } 1400s confighashes() { 1400s { 1400s echo 'APT::FTPArchive {' 1400s { 1400s while [ -n "$1" ]; do 1400s printf "$1" | tr 'a-z' 'A-Z' 1400s printf "\t\"true\";\n" 1400s shift 1400s done 1400s for h in 'MD5' 'SHA1' 'SHA256' 'SHA512'; do 1400s printf "$h\t\"false\";\n" 1400s done 1400s } | awk '!x[$1]++' 1400s echo '};' 1400s } >> "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/ftparchive-hashes.conf" 1400s } 1400s forcecompressor() { 1400s COMPRESSOR="$1" 1400s COMPRESS="$1" 1400s COMPRESSOR_CMD="apthelper cat-file -C $1" 1400s case $COMPRESSOR in 1400s gzip) COMPRESS='gz';; 1400s bzip2) COMPRESS='bz2';; 1400s zstd) COMPRESS='zst';; 1400s esac 1400s local CONFFILE="${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1400s echo "Acquire::CompressionTypes::Order { \"${COMPRESS}\"; }; 1400s Dir::Bin::uncompressed \"/does/not/exist\";" > "$CONFFILE" 1400s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1400s if [ -z "$COMP" -o "$COMP" = '.' -o "$COMP" = "$COMPRESSOR" ]; then continue; fi 1400s echo "Dir::Bin::${COMP} \"/does/not/exist\";" >> "$CONFFILE" 1400s echo "APT::Compressor::${COMP}::Name \"${COMP}-disabled\";" >> "$CONFFILE" 1400s done 1400s } 1400s 1400s _setupsimplenativepackage() { 1400s local NAME="$1" 1400s local ARCH="$2" 1400s local VERSION="$3" 1400s local RELEASE="${4:-unstable}" 1400s local DEPENDENCIES="$5" 1400s local DESCRIPTION="${6:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASE} 1400s If you find such a package installed on your system, 1400s something went horribly wrong! They are autogenerated 1400s and used only by testcases and serve no other purpose…}" 1400s 1400s local SECTION="${7:-others}" 1400s local PRIORITY="${8:-optional}" 1400s local FILE_TREE="$9" 1400s local COMPRESS_TYPE="${10:-gzip}" 1400s local DISTSECTION 1400s if [ "$SECTION" = "${SECTION#*/}" ]; then 1400s DISTSECTION="main" 1400s else 1400s DISTSECTION="${SECTION%/*}" 1400s fi 1400s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1400s 1400s mkdir -p "$BUILDDIR/debian/source" 1400s echo "* most suckless software product ever" > "${BUILDDIR}/FEATURES" 1400s echo "#!/bin/sh 1400s echo '$NAME says \"Hello!\"'" > "${BUILDDIR}/${NAME}" 1400s 1400s echo "Copyleft by Joe Sixpack $(date -u +%Y)" > "${BUILDDIR}/debian/copyright" 1400s echo "$NAME ($VERSION) $RELEASE; urgency=low 1400s 1400s * Initial release 1400s 1400s -- Joe Sixpack $(date -u -R)" > "${BUILDDIR}/debian/changelog" 1400s { 1400s echo "Source: $NAME 1400s Priority: $PRIORITY 1400s Maintainer: Joe Sixpack 1400s Standards-Version: 4.3.1 1400s Rules-Requires-Root: no" 1400s if [ "$SECTION" != '' ]; then 1400s echo "Section: $SECTION" 1400s fi 1400s local BUILDDEPS="$(printf "%b\n" "$DEPENDENCIES" | grep '^Build-')" 1400s test -z "$BUILDDEPS" || echo "$BUILDDEPS" 1400s echo " 1400s Package: $NAME" 1400s 1400s if [ "$ARCH" = 'all' ]; then 1400s echo "Architecture: all" 1400s else 1400s echo "Architecture: any" 1400s fi 1400s local DEPS="$(printf "%b\n" "$DEPENDENCIES" | grep -v '^Build-')" 1400s test -z "$DEPS" || echo "$DEPS" 1400s printf "%b\n" "Description: $DESCRIPTION" 1400s } > "${BUILDDIR}/debian/control" 1400s 1400s echo '3.0 (native)' > "${BUILDDIR}/debian/source/format" 1400s } 1400s 1400s make_tiny_rules() { 1400s local OUT="$1" 1400s if command -v gmake >/dev/null 2>&1; then 1400s [ -e ${TMPWORKINGDIRECTORY}/bin/make ] || ln -s $(command -v gmake) ${TMPWORKINGDIRECTORY}/bin/make 1400s echo "#!${TMPWORKINGDIRECTORY}/bin/make -f" > "$OUT" 1400s else 1400s echo '#!/usr/bin/make -f' > "$OUT" 1400s fi 1400s echo '%:' >> "$OUT" 1400s echo ' dh $@' >> "$OUT" 1400s } 1400s 1400s setupsimplenativepackage() { 1400s _setupsimplenativepackage "$@" 1400s local NAME="$1" 1400s local VERSION="$3" 1400s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1400s test -e "${BUILDDIR}/debian/compat" || echo '10' > "${BUILDDIR}/debian/compat" 1400s test -e "${BUILDDIR}/debian/rules" || make_tiny_rules "${BUILDDIR}/debian/rules" 1400s } 1400s 1400s buildsimplenativepackage() { 1400s local NAME="$1" 1400s local ARCH="$2" 1400s local VERSION="$3" 1400s local RELEASE="${4:-unstable}" 1400s local DEPENDENCIES="$5" 1400s local DESCRIPTION="$6" 1400s local SECTION="${7:-others}" 1400s local PRIORITY="${8:-optional}" 1400s local FILE_TREE="$9" 1400s local COMPRESS_TYPE="${10:-gzip}" 1400s local DISTSECTION 1400s if [ "$SECTION" = "${SECTION#*/}" ]; then 1400s DISTSECTION="main" 1400s else 1400s DISTSECTION="${SECTION%/*}" 1400s fi 1400s local BUILDDIR="${TMPWORKINGDIRECTORY}/incoming/${NAME}-${VERSION}" 1400s msgtest "Build source package in version ${VERSION} for ${RELEASE} in ${DISTSECTION}" "$NAME" 1400s _setupsimplenativepackage "$@" 1400s cd "${BUILDDIR}/.." 1400s testsuccess --nomsg dpkg-source -b ${NAME}-${VERSION} 1400s cd - >/dev/null 1400s sed -n 's#^dpkg-source: info: building [^ ]\+ in ##p' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" \ 1400s | while read SRC; do 1400s echo "pool/${SRC}" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.srclist" 1400s # if expr match "${SRC}" '.*\.dsc' >/dev/null 2>&1; then 1400s # aptkey --keyring ./keys/joesixpack.pub --secret-keyring ./keys/joesixpack.sec --quiet --readonly \ 1400s # adv --yes --default-key 'Joe Sixpack' \ 1400s # --clearsign -o "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1400s # mv "${BUILDDIR}/../${SRC}.sign" "${BUILDDIR}/../$SRC" 1400s # fi 1400s done 1400s 1400s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1400s msgtest "Build binary package for ${RELEASE} in ${SECTION}" "$NAME" 1400s rm -rf "${BUILDDIR}/debian/tmp" 1400s mkdir -p "${BUILDDIR}/debian/tmp/DEBIAN" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin" 1400s cp "${BUILDDIR}/debian/copyright" "${BUILDDIR}/debian/changelog" "${BUILDDIR}/FEATURES" "${BUILDDIR}/debian/tmp/usr/share/doc/${NAME}" 1400s cp "${BUILDDIR}/${NAME}" "${BUILDDIR}/debian/tmp/usr/bin/${NAME}-${arch}" 1400s if [ -n "$FILE_TREE" ]; then 1400s cp -ar "$FILE_TREE" "${BUILDDIR}/debian/tmp" 1400s fi 1400s 1400s (cd "${BUILDDIR}"; dpkg-gencontrol -DArchitecture=$arch) 1400s (cd "${BUILDDIR}/debian/tmp"; md5sum $(find usr/ -type f) > DEBIAN/md5sums) 1400s local LOG="${BUILDDIR}/../${NAME}_${VERSION}_${arch}.dpkg-deb.log" 1400s # ensure the right permissions as dpkg-deb insists 1400s chmod 755 "${BUILDDIR}/debian/tmp/DEBIAN" 1400s testsuccess --nomsg dpkg-deb -Z${COMPRESS_TYPE} --build "${BUILDDIR}/debian/tmp" "${BUILDDIR}/.." 1400s echo "pool/${NAME}_${VERSION}_${arch}.deb" >> "${BUILDDIR}/../${RELEASE}.${DISTSECTION}.pkglist" 1400s done 1400s 1400s local NM 1400s if [ "$(echo "$NAME" | cut -c 1-3)" = 'lib' ]; then 1400s NM="$(echo "$NAME" | cut -c 1-4)" 1400s else 1400s NM="$(echo "$NAME" | cut -c 1)" 1400s fi 1400s local CHANGEPATH="${BUILDDIR}/../${DISTSECTION}/${NM}/${NAME}/${NAME}_${VERSION}" 1400s mkdir -p "$CHANGEPATH" 1400s cp "${BUILDDIR}/debian/changelog" "$CHANGEPATH" 1400s rm -rf "${BUILDDIR}" 1400s msgdone "info" 1400s } 1400s 1400s buildpackage() { 1400s local BUILDDIR=$1 1400s local RELEASE=$2 1400s local SECTION=$3 1400s local ARCH=$(getarchitecture $4) 1400s local PKGNAME="$(echo "$BUILDDIR" | grep -o '[^/]*$')" 1400s local BUILDLOG="$(readlink -f "${BUILDDIR}/../${PKGNAME}_${RELEASE}_${SECTION}.dpkg-bp.log")" 1400s msgtest "Build package for ${RELEASE} in ${SECTION}" "$PKGNAME" 1400s cd "$BUILDDIR" 1400s if [ "$ARCH" = "all" ]; then 1400s ARCH="$(dpkg-architecture -qDEB_HOST_ARCH 2> /dev/null)" 1400s fi 1400s testsuccess --nomsg dpkg-buildpackage -uc -us -a$ARCH -d 1400s cp "${TMPWORKINGDIRECTORY}/rootdir/tmp/testsuccess.output" "$BUILDLOG" 1400s local PKGS="$(grep '^dpkg-deb: building package' "$BUILDLOG" | cut -d'/' -f 2 | sed -e "s#'\.##")" 1400s local SRCS="$(grep '^dpkg-source: info: building' "$BUILDLOG" | grep -o '[a-z0-9._+~-]*$')" 1400s cd - > /dev/null 1400s for PKG in $PKGS; do 1400s echo "pool/${PKG}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.pkglist" 1400s done 1400s for SRC in $SRCS; do 1400s echo "pool/${SRC}" >> "${TMPWORKINGDIRECTORY}/incoming/${RELEASE}.${SECTION}.srclist" 1400s done 1400s } 1400s 1400s buildaptarchive() { 1400s if [ -d incoming ]; then 1400s buildaptarchivefromincoming "$@" 1400s else 1400s buildaptarchivefromfiles "$@" 1400s fi 1400s } 1400s 1400s createaptftparchiveconfig() { 1400s local COMPRESSORS="$(cut -d' ' -f 1 "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" | tr '\n' ' ')" 1400s local COMPRESSORS="${COMPRESSORS%* }" 1400s local ARCHS="$(getarchitectures)" 1400s cat > ftparchive.conf <> ftparchive.conf 1400s } 1400s 1400s buildaptftparchivedirectorystructure() { 1400s local DISTS="$(grep -i '^tree ' ftparchive.conf | cut -d'/' -f 2 | sed -e 's#".*##')" 1400s for DIST in $DISTS; do 1400s local SECTIONS="$(grep -i -A 5 "dists/$DIST" ftparchive.conf | grep -i 'Sections' | cut -d'"' -f 2)" 1400s for SECTION in $SECTIONS; do 1400s local ARCHS="$(grep -A 5 "dists/$DIST" ftparchive.conf | grep Architectures | cut -d'"' -f 2 | sed -e 's#source##')" 1400s for ARCH in $ARCHS; do 1400s mkdir -p "dists/${DIST}/${SECTION}/binary-${ARCH}" 1400s done 1400s mkdir -p "dists/${DIST}/${SECTION}/source" 1400s mkdir -p "dists/${DIST}/${SECTION}/i18n" 1400s done 1400s done 1400s } 1400s 1400s insertpackage() { 1400s local RELEASES="$1" 1400s local NAME="$2" 1400s local ARCH="$3" 1400s local VERSION="$4" 1400s local DEPENDENCIES="$5" 1400s local PRIORITY="${6:-optional}" 1400s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/${RELEASES} 1400s If you find such a package installed on your system, 1400s something went horribly wrong! They are autogenerated 1400s and used only by testcases and serve no other purpose…}" 1400s local SECTION="${8:-other}" 1400s 1400s if [ "$SECTION" = "${SECTION#*/}" ]; then 1400s DISTSECTION="main" 1400s else 1400s DISTSECTION="${SECTION%/*}" 1400s fi 1400s local ARCHS="" 1400s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1400s if [ "$RELEASE" = 'installed' ]; then 1400s insertinstalledpackage "$2" "$3" "$4" "$5" "$6" "$7" "$8" 1400s continue 1400s fi 1400s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1400s if [ "$arch" = 'none' ]; then 1400s ARCHS="$(getarchitectures)" 1400s else 1400s ARCHS="$arch" 1400s fi 1400s for BUILDARCH in $ARCHS; do 1400s local PPATH="aptarchive/dists/${RELEASE}/${DISTSECTION}/binary-${BUILDARCH}" 1400s mkdir -p "$PPATH" 1400s { 1400s echo "Package: $NAME 1400s Priority: $PRIORITY 1400s Section: $SECTION 1400s Installed-Size: 42 1400s Size: 42" 1400s if echo "$DEPENDENCIES" | grep -q SHA256:; then 1400s : 1400s else 1400s echo "SHA256: 0000000000000000000000000000000000000000000000000000000000000000" 1400s fi 1400s echo "Maintainer: Joe Sixpack " 1400s test "$arch" = 'none' || echo "Architecture: $arch" 1400s echo "Version: $VERSION 1400s Filename: pool/${DISTSECTION}/${NAME}/${NAME}_${VERSION}_${arch}.deb" 1400s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" 1400s echo "Description: $(printf '%s' "$DESCRIPTION" | head -n 1)" 1400s echo "Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1)" 1400s echo 1400s } >> "${PPATH}/Packages" 1400s done 1400s done 1400s mkdir -p "aptarchive/dists/${RELEASE}/${DISTSECTION}/source" "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n" 1400s touch "aptarchive/dists/${RELEASE}/${DISTSECTION}/source/Sources" 1400s echo "Package: $NAME 1400s Description-md5: $(printf '%s' "$DESCRIPTION" | md5sum | cut -d' ' -f 1) 1400s Description-en: $DESCRIPTION 1400s " >> "aptarchive/dists/${RELEASE}/${DISTSECTION}/i18n/Translation-en" 1400s done 1400s } 1400s 1400s insertsource() { 1400s local RELEASES="$1" 1400s local NAME="$2" 1400s local ARCH="$3" 1400s local VERSION="$4" 1400s local DEPENDENCIES="$5" 1400s local BINARY="${6:-$NAME}" 1400s local ARCHS="" 1400s for RELEASE in $(printf '%s' "$RELEASES" | tr ',' '\n'); do 1400s local SPATH="aptarchive/dists/${RELEASE}/main/source" 1400s mkdir -p $SPATH 1400s local FILE="${SPATH}/Sources" 1400s local DSCFILE="${NAME}_${VERSION}.dsc" 1400s local TARFILE="${NAME}_${VERSION}.tar.gz" 1400s echo "Package: $NAME 1400s Binary: $BINARY 1400s Version: $VERSION 1400s Maintainer: Joe Sixpack 1400s Architecture: $ARCH" >> $FILE 1400s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1400s echo "Files: 1400s $(echo -n "$DSCFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1400s $(echo -n "$TARFILE" | md5sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1400s Checksums-Sha256: 1400s $(echo -n "$DSCFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$DSCFILE" | wc -c) "$DSCFILE" 1400s $(echo -n "$TARFILE" | sha256sum | cut -d' ' -f 1) $(echo -n "$TARFILE" | wc -c) "$TARFILE" 1400s " >> "$FILE" 1400s done 1400s } 1400s 1400s insertinstalledpackage() { 1400s local NAME="$1" 1400s local ARCH="$2" 1400s local VERSION="$3" 1400s local DEPENDENCIES="$4" 1400s local PRIORITY="${5:-optional}" 1400s local STATUS="${6:-install ok installed}" 1400s local DESCRIPTION="${7:-an autogenerated dummy ${NAME}=${VERSION}/installed 1400s If you find such a package installed on your system, 1400s something went horribly wrong! They are autogenerated 1400s and used only by testcases and serve no other purpose…}" 1400s local SECTION="${8:-other}" 1400s 1400s local FILE='rootdir/var/lib/dpkg/status' 1400s local INFO='rootdir/var/lib/dpkg/info' 1400s for arch in $(getarchitecturesfromcommalist "$ARCH"); do 1400s echo "Package: $NAME 1400s Status: $STATUS 1400s Priority: $PRIORITY 1400s Section: $SECTION 1400s Installed-Size: 42 1400s Maintainer: Joe Sixpack 1400s Version: $VERSION" >> "$FILE" 1400s test "$arch" = 'none' || echo "Architecture: $arch" >> "$FILE" 1400s test -z "$DEPENDENCIES" || printf "%b\n" "$DEPENDENCIES" >> "$FILE" 1400s printf "%b\n" "Description: $DESCRIPTION" >> "$FILE" 1400s echo >> "$FILE" 1400s if [ "$(dpkgquery -W --showformat='${Multi-Arch}' "${NAME}:${arch}" 2>/dev/null)" = 'same' ]; then 1400s echo -n > "${INFO}/${NAME}:${arch}.list" 1400s echo -n > "${INFO}/${NAME}:${arch}.md5sums" 1400s else 1400s echo -n > "${INFO}/${NAME}.list" 1400s echo -n > "${INFO}/${NAME}.md5sums" 1400s fi 1400s done 1400s } 1400s 1400s 1400s buildaptarchivefromincoming() { 1400s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on incoming packages…" 1400s cd aptarchive 1400s [ -e pool ] || ln -s ../incoming pool 1400s [ -e ftparchive.conf ] || createaptftparchiveconfig 1400s [ -e dists ] || buildaptftparchivedirectorystructure 1400s msgninfo "\tGenerate Packages, Sources and Contents files… " 1400s testsuccess aptftparchive generate ftparchive.conf 1400s cd - > /dev/null 1400s msgdone "info" 1400s generatereleasefiles "$@" 1400s } 1400s 1400s buildaptarchivefromfiles() { 1400s msginfo "Build APT archive for ${CCMD}${0##*/}${CINFO} based on prebuild files…" 1400s local DIR='aptarchive' 1400s if [ -d "${DIR}/dists" ]; then DIR="${DIR}/dists"; fi 1400s find "$DIR" -name 'Packages' -o -name 'Sources' -o -name 'Translation-*' | while read line; do 1400s msgninfo "\t${line} file… " 1400s compressfile "$line" "$1" 1400s msgdone "info" 1400s done 1400s generatereleasefiles "$@" 1400s } 1400s 1400s compressfile() { 1400s while read compressor extension command; do 1400s if [ "$compressor" = '.' ]; then 1400s if [ -n "$2" ]; then 1400s touch -d "$2" "$1" 1400s fi 1400s continue 1400s fi 1400s cat "$1" | $command > "${1}.${extension}" 1400s if [ -n "$2" ]; then 1400s touch -d "$2" "${1}.${extension}" 1400s fi 1400s done < "${TMPWORKINGDIRECTORY}/rootdir/etc/testcase-compressor.conf" 1400s } 1400s 1400s # can be overridden by testcases for their pleasure 1400s getcodenamefromsuite() { 1400s case "$1" in 1400s unstable) echo 'sid';; 1400s *) echo -n "$1";; 1400s esac 1400s } 1400s getreleaseversionfromsuite() { true; } 1400s getlabelfromsuite() { true; } 1400s getoriginfromsuite() { true; } 1400s getarchitecturesfromreleasefile() { echo "all $(getarchitectures)"; } 1400s getnotautomaticfromsuite() { 1400s case "$1" in 1400s experimental|experimental2) echo "yes";; 1400s esac 1400s } 1400s getbutautomaticupgradesfromsuite() { true; } 1400s 1400s aptftparchiverelease() { 1400s aptftparchive -qq release "$@" | sed -e '/0 Release$/ d' # remove the self reference 1400s } 1400s generatereleasefiles() { 1400s # $1 is the Date header and $2 is the ValidUntil header to be set 1400s # both should be given in notation date/touch can understand 1400s local DATE="$1" 1400s local VALIDUNTIL="$2" 1400s if [ -e aptarchive/dists ]; then 1400s msgninfo "\tGenerate Release files for dists… " 1400s for dir in $(find ./aptarchive/dists -mindepth 1 -maxdepth 1 -type d); do 1400s local ARCHITECTURES="$(getarchitecturesfromreleasefile "$dir")" 1400s local SUITE="$(echo "$dir" | cut -d'/' -f 4)" 1400s local CODENAME="$(getcodenamefromsuite $SUITE)" 1400s local VERSION="$(getreleaseversionfromsuite $SUITE)" 1400s local LABEL="$(getlabelfromsuite $SUITE)" 1400s local ORIGIN="$(getoriginfromsuite $SUITE)" 1400s local NOTAUTOMATIC="$(getnotautomaticfromsuite $SUITE)" 1400s local BUTAUTOMATICUPGRADES="$(getbutautomaticupgradesfromsuite $SUITE)" 1400s aptftparchiverelease "$dir" \ 1400s -o APT::FTPArchive::Release::Suite="${SUITE}" \ 1400s -o APT::FTPArchive::Release::Codename="${CODENAME}" \ 1400s -o APT::FTPArchive::Release::Architectures="${ARCHITECTURES}" \ 1400s -o APT::FTPArchive::Release::Label="${LABEL}" \ 1400s -o APT::FTPArchive::Release::Origin="${ORIGIN}" \ 1400s -o APT::FTPArchive::Release::Version="${VERSION}" \ 1400s -o APT::FTPArchive::Release::NotAutomatic="${NOTAUTOMATIC}" \ 1400s -o APT::FTPArchive::Release::ButAutomaticUpgrades="${BUTAUTOMATICUPGRADES}" \ 1400s > "$dir/Release" 1400s done 1400s else 1400s msgninfo "\tGenerate Release files for flat… " 1400s aptftparchiverelease ./aptarchive > aptarchive/Release 1400s fi 1400s if [ -n "$VALIDUNTIL" ]; then 1400s sed -i "/^Date: / a\ 1400s Valid-Until: $(date -u -d "$VALIDUNTIL" -R)" $(find ./aptarchive -name 'Release') 1400s fi 1400s if [ -n "$DATE" -a "$DATE" != "now" ]; then 1400s for release in $(find ./aptarchive -name 'Release'); do 1400s sed -i "s/^Date: .*$/Date: $(date -u -d "$DATE" -R)/" "$release" 1400s touch -d "$DATE" "$release" 1400s done 1400s fi 1400s msgdone "info" 1400s } 1400s 1400s setupdistsaptarchive() { 1400s local APTARCHIVE="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1400s rm -f root/etc/apt/sources.list.d/apt-test-*-deb.list 1400s rm -f root/etc/apt/sources.list.d/apt-test-*-deb-src.list 1400s for DISTS in $(find ./aptarchive/dists/ -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 4); do 1400s SECTIONS=$(find "./aptarchive/dists/${DISTS}/" -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 5 | tr '\n' ' ') 1400s msgninfo "\tadd deb and deb-src sources.list lines for ${CCMD}${DISTS} ${SECTIONS}${CINFO}… " 1400s echo "deb file://$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb.list" 1400s echo "deb-src file:$APTARCHIVE $DISTS $SECTIONS" > "rootdir/etc/apt/sources.list.d/apt-test-${DISTS}-deb-src.list" 1400s msgdone "info" 1400s done 1400s } 1400s 1400s setupflataptarchive() { 1400s local APTARCHIVE="$(readlink -f ./aptarchive)" 1400s local APTARCHIVEURI="$(readlink -f ./aptarchive | sed 's# #%20#g')" 1400s if [ -f "${APTARCHIVE}/Packages" ]; then 1400s msgninfo "\tadd deb sources.list line… " 1400s echo "deb file://$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1400s msgdone 'info' 1400s else 1400s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb.list' 1400s fi 1400s if [ -f "${APTARCHIVE}/Sources" ]; then 1400s msgninfo "\tadd deb-src sources.list line… " 1400s echo "deb-src file:$APTARCHIVEURI /" > 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1400s msgdone 'info' 1400s else 1400s rm -f 'rootdir/etc/apt/sources.list.d/apt-test-archive-deb-src.list' 1400s fi 1400s } 1400s 1400s setupaptarchive() { 1400s local NOUPDATE=0 1400s if [ "$1" = '--no-update' ]; then 1400s NOUPDATE=1 1400s shift 1400s fi 1400s buildaptarchive "$@" 1400s if [ -e aptarchive/dists ]; then 1400s setupdistsaptarchive 1400s else 1400s setupflataptarchive 1400s fi 1400s signreleasefiles 'Joe Sixpack' 1400s if [ "1" != "$NOUPDATE" ]; then 1400s testsuccess aptget update -o Debug::pkgAcquire::Worker=true -o Debug::Acquire::gpgv=true 1400s fi 1400s } 1400s 1400s killgpgagent() { 1400s if [ -z "${TMPWORKINGDIRECTORY}" ]; then return; fi 1400s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1400s if [ ! -e "${GPGHOME}" ]; then return; fi 1400s # ensure the agent dies quickly as different versions have different suicide heuristics 1400s GNUPGHOME="${GPGHOME}" gpgconf --kill gpg-agent >/dev/null 2>&1 || true 1400s rm -rf "$GPGHOME" 1400s } 1400s dosigning() { 1400s local KEY="$1" 1400s shift 1400s local GPGHOME="${TMPWORKINGDIRECTORY}/signinghome" 1400s if [ -n "$APT_TEST_SIGNINGHOME" ]; then 1400s GPGHOME="$APT_TEST_SIGNINGHOME" 1400s else 1400s if [ ! -e "$GPGHOME" ]; then 1400s mkdir -p --mode=700 "${GPGHOME}" 1400s addtrap 'prefix' 'killgpgagent;' 1400s fi 1400s fi 1400s testsuccess aptkey --quiet --keyring ${KEY}.pub --secret-keyring ${KEY}.sec --readonly \ 1400s --homedir "${GPGHOME}" adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1400s "$@" 1400s } 1400s signreleasefiles() { 1400s local SIGNERS="${1:-Joe Sixpack}" 1400s local REPODIR="${2:-aptarchive}" 1400s if [ -n "$1" ]; then shift; fi 1400s if [ -n "$1" ]; then shift; fi 1400s local KEY="keys/$(echo "$SIGNERS" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1400s msgninfo "\tSign archive with $SIGNERS key $KEY… " 1400s local REXKEY='keys/rexexpired' 1400s local SECEXPIREBAK="${REXKEY}.sec.bak" 1400s local PUBEXPIREBAK="${REXKEY}.pub.bak" 1400s local SIGUSERS="" 1400s while [ -n "${SIGNERS%%,*}" ]; do 1400s local SIGNER="${SIGNERS%%,*}" 1400s if [ "${SIGNERS}" = "${SIGNER}" ]; then 1400s SIGNERS="" 1400s fi 1400s SIGNERS="${SIGNERS#*,}" 1400s # FIXME: This should be the full name, but we can't encode the space properly currently 1400s SIGUSERS="${SIGUSERS} -u ${SIGNER#* }" 1400s if [ "${SIGNER}" = 'Rex Expired' ]; then 1400s # the key is expired, so gpg doesn't allow one to sign with and the --faked-system-time 1400s # option doesn't exist anymore (and using faketime would add a new obscure dependency) 1400s # therefore we 'temporary' make the key not expired and restore a backup after signing 1400s cp "${REXKEY}.sec" "$SECEXPIREBAK" 1400s cp "${REXKEY}.pub" "$PUBEXPIREBAK" 1400s local SECUNEXPIRED="${REXKEY}.sec.unexpired" 1400s local PUBUNEXPIRED="${REXKEY}.pub.unexpired" 1400s if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then 1400s cp "$SECUNEXPIRED" "${REXKEY}.sec" 1400s cp "$PUBUNEXPIRED" "${REXKEY}.pub" 1400s else 1400s if ! printf "expire\n1w\nsave\n" | aptkey --quiet --keyring "${REXKEY}.pub" --secret-keyring "${REXKEY}.sec" \ 1400s --readonly adv --batch --yes --digest-algo "${APT_TESTS_DIGEST_ALGO:-SHA512}" \ 1400s --default-key "$SIGNER" --command-fd 0 --edit-key "${SIGNER}" >setexpire.gpg 2>&1; then 1400s cat setexpire.gpg 1400s exit 1 1400s fi 1400s cp "${REXKEY}.sec" "$SECUNEXPIRED" 1400s cp "${REXKEY}.pub" "$PUBUNEXPIRED" 1400s fi 1400s fi 1400s if [ ! -e "${KEY}.pub" ]; then 1400s local K="keys/$(echo "$SIGNER" | tr 'A-Z' 'a-z' | tr -d ' ,')" 1400s cat "${K}.pub" >> "${KEY}.new.pub" 1400s cat "${K}.sec" >> "${KEY}.new.sec" 1400s fi 1400s done 1400s if [ ! -e "${KEY}.pub" ]; then 1400s mv "${KEY}.new.pub" "${KEY}.pub" 1400s mv "${KEY}.new.sec" "${KEY}.sec" 1400s fi 1400s for RELEASE in $(find "${REPODIR}/" -name Release); do 1400s # we might have set a specific date for the Release file, so copy it 1400s local DATE="$(stat --format "%y" "${RELEASE}")" 1400s if [ "$APT_DONT_SIGN" = 'Release.gpg' ]; then 1400s rm -f "${RELEASE}.gpg" 1400s else 1400s dosigning "$KEY" "$@" $SIGUSERS --armor --detach-sign --sign --output "${RELEASE}.gpg" "${RELEASE}" 1400s touch -d "$DATE" "${RELEASE}.gpg" 1400s fi 1400s local INRELEASE="${RELEASE%/*}/InRelease" 1400s if [ "$APT_DONT_SIGN" = 'InRelease' ]; then 1400s rm -f "$INRELEASE" 1400s else 1400s dosigning "$KEY" "$@" $SIGUSERS --clearsign --output "$INRELEASE" "$RELEASE" 1400s touch -d "$DATE" "${INRELEASE}" 1400s fi 1400s done 1400s if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then 1400s mv -f "$SECEXPIREBAK" "${REXKEY}.sec" 1400s mv -f "$PUBEXPIREBAK" "${REXKEY}.pub" 1400s fi 1400s msgdone 'info' 1400s } 1400s 1400s redatereleasefiles() { 1400s local DATE="$(date -u -d "$1" -R)" 1400s for release in $(find aptarchive/ -name 'Release'); do 1400s sed -i "s/^Date: .*$/Date: ${DATE}/" "$release" 1400s touch -d "$DATE" "$release" 1400s done 1400s signreleasefiles "${2:-Joe Sixpack}" 1400s } 1400s 1400s webserverconfig() { 1400s local WEBSERVER="${3:-http://localhost:${APTHTTPPORT}}" 1400s local NOCHECK=false 1400s if [ "$1" = '--no-check' ]; then 1400s NOCHECK=true 1400s shift 1400s fi 1400s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/download-testfile.log" 1400s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverconfig.status" 1400s rm -f "$STATUS" "$DOWNLOG" 1400s local URI 1400s if [ -n "$2" ]; then 1400s msgtest "Set webserver config option '${1}' to" "$2" 1400s URI="${WEBSERVER}/_config/set/$(apthelper quote-string "${1}" '/?#')/$(apthelper quote-string "${2}" '/?#')" 1400s else 1400s msgtest 'Clear webserver config option' "${1}" 1400s URI="${WEBSERVER}/_config/clear/$(apthelper quote-string "${1}" '/?#')" 1400s fi 1400s if downloadfile "$URI" "$STATUS" > "$DOWNLOG"; then 1400s msgpass 1400s else 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverconfig.output" 1400s cat "$DOWNLOG" "$STATUS" >"$OUTPUT" 2>&1 || true 1400s msgfailoutput '' "$OUTPUT" 1400s fi 1400s $NOCHECK || testwebserverlaststatuscode '200' 1400s } 1400s 1400s rewritesourceslist() { 1400s local APTARCHIVE="$(readlink -f "${TMPWORKINGDIRECTORY}/aptarchive" | sed 's# #%20#g')" 1400s for LIST in $(find "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/sources.list.d/" -name 'apt-test-*.list'); do 1400s sed -i $LIST \ 1400s -e "s#file://$APTARCHIVE#${1}#" \ 1400s -e "s#file:$APTARCHIVE#${1}#" \ 1400s -e "s#copy://$APTARCHIVE#${1}#" \ 1400s -e "s#copy:$APTARCHIVE#${1}#" \ 1400s -e "s#http://[^@]*@\?localhost:${APTHTTPPORT}/\?#${1}#" \ 1400s -e "s#https://[^@]*@\?localhost:${APTHTTPSPORT}/\?#${1}#" 1400s done 1400s } 1400s 1400s # wait for up to 10s for a pid file to appear to avoid possible race 1400s # when a helper is started and doesn't write the PID quick enough 1400s waitforpidfile() { 1400s local PIDFILE="$1" 1400s for i in $(seq 10); do 1400s if test -s "$PIDFILE"; then 1400s return 0 1400s fi 1400s sleep 1 1400s done 1400s msgdie "waiting for $PIDFILE failed" 1400s return 1 1400s } 1400s 1400s changetowebserver() { 1400s local REWRITE='yes' 1400s if [ "$1" = '--no-rewrite' ]; then 1400s REWRITE='no' 1400s shift 1400s fi 1400s if test -x "${APTTESTHELPERSBINDIR}/aptwebserver"; then 1400s cd aptarchive 1400s local LOG="webserver.log" 1400s if ! aptwebserver --port 0 -o aptwebserver::fork=1 -o aptwebserver::portfile='aptwebserver.port' -o aptwebserver::logfiles="$(readlink -f .)/$LOG" "$@" >$LOG 2>&1 ; then 1400s cat "$LOG" 1400s false 1400s fi 1400s waitforpidfile aptwebserver.pid 1400s local PID="$(cat aptwebserver.pid)" 1400s if [ -z "$PID" ]; then 1400s msgdie 'Could not fork aptwebserver successfully' 1400s fi 1400s addtrap "kill $PID;" 1400s waitforpidfile aptwebserver.port 1400s APTHTTPPORT="$(cat aptwebserver.port)" 1400s if [ -z "$APTHTTPPORT" ]; then 1400s msgdie 'Could not get port for aptwebserver successfully' 1400s fi 1400s cd - > /dev/null 1400s else 1400s msgdie 'You have to build apt from source to have test/interactive-helper/aptwebserver available for tests requiring a webserver' 1400s fi 1400s if [ "$REWRITE" != 'no' ]; then 1400s rewritesourceslist "http://localhost:${APTHTTPPORT}/" 1400s fi 1400s } 1400s 1400s changetohttpswebserver() { 1400s local REWRITE='yes' 1400s if [ "$1" = '--no-rewrite' ]; then 1400s REWRITE='no' 1400s shift 1400s fi 1400s local stunnel4 1400s if command -v stunnel4 >/dev/null 2>&1; then 1400s stunnel4=stunnel4 1400s elif command -v stunnel >/dev/null 2>&1; then 1400s stunnel4=stunnel 1400s else 1400s msgdie 'You need to install stunnel4 for https testcases' 1400s fi 1400s if [ ! -e "${TMPWORKINGDIRECTORY}/aptarchive/aptwebserver.pid" ]; then 1400s changetowebserver --no-rewrite "$@" 1400s fi 1400s echo "pid = ${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid 1400s cert = ${TMPWORKINGDIRECTORY}/rootdir/etc/webserver.pem 1400s output = /dev/null 1400s 1400s [https] 1400s accept = 127.0.0.1:0 1400s connect = $APTHTTPPORT 1400s " > "${TMPWORKINGDIRECTORY}/stunnel.conf" 1400s $stunnel4 "${TMPWORKINGDIRECTORY}/stunnel.conf" 1400s waitforpidfile "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid" 1400s local PID="$(cat "${TMPWORKINGDIRECTORY}/aptarchive/stunnel.pid")" 1400s if [ -z "$PID" ]; then 1400s msgdie 'Could not fork $stunnel4 successfully' 1400s fi 1400s addtrap 'prefix' "kill ${PID};" 1400s APTHTTPSPORT="$(lsof -i -n | awk "/^$stunnel4 / && \$2 == \"${PID}\" {print \$9; exit; }" | cut -d':' -f 2)" 1400s webserverconfig 'aptwebserver::port::https' "$APTHTTPSPORT" "https://localhost:${APTHTTPSPORT}" 1400s if [ "$REWRITE" != 'no' ]; then 1400s rewritesourceslist "https://localhost:${APTHTTPSPORT}/" 1400s fi 1400s } 1400s 1400s changetocdrom() { 1400s mkdir -p rootdir/media/cdrom/.disk 1400s local CD="$(readlink -f rootdir/media/cdrom)" 1400s cat > rootdir/etc/apt/apt.conf.d/00cdrom < "${CD}/.disk/info" 1400s if [ ! -d aptarchive/dists ]; then 1400s msgdie 'Flat file archive cdroms can not be created currently' 1400s return 1 1400s fi 1400s mv aptarchive/dists "$CD" 1400s ln -s "$(readlink -f ./incoming)" "$CD/pool" 1400s find rootdir/etc/apt/sources.list.d/ -name 'apt-test-*.list' -delete 1400s # start with an unmounted disk 1400s mv "${CD}" "${CD}-unmounted" 1400s # we don't want the disk to be modifiable 1400s addtrap 'prefix' "chmod -f -R +w '$(escape_shell "$PWD/rootdir/media/cdrom/dists/")' '$(escape_shell "$PWD/rootdir/media/cdrom-unmounted/dists/")' || true;" 1400s chmod -R 555 rootdir/media/cdrom-unmounted/dists 1400s } 1400s 1400s downloadfile() { 1400s local PROTO="${1%%:*}" 1400s if ! apthelper -o Debug::Acquire::${PROTO}=1 -o Debug::pkgAcquire::Worker=1 \ 1400s download-file "$1" "$2" "$3" 2>&1 ; then 1400s return 1 1400s fi 1400s # only if the file exists the download was successful 1400s if [ -r "$2" ]; then 1400s return 0 1400s else 1400s return 1 1400s fi 1400s } 1400s 1400s cleanup_output() { 1400s cat "$1" | sed \ 1400s -e '/gpgv: WARNING: This key is not suitable for signing in --compliance=gnupg mode/ d' \ 1400s -e '/^profiling:/ d' \ 1400s | sed -e '/\.\.\.profiling:/ {N;s#\.\.\.profiling:.*\n#...#g}' \ 1400s >"$2" 1400s } 1400s 1400s checkdiff() { 1400s local TMPFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.1.tmp" 1400s local TMPFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/checkdiff.2.tmp" 1400s touch "$TMPFILE1" "$TMPFILE2" 1400s 1400s cleanup_output "$1" "$TMPFILE1" 1400s cleanup_output "$2" "$TMPFILE2" 1400s 1400s local DIFFTEXT="$(command diff -u "$TMPFILE1" "$TMPFILE2" 2>&1 | sed -e '/^---/ d' -e '/^+++/ d' -e '/^@@/ d')" 1400s if [ -n "$DIFFTEXT" ]; then 1400s echo >&2 1400s echo >&2 "$DIFFTEXT" 1400s return 1 1400s else 1400s return 0 1400s fi 1400s } 1400s 1400s testoutputequal() { 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testoutputequal.output" 1400s local COMPAREFILE="$1" 1400s shift 1400s if "$@" 2>&1 | checkdiff "$COMPAREFILE" - >"$OUTPUT" 2>&1; then 1400s msgpass 1400s else 1400s echo "=== content of file we compared with (${COMPAREFILE}) ===" >>"${OUTPUT}" 1400s cat "$COMPAREFILE" >>"${OUTPUT}" 1400s msgfailoutput '' "$OUTPUT" "$@" 1400s fi 1400s } 1400s 1400s testfileequal() { 1400s msggroup 'testfileequal' 1400s local MSG='Test for correctness of file' 1400s if [ "$1" = '--nomsg' ]; then 1400s MSG='' 1400s shift 1400s fi 1400s local FILE="$1" 1400s shift 1400s if [ -n "$MSG" ]; then 1400s msgtest "$MSG" "$FILE" 1400s fi 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfileequal.output" 1400s if [ -z "$*" ]; then 1400s testoutputequal "$FILE" echo -n '' 1400s else 1400s testoutputequal "$FILE" echo "$*" 1400s fi 1400s msggroup 1400s } 1400s 1400s testempty() { 1400s msggroup 'testempty' 1400s if [ "$1" = '--nomsg' ]; then 1400s shift 1400s else 1400s msgtest "Test for no output of" "$*" 1400s fi 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testempty.comparefile" 1400s if "$@" >"$COMPAREFILE" 2>&1 && test ! -s "$COMPAREFILE"; then 1400s msgpass 1400s else 1400s msgfailoutput '' "$COMPAREFILE" "$@" 1400s fi 1400s aptautotest 'testempty' "$@" 1400s msggroup 1400s } 1400s testwarningempty() { 1400s testwarning "$@" 1400s testfailure grep -v '^W:' "${ROOTDIR}/tmp/testwarning.output" 1400s } 1400s testnotempty() { 1400s msggroup 'testnotempty' 1400s msgtest "Test for some output of" "$*" 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnotempty.comparefile" 1400s if ("$@" >"$COMPAREFILE" 2>&1 || true) && test -s "$COMPAREFILE"; then 1400s msgpass 1400s else 1400s msgfailoutput '' "$COMPAREFILE" "$@" 1400s fi 1400s aptautotest 'testnotempty' "$@" 1400s msggroup 1400s } 1400s 1400s testequal() { 1400s msggroup 'testequal' 1400s local MSG='Test of equality of' 1400s if [ "$1" = '--nomsg' ]; then 1400s MSG='' 1400s shift 1400s fi 1400s 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.comparefile" 1400s echo "$1" > "$COMPAREFILE" 1400s shift 1400s 1400s if [ -n "$MSG" ]; then 1400s msgtest "$MSG" "$*" 1400s fi 1400s testoutputequal "$COMPAREFILE" "$@" 1400s aptautotest 'testequal' "$@" 1400s msggroup 1400s } 1400s 1400s testequalor2() { 1400s msggroup 'testequalor2' 1400s local COMPAREFILE1="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile1" 1400s local COMPAREFILE2="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.comparefile2" 1400s local COMPAREAGAINST="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequalor2.compareagainst" 1400s echo "$1" > "$COMPAREFILE1" 1400s echo "$2" > "$COMPAREFILE2" 1400s shift 2 1400s msgtest "Test for equality OR of" "$*" 1400s "$@" >"$COMPAREAGAINST" 2>&1 || true 1400s if checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >/dev/null 2>&1 || \ 1400s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >/dev/null 2>&1 1400s then 1400s msgpass 1400s else 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testequal.output" 1400s echo -n "\n${CINFO}Diff against OR 1${CNORMAL}" >"$OUTPUT" 2>&1 1400s checkdiff "$COMPAREFILE1" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1400s echo -n "${CINFO}Diff against OR 2${CNORMAL}" >"$OUTPUT" 2>&1 1400s checkdiff "$COMPAREFILE2" "$COMPAREAGAINST" >"$OUTPUT" 2>&1 || true 1400s msgfailoutput '' "$OUTPUT" 1400s fi 1400s aptautotest 'testequalor2' "$@" 1400s msggroup 1400s } 1400s 1400s testshowvirtual() { 1400s msggroup 'testshowvirtual' 1400s local VIRTUAL="N: Can't select versions from package '$1' as it is purely virtual" 1400s local PACKAGE="$1" 1400s shift 1400s while [ -n "$1" ]; do 1400s VIRTUAL="${VIRTUAL} 1400s N: Can't select versions from package '$1' as it is purely virtual" 1400s PACKAGE="${PACKAGE} $1" 1400s shift 1400s done 1400s msgtest "Test for virtual packages" "apt-cache show $PACKAGE" 1400s VIRTUAL="${VIRTUAL} 1400s N: No packages found" 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.comparefile" 1400s local ARCH="$(getarchitecture 'native')" 1400s echo "$VIRTUAL" | sed -e "s/:$ARCH//" -e 's/:all//' >"$COMPAREFILE" 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testshowvirtual.output" 1400s testoutputequal "$COMPAREFILE" aptcache show "$PACKAGE" 1400s msggroup 1400s } 1400s 1400s testnopackage() { 1400s msggroup 'testnopackage' 1400s msgtest "Test for non-existent packages" "apt-cache show $*" 1400s local SHOWPKG="$(aptcache show "$@" 2>&1 | grep '^Package: ')" 1400s if [ -n "$SHOWPKG" ]; then 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1400s echo "$SHOWPKG" >"$OUTPUT" 1400s msgfailoutput '' "$OUTPUT" 1400s else 1400s msgpass 1400s fi 1400s msggroup 1400s } 1400s testnosrcpackage() { 1400s msggroup 'testnosrcpackage' 1400s msgtest "Test for non-existent source packages" "apt-cache showsrc $*" 1400s local SHOWPKG="$(aptcache showsrc "$@" 2>&1 | grep '^Package: ')" 1400s if [ -n "$SHOWPKG" ]; then 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnosrcpackage.output" 1400s echo "$SHOWPKG" >"$OUTPUT" 1400s msgfailoutput '' "$OUTPUT" 1400s else 1400s msgpass 1400s fi 1400s msggroup 1400s } 1400s 1400s testdpkgstatus() { 1400s msggroup 'testdpkgstatus' 1400s local STATE="$1" 1400s local NR="$2" 1400s shift 2 1400s msgtest "Test that $NR package(s) are in state $STATE with" "dpkg -l $*" 1400s local PKGS="$(dpkg -l "$@" 2>/dev/null | grep "^${STATE}" | wc -l)" 1400s if [ "$PKGS" != $NR ]; then 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testnopackage.output" 1400s echo "$PKGS" >"$OUTPUT" 1400s dpkg -l "$@" | grep '^[a-z]' >"$OUTPUT" >&2 || true 1400s msgfailoutput '' "$OUTPUT" 1400s else 1400s msgpass 1400s fi 1400s msggroup 1400s } 1400s 1400s testdpkginstalled() { 1400s msggroup 'testdpkginstalled' 1400s testdpkgstatus 'ii' "$#" "$@" 1400s msggroup 1400s } 1400s 1400s testdpkgnotinstalled() { 1400s msggroup 'testdpkgnotinstalled' 1400s testdpkgstatus 'ii' '0' "$@" 1400s msggroup 1400s } 1400s 1400s testmarkedauto() { 1400s msggroup 'testmarkedauto' 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedauto.comparefile" 1400s if [ -n "$1" ]; then 1400s msgtest 'Test for correctly marked as auto-installed' "$*" 1400s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1400s else 1400s msgtest 'Test for correctly marked as auto-installed' 'no package' 1400s echo -n > "$COMPAREFILE" 1400s fi 1400s testoutputequal "$COMPAREFILE" aptmark showauto 1400s msggroup 1400s } 1400s testmarkedmanual() { 1400s msggroup 'testmarkedmanual' 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testmarkedmanual.comparefile" 1400s if [ -n "$1" ]; then 1400s msgtest 'Test for correctly marked as manually installed' "$*" 1400s while [ -n "$1" ]; do echo "$1"; shift; done | sort > "$COMPAREFILE" 1400s else 1400s msgtest 'Test for correctly marked as manually installed' 'no package' 1400s echo -n > "$COMPAREFILE" 1400s fi 1400s testoutputequal "$COMPAREFILE" aptmark showmanual 1400s msggroup 1400s } 1400s 1400s catfile() { 1400s if [ "${1##*.}" = 'deb' ]; then 1400s stat >&2 "$1" || true 1400s file >&2 "$1" || true 1400s else 1400s cat >&2 "$1" || true 1400s fi 1400s } 1400s msgfailoutput() { 1400s msgreportheader 'msgfailoutput' 1400s local MSG="$1" 1400s local OUTPUT="$2" 1400s shift 2 1400s local CMD="$1" 1400s if [ "$1" = 'grep' -o "$1" = 'tail' -o "$1" = 'head' ]; then 1400s echo >&2 1400s while [ -n "$2" ]; do shift; done 1400s echo "#### Complete file: $1 ####" 1400s catfile "$1" 1400s echo "#### $CMD output ####" 1400s elif [ "$1" = 'test' ]; then 1400s echo >&2 1400s # doesn't support ! or non-file flags 1400s msgfailoutputstatfile() { 1400s local FILEFLAGS='^-[bcdefgGhkLOprsStuwx]$' 1400s if expr match "$1" "$FILEFLAGS" >/dev/null; then 1400s echo "#### stat(2) of file: $2 ####" 1400s stat "$2" || true 1400s if test -d "$2"; then 1400s echo "#### The directory contains: $2 ####" 1400s ls >&2 "$2" || true 1400s elif test -e "$2"; then 1400s echo "#### Complete file: $2 ####" 1400s catfile "$2" 1400s fi 1400s fi 1400s } 1400s msgfailoutputstatfile "$2" "$3" 1400s while [ -n "$5" ] && [ "$4" = '-o' -o "$4" = '-a' ]; do 1400s shift 3 1400s msgfailoutputstatfile "$2" "$3" 1400s done 1400s echo '#### test output ####' 1400s elif [ "$1" = 'cmp' ]; then 1400s echo >&2 1400s while [ -n "$2" ]; do 1400s echo "#### Complete file: $2 ####" 1400s catfile "$2" 1400s shift 1400s done 1400s echo '#### cmp output ####' 1400s elif [ "$1" = 'rm' ]; then 1400s echo "#### Directory listing of: $(pwd) ####" 1400s ls -l 1400s fi 1400s catfile "$OUTPUT" 1400s if [ "$CMD" != 'echo' ] && tail -n 1 "$OUTPUT" | grep -q '(core dumped)$'; then 1400s local COREDUMP="${TMPWORKINGDIRECTORY}/rootdir/tmp/core.dump" 1400s local COREEXE='' 1400s for CORENAME in 'core' 'core.pid'; do 1400s if [ -s "$CORENAME" ]; then 1400s cp -a ${CORENAME} "$COREDUMP" 1400s elif [ -s "${TMPWORKINGDIRECTORY}/${CORENAME}" ]; then 1400s cp -a "${TMPWORKINGDIRECTORY}/${CORENAME}" "$COREDUMP" 1400s else 1400s continue 1400s fi 1400s break 1400s done 1400s if [ -s "$COREDUMP" ]; then 1400s true # found already as a file 1400s elif dpkg-checkbuilddeps -d 'systemd-coredump' /dev/null >/dev/null 2>&1; then 1400s COREEXE="$(coredumpctl -1 --no-legend list | sed -e 's#^.* \([^ ]\+\)$#\1#')" 1400s coredumpctl -1 dump "$COREEXE" -o "$COREDUMP" 2>/dev/null >&2 || true 1400s else 1400s echo '### core dump not found ###' 1400s cat /proc/sys/kernel/core_pattern 1400s fi 1400s if [ -s "$COREDUMP" ]; then 1400s if [ -z "$COREEXE" ]; then 1400s case "$CMD" in 1400s apt) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1400s aptftparchive) COREEXE="${APTFTPARCHIVEBINDIR}/apt-ftparchive";; 1400s apthelper) COREEXE="${APTHELPERBINDIR}/apt-helper";; 1400s aptwebserver) COREEXE="${APTTESTHELPERSBINDIR}/aptwebserver";; 1400s apt*) COREEXE="${APTCMDLINEBINDIR}/apt-${CMD##*apt}";; 1400s *) COREEXE="${APTCMDLINEBINDIR}/${CMD}";; 1400s esac 1400s fi 1400s 1400s if [ -d "${ARTIFACTSDIR}" ]; then 1400s local ARTIFACT_COREDUMP="$(mktemp --suffix=.coredump -p "${ARTIFACTSDIR}" "${COREEXE##*/}-XXXXXX")" 1400s cp -a "$COREDUMP" "$ARTIFACT_COREDUMP" 1400s echo "#### coredump in $ARTIFACT_COREDUMP for $COREEXE ####" 1400s fi 1400s if [ -n "$COREEXE" -a -s "$COREEXE" ] && dpkg-checkbuilddeps -d 'gdb' /dev/null >/dev/null 2>&1; then 1400s echo "#### gdb backtrace ####" 1400s command gdb --batch -n -ex 'set pagination off' --ex 'thread apply all bt full' "$COREEXE" "$COREDUMP" || true 1400s fi 1400s fi 1400s rm -f "$COREDUMP" 1400s fi 1400s msgfail "$MSG" 1400s } 1400s 1400s testsuccesswithglobalerror() { 1400s local TYPE="$1" 1400s local ERRORS="$2" 1400s shift 2 1400s msggroup "$TYPE" 1400s if [ "$1" = '--nomsg' ]; then 1400s shift 1400s else 1400s msgtest 'Test for successful execution of' "$*" 1400s fi 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/${TYPE}.output" 1400s if "$@" >"${OUTPUT}" 2>&1; then 1400s if expr match "$1" '^apt.*' >/dev/null; then 1400s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1400s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1400s elif grep -E "^[${ERRORS}]: " "$OUTPUT" > "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" 2>&1; then 1400s if [ "$IGNORE_PTY_NOT_MOUNTED" = '1' ]; then 1400s if echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory)' \ 1400s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1400s msgpass 1400s elif echo 'E: Can not write log (Is /dev/pts mounted?) - posix_openpt (13: Permission denied)' \ 1400s | cmp - "${TMPWORKINGDIRECTORY}/rootdir/tmp/checkforwarnings.output" >/dev/null 2>&1; then 1400s msgpass 1400s else 1400s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1400s fi 1400s else 1400s msgfailoutput 'successful run, but output contains warnings/errors' "$OUTPUT" "$@" 1400s fi 1400s elif [ "$TYPE" = 'testsuccesswithnotice' ]; then 1400s if grep -q -E "^N: " "$OUTPUT"; then 1400s msgpass 1400s else 1400s msgfailoutput 'successful run, but output had no notices' "$OUTPUT" "$@" 1400s fi 1400s else 1400s msgpass 1400s fi 1400s else 1400s msgpass 1400s fi 1400s else 1400s local EXITCODE=$? 1400s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1400s fi 1400s aptautotest "$TYPE" "$@" 1400s msggroup 1400s } 1400s testsuccesswithnotice() { 1400s testsuccesswithglobalerror 'testsuccesswithnotice' 'WE' "$@" 1400s } 1400s testsuccess() { 1400s testsuccesswithglobalerror 'testsuccess' 'NWE' "$@" 1400s } 1400s testwarning() { 1400s msggroup 'testwarning' 1400s if [ "$1" = '--nomsg' ]; then 1400s shift 1400s else 1400s msgtest 'Test for successful execution with warnings of' "$*" 1400s fi 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" 1400s if "$@" >"${OUTPUT}" 2>&1; then 1400s if expr match "$1" '^apt.*' >/dev/null; then 1400s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1400s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1400s elif grep -q -E '^E: ' "$OUTPUT"; then 1400s msgfailoutput 'successful run, but output contains errors' "$OUTPUT" "$@" 1400s elif ! grep -q -E '^W: ' "$OUTPUT"; then 1400s msgfailoutput 'successful run, but output contains no warnings' "$OUTPUT" "$@" 1400s else 1400s msgpass 1400s fi 1400s else 1400s msgpass 1400s fi 1400s else 1400s local EXITCODE=$? 1400s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1400s fi 1400s aptautotest 'testwarning' "$@" 1400s msggroup 1400s } 1400s testfailure() { 1400s msggroup 'testfailure' 1400s if [ "$1" = '--nomsg' ]; then 1400s shift 1400s else 1400s msgtest 'Test for failure in execution of' "$*" 1400s fi 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" 1400s if "$@" >"${OUTPUT}" 2>&1; then 1400s local EXITCODE=$? 1400s msgfailoutput "exitcode $EXITCODE" "$OUTPUT" "$@" 1400s else 1400s local EXITCODE=$? 1400s if expr match "$1" '^apt.*' >/dev/null; then 1400s if [ "$1" = 'aptkey' ]; then 1400s if grep -q " Can't check signature: 1400s BAD signature from 1400s signature could not be verified" "$OUTPUT"; then 1400s msgpass 1400s else 1400s msgfailoutput "run failed with exitcode ${EXITCODE}, but no signature error" "$OUTPUT" "$@" 1400s fi 1400s else 1400s if grep -q -E ' runtime error: ' "$OUTPUT"; then 1400s msgfailoutput 'compiler detected undefined behavior' "$OUTPUT" "$@" 1400s elif grep -q -E '==ERROR' "$OUTPUT"; then 1400s msgfailoutput 'compiler sanitizers reported errors' "$OUTPUT" "$@" 1400s elif ! grep -q -E '^E: ' "$OUTPUT"; then 1400s msgfailoutput "run failed with exitcode ${EXITCODE}, but with no errors" "$OUTPUT" "$@" 1400s else 1400s msgpass 1400s fi 1400s fi 1400s else 1400s msgpass 1400s fi 1400s fi 1400s aptautotest 'testfailure' "$@" 1400s msggroup 1400s } 1400s 1400s testreturnstateequal() { 1400s local STATE="$1" 1400s if [ "$STATE" = 'testsuccesswithglobalerror' ]; then 1400s local STATE="$2" 1400s local TYPE="$3" 1400s shift 3 1400s msggroup "${STATE}equal" 1400s if [ "$1" != '--nomsg' ]; then 1400s local CMP="$1" 1400s shift 1400s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1400s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1400s else 1400s local CMP="$2" 1400s shift 2 1400s testsuccesswithglobalerror "$STATE" "$TYPE" "$@" 1400s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1400s fi 1400s else 1400s msggroup "${STATE}equal" 1400s if [ "$2" != '--nomsg' ]; then 1400s local CMP="$2" 1400s shift 2 1400s "$STATE" "$@" 1400s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1400s else 1400s local CMP="$3" 1400s shift 3 1400s "$STATE" --nomsg "$@" 1400s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/tmp/${STATE}.output" "$CMP" 1400s fi 1400s fi 1400s msggroup 1400s } 1400s testsuccessequal() { 1400s # we compare output, so we know perfectly well about N: 1400s testreturnstateequal 'testsuccesswithglobalerror' 'testsuccess' 'WE' "$@" 1400s } 1400s testwarningequal() { 1400s testreturnstateequal 'testwarning' "$@" 1400s } 1400s testfailureequal() { 1400s testreturnstateequal 'testfailure' "$@" 1400s } 1400s 1400s testfailuremsg() { 1400s msggroup 'testfailuremsg' 1400s local CMP="$1" 1400s shift 1400s testfailure "$@" 1400s msgtest 'Check that the output of the previous failed command has expected' 'failures and warnings' 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailuremsg.comparefile" 1400s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testfailure.output" > "$COMPAREFILE" 2>&1 || true 1400s testoutputequal "$COMPAREFILE" echo "$CMP" 1400s msggroup 1400s } 1400s testwarningmsg() { 1400s msggroup 'testwarningmsg' 1400s local CMP="$1" 1400s shift 1400s testwarning "$@" 1400s msgtest 'Check that the output of the previous warned command has expected' 'warnings' 1400s local COMPAREFILE="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarningmsg.comparefile" 1400s grep '^\(W\|E\|N\):' "${TMPWORKINGDIRECTORY}/rootdir/tmp/testwarning.output" > "$COMPAREFILE" 2>&1 || true 1400s testoutputequal "$COMPAREFILE" echo "$CMP" 1400s msggroup 1400s } 1400s 1400s testfilestats() { 1400s msggroup 'testfilestats' 1400s msgtest "Test that file $1 has $2 $3" "$4" 1400s if [ "$4" "$3" "$(stat --format "$2" "$1")" ]; then 1400s msgpass 1400s else 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testfilestats.output" 1400s { 1400s echo 1400s ls -ld "$1" || true 1400s echo -n "stat(1) reports for $2: " 1400s stat --format "$2" "$1" || true 1400s } >"$OUTPUT" 2>&1 1400s msgfailoutput '' "$OUTPUT" stat --format "$2" "$1" 1400s fi 1400s msggroup 1400s } 1400s testaccessrights() { 1400s msggroup 'testaccessrights' 1400s testfilestats "$1" '%a' '=' "$2" 1400s msggroup 1400s } 1400s 1400s testwebserverlaststatuscode() { 1400s msggroup 'testwebserverlaststatuscode' 1400s local DOWNLOG="${TMPWORKINGDIRECTORY}/rootdir/tmp/webserverstatus-testfile.log" 1400s local STATUS="${TMPWORKINGDIRECTORY}/downloaded/webserverstatus-statusfile.log" 1400s rm -f "$DOWNLOG" "$STATUS" 1400s msgtest 'Test last status code from the webserver was' "$1" 1400s if downloadfile "http://localhost:${APTHTTPPORT}/_config/find/aptwebserver::last-status-code" "$STATUS" > "$DOWNLOG" && [ "$(cat "$STATUS")" = "$1" ]; then 1400s msgpass 1400s else 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/testwebserverlaststatuscode.output" 1400s { 1400s if [ -n "$2" ]; then 1400s shift 1400s echo >&2 '#### Additionally provided output files contain:' 1400s cat >&2 "$@" 1400s fi 1400s echo >&2 '#### Download log of the status code:' 1400s cat >&2 "$DOWNLOG" 1400s } >"$OUTPUT" 2>&1 1400s msgfailoutput "Status was $(cat "$STATUS")" "$OUTPUT" 1400s fi 1400s msggroup 1400s } 1400s 1400s mapkeynametokeyid() { 1400s while [ -n "$1" ]; do 1400s case "$1" in 1400s *Joe*|*Sixpack*|newarchive) echo '5A90D141DBAC8DAE';; 1400s *Rex*|*Expired*) echo '4BC0A39C27CE74F9';; 1400s *Marvin*|*Paranoid*) echo 'E8525D47528144E2';; 1400s *Sebastian*|*Subkey*) echo '5B6896415D44C43E';; 1400s oldarchive) echo 'FDD2DB85F68C85A3';; 1400s *) echo 'UNKNOWN KEY';; 1400s esac 1400s shift 1400s done 1400s } 1400s testaptkeys() { 1400s local OUTPUT="${TMPWORKINGDIRECTORY}/rootdir/tmp/aptkeylist.output" 1400s if ! aptkey list --with-colon 2>/dev/null | grep '^pub' | cut -d':' -f 5 > "$OUTPUT"; then 1400s echo -n > "$OUTPUT" 1400s fi 1400s testfileequal "$OUTPUT" "$(mapkeynametokeyid "$@")" 1400s } 1400s 1400s pause() { 1400s echo "STOPPED execution. Press enter to continue" 1400s local IGNORE 1400s read IGNORE 1400s } 1400s 1400s logcurrentarchivedirectory() { 1400s find "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do 1400s stat --format '%U:%G:%a:%n' "$line" 1400s done | sort > "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" 1400s } 1400s listcurrentlistsdirectory() { 1400s { 1400s find rootdir/var/lib/apt/lists -maxdepth 1 -type d | while read line; do 1400s stat --format '%U:%G:%a:%n' "$line" 1400s done 1400s find rootdir/var/lib/apt/lists -maxdepth 1 \! -type d | while read line; do 1400s stat --format '%U:%G:%a:%s:%y:%n' "$line" 1400s done 1400s } | sort 1400s } 1400s forallsupportedcompressors() { 1400s rm -f "${TMPWORKINGDIRECTORY}/rootdir/etc/apt/apt.conf.d/00force-compressor" 1400s for COMP in $(aptconfig dump 'APT::Compressor' --format '%f%n' | cut -d':' -f 5 | uniq); do 1400s if [ -z "$COMP" -o "$COMP" = '.' ]; then continue; fi 1400s "$@" "$COMP" 1400s done 1400s } 1400s 1400s breakfiles() { 1400s while [ -n "$1" ]; do 1400s mv -f "${1}" "${1}.bak" 1400s testsuccess dd if=/dev/zero of="${1}" bs="$(stat -c %s "${1}.bak")" count=1 1400s shift 1400s done 1400s } 1400s unbreakfiles() { 1400s while [ -n "$1" ]; do 1400s mv -f "${1}.bak" "${1}" 1400s shift 1400s done 1400s } 1400s 1400s ### convenience hacks ### 1400s mkdir() { 1400s # creating some directories by hand is a tedious task, so make it look simple 1400s local PARAMS="$*" 1400s if [ "$PARAMS" != "${PARAMS#*rootdir/var/lib/apt/lists}" ]; then 1400s # only the last directory created by mkdir is effected by the -m ! 1400s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" 1400s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" 1400s command mkdir -m 700 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1400s command mkdir -m 755 -p "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1400s touch "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/lock" 1400s if [ "$(id -u)" = '0' ]; then 1400s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" 1400s chown _apt:$(id -gn) "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/auxfiles" 1400s fi 1400s else 1400s command mkdir "$@" 1400s fi 1400s } 1400s 1400s ### The following tests are run by most test methods automatically to check 1400s ### general things about commands executed without writing the test every time. 1400s 1400s aptautotest() { 1400s if [ $# -lt 3 ]; then return; fi 1400s local TESTCALL="$1" 1400s local CMD="$2" 1400s local FIRSTOPT="$3" 1400s shift 2 1400s for i in "$@"; do 1400s if ! expr match "$i" '^-' >/dev/null 2>&1; then 1400s FIRSTOPT="$i" 1400s break 1400s fi 1400s done 1400s shift 1400s local AUTOTEST="aptautotest_$(echo "${CMD##*/}_${FIRSTOPT}" | tr -d -c 'A-za-z0-9')" 1400s if command -v $AUTOTEST >/dev/null; then 1400s # save and restore the *.output files from other tests 1400s # as we might otherwise override them in these automatic tests 1400s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1400s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" 1400s mkdir "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1400s $AUTOTEST "$TESTCALL" "$@" 1400s rm -rf "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1400s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp" "${TMPWORKINGDIRECTORY}/rootdir/tmp-aptautotest" 1400s mv "${TMPWORKINGDIRECTORY}/rootdir/tmp-before" "${TMPWORKINGDIRECTORY}/rootdir/tmp" 1400s fi 1400s } 1400s 1400s cdfind() { 1400s ( cd /; find "$@" ) 1400s } 1400s aptautotest_aptget_update() { 1400s local TESTCALL="$1" 1400s while [ -n "$2" ]; do 1400s if [ "$2" = '--print-uris' ]; then return; fi # simulation mode 1400s shift 1400s done 1400s if ! test -d "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists"; then return; fi 1400s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1400s testfilestats "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:755" 1400s # all copied files are properly chmodded 1400s local backupIFS="$IFS" 1400s IFS="$(printf "\n\b")" 1400s for file in $(cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists" -type f ! -name 'lock' | cut -c "$((${#TMPWORKINGDIRECTORY} + 1))-"); do 1400s testfilestats "${TMPWORKINGDIRECTORY}$file" '%U:%G:%a' '=' "${TEST_DEFAULT_USER}:${TEST_DEFAULT_GROUP}:644" 1400s done 1400s IFS="$backupIFS" 1400s if [ "$TESTCALL" = 'testsuccess' ]; then 1400s # failure cases can retain partial files and such 1400s testempty cdfind "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/lists/partial" -mindepth 1 ! \( -name 'lock' -o -name '*.FAILED' \) 1400s fi 1400s if [ -s "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" ]; then 1400s testfileequal "${TMPWORKINGDIRECTORY}/rootdir/var/log/aptgetupdate.before.lst" \ 1400s "$(cdfind "${TMPWORKINGDIRECTORY}/aptarchive/dists" -type f | while read line; do stat --format '%U:%G:%a:%n' "$line"; done | sort)" 1400s fi 1400s } 1400s aptautotest_apt_update() { aptautotest_aptget_update "$@"; } 1400s aptautotest_aptcdrom_add() { aptautotest_aptget_update "$@"; } 1400s 1400s testaptautotestnodpkgwarning() { 1400s local TESTCALL="$1" 1400s while [ -n "$2" ]; do 1400s if expr match "$2" '^-[a-z]*s' >/dev/null 2>&1; then return; fi # simulation mode 1400s if expr match "$2" '^-dy\?' >/dev/null 2>&1; then return; fi # download-only mode 1400s shift 1400s done 1400s testfailure grep '^dpkg: warning:.*\(ignor\|unknown\).*' "${TMPWORKINGDIRECTORY}/rootdir/tmp-before/${TESTCALL}.output" 1400s } 1400s 1400s aptautotest_aptget_install() { testaptautotestnodpkgwarning "$@"; } 1400s aptautotest_aptget_remove() { testaptautotestnodpkgwarning "$@"; } 1400s aptautotest_aptget_purge() { testaptautotestnodpkgwarning "$@"; } 1400s aptautotest_apt_install() { testaptautotestnodpkgwarning "$@"; } 1400s aptautotest_apt_remove() { testaptautotestnodpkgwarning "$@"; } 1400s aptautotest_apt_purge() { testaptautotestnodpkgwarning "$@"; } 1400s 1400s testaptmarknodefaultsections() { 1400s testfailure grep '^Auto-Installed: 0$' "${TMPWORKINGDIRECTORY}/rootdir/var/lib/apt/extended_states" 1400s } 1400s aptautotest_aptmark_auto() { testaptmarknodefaultsections "$@"; } 1400s aptautotest_aptmark_manual() { testaptmarknodefaultsections "$@"; } 1400s aptautotest_aptget_markauto() { testaptmarknodefaultsections "$@"; } 1400s aptautotest_aptget_markmanual() { testaptmarknodefaultsections "$@"; } 1400s cmp: ./downloaded/foo1: No such file or directory 1400s FAIL: exitcode 2 1401s P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1401s (4/302) Testcase test-allow: 1404s Running test-acquire-same-file-multiple-times -> FAILED P P P P P P P P P P P P P P P P P P P P P P P P P 1409s (5/302) Testcase test-allow-scores-for-all-dependency-types: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1417s (6/302) Testcase test-apt-acquire-additional-files: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1420s (7/302) Testcase test-apt-acquire-additional-files-duplicates: P P P P P P P P 1429s (8/302) Testcase test-apt-by-hash-update: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1432s (9/302) Testcase test-apt-cache: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1434s (10/302) Testcase test-apt-cache-remapping: P P P P P P P P P P P P P P P 1436s (11/302) Testcase test-apt-cache-showsrc: P P P P P P P P P P P P P 1448s (12/302) Testcase test-apt-cdrom: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1452s (13/302) Testcase test-apt-cli-json-hooks: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1455s (14/302) Testcase test-apt-cli-list: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1458s (15/302) Testcase test-apt-cli-search: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1461s (16/302) Testcase test-apt-cli-show: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1463s (17/302) Testcase test-apt-cli-update: P P P P P P P P P P P P P P P P P P P P P P P P P 1465s (18/302) Testcase test-apt-cli-upgrade: P P P P P P P P P P P P 1467s (19/302) Testcase test-apt-config: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1468s (20/302) Testcase test-apt-edit-sources: P P P P P P P P 1471s (21/302) Testcase test-apt-extracttemplates: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1478s (22/302) Testcase test-apt-ftparchive: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1482s (23/302) Testcase test-apt-ftparchive-by-hash: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1484s (24/302) Testcase test-apt-ftparchive-cachedb: P P P P P P P P P P P P P P P P P P P P P P P P 1486s (25/302) Testcase test-apt-ftparchive-cachedb-lp1274466: P P P P P P P 1504s (26/302) Testcase test-apt-ftparchive-corner-cases: P P P P P P P P P P 1506s (27/302) Testcase test-apt-ftparchive-notautomatic: P P P P P P P P P P P P P P P P P P P P P P P P P P 1508s (28/302) Testcase test-apt-ftparchive-src-cachedb: P P P P P P P P P P P P P P P P P P P P P P P P P P P 1522s (29/302) Testcase test-apt-get-autoremove: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1523s (30/302) Testcase test-apt-get-autoremove-kernel-module-providers: P P P P P P P P P 1525s (31/302) Testcase test-apt-get-autoremove-real-virtual-provider: P P P P P P P 1527s (32/302) Testcase test-apt-get-build-dep: P P P P P P P P P P P P P P P P P P P P 1534s (33/302) Testcase test-apt-get-build-dep-barbarian: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1539s (34/302) Testcase test-apt-get-build-dep-file: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1546s (35/302) Testcase test-apt-get-changelog: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1550s (36/302) Testcase test-apt-get-clean: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1554s (37/302) Testcase test-apt-get-download: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1568s (38/302) Testcase test-apt-get-install-deb: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1580s (39/302) Testcase test-apt-get-install-update: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1586s (40/302) Testcase test-apt-get-install-virtual-pkgs: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1589s (41/302) Testcase test-apt-get-remove-depends: P P P P P P P P P P P P P P P P P P P P 1593s (42/302) Testcase test-apt-get-satisfy: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1596s (43/302) Testcase test-apt-get-source-arch: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1598s (44/302) Testcase test-apt-get-source-authenticated: P P P P P P P P P P P P P P P P P 1600s (45/302) Testcase test-apt-get-source-multisources: P P P P P P P P P P P P P P P P P P 1602s (46/302) Testcase test-apt-get-update-sourceslist-warning: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1605s (47/302) Testcase test-apt-get-update-unauth-warning: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1608s (48/302) Testcase test-apt-get-upgrade: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1610s (49/302) Testcase test-apt-get-upgrade-by-source: P P P P P P P P P P P P 1615s (50/302) Testcase test-apt-helper: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1617s (51/302) Testcase test-apt-helper-cat-file: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1619s (52/302) Testcase test-apt-https-no-redirect: P P P P P P P P P P P P P P P P P P P 1624s (53/302) Testcase test-apt-https-transient: P P P P P P P P P P 1628s (54/302) Testcase test-apt-install-file-reltag: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1630s (55/302) Testcase test-apt-install-order-matters-a-bit: P P P P P P P P P P P P P P P P P P 1636s (56/302) Testcase test-apt-keep-downloaded-pkgs: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1797s (57/302) Testcase test-apt-key: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1799s (58/302) Testcase test-apt-key-net-update: P P P P P P 1806s (59/302) Testcase test-apt-key-used-in-maintainerscript: P P P P P P P P P P P P P P P P 1819s (60/302) Testcase test-apt-mark: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1827s (61/302) Testcase test-apt-move-and-forget-manual-sections: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1834s (62/302) Testcase test-apt-never-markauto-sections: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1839s (63/302) Testcase test-apt-patterns: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1843s (64/302) Testcase test-apt-progress-fd: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1850s (65/302) Testcase test-apt-progress-fd-conffile: P P P P P P P P P P P P P P P P P 1853s (66/302) Testcase test-apt-progress-fd-deb822: P P P P P P P P P P P P P P P P P P P P P P 1856s (67/302) Testcase test-apt-progress-fd-error: P P P P P P P P P P P P P P P P P P P 1858s (68/302) Testcase test-apt-redirect-loop: P P P P P P P P P P P P 1862s (69/302) Testcase test-apt-showlist-orgroup-in-recommends: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1870s (70/302) Testcase test-apt-source-and-build-dep: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1873s (71/302) Testcase test-apt-sources-deb822: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1874s (72/302) Testcase test-apt-tagfile-fields-order: P P P P P P P P P PCompare our knowledge with the source code of dpkg … SKIP: source not provided 1874s SKIP: source not provided 1874s Compare our knowledge with the source code of dak … 1875s (73/302) Testcase test-apt-translation-has-no-packages: P P P P P P P P P P P P P P 1878s (74/302) Testcase test-apt-update-disappeared-component: P P P P P P P P P P P P P P P P P P P P P P P P 1881s (75/302) Testcase test-apt-update-empty-files: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1891s (76/302) Testcase test-apt-update-expected-size: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1897s (77/302) Testcase test-apt-update-failure-propagation: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1900s (78/302) Testcase test-apt-update-file: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1906s (79/302) Testcase test-apt-update-filesize-mismatch: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1910s (80/302) Testcase test-apt-update-hashsum-mismatch: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1914s (81/302) Testcase test-apt-update-hooks: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1941s (82/302) Testcase test-apt-update-ims: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1955s (83/302) Testcase test-apt-update-nofallback: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1975s (84/302) Testcase test-apt-update-not-modified: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1986s (85/302) Testcase test-apt-update-releaseinfo-changes: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 1991s (86/302) Testcase test-apt-update-repeated-ims-hit: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2002s (87/302) Testcase test-apt-update-reporting: P P 2015s (88/302) Testcase test-apt-update-rollback: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2017s (89/302) Testcase test-apt-update-simple: P P P P P P P P P P P P PSKIP: valgrind on armhf is broken 2017s Test of equality of apt-get indextargets --format $(METAKEY) … P P P P P P P P P P 2020s (90/302) Testcase test-apt-update-stale: P P P P P P P P P P P P P P P P P 2034s (91/302) Testcase test-apt-update-transactions: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2038s (92/302) Testcase test-apt-update-unauth: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2062s (93/302) Testcase test-apt-update-weak-hashes: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2067s (94/302) Testcase test-architecture-specification-parsing: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2084s (95/302) Testcase test-authentication-basic: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2084s (96/302) Testcase test-bug-1053887-regex-return-failure: P P P 2086s (97/302) Testcase test-bug-254770-segfault-if-cache-not-buildable: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2087s (98/302) Testcase test-bug-330162-encoded-tar-header: P 2089s (99/302) Testcase test-bug-407511-fail-invalid-default-release: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2093s (100/302) Testcase test-bug-470115-new-and-tighten-recommends: P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2094s (101/302) Testcase test-bug-490000-search-in-all-translations: P P P P P P P P P P P P P P P P P P P P P 2096s (102/302) Testcase test-bug-507998-dist-upgrade-recommends: P P P P P P P P P P 2098s (103/302) Testcase test-bug-543966-downgrade-below-1000-pin: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2100s (104/302) Testcase test-bug-549968-install-depends-of-not-installed: P P P P P P P P P P 2102s (105/302) Testcase test-bug-590041-prefer-non-virtual-packages: P P P P P P P P P P P P P P P P P 2108s (106/302) Testcase test-bug-590438-broken-provides-thanks-to-remove-order: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2109s (107/302) Testcase test-bug-591882-conkeror: P P P P P P P P P P P 2111s (108/302) Testcase test-bug-593360-modifiers-in-names: P P P P P P P P P P P P P P P P P P P P P P P 2119s (109/302) Testcase test-bug-595691-empty-and-broken-archive-files: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2123s (110/302) Testcase test-bug-596498-trusted-unsigned-repo: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2126s (111/302) Testcase test-bug-598669-install-postfix-gets-exim-heavy: P P P P P P P P P P 2127s (112/302) Testcase test-bug-601961-install-info: P P P P P P P P P P P P P P P P P 2143s (113/302) Testcase test-bug-602412-dequote-redirect: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2146s (114/302) Testcase test-bug-604222-new-and-autoremove: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2148s (115/302) Testcase test-bug-604401-files-are-directories: P P P P P P P P P P P P P P P 2149s (116/302) Testcase test-bug-605394-versioned-or-groups: P P P P P P P P P P P P 2159s (117/302) Testcase test-bug-611729-mark-as-manual: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2172s (118/302) Testcase test-bug-612099-multiarch-conflicts: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2174s (119/302) Testcase test-bug-612557-garbage-upgrade: P P P P P P P P P P P P P P P P P P P P 2176s (120/302) Testcase test-bug-612958-use-dpkg-multiarch-config: P P P P P P P P P P P P P P P P P P P P P P 2178s (121/302) Testcase test-bug-613420-new-garbage-dependency: P P P P P P P P P P P P P P P 2181s (122/302) Testcase test-bug-617690-allow-unauthenticated-makes-all-untrusted: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2185s (123/302) Testcase test-bug-618288-multiarch-same-lockstep: P P P P P P P P P P P P P P P P P P P P P P P P 2187s (124/302) Testcase test-bug-618848-always-respect-user-requests: P P P P P P P P P P 2190s (125/302) Testcase test-bug-623443-fail-on-bad-proxies: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2205s (126/302) Testcase test-bug-624218-Translation-file-handling: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2210s (127/302) Testcase test-bug-632221-cross-dependency-satisfaction: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2212s (128/302) Testcase test-bug-633350-do-not-kill-last-char-in-Release: P P P P P P P P P P 2213s (129/302) Testcase test-bug-64141-install-dependencies-for-on-hold: P P P P P P P P P P P P P P 2217s (130/302) Testcase test-bug-657695-resolver-breaks-on-virtuals: P P P P P P P P P P 2225s (131/302) Testcase test-bug-661537-build-profiles-support: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2231s (132/302) Testcase test-bug-673536-pre-depends-breaks-loop: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2234s (133/302) Testcase test-bug-675449-essential-are-protected: P P P P P P P P P P P P P P P P P P P P P 2238s (134/302) Testcase test-bug-679371-apt-get-autoclean-multiarch: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2241s (135/302) Testcase test-bug-680041-apt-mark-holds-correctly: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2244s (136/302) Testcase test-bug-683786-build-dep-on-virtual-packages: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2247s (137/302) Testcase test-bug-686346-package-missing-architecture: P P P P P P P P P P P P P P P P P P P P P P P P P P P 2247s (138/302) Testcase test-bug-689582-100-char-long-path-names: P P 2249s (139/302) Testcase test-bug-691453-apt-cache-search-multi-pattern: P P P P P P P P P P P P P P P P P P P P 2250s (140/302) Testcase test-bug-709560-set-candidate-release: P P P P P P P P P P 2282s (141/302) Testcase test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2283s (142/302) Testcase test-bug-712435-missing-descriptions: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2288s (143/302) Testcase test-bug-717891-abolute-uris-for-proxies: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2290s (144/302) Testcase test-bug-718329-support-data.tar-uncompressed: P P P P P P P P P P P P P P P P P P P P P 2294s (145/302) Testcase test-bug-719263-print-uris-removes-authentication: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2297s (146/302) Testcase test-bug-720597-build-dep-purge: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2299s (147/302) Testcase test-bug-722207-print-uris-even-if-very-quiet: P P P P P P P P P P P P P P P P P P P P P P P P 2301s (148/302) Testcase test-bug-723586-any-stripped-in-single-arch: P P P P P P P P P P P P P P P P P P P P P P 2302s (149/302) Testcase test-bug-723705-tagfile-truncates-fields: P P P P P P P P 2304s (150/302) Testcase test-bug-728500-tempdir: P P P P P P P P P P P P P P P P P P 2304s (151/302) Testcase test-bug-732746-preferences: P P P 2306s (152/302) Testcase test-bug-733028-gpg-resource-limit: P P P P P P P P P P 2307s (153/302) Testcase test-bug-734922-apt-showsrc-duplicate: P P P P P P P P P P P P P P P 2310s (154/302) Testcase test-bug-735967-lib32-to-i386-unavailable: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2311s (155/302) Testcase test-bug-737130-multicompress-file-modes: P P P P P 2316s (156/302) Testcase test-bug-738785-switch-protocol: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2319s (157/302) Testcase test-bug-740843-versioned-up-down-breaks: P P P P P P P P P P P P P P P P P P P P P 2321s (158/302) Testcase test-bug-745036-new-foreign-invalidates-cache: P P P P P P P P P P P P P P P P P P P P P 2323s (159/302) Testcase test-bug-745046-candidate-propagation-fails: P P P P P P P P P P P P P P P P 2328s (160/302) Testcase test-bug-747261-arch-specific-conflicts: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2330s (161/302) Testcase test-bug-753297-upgradable: P P P P P P P P P P P P P P P P P P P P 2341s (162/302) Testcase test-bug-758153-versioned-provides-support: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2343s (163/302) Testcase test-bug-762160-relpath: P P P P P P P P P P P P P P P P P P P P P P 2345s (164/302) Testcase test-bug-767891-force-essential-important: P P P P P P P P P P P P P P P P P P P P P P P 2353s (165/302) Testcase test-bug-769609-triggers-still-pending-after-run: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2354s (166/302) Testcase test-bug-770291-reinstall: P P P P P P P P P P P P P P P P P P P P P P P P 2356s (167/302) Testcase test-bug-778375-server-has-no-reason-phrase: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2359s (168/302) Testcase test-bug-782777-single-arch-weirdness: P P P P P P P P P P P P P P P P P P P P P P P P 2363s (169/302) Testcase test-bug-796070-downgrade-realpkg: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2365s (170/302) Testcase test-bug-796070-downgrade-simulate: P P P P P P P P P P P P P P 2367s (171/302) Testcase test-bug-807012-mixed-case-package-names: P P P P P P P P P P 2371s (172/302) Testcase test-bug-814139-pickup-of-different-cache-states: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2379s (173/302) Testcase test-bug-818628-unreadable-source: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2381s (174/302) Testcase test-bug-829651: P P P P P P P P P P P 2386s (175/302) Testcase test-bug-835094-configure-before-purge: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2393s (176/302) Testcase test-bug-838779-untrusted-to-trusted-Release-hit: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2396s (177/302) Testcase test-bug-841874-warning-for-mismatching-distribution: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2407s (178/302) Testcase test-bug-869859-retry-downloads: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2407s (179/302) Testcase test-bug-870675-hang-on-unsupported-method: P P P P P P 2408s (180/302) Testcase test-bug-872963-apt-ftparchive-disable-hashes: P P P P P P P P 2411s (181/302) Testcase test-bug-879591-dont-warn-for-hidden-but-good-components: P P P P P P P P P P P P P P P P P P P P P P P P 2412s (182/302) Testcase test-bug-921685-binary-detached-signature: P P P P P P P P P 2413s (183/302) Testcase test-bug-960705-propagate-protected-to-satisfied-conflict: P P P P P P P P P P 2415s (184/302) Testcase test-bug-960705-propagate-protected-to-satisfied-depends: P P P P P P P P P P 2419s (185/302) Testcase test-bug-961266-hold-means-hold: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2420s (186/302) Testcase test-bug-990518-sourceslist-volatile: P P P P 2423s (187/302) Testcase test-bug-990555-https-proxy-for-http: P P P P P P P P P P P P P P P P P P P P P P P 2425s (188/302) Testcase test-bug-992993-marked-cycles: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2432s (189/302) Testcase test-bug-998444-regex-as-target-release: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2433s (190/302) Testcase test-bug-lp1347721-dpkg-ordering: P P P P P P P P 2433s (191/302) Testcase test-bug-lp1445239-download-loop: P 2435s (192/302) Testcase test-bug-lp1550741-heisestate: P P P P P P P PTest for no output of cdfind /tmp/tmp.jsxDSDoLF9/rootdir/var/lib/apt/lists/partial -mindepth 1 ! ( -name lock -o -name *.FAILED ) … SKIP: python-apt build with the wrong library version: 6.0.0 2435s 2436s (193/302) Testcase test-bug-lp1562402-nomark-removals-as-keep: P P P P P P P P P P P P 2438s (194/302) Testcase test-bug-lp1694697-build-dep-architecture-limited-alternative: P P P P P P P P P P P P 2439s (195/302) Testcase test-bug-multiarch-upgrade: P P P P P P P P P P P 2443s (196/302) Testcase test-cachecontainer-architecture-specification: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2625s (197/302) Testcase test-compressed-indexes: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2626s (198/302) Testcase test-conflicts-loop: P P P P P P P P P P P 2628s (199/302) Testcase test-conflicts-real-multiarch-same: P P P P P P P P P P P P P P P 2642s (200/302) Testcase test-crossgrades: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2644s (201/302) Testcase test-cve-2013-1051-InRelease-parsing: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2646s (202/302) Testcase test-cve-2018-0501-mirror-alternatives: P P P P P P P P P P P P P 2648s (203/302) Testcase test-cve-2019-3462-Release.gpg-payload: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2652s (204/302) Testcase test-cve-2019-3462-dequote-injection: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2652s (205/302) Testcase test-cve-2020-27350: P P P P P P 2655s (206/302) Testcase test-different-methods-for-same-source: P P P P P P P P P P P P P P P P P P P P P P P P P 2667s (207/302) Testcase test-disappearing-packages: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2671s (208/302) Testcase test-dont-forget-conflicts-via-unknown-architectures: P P P P P P P P P P P P P P P P P P P P P P P P P P 2679s (209/302) Testcase test-dpkg-assert-multi-arch: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2681s (210/302) Testcase test-dpkg-i-apt-install-fix-broken: P P P P P P P P P P P P P P P P P P 2683s (211/302) Testcase test-dpkg-normalization: P P P P P P P P P P P P P P 2689s (212/302) Testcase test-dpkg-path: P P P P P P P P P P P P P P P P P P P 2690s (213/302) Testcase test-dpkg-protected: P P P P P P P P 2700s (214/302) Testcase test-essential-force-loopbreak: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2705s (215/302) Testcase test-explore-or-groups-in-markinstall: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2710s (216/302) Testcase test-external-dependency-solver-protocol: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P PA resolving error is format as valid parseable EDSP error … SKIP: dctrl-tools not installed 2713s P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2718s (217/302) Testcase test-external-installation-planner-protocol: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2731s (218/302) Testcase test-failing-maintainer-scripts: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2735s (219/302) Testcase test-frontend-lock: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2736s (220/302) Testcase test-github-111-invalid-armember: P P P P P P P P P P P P P P P P 2737s (221/302) Testcase test-github-23-too-long-dependency-line: P P P P P P P P P 2742s (222/302) Testcase test-handle-redirect-as-used-mirror-change: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2744s (223/302) Testcase test-handling-broken-orgroups: P P P P P P P P P P P P P P P P P P P P P P 2747s (224/302) Testcase test-hashsum-verification: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2751s (225/302) Testcase test-http-if-range: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2755s (226/302) Testcase test-http-pipeline-messup: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2758s (227/302) Testcase test-ignore-provides-if-versioned-breaks: P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2761s (228/302) Testcase test-ignore-provides-if-versioned-conflicts: P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2762s (229/302) Testcase test-ignored-files: P P P P P P P P P P P P P 2765s (230/302) Testcase test-implicit-conflicts-real-not-virtual: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2767s (231/302) Testcase test-kernel-helper-autoremove: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2767s (232/302) Testcase test-method-connect: P P 2771s (233/302) Testcase test-method-gpgv: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2773s (234/302) Testcase test-method-gpgv-legacy-keyring: P P P P P P P P P P P P P P P P P P P P P P P P 2818s (235/302) Testcase test-method-mirror: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2821s (236/302) Testcase test-method-rred: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2829s (237/302) Testcase test-multiarch-allowed: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2841s (238/302) Testcase test-multiarch-barbarian: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2847s (239/302) Testcase test-multiarch-foreign: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2854s (240/302) Testcase test-no-fds-leaked-to-maintainer-scripts: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 2855s (241/302) Testcase test-or-group-substitution: P P P P P P P P P P P 2857s (242/302) Testcase test-package-reinstallation: P P P P P P P P P P 2859s (243/302) Testcase test-parse-all-archs-into-cache: P P P P P P P P P P P P P P P P P P P P P P P P 2923s (244/302) Testcase test-partial-file-support: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3032s (245/302) Testcase test-pdiff-usage: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3035s (246/302) Testcase test-phased-updates: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3037s (247/302) Testcase test-phased-updates-new-depends: P P P P P P P P P P P P P P P P P P 3042s (248/302) Testcase test-phased-updates-upgrade: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3043s (249/302) Testcase test-pin-non-existent-package: P P P P P P P P P P P P P P P P P P P P P P P P P P 3063s (250/302) Testcase test-policy-pinning: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3065s (251/302) Testcase test-prefer-higher-priority-providers: P P P P P P P P P P P P P P P P P P P P P P 3066s (252/302) Testcase test-prefer-native-architecture-over-higher-priority: P P P P P P P P P P P P 3070s (253/302) Testcase test-prevent-markinstall-multiarch-same-versionscrew: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3071s (254/302) Testcase test-provides-arch-all: P P P P P P P 3072s (255/302) Testcase test-provides-gone-with-upgrade: P P P P P P P P P P 3081s (256/302) Testcase test-proxy-connect: P P P P P P P P P P P P P P 3086s (257/302) Testcase test-release-candidate-switching: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3090s (258/302) Testcase test-releasefile-date: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3102s (259/302) Testcase test-releasefile-date-older: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3113s (260/302) Testcase test-releasefile-valid-until: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3200s (261/302) Testcase test-releasefile-verification: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3202s (262/302) Testcase test-releasefile-verification-noflat: P P P P P P P P P P P P P P P P P P P P P P P P 3203s (263/302) Testcase test-resolve-by-keep-new-recommends: P P P P P P P P P P 3204s (264/302) Testcase test-resolve-by-keep-obsolete-removals: P P P P P P P P P P P P 3206s (265/302) Testcase test-resolver-delays-remove-decisions: P P P P P P P P P P P P P P 3209s (266/302) Testcase test-resolver-provider-exchange: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3211s (267/302) Testcase test-same-version-but-different: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3212s (268/302) Testcase test-security-no-remote-status: P P P P P P P P P P 3214s (269/302) Testcase test-signed-by-option: P P P P P P P P P P P P P P P P P P P P P P 3219s (270/302) Testcase test-snapshot: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3221s (271/302) Testcase test-sourceslist-arch-plusminus-options: P P P P P P P P P P P P P P P P P P P P P P P P P P 3222s (272/302) Testcase test-sourceslist-lang-plusminus-options: P P P P P P P P P P P P P P P P P P P P P P P P P P 3224s (273/302) Testcase test-sourceslist-target-plusminus-options: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3243s (274/302) Testcase test-sourceslist-trusted-options: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3249s (275/302) Testcase test-specific-architecture-dependencies: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3250s (276/302) Testcase test-srcrecord: P P P P P P P P P P 3252s (277/302) Testcase test-suggest-installed-multiarch-silbing: P P P P P P P P P P P P P P P P P P P P P P P P P P P 3252s (278/302) Testcase test-ubuntu-bug-1078697-missing-source-hashes: P P P P P P P P P P P P P P 3255s (279/302) Testcase test-ubuntu-bug-1098738-apt-get-source-md5sum: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3258s (280/302) Testcase test-ubuntu-bug-1130419-prefer-installed-ma-same-siblings: P P P P P P P P P P P P P P P P P P P P P P P P P P 3259s (281/302) Testcase test-ubuntu-bug-1304403-obsolete-priority-standard: P P P P P P P P P P P P 3260s (282/302) Testcase test-ubuntu-bug-1549819-empty-arch-list: P P P P P P 3262s (283/302) Testcase test-ubuntu-bug-1651923-requote-https-uri: P P P P P P P P P P 3263s (284/302) Testcase test-ubuntu-bug-1876495-pkgnames-virtual: P P P P P P P P P P P P P 3265s (285/302) Testcase test-ubuntu-bug-1921626-unsized-packages: P P P P P P P P P P P P P P P P P P P P 3267s (286/302) Testcase test-ubuntu-bug-1974196: P P P P P P P P P P P P 3267s (287/302) Testcase test-ubuntu-bug-1990586: P P 3268s (288/302) Testcase test-ubuntu-bug-2025462-phased-dist-upgrade: P P P P P P P P P P P P 3273s (289/302) Testcase test-ubuntu-bug-346386-apt-get-update-paywall: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3274s (290/302) Testcase test-ubuntu-bug-365611-long-package-names: P P P P P P P 3275s (291/302) Testcase test-ubuntu-bug-614993: P P P P P P P P P P 3316s (292/302) Testcase test-ubuntu-bug-761175-remove-purge: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3317s (293/302) Testcase test-ubuntu-bug-784473-InRelease-one-message-only: P P P P P P P P P P 3318s (294/302) Testcase test-ubuntu-bug-802901-multiarch-early-remove: P P P P P P P P P P P 3320s (295/302) Testcase test-ubuntu-bug-806274-install-suggests: P P P P P P P P P P P P P P P P 3321s (296/302) Testcase test-ubuntu-bug-835625-multiarch-lockstep-installed-first: P P P P P P P P P P 3324s (297/302) Testcase test-ubuntu-bug-859188-multiarch-reinstall: P P P P P P P P P P P P P P P P P P P P P P P P P P 3325s (298/302) Testcase test-ubuntu-bug-985852-pre-depends-or-group-ordering: P P P P P P P P P P 3327s (299/302) Testcase test-unpack-different-version-unpacked: P P P P P P P P P P P P P P P P P P P P P P P 3332s (300/302) Testcase test-uri-encode-filename-field: P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P P 3334s (301/302) Testcase test-very-tight-loop-configure-with-unpacking-new-packages: P P P P P P P P P P 3335s (302/302) Testcase test-xorg-break-providers: P P P P P P P P P P P P P P 3335s Statistics: 302 tests were run: 301 successfully and 1 failed 3335s Failed tests: test-acquire-same-file-multiple-times 3335s autopkgtest [00:55:04]: test run-tests: -----------------------] 3339s autopkgtest [00:55:08]: test run-tests: - - - - - - - - - - results - - - - - - - - - - 3339s run-tests FAIL non-zero exit status 1 3343s autopkgtest [00:55:12]: @@@@@@@@@@@@@@@@@@@@ summary 3343s pkg-config-test PASS (superficial) 3343s run-tests FAIL non-zero exit status 1