]> git.saurik.com Git - apt.git/blobdiff - test/integration/test-apt-update-not-modified
treat .ddeb files like .deb, especially for dpkg
[apt.git] / test / integration / test-apt-update-not-modified
index 32818658fc6048f5da086c35859f37fad14feac1..064c7cbc7da4f27da74b5f7105f89240500b71b5 100755 (executable)
@@ -1,14 +1,16 @@
 #!/bin/sh
 set -e
 
 #!/bin/sh
 set -e
 
-TESTDIR=$(readlink -f $(dirname $0))
-. $TESTDIR/framework
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
 
 setupenvironment
 configarchitecture 'amd64' 'i386'
 
 setupenvironment
 configarchitecture 'amd64' 'i386'
+confighashes 'SHA256'
 
 
-insertpackage 'unstable' 'apt' 'all' '1.0'
+insertpackage 'unstable' 'apt' 'amd64,i386' '1.0'
 
 
+export APT_DONT_SIGN=''
 setupaptarchive --no-update
 
 methodtest() {
 setupaptarchive --no-update
 
 methodtest() {
@@ -20,42 +22,58 @@ methodtest() {
        listcurrentlistsdirectory > listsdir.lst
 
        # hit again with a good cache
        listcurrentlistsdirectory > listsdir.lst
 
        # hit again with a good cache
-       testsuccessequal "Hit $1 unstable InRelease
+       testsuccessequal "Hit:1 $1 unstable InRelease
 Reading package lists..." aptget update
        testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
 
        # drop an architecture, which means the file should be gone now
        configarchitecture 'i386'
        sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
 Reading package lists..." aptget update
        testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
 
        # drop an architecture, which means the file should be gone now
        configarchitecture 'i386'
        sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
-       testsuccessequal "Hit $1 unstable InRelease
+       testsuccessequal "Hit:1 $1 unstable InRelease
 Reading package lists..." aptget update
        testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
 
        # readd arch so its downloaded again…
        configarchitecture 'amd64' 'i386'
        # … but oh noes, hashsum mismatch!
 Reading package lists..." aptget update
        testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
 
        # readd arch so its downloaded again…
        configarchitecture 'amd64' 'i386'
        # … but oh noes, hashsum mismatch!
-       find aptarchive/dists/unstable/main/binary-amd64/ -type f -delete
-       cat >> aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF
-
+       SIZE=$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
+       mv aptarchive/dists/unstable/main/binary-amd64/Packages.gz aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig
+       cat > aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF
 Package: thisisbad
 Architecture: amd64
 Version: 1
 EOF
        compressfile aptarchive/dists/unstable/main/binary-amd64/Packages
 Package: thisisbad
 Architecture: amd64
 Version: 1
 EOF
        compressfile aptarchive/dists/unstable/main/binary-amd64/Packages
-       testfailureequal "Hit $1 unstable InRelease
-Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
-Err $1 unstable/main amd64 Packages
+       testfailureequal "Hit:1 $1 unstable InRelease
+Get:2 $1 unstable/main amd64 Packages [$SIZE B]
+Err:2 $1 unstable/main amd64 Packages
   Hash Sum mismatch
   Hash Sum mismatch
-W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz  Hash Sum mismatch
-
+  Hashes of expected file:
+   - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig') [weak]
+   - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig' | cut -d' ' -f 1)
+  Hashes of received file:
+   - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
+   - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak]
+  Last modification reported: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
+  Release file created at: $(releasefiledate 'aptarchive/dists/unstable/InRelease')
+Reading package lists...
+E: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz  Hash Sum mismatch
+   Hashes of expected file:
+    - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig') [weak]
+    - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig' | cut -d' ' -f 1)
+   Hashes of received file:
+    - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
+    - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak]
+   Last modification reported: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
+   Release file created at: $(releasefiledate 'aptarchive/dists/unstable/InRelease')
 E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
        testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
        rm -rf aptarchive/dists
        cp -a aptarchive/dists.good aptarchive/dists
 
        # … now everything is fine again
 E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
        testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
        rm -rf aptarchive/dists
        cp -a aptarchive/dists.good aptarchive/dists
 
        # … now everything is fine again
-       testsuccessequal "Hit $1 unstable InRelease
-Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
+       testsuccessequal "Hit:1 $1 unstable InRelease
+Get:2 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
 Reading package lists..." aptget update
        testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
 
 Reading package lists..." aptget update
        testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
 
@@ -74,40 +92,56 @@ Reading package lists..." aptget update
        listcurrentlistsdirectory > listsdir.lst
 
        # hit again with a good cache
        listcurrentlistsdirectory > listsdir.lst
 
        # hit again with a good cache
-       testsuccessequal "Ign $1 unstable InRelease
+       testsuccessequal "Ign:1 $1 unstable InRelease
   404  Not Found
   404  Not Found
-Hit $1 unstable Release
+Hit:2 $1 unstable Release
 Reading package lists..." aptget update
        testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
 
        # drop an architecture, which means the file should be gone now
        configarchitecture 'i386'
        sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
 Reading package lists..." aptget update
        testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
 
        # drop an architecture, which means the file should be gone now
        configarchitecture 'i386'
        sed '/_binary-amd64_Packages/ d' listsdir.lst > listsdir-without-amd64.lst
-       testsuccessequal "Ign $1 unstable InRelease
+       testsuccessequal "Ign:1 $1 unstable InRelease
   404  Not Found
   404  Not Found
-Hit $1 unstable Release
+Hit:2 $1 unstable Release
 Reading package lists..." aptget update
        testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
 
        # readd arch so its downloaded again…
        configarchitecture 'amd64' 'i386'
        # … but oh noes, hashsum mismatch!
 Reading package lists..." aptget update
        testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
 
        # readd arch so its downloaded again…
        configarchitecture 'amd64' 'i386'
        # … but oh noes, hashsum mismatch!
-       find aptarchive/dists/unstable/main/binary-amd64/ -type f -delete
-       cat >> aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF
-
+       SIZE=$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
+       mv aptarchive/dists/unstable/main/binary-amd64/Packages.gz aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig
+       cat > aptarchive/dists/unstable/main/binary-amd64/Packages <<EOF
 Package: thisisbad
 Architecture: amd64
 Version: 1
 EOF
        compressfile aptarchive/dists/unstable/main/binary-amd64/Packages
 Package: thisisbad
 Architecture: amd64
 Version: 1
 EOF
        compressfile aptarchive/dists/unstable/main/binary-amd64/Packages
-       testfailureequal "Ign $1 unstable InRelease
+       testfailureequal "Ign:1 $1 unstable InRelease
   404  Not Found
   404  Not Found
-Hit $1 unstable Release
-Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
-Err $1 unstable/main amd64 Packages
+Hit:2 $1 unstable Release
+Get:4 $1 unstable/main amd64 Packages [$SIZE B]
+Err:4 $1 unstable/main amd64 Packages
   Hash Sum mismatch
   Hash Sum mismatch
-W: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz  Hash Sum mismatch
-
+  Hashes of expected file:
+   - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig') [weak]
+   - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig' | cut -d' ' -f 1)
+  Hashes of received file:
+   - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
+   - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak]
+  Last modification reported: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
+  Release file created at: $(releasefiledate 'aptarchive/dists/unstable/Release')
+Reading package lists...
+E: Failed to fetch $1/dists/unstable/main/binary-amd64/Packages.gz  Hash Sum mismatch
+   Hashes of expected file:
+    - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig') [weak]
+    - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz.orig' | cut -d' ' -f 1)
+   Hashes of received file:
+    - SHA256:$(sha256sum 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz' | cut -d' ' -f 1)
+    - Checksum-FileSize:$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') [weak]
+   Last modification reported: $(lastmodification 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz')
+   Release file created at: $(releasefiledate 'aptarchive/dists/unstable/Release')
 E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
        testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
        rm -rf aptarchive/dists
 E: Some index files failed to download. They have been ignored, or old ones used instead." aptget update
        testfileequal 'listsdir-without-amd64.lst' "$(listcurrentlistsdirectory)"
        rm -rf aptarchive/dists
@@ -115,18 +149,18 @@ E: Some index files failed to download. They have been ignored, or old ones used
        find aptarchive/dists -name 'InRelease' -delete
 
        # … now everything is fine again
        find aptarchive/dists -name 'InRelease' -delete
 
        # … now everything is fine again
-       testsuccessequal "Ign $1 unstable InRelease
+       testsuccessequal "Ign:1 $1 unstable InRelease
   404  Not Found
   404  Not Found
-Hit $1 unstable Release
-Get:1 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
+Hit:2 $1 unstable Release
+Get:4 $1 unstable/main amd64 Packages [$(stat -c '%s' 'aptarchive/dists/unstable/main/binary-amd64/Packages.gz') B]
 Reading package lists..." aptget update
        testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
 
        webserverconfig 'aptwebserver::support::modified-since' 'false'
        webserverconfig 'aptwebserver::support::last-modified' 'false'
 Reading package lists..." aptget update
        testfileequal 'listsdir.lst' "$(listcurrentlistsdirectory)"
 
        webserverconfig 'aptwebserver::support::modified-since' 'false'
        webserverconfig 'aptwebserver::support::last-modified' 'false'
-       testsuccessequal "Ign $1 unstable InRelease
+       testsuccessequal "Ign:1 $1 unstable InRelease
   404  Not Found
   404  Not Found
-Get:1 $1 unstable Release [$(stat -c '%s' 'aptarchive/dists/unstable/Release') B]
+Get:2 $1 unstable Release [$(stat -c '%s' 'aptarchive/dists/unstable/Release') B]
 Reading package lists..." aptget update
        webserverconfig 'aptwebserver::support::modified-since' 'true'
        webserverconfig 'aptwebserver::support::last-modified' 'true'
 Reading package lists..." aptget update
        webserverconfig 'aptwebserver::support::modified-since' 'true'
        webserverconfig 'aptwebserver::support::last-modified' 'true'
@@ -155,7 +189,7 @@ Reading package lists..." aptget update
 }
 
 changetowebserver
 }
 
 changetowebserver
-methodtest 'http://localhost:8080'
+methodtest "http://localhost:${APTHTTPPORT}"
 
 changetohttpswebserver
 
 changetohttpswebserver
-methodtest 'https://localhost:4433'
+methodtest "https://localhost:${APTHTTPSPORT}"