summaryrefslogtreecommitdiff
path: root/test/integration/test-apt-ftparchive
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2017-07-28 18:20:14 +0200
committerDavid Kalnischkies <david@kalnischkies.de>2017-08-04 13:06:10 +0200
commitd108e019d3ca74c31a1ab646ddef5c60744a5e7d (patch)
tree944a9784a75c6bfc42de30b33be338af131e66d8 /test/integration/test-apt-ftparchive
parenteb0ccb003ceedac0fd78fee05d7b8119dd04c48b (diff)
ftparchive: sort discovered filenames before writing indexes
If 'apt-ftparchive packages /path/to/files/' (or sources) is used the files to include in the generated index (on stdout) were included in the order in which they were discovered, which isn't a very stable order which could lead to indexes changing without actually changing content causing needless changes in the repository changing hashsums, pdiffs, rsyncs, downloads, …. This does not effect apt-ftparchive calls which already have an order defined via a filelist (like generate) which will still print in the order given by the filelist. Note that a similar effect can be achieved by post-processing index files with apt-sortpkgs. Closes: 869557 Thanks: Chris Lamb for initial patch & Stefan Lippers-Hollmann for testing
Diffstat (limited to 'test/integration/test-apt-ftparchive')
-rwxr-xr-xtest/integration/test-apt-ftparchive64
1 files changed, 64 insertions, 0 deletions
diff --git a/test/integration/test-apt-ftparchive b/test/integration/test-apt-ftparchive
new file mode 100755
index 000000000..378b05944
--- /dev/null
+++ b/test/integration/test-apt-ftparchive
@@ -0,0 +1,64 @@
+#!/bin/sh
+set -e
+
+TESTDIR="$(readlink -f "$(dirname "$0")")"
+. "$TESTDIR/framework"
+
+setupenvironment
+
+buildsimplenativepackage 'baz' 'all' '1'
+buildsimplenativepackage 'foo' 'all' '1'
+buildsimplenativepackage 'bar' 'all' '2'
+buildsimplenativepackage 'bar' 'all' '1'
+
+EXPECT_PKG='Package: bar
+Version: 1
+Package: bar
+Version: 2
+Package: baz
+Version: 1
+Package: foo
+Version: 1'
+EXPECT_SRC="$EXPECT_PKG"
+
+linkfiles() {
+ ln -s "../incoming/${2}.dsc" "${1}/${2}.dsc"
+ ln -s "../incoming/${2}.tar.xz" "${1}/${2}.tar.xz"
+ ln -s "../incoming/${2}_all.deb" "${1}/${2}_all.deb"
+}
+genoptions() {
+ echo 'baz_1'
+ echo 'foo_1'
+ echo 'bar_2'
+ echo 'bar_1'
+}
+gencombos() {
+ for a in $(genoptions); do
+ for b in $(genoptions); do
+ if [ "$a" = "$b" ]; then continue; fi
+ for c in $(genoptions); do
+ if [ "$a" = "$c" -o "$b" = "$c" ]; then continue; fi
+ for d in $(genoptions); do
+ if [ "$a" = "$d" -o "$b" = "$d" -o "$c" = "$d" ]; then continue; fi
+ echo "${a};${b};${c};${d}"
+ done
+ done
+ done
+ done
+}
+for combo in $(gencombos); do
+ msgmsg 'Running apt-ftparchive in configuration' "$combo"
+ incomedir="incoming${combo}"
+ mkdir "$incomedir"
+ for i in $(echo "$combo" | tr ';' '\n'); do
+ linkfiles "$incomedir" "$i"
+ done
+
+ testsuccess aptftparchive packages "$incomedir"
+ cp rootdir/tmp/testsuccess.output aptarchive/Packages
+ testsuccessequal "$EXPECT_PKG" grep -e '^Package: ' -e '^Version: ' aptarchive/Packages
+
+ testsuccess aptftparchive -qq sources "$incomedir"
+ cp rootdir/tmp/testsuccess.output aptarchive/Sources
+ testsuccessequal "$EXPECT_SRC" grep -e '^Package: ' -e '^Version: ' aptarchive/Sources
+done