chiark / gitweb /
nightly: fix QR icon.png generation
[fdroidserver.git] / tests / run-tests
1 #!/bin/bash
2
3 set -e # quit script on error
4
5 echo_header() {
6     { echo -e "==============================================================================\n$1"; } 2>/dev/null
7 }
8
9 copy_apks_into_repo() {
10     set +x
11     find $APKDIR -type f -name '*.apk' -print0 | while IFS= read -r -d '' f; do
12         echo $f | grep -F -v -e unaligned -e unsigned -e badsig -e badcert -e bad-unicode || continue
13         apk=`$aapt dump badging "$f" | sed -n "s,^package: name='\(.*\)' versionCode='\([0-9][0-9]*\)' .*,\1_\2.apk,p"`
14         test "$f" -nt repo/$apk && rm -f repo/$apk  # delete existing if $f is newer
15         if [ ! -e repo/$apk ] && [ ! -e archive/$apk ]; then
16             echo "$f --> repo/$apk"
17             ln "$f" $1/repo/$apk || \
18                 rsync -axv "$f" $1/repo/$apk # rsync if hard link is not possible
19         fi
20     done
21     set -x
22 }
23
24 # keep this as an old version to test the automatic parsing of build-tools
25 # verion numbers in `fdroid init`
26 create_fake_android_home() {
27     mkdir $1/tools
28     mkdir $1/platform-tools
29     mkdir $1/build-tools
30     mkdir $1/build-tools/19.0.2
31     touch $1/build-tools/19.0.2/aapt
32 }
33
34 create_test_dir() {
35     test -e $WORKSPACE/.testfiles || mkdir $WORKSPACE/.testfiles
36     mktemp -d $WORKSPACE/.testfiles/run-tests.XXXX
37 }
38
39 create_test_file() {
40     test -e $WORKSPACE/.testfiles || mkdir $WORKSPACE/.testfiles
41     TMPDIR=$WORKSPACE/.testfiles  mktemp
42 }
43
44 # the < is reverse since 0 means success in exit codes
45 have_git_2_3() {
46     python3 -c "import sys; from distutils.version import LooseVersion as V; sys.exit(V(sys.argv[3]) < V('2.3'))" `git --version`
47 }
48
49 is_MD5_disabled() {
50     javac $WORKSPACE/tests/IsMD5Disabled.java && java -cp $WORKSPACE/tests IsMD5Disabled
51     return $?
52 }
53
54 #------------------------------------------------------------------------------#
55 # "main"
56
57 if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
58     set +x
59     echo "Usage: $0 '/path/to/folder/with/apks'"
60     exit 1
61 fi
62
63 if [ -z "$ANDROID_HOME" ]; then
64     echo "ANDROID_HOME must be set with the path to the Android SDK, i.e.: "
65     echo "  export ANDROID_HOME=/opt/android-sdk"
66     exit 1
67 fi
68
69 if [ -d tests ]; then
70     cd tests
71 fi
72
73 if [ -z "$1" ]; then
74     APKDIR=`pwd`
75 else
76     APKDIR=$1
77 fi
78
79 if [ -z $WORKSPACE ]; then
80     WORKSPACE=`dirname $(pwd)`
81     echo "Setting Workspace to $WORKSPACE"
82 fi
83
84 # allow the location of the script to be overridden
85 if [ -z $fdroid ]; then
86     fdroid="$WORKSPACE/fdroid"
87 fi
88
89 # allow the location of aapt to be overridden
90 if [ -z $aapt ]; then
91     aapt=`ls -1 $ANDROID_HOME/build-tools/*/aapt | sort | tail -1`
92 fi
93
94 # allow the location of python to be overridden
95 if [ -z $python ]; then
96     python=python3
97 fi
98
99 # try to use GNU sed on OSX/BSD cuz BSD sed sucks
100 if which gsed; then
101     sed=gsed
102 else
103     sed=sed
104 fi
105
106 set -x # show each command as it is executed
107
108 #------------------------------------------------------------------------------#
109 echo_header "run commit hooks"
110
111 cd $WORKSPACE
112 ./hooks/pre-commit
113
114
115 #------------------------------------------------------------------------------#
116 echo_header "test python getsig replacement"
117
118 cd $WORKSPACE/tests/getsig
119 ./make.sh
120
121 cd $WORKSPACE/tests
122 for testcase in $WORKSPACE/tests/*.TestCase; do
123     $testcase
124 done
125
126
127 #------------------------------------------------------------------------------#
128 echo_header "print fdroid version"
129
130 $fdroid --version
131
132
133 #------------------------------------------------------------------------------#
134 echo_header 'run process when building and signing are on separate machines'
135
136 REPOROOT=`create_test_dir`
137 cd $REPOROOT
138 cp $WORKSPACE/tests/keystore.jks $REPOROOT/
139 $fdroid init --keystore keystore.jks --repo-keyalias=sova
140 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
141 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
142 echo "accepted_formats = ['txt', 'yml']" >> config.py
143 echo 'keydname = "CN=Birdman, OU=Cell, O=Alcatraz, L=Alcatraz, S=California, C=US"' >> config.py
144 test -d archive || mkdir archive
145 test -d metadata || mkdir metadata
146 cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/
147 test -d repo || mkdir repo
148 test -d unsigned || mkdir unsigned
149 cp $WORKSPACE/tests/urzip-release-unsigned.apk unsigned/info.guardianproject.urzip_100.apk
150 $fdroid publish --verbose
151 $fdroid update --verbose --nosign
152 $fdroid signindex --verbose
153 test -e repo/index.xml
154 test -e repo/index.jar
155 test -e repo/index-v1.jar
156 test -e tmp/apkcache
157 ! test -z tmp/apkcache
158 test -L urzip.apk
159 grep -F '<application id=' repo/index.xml > /dev/null
160
161
162 #------------------------------------------------------------------------------#
163 echo_header "test UTF-8 metadata"
164
165 REPOROOT=`create_test_dir`
166 cd $REPOROOT
167
168 $fdroid init
169 $sed -i.tmp 's,^ *repo_description.*,repo_description = """获取已安装在您的设备上的应用的,' config.py
170 echo "mirrors = ('https://foo.bar/fdroid', 'http://secret.onion/fdroid')" >> config.py
171 mkdir metadata
172 cp $WORKSPACE/tests/urzip.apk $WORKSPACE/tests/bad-unicode*.apk repo/
173 cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/
174
175 $fdroid readmeta
176 $fdroid update
177
178
179 #------------------------------------------------------------------------------#
180 echo_header 'run "fdroid build" in fresh git checkout from import.TestCase'
181
182 cd $WORKSPACE/tests/tmp/importer
183 git remote update -p
184 git clean -fdx
185 # stick with known working commit, in case future commits break things for this code
186 git reset --hard fea54e1161d5eb9eb1a54e26253ef84d3ab63705
187 if [ -d $ANDROID_HOME/platforms/android-23 && -d $ANDROID_HOME/build-tools/23.0.3 ]; then
188     echo "build_tools = '`ls -1 $ANDROID_HOME/build-tools/ | sort -n | tail -1`'" > config.py
189     echo "force_build_tools = True" >> config.py
190     $fdroid build --verbose org.fdroid.ci.test.app:300
191 else
192     echo 'WARNING: Skipping "fdroid build" test since android-23 is missing!'
193 fi
194
195 #------------------------------------------------------------------------------#
196 echo_header 'copy git import and run "fdroid scanner" on it'
197
198 REPOROOT=`create_test_dir`
199 cd $REPOROOT
200 cp $WORKSPACE/examples/fdroid-icon.png $REPOROOT/
201 mkdir metadata
202 echo "Auto Name:Just A Test" > metadata/org.fdroid.ci.test.app.txt
203 echo "Web Site:" >> metadata/org.fdroid.ci.test.app.txt
204 echo "Build:0.3,300" >> metadata/org.fdroid.ci.test.app.txt
205 echo "    commit=0.3" >> metadata/org.fdroid.ci.test.app.txt
206 echo "    subdir=app" >> metadata/org.fdroid.ci.test.app.txt
207 echo "    gradle=yes" >> metadata/org.fdroid.ci.test.app.txt
208 echo "" >> metadata/org.fdroid.ci.test.app.txt
209 echo "Repo:https://gitlab.com/fdroid/ci-test-app.git" >> metadata/org.fdroid.ci.test.app.txt
210 echo "Repo Type:git" >> metadata/org.fdroid.ci.test.app.txt
211 mkdir build
212 cp -a $WORKSPACE/tests/tmp/importer build/org.fdroid.ci.test.app
213 ls -l build/org.fdroid.ci.test.app
214 $fdroid scanner org.fdroid.ci.test.app --verbose
215
216
217 #------------------------------------------------------------------------------#
218 echo_header "copy tests/repo, generate java/gpg keys, update, and gpgsign"
219
220 REPOROOT=`create_test_dir`
221 GNUPGHOME=$REPOROOT/gnupghome
222 KEYSTORE=$WORKSPACE/tests/keystore.jks
223 cd $REPOROOT
224 $fdroid init --keystore $KEYSTORE --repo-keyalias=sova
225 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
226 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
227 cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/
228 cp -a $WORKSPACE/tests/gnupghome $GNUPGHOME
229 chmod 0700 $GNUPGHOME
230 echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
231 echo "install_list = 'org.adaway'" >> config.py
232 echo "uninstall_list = ('com.android.vending', 'com.facebook.orca',)" >> config.py
233 echo "gpghome = '$GNUPGHOME'" >> config.py
234 echo "gpgkey = 'CE71F7FB'" >> config.py
235 echo "mirrors = ('http://foobarfoobarfoobar.onion/fdroid','https://foo.bar/fdroid',)" >> config.py
236 $fdroid update --verbose --pretty
237 test -e repo/index.xml
238 test -e repo/index.jar
239 test -e repo/index-v1.jar
240 grep -F '<application id=' repo/index.xml > /dev/null
241 grep -F '<install packageName=' repo/index.xml > /dev/null
242 grep -F '<uninstall packageName=' repo/index.xml > /dev/null
243 # OSX tests are run on Travis-CI, and gpg fails to launch gpg-agent there
244 if [ "$TRAVIS_OS_NAME" != "osx" ]; then
245     $fdroid gpgsign --verbose
246     $fdroid gpgsign --verbose
247     test -e repo/obb.mainpatch.current_1619.apk.asc
248     test -e repo/obb.main.twoversions_1101617_src.tar.gz.asc
249     ! test -e repo/obb.mainpatch.current_1619.apk.asc.asc
250     ! test -e repo/obb.main.twoversions_1101617_src.tar.gz.asc.asc
251     ! test -e repo/index.xml.asc
252 fi
253
254 # we can't easily reproduce the timestamps for things, so just hardcode them
255 $sed -i.tmp -e 's,timestamp="[0-9]*",timestamp="1480431575",' repo/index.xml
256 diff -uw $WORKSPACE/tests/repo/index.xml repo/index.xml
257 sed -i --expression='s,"timestamp": [0-9]*,"timestamp": 1502845383782,' repo/index-v1.json
258 diff -uw $WORKSPACE/tests/repo/index-v1.json repo/index-v1.json
259
260
261 #------------------------------------------------------------------------------#
262 echo_header 'test moving lots of APKs to the archive'
263
264 REPOROOT=`create_test_dir`
265 cd $REPOROOT
266 cp $WORKSPACE/tests/keystore.jks $REPOROOT/
267 $fdroid init --keystore keystore.jks --repo-keyalias=sova
268 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
269 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
270 echo "accepted_formats = ['txt']" >> config.py
271 $sed -i.tmp '/allow_disabled_algorithms/d' config.py
272 test -d metadata || mkdir metadata
273 cp $WORKSPACE/tests/metadata/*.txt metadata/
274 echo 'Summary:good test version of urzip' > metadata/info.guardianproject.urzip.txt
275 echo 'Summary:good MD5 sig, which is disabled algorithm' > metadata/org.bitbucket.tickytacky.mirrormirror.txt
276 $sed -i.tmp '/Archive Policy:/d' metadata/*.txt
277 test -d repo || mkdir repo
278 cp $WORKSPACE/tests/urzip.apk \
279    $WORKSPACE/tests/org.bitbucket.tickytacky.mirrormirror_[0-9].apk \
280    $WORKSPACE/tests/repo/com.politedroid_[0-9].apk \
281    $WORKSPACE/tests/repo/obb.main.twoversions_110161[357].apk \
282    repo/
283 $sed -i.tmp 's,archive_older = [0-9],archive_older = 3,' config.py
284
285 $fdroid update --pretty --nosign
286 echo "This will fail when jarsigner allows MD5 for APK signatures"
287 test `grep '<package>' archive/index.xml | wc -l` -eq 5
288 test `grep '<package>' repo/index.xml | wc -l` -eq 7
289
290
291 #------------------------------------------------------------------------------#
292 echo_header 'test per-app "Archive Policy"'
293
294 REPOROOT=`create_test_dir`
295 cd $REPOROOT
296 cp $WORKSPACE/tests/keystore.jks $REPOROOT/
297 $fdroid init --keystore keystore.jks --repo-keyalias=sova
298 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
299 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
300 echo "accepted_formats = ['txt']" >> config.py
301 test -d metadata || mkdir metadata
302 cp $WORKSPACE/tests/metadata/com.politedroid.txt metadata/
303 test -d repo || mkdir repo
304 cp $WORKSPACE/tests/repo/com.politedroid_[0-9].apk repo/
305 $sed -i.tmp 's,archive_older = [0-9],archive_older = 3,' config.py
306
307 $fdroid update --pretty --nosign
308 test `grep '<package>' archive/index.xml | wc -l` -eq 0
309 test `grep '<package>' repo/index.xml | wc -l` -eq 4
310 grep -F com.politedroid_3.apk repo/index.xml
311 grep -F com.politedroid_4.apk repo/index.xml
312 grep -F com.politedroid_5.apk repo/index.xml
313 grep -F com.politedroid_6.apk repo/index.xml
314 test -e repo/com.politedroid_3.apk
315 test -e repo/com.politedroid_4.apk
316 test -e repo/com.politedroid_5.apk
317 test -e repo/com.politedroid_6.apk
318
319 echo "enable one app in the repo"
320 $sed -i.tmp 's,^Archive Policy:4,Archive Policy:1,' metadata/com.politedroid.txt
321 $fdroid update --pretty --nosign
322 test `grep '<package>' archive/index.xml | wc -l` -eq 3
323 test `grep '<package>' repo/index.xml | wc -l` -eq 1
324 grep -F com.politedroid_3.apk archive/index.xml
325 grep -F com.politedroid_4.apk archive/index.xml
326 grep -F com.politedroid_5.apk archive/index.xml
327 grep -F com.politedroid_6.apk repo/index.xml
328 test -e archive/com.politedroid_3.apk
329 test -e archive/com.politedroid_4.apk
330 test -e archive/com.politedroid_5.apk
331 test -e repo/com.politedroid_6.apk
332
333 echo "remove all apps from the repo"
334 $sed -i.tmp 's,^Archive Policy:1,Archive Policy:0,' metadata/com.politedroid.txt
335 $fdroid update --pretty --nosign
336 test `grep '<package>' archive/index.xml | wc -l` -eq 4
337 test `grep '<package>' repo/index.xml | wc -l` -eq 0
338 grep -F com.politedroid_3.apk archive/index.xml
339 grep -F com.politedroid_4.apk archive/index.xml
340 grep -F com.politedroid_5.apk archive/index.xml
341 grep -F com.politedroid_6.apk archive/index.xml
342 test -e archive/com.politedroid_3.apk
343 test -e archive/com.politedroid_4.apk
344 test -e archive/com.politedroid_5.apk
345 test -e archive/com.politedroid_6.apk
346 ! test -e repo/com.politedroid_6.apk
347
348 echo "move back one from archive to the repo"
349 $sed -i.tmp 's,^Archive Policy:0,Archive Policy:1,' metadata/com.politedroid.txt
350 $fdroid update --pretty --nosign
351 test `grep '<package>' archive/index.xml | wc -l` -eq 3
352 test `grep '<package>' repo/index.xml | wc -l` -eq 1
353 grep -F com.politedroid_3.apk archive/index.xml
354 grep -F com.politedroid_4.apk archive/index.xml
355 grep -F com.politedroid_5.apk archive/index.xml
356 grep -F com.politedroid_6.apk repo/index.xml
357 test -e archive/com.politedroid_3.apk
358 test -e archive/com.politedroid_4.apk
359 test -e archive/com.politedroid_5.apk
360 ! test -e archive/com.politedroid_6.apk
361 test -e repo/com.politedroid_6.apk
362
363
364
365 #------------------------------------------------------------------------------#
366 echo_header 'test moving old APKs to and from the archive'
367
368 REPOROOT=`create_test_dir`
369 cd $REPOROOT
370 cp $WORKSPACE/tests/keystore.jks $REPOROOT/
371 $fdroid init --keystore keystore.jks --repo-keyalias=sova
372 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
373 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
374 echo "accepted_formats = ['txt']" >> config.py
375 test -d metadata || mkdir metadata
376 cp $WORKSPACE/tests/metadata/com.politedroid.txt metadata/
377 $sed -i.tmp '/Archive Policy:/d' metadata/com.politedroid.txt
378 test -d repo || mkdir repo
379 cp $WORKSPACE/tests/repo/com.politedroid_[0-9].apk repo/
380 $sed -i.tmp 's,archive_older = [0-9],archive_older = 3,' config.py
381
382 $fdroid update --pretty --nosign
383 test `grep '<package>' archive/index.xml | wc -l` -eq 1
384 test `grep '<package>' repo/index.xml | wc -l` -eq 3
385 grep -F com.politedroid_3.apk archive/index.xml
386 grep -F com.politedroid_4.apk repo/index.xml
387 grep -F com.politedroid_5.apk repo/index.xml
388 grep -F com.politedroid_6.apk repo/index.xml
389 test -e archive/com.politedroid_3.apk
390 test -e repo/com.politedroid_4.apk
391 test -e repo/com.politedroid_5.apk
392 test -e repo/com.politedroid_6.apk
393
394 $sed -i.tmp 's,archive_older = 3,archive_older = 1,' config.py
395 $fdroid update --pretty --nosign
396 test `grep '<package>' archive/index.xml | wc -l` -eq 3
397 test `grep '<package>' repo/index.xml | wc -l` -eq 1
398 grep -F com.politedroid_3.apk archive/index.xml
399 grep -F com.politedroid_4.apk archive/index.xml
400 grep -F com.politedroid_5.apk archive/index.xml
401 grep -F com.politedroid_6.apk repo/index.xml
402 test -e archive/com.politedroid_3.apk
403 test -e archive/com.politedroid_4.apk
404 test -e archive/com.politedroid_5.apk
405 test -e repo/com.politedroid_6.apk
406
407 # disabling deletes from the archive
408 $sed -i.tmp 's/Build:1.3,4/Build:1.3,4\n    disable=testing deletion/' metadata/com.politedroid.txt
409 $fdroid update --pretty --nosign
410 test `grep '<package>' archive/index.xml | wc -l` -eq 2
411 test `grep '<package>' repo/index.xml | wc -l` -eq 1
412 grep -F com.politedroid_3.apk archive/index.xml
413 ! grep -F com.politedroid_4.apk archive/index.xml
414 grep -F com.politedroid_5.apk archive/index.xml
415 grep -F com.politedroid_6.apk repo/index.xml
416 test -e archive/com.politedroid_3.apk
417 ! test -e archive/com.politedroid_4.apk
418 test -e archive/com.politedroid_5.apk
419 test -e repo/com.politedroid_6.apk
420
421 # disabling deletes from the repo, and promotes one from the archive
422 $sed -i.tmp 's/Build:1.5,6/Build:1.5,6\n    disable=testing deletion/' metadata/com.politedroid.txt
423 $fdroid update --pretty --nosign
424 test `grep '<package>' archive/index.xml | wc -l` -eq 1
425 test `grep '<package>' repo/index.xml | wc -l` -eq 1
426 grep -F com.politedroid_3.apk archive/index.xml
427 grep -F com.politedroid_5.apk repo/index.xml
428 ! grep -F com.politedroid_6.apk repo/index.xml
429 test -e archive/com.politedroid_3.apk
430 test -e repo/com.politedroid_5.apk
431 ! test -e repo/com.politedroid_6.apk
432
433
434 #------------------------------------------------------------------------------#
435 echo_header 'test allowing disabled signatures in repo and archive'
436
437 REPOROOT=`create_test_dir`
438 cd $REPOROOT
439 cp $WORKSPACE/tests/keystore.jks $REPOROOT/
440 $fdroid init --keystore keystore.jks --repo-keyalias=sova
441 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
442 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
443 echo "accepted_formats = ['txt']" >> config.py
444 echo 'allow_disabled_algorithms = True' >> config.py
445 $sed -i.tmp 's,archive_older = [0-9],archive_older = 3,' config.py
446 test -d metadata || mkdir metadata
447 cp $WORKSPACE/tests/metadata/com.politedroid.txt metadata/
448 echo 'Summary:good test version of urzip' > metadata/info.guardianproject.urzip.txt
449 echo 'Summary:good MD5 sig, disabled algorithm' > metadata/org.bitbucket.tickytacky.mirrormirror.txt
450 $sed -i.tmp '/Archive Policy:/d' metadata/*.txt
451 test -d repo || mkdir repo
452 cp $WORKSPACE/tests/repo/com.politedroid_[0-9].apk \
453    $WORKSPACE/tests/org.bitbucket.tickytacky.mirrormirror_[0-9].apk \
454    $WORKSPACE/tests/urzip-badsig.apk \
455    repo/
456
457 $fdroid update --pretty --nosign
458 test `grep '<package>' archive/index.xml | wc -l` -eq 2
459 test `grep '<package>' repo/index.xml | wc -l` -eq 6
460 grep -F com.politedroid_3.apk archive/index.xml
461 grep -F com.politedroid_4.apk repo/index.xml
462 grep -F com.politedroid_5.apk repo/index.xml
463 grep -F com.politedroid_6.apk repo/index.xml
464 grep -F org.bitbucket.tickytacky.mirrormirror_1.apk archive/index.xml
465 grep -F org.bitbucket.tickytacky.mirrormirror_2.apk repo/index.xml
466 grep -F org.bitbucket.tickytacky.mirrormirror_3.apk repo/index.xml
467 grep -F org.bitbucket.tickytacky.mirrormirror_4.apk repo/index.xml
468 ! grep -F urzip-badsig.apk repo/index.xml
469 ! grep -F urzip-badsig.apk archive/index.xml
470 test -e archive/com.politedroid_3.apk
471 test -e repo/com.politedroid_4.apk
472 test -e repo/com.politedroid_5.apk
473 test -e repo/com.politedroid_6.apk
474 test -e archive/org.bitbucket.tickytacky.mirrormirror_1.apk
475 test -e repo/org.bitbucket.tickytacky.mirrormirror_2.apk
476 test -e repo/org.bitbucket.tickytacky.mirrormirror_3.apk
477 test -e repo/org.bitbucket.tickytacky.mirrormirror_4.apk
478 test -e archive/urzip-badsig.apk
479
480 $sed -i.tmp '/allow_disabled_algorithms/d' config.py
481 $fdroid update --pretty --nosign
482 test `grep '<package>' archive/index.xml | wc -l` -eq 5
483 test `grep '<package>' repo/index.xml | wc -l` -eq 3
484 grep -F org.bitbucket.tickytacky.mirrormirror_1.apk archive/index.xml
485 grep -F org.bitbucket.tickytacky.mirrormirror_2.apk archive/index.xml
486 grep -F org.bitbucket.tickytacky.mirrormirror_3.apk archive/index.xml
487 grep -F org.bitbucket.tickytacky.mirrormirror_4.apk archive/index.xml
488 grep -F com.politedroid_3.apk archive/index.xml
489 grep -F com.politedroid_4.apk repo/index.xml
490 grep -F com.politedroid_5.apk repo/index.xml
491 grep -F com.politedroid_6.apk repo/index.xml
492 ! grep -F urzip-badsig.apk repo/index.xml
493 ! grep -F urzip-badsig.apk archive/index.xml
494 test -e archive/org.bitbucket.tickytacky.mirrormirror_1.apk
495 test -e archive/org.bitbucket.tickytacky.mirrormirror_2.apk
496 test -e archive/org.bitbucket.tickytacky.mirrormirror_3.apk
497 test -e archive/org.bitbucket.tickytacky.mirrormirror_4.apk
498 test -e archive/com.politedroid_3.apk
499 test -e archive/urzip-badsig.apk
500 test -e repo/com.politedroid_4.apk
501 test -e repo/com.politedroid_5.apk
502 test -e repo/com.politedroid_6.apk
503
504
505 #------------------------------------------------------------------------------#
506 echo_header 'rename apks with `fdroid update --rename-apks`, --nosign for speed'
507
508 REPOROOT=`create_test_dir`
509 cd $REPOROOT
510 cp $WORKSPACE/tests/keystore.jks $REPOROOT/
511 $fdroid init --keystore keystore.jks --repo-keyalias=sova
512 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
513 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
514 echo "accepted_formats = ['txt', 'yml']" >> config.py
515 echo 'keydname = "CN=Birdman, OU=Cell, O=Alcatraz, L=Alcatraz, S=California, C=US"' >> config.py
516 test -d metadata || mkdir metadata
517 cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/
518 test -d repo || mkdir repo
519 cp $WORKSPACE/tests/urzip.apk "repo/asdfiuhk urzip-πÇÇπÇÇ现代汉语通用字-български-عربي1234 ö.apk"
520 $fdroid update --rename-apks --pretty --nosign
521 test -e repo/info.guardianproject.urzip_100.apk
522 grep -F 'info.guardianproject.urzip_100.apk' repo/index-v1.json repo/index.xml
523 cp $WORKSPACE/tests/urzip-release.apk repo/
524 $fdroid update --rename-apks --pretty --nosign
525 test -e repo/info.guardianproject.urzip_100.apk
526 test -e repo/info.guardianproject.urzip_100_b4964fd.apk
527 grep -F 'info.guardianproject.urzip_100.apk' repo/index-v1.json repo/index.xml
528 grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index-v1.json
529 ! grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index.xml
530 cp $WORKSPACE/tests/urzip-release.apk repo/
531 $fdroid update --rename-apks --pretty --nosign
532 test -e repo/info.guardianproject.urzip_100.apk
533 test -e repo/info.guardianproject.urzip_100_b4964fd.apk
534 test -e duplicates/repo/info.guardianproject.urzip_100_b4964fd.apk
535 grep -F 'info.guardianproject.urzip_100.apk' repo/index-v1.json repo/index.xml
536 grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index-v1.json
537 ! grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index.xml
538
539
540 #------------------------------------------------------------------------------#
541 echo_header "test metadata checks"
542
543 REPOROOT=`create_test_dir`
544 cd $REPOROOT
545
546 mkdir repo
547 cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
548
549 set +e
550 $fdroid build
551 if [ $? -eq 0 ]; then
552     echo "This should have failed because there is no metadata!"
553     exit 1
554 else
555     echo "testing metadata checks passed"
556 fi
557 set -e
558
559 mkdir $REPOROOT/metadata/
560 cp $WORKSPACE/tests/metadata/org.smssecure.smssecure.txt $REPOROOT/metadata/
561 $fdroid readmeta
562
563 # now make a fake duplicate
564 touch $REPOROOT/metadata/org.smssecure.smssecure.yml
565
566 set +e
567 $fdroid readmeta
568 if [ $? -eq 0 ]; then
569     echo "This should have failed because there is a duplicate metadata file!"
570     exit 1
571 else
572     echo "testing duplicate metadata checks passed"
573 fi
574 set -e
575
576
577 #------------------------------------------------------------------------------#
578 echo_header "ensure commands that don't need the JDK work without a JDK configed"
579
580 REPOROOT=`create_test_dir`
581 cd $REPOROOT
582 mkdir repo
583 mkdir metadata
584 echo "License:GPL-2.0" >> metadata/fake.txt
585 echo "Summary:Yup still fake" >> metadata/fake.txt
586 echo "Categories:Internet" >> metadata/fake.txt
587 echo "Description:" >> metadata/fake.txt
588 echo "this is fake" >> metadata/fake.txt
589 echo "." >> metadata/fake.txt
590
591 # fake that no JDKs are available
592 echo 'java_paths = {}' > config.py
593
594 LOCAL_COPY_DIR=`create_test_dir`/fdroid
595 mkdir -p $LOCAL_COPY_DIR/repo
596 echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
597
598 $fdroid checkupdates
599 $fdroid gpgsign
600 $fdroid lint
601 $fdroid readmeta
602 $fdroid rewritemeta fake
603 $fdroid server update
604 $fdroid scanner
605
606 # run these to get their output, but the are not setup, so don't fail
607 $fdroid build || true
608 $fdroid import || true
609 $fdroid install || true
610
611
612 #------------------------------------------------------------------------------#
613 echo_header "create a source tarball and use that to build a repo"
614
615 cd $WORKSPACE
616 $python setup.py sdist
617
618 REPOROOT=`create_test_dir`
619 cd $REPOROOT
620 tar xzf `ls -1 $WORKSPACE/dist/fdroidserver-*.tar.gz | sort -n | tail -1`
621 cd $REPOROOT
622 ./fdroidserver-*/fdroid init
623 copy_apks_into_repo $REPOROOT
624 ./fdroidserver-*/fdroid update --create-metadata --verbose
625
626
627 #------------------------------------------------------------------------------#
628 echo_header "test config checks of local_copy_dir"
629
630 REPOROOT=`create_test_dir`
631 cd $REPOROOT
632 $fdroid init
633 $fdroid update --create-metadata --verbose
634 $fdroid readmeta
635 $fdroid server update --local-copy-dir=/tmp/fdroid
636
637 # now test the errors work
638 set +e
639 $fdroid server update --local-copy-dir=thisisnotanabsolutepath
640 if [ $? -eq 0 ]; then
641     echo "This should have failed because thisisnotanabsolutepath is not an absolute path!"
642     exit 1
643 else
644     echo "testing absolute path checker passed"
645 fi
646 $fdroid server update --local-copy-dir=/tmp/IReallyDoubtThisPathExistsasdfasdf
647 if [ $? -eq 0 ]; then
648     echo "This should have failed because the path does not end with 'fdroid'!"
649     exit 1
650 else
651     echo "testing dirname exists checker passed"
652 fi
653 $fdroid server update --local-copy-dir=/tmp/IReallyDoubtThisPathExistsasdfasdf/fdroid
654 if [ $? -eq 0 ]; then
655     echo "This should have failed because the dirname path does not exist!"
656     exit 1
657 else
658     echo "testing dirname exists checker passed"
659 fi
660 set -e
661
662
663 #------------------------------------------------------------------------------#
664 echo_header "setup a new repo from scratch using ANDROID_HOME and do a local sync"
665
666 REPOROOT=`create_test_dir`
667 cd $REPOROOT
668 $fdroid init
669 copy_apks_into_repo $REPOROOT
670 $fdroid update --create-metadata --verbose
671 $fdroid readmeta
672 grep -F '<application id=' repo/index.xml > /dev/null
673
674 LOCALCOPYDIR=`create_test_dir`/fdroid
675 $fdroid server update --local-copy-dir=$LOCALCOPYDIR
676 NEWREPOROOT=`create_test_dir`
677 cd $NEWREPOROOT
678 $fdroid init
679 echo "sync_from_local_copy_dir = True" >> config.py
680 $fdroid server update --local-copy-dir=$LOCALCOPYDIR
681
682
683 #------------------------------------------------------------------------------#
684 # check that --android-home fails when dir does not exist or is not a dir
685
686 REPOROOT=`create_test_dir`
687 KEYSTORE=$REPOROOT/keystore.jks
688 cd $REPOROOT
689 set +e
690 $fdroid init --keystore $KEYSTORE --android-home /opt/fakeandroidhome
691 if [ $? -eq 0 ]; then
692     echo "This should have failed because /opt/fakeandroidhome does not exist!"
693     exit 1
694 else
695     echo "testing android-home path checker passed"
696 fi
697 TESTFILE=`create_test_file`
698 $fdroid init --keystore $KEYSTORE --android-home $TESTFILE
699 if [ $? -eq 0 ]; then
700     echo "This should have failed because $TESTFILE is a file not a dir!"
701     exit 1
702 else
703     echo "testing android-home not-dir checker passed"
704 fi
705 set -e
706
707
708 #------------------------------------------------------------------------------#
709 echo_header "check that fake android home passes 'fdroid init'"
710
711 REPOROOT=`create_test_dir`
712 FAKE_ANDROID_HOME=`create_test_dir`
713 create_fake_android_home $FAKE_ANDROID_HOME
714 KEYSTORE=$REPOROOT/keystore.jks
715 cd $REPOROOT
716 $fdroid init --keystore $KEYSTORE --android-home $FAKE_ANDROID_HOME
717
718
719 #------------------------------------------------------------------------------#
720 echo_header "check that 'fdroid init' fails when build-tools cannot be found"
721
722 if [ -e /usr/bin/aapt ]; then
723     echo "/usr/bin/aapt exists, not running test"
724 else
725     REPOROOT=`create_test_dir`
726     FAKE_ANDROID_HOME=`create_test_dir`
727     create_fake_android_home $FAKE_ANDROID_HOME
728     rm -f $FAKE_ANDROID_HOME/build-tools/*/aapt
729     KEYSTORE=$REPOROOT/keystore.jks
730     cd $REPOROOT
731     set +e
732     $fdroid init --keystore $KEYSTORE --android-home $FAKE_ANDROID_HOME
733     [ $? -eq 0 ] && exit 1
734     set -e
735 fi
736
737
738 #------------------------------------------------------------------------------#
739 echo_header "check that --android-home overrides ANDROID_HOME"
740
741 REPOROOT=`create_test_dir`
742 FAKE_ANDROID_HOME=`create_test_dir`
743 create_fake_android_home $FAKE_ANDROID_HOME
744 KEYSTORE=$REPOROOT/keystore.jks
745 cd $REPOROOT
746 $fdroid init --keystore $KEYSTORE --android-home $FAKE_ANDROID_HOME
747 set +e
748 grep $FAKE_ANDROID_HOME $REPOROOT/config.py
749 if [ $? -ne 0 ]; then
750     echo "the value set in --android-home '$FAKE_ANDROID_HOME' should override ANDROID_HOME '$ANDROID_HOME'"
751     exit 1
752 fi
753 set -e
754
755
756 #------------------------------------------------------------------------------#
757 # In this case, ANDROID_HOME is set to a fake, non-working version that will
758 # be detected by fdroid as an Android SDK install.  It should use the path set
759 # by --android-home over the one in ANDROID_HOME, therefore if it uses the one
760 # in ANDROID_HOME, it won't work because it is a fake one.  Only
761 # --android-home provides a working one.
762 echo_header "setup a new repo from scratch with keystore and android-home set on cmd line"
763
764 REPOROOT=`create_test_dir`
765 KEYSTORE=$REPOROOT/keystore.jks
766 FAKE_ANDROID_HOME=`create_test_dir`
767 create_fake_android_home $FAKE_ANDROID_HOME
768 STORED_ANDROID_HOME=$ANDROID_HOME
769 unset ANDROID_HOME
770 echo "ANDROID_HOME: $ANDROID_HOME"
771 cd $REPOROOT
772 $fdroid init --keystore $KEYSTORE --android-home $STORED_ANDROID_HOME --no-prompt
773 test -e $KEYSTORE
774 copy_apks_into_repo $REPOROOT
775 $fdroid update --create-metadata --verbose
776 $fdroid readmeta
777 grep -F '<application id=' repo/index.xml > /dev/null
778 test -e repo/index.xml
779 test -e repo/index.jar
780 test -e repo/index-v1.jar
781 test -e tmp/apkcache
782 ! test -z tmp/apkcache
783 export ANDROID_HOME=$STORED_ANDROID_HOME
784
785
786 #------------------------------------------------------------------------------#
787 echo_header "check duplicate files are properly handled by fdroid update"
788
789 REPOROOT=`create_test_dir`
790 KEYSTORE=$WORKSPACE/tests/keystore.jks
791 cd $REPOROOT
792 $fdroid init --keystore $KEYSTORE --repo-keyalias=sova
793 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
794 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
795 mkdir $REPOROOT/metadata
796 cp -a $WORKSPACE/tests/metadata/obb.mainpatch.current.txt $REPOROOT/metadata
797 echo "accepted_formats = ['txt']" >> config.py
798 cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619.apk $REPOROOT/repo/
799 cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619_another-release-key.apk $REPOROOT/repo/
800 $fdroid update --pretty
801 grep -F 'obb.mainpatch.current_1619.apk' repo/index.xml repo/index-v1.json
802 grep -F 'obb.mainpatch.current_1619_another-release-key.apk' repo/index-v1.json
803 ! grep -F 'obb.mainpatch.current_1619_another-release-key.apk' repo/index.xml
804 # die if there are exact duplicates
805 cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619.apk $REPOROOT/repo/duplicate.apk
806 ! $fdroid update
807
808
809 #------------------------------------------------------------------------------#
810 echo_header "setup new repo from scratch using ANDROID_HOME, putting APKs in repo first"
811
812 REPOROOT=`create_test_dir`
813 cd $REPOROOT
814 mkdir repo
815 copy_apks_into_repo $REPOROOT
816 $fdroid init
817 $fdroid update --create-metadata --verbose
818 $fdroid readmeta
819 grep -F '<application id=' repo/index.xml > /dev/null
820
821
822 #------------------------------------------------------------------------------#
823 echo_header "setup a new repo from scratch and generate a keystore"
824
825 REPOROOT=`create_test_dir`
826 KEYSTORE=$REPOROOT/keystore.jks
827 cd $REPOROOT
828 $fdroid init --keystore $KEYSTORE
829 test -e $KEYSTORE
830 copy_apks_into_repo $REPOROOT
831 $fdroid update --create-metadata --verbose
832 $fdroid readmeta
833 test -e repo/index.xml
834 test -e repo/index.jar
835 test -e repo/index-v1.jar
836 test -e tmp/apkcache
837 ! test -z tmp/apkcache
838 grep -F '<application id=' repo/index.xml > /dev/null
839
840
841 #------------------------------------------------------------------------------#
842 echo_header "setup a new repo manually and generate a keystore"
843
844 REPOROOT=`create_test_dir`
845 KEYSTORE=$REPOROOT/keystore.jks
846 cd $REPOROOT
847 cp $WORKSPACE/examples/fdroid-icon.png $REPOROOT/
848 ! test -e $KEYSTORE
849 set +e
850 $fdroid update
851 if [ $? -eq 0 ]; then
852     echo "This should have failed because this repo has no keystore!"
853     exit 1
854 else
855     echo '`fdroid update` prompted to add keystore'
856 fi
857 set -e
858 $fdroid update --create-key
859 test -e $KEYSTORE
860 copy_apks_into_repo $REPOROOT
861 $fdroid update --create-metadata --verbose
862 $fdroid readmeta
863 test -e repo/index.xml
864 test -e repo/index.jar
865 test -e repo/index-v1.jar
866 test -e tmp/apkcache
867 ! test -z tmp/apkcache
868 grep -F '<application id=' repo/index.xml > /dev/null
869
870
871 #------------------------------------------------------------------------------#
872 echo_header "setup a new repo from scratch, generate a keystore, then add APK and update"
873
874 REPOROOT=`create_test_dir`
875 KEYSTORE=$REPOROOT/keystore.jks
876 cd $REPOROOT
877 $fdroid init --keystore $KEYSTORE
878 test -e $KEYSTORE
879 copy_apks_into_repo $REPOROOT
880 $fdroid update --create-metadata --verbose
881 $fdroid readmeta
882 test -e repo/index.xml
883 test -e repo/index.jar
884 test -e repo/index-v1.jar
885 grep -F '<application id=' repo/index.xml > /dev/null
886 test -e $REPOROOT/repo/info.guardianproject.urzip_100.apk || \
887     cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
888 $fdroid update --create-metadata --verbose
889 $fdroid readmeta
890 test -e repo/index.xml
891 test -e repo/index.jar
892 test -e repo/index-v1.jar
893 test -e tmp/apkcache
894 ! test -z tmp/apkcache
895 grep -F '<application id=' repo/index.xml > /dev/null
896
897
898 #------------------------------------------------------------------------------#
899 echo_header "setup a new repo from scratch with a HSM/smartcard"
900 REPOROOT=`create_test_dir`
901 cd $REPOROOT
902 $fdroid init --keystore NONE
903 test -e opensc-fdroid.cfg
904 test ! -e NONE
905
906
907 #------------------------------------------------------------------------------#
908 echo_header "setup a new repo with no keystore, add APK, and update"
909
910 REPOROOT=`create_test_dir`
911 KEYSTORE=$REPOROOT/keystore.jks
912 cd $REPOROOT
913 touch fdroid-icon.png
914 mkdir repo
915 cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
916 set +e
917 $fdroid update --create-metadata --verbose
918 if [ $? -eq 0 ]; then
919     echo "This should have failed because this repo has no keystore!"
920     exit 1
921 else
922     echo '`fdroid update` prompted to add keystore'
923 fi
924 set -e
925
926 # now set up fake, non-working keystore setup
927 touch $KEYSTORE
928 echo "keystore = \"$KEYSTORE\"" >> config.py
929 echo 'repo_keyalias = "foo"' >> config.py
930 echo 'keystorepass = "foo"' >> config.py
931 echo 'keypass = "foo"' >> config.py
932 set +e
933 $fdroid update --create-metadata --verbose
934 if [ $? -eq 0 ]; then
935     echo "This should have failed because this repo has a bad/fake keystore!"
936     exit 1
937 else
938     echo '`fdroid update` prompted to add keystore'
939 fi
940 set -e
941
942
943 #------------------------------------------------------------------------------#
944 echo_header "copy tests/repo, update with binary transparency log"
945
946 REPOROOT=`create_test_dir`
947 GIT_REMOTE=`create_test_dir`
948 GNUPGHOME=$REPOROOT/gnupghome
949 KEYSTORE=$WORKSPACE/tests/keystore.jks
950 cd $REPOROOT
951 $fdroid init --keystore $KEYSTORE --repo-keyalias=sova
952 cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/
953 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
954 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
955 echo "binary_transparency_remote = '$GIT_REMOTE'" >> config.py
956 echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
957 $fdroid update --verbose
958 if have_git_2_3; then
959     $fdroid server update --verbose
960     test -e repo/index.xml
961     test -e repo/index.jar
962     test -e repo/index-v1.jar
963     grep -F '<application id=' repo/index.xml > /dev/null
964     cd binary_transparency
965     [ `git rev-list --count HEAD` == "2" ]
966     cd $GIT_REMOTE
967     [ `git rev-list --count HEAD` == "2" ]
968 else
969     echo "Skipping test, `git --version` older than 2.3"
970 fi
971
972
973 #------------------------------------------------------------------------------#
974 echo_header "setup a new repo with keystore with APK, update, then without key"
975
976 REPOROOT=`create_test_dir`
977 KEYSTORE=$REPOROOT/keystore.jks
978 cd $REPOROOT
979 $fdroid init --keystore $KEYSTORE
980 test -e $KEYSTORE
981 cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
982 $fdroid update --create-metadata --verbose
983 $fdroid readmeta
984 test -e repo/index.xml
985 test -e repo/index.jar
986 test -e repo/index-v1.jar
987 test -e tmp/apkcache
988 ! test -z tmp/apkcache
989 grep -F '<application id=' repo/index.xml > /dev/null
990
991 # now set fake repo_keyalias
992 $sed -i.tmp 's,^ *repo_keyalias.*,repo_keyalias = "fake",' $REPOROOT/config.py
993 set +e
994 $fdroid update
995 if [ $? -eq 0 ]; then
996     echo "This should have failed because this repo has a bad repo_keyalias!"
997     exit 1
998 else
999     echo '`fdroid update` prompted to add keystore'
1000 fi
1001 set -e
1002
1003 # try creating a new keystore, but fail because the old one is there
1004 test -e $KEYSTORE
1005 set +e
1006 $fdroid update --create-key
1007 if [ $? -eq 0 ]; then
1008     echo "This should have failed because a keystore is already there!"
1009     exit 1
1010 else
1011     echo '`fdroid update` complained about existing keystore'
1012 fi
1013 set -e
1014
1015 # now actually create the key with the existing settings
1016 rm -f $KEYSTORE
1017 ! test -e $KEYSTORE
1018 $fdroid update --create-key
1019 test -e $KEYSTORE
1020
1021
1022 #------------------------------------------------------------------------------#
1023 echo_header "sign binary repo in offline box, then publishing from online box"
1024
1025 OFFLINE_ROOT=`create_test_dir`
1026 KEYSTORE=$WORKSPACE/tests/keystore.jks
1027 LOCAL_COPY_DIR=`create_test_dir`/fdroid
1028 mkdir $LOCAL_COPY_DIR
1029 ONLINE_ROOT=`create_test_dir`
1030 SERVERWEBROOT=`create_test_dir`
1031
1032 # create offline binary transparency log
1033 cd $OFFLINE_ROOT
1034 mkdir binary_transparency
1035 cd binary_transparency
1036 git init
1037
1038 # fake git remote server for binary transparency log
1039 BINARY_TRANSPARENCY_REMOTE=`create_test_dir`
1040
1041 # fake git remote server for repo mirror
1042 SERVER_GIT_MIRROR=`create_test_dir`
1043 cd $SERVER_GIT_MIRROR
1044 git init
1045 if have_git_2_3; then
1046     git config receive.denyCurrentBranch updateInstead
1047 fi
1048
1049 cd $OFFLINE_ROOT
1050 $fdroid init --keystore $KEYSTORE --repo-keyalias=sova
1051 cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $OFFLINE_ROOT/
1052
1053 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
1054 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
1055 echo "mirrors = ['http://foo.bar/fdroid', 'http://asdflkdsfjafdsdfhkjh.onion/fdroid']" >> config.py
1056 echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py
1057 echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
1058 echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
1059 $fdroid update --pretty
1060 grep -F '<application id=' repo/index.xml > /dev/null
1061 grep -F '/fdroid/repo</mirror>' repo/index.xml
1062 grep -F '/fdroid/archive</mirror>' archive/index.xml
1063 test `grep '<mirror>' repo/index.xml | wc -l` -eq 2
1064 test `grep '<mirror>' archive/index.xml | wc -l` -eq 2
1065 cd binary_transparency
1066 [ `git rev-list --count HEAD` == "1" ]
1067 cd ..
1068 $fdroid server update --verbose
1069 grep -F '<application id=' $LOCAL_COPY_DIR/repo/index.xml > /dev/null
1070 cd $ONLINE_ROOT
1071 echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
1072 echo "sync_from_local_copy_dir = True" >> config.py
1073 echo "serverwebroots = '$SERVERWEBROOT'" >> config.py
1074 echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py
1075 echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
1076 echo "binary_transparency_remote = '$BINARY_TRANSPARENCY_REMOTE'" >> config.py
1077 $fdroid server update --verbose
1078 cd $BINARY_TRANSPARENCY_REMOTE
1079 [ `git rev-list --count HEAD` == "1" ]
1080 cd $SERVER_GIT_MIRROR
1081 [ `git rev-list --count HEAD` == "1" ]
1082
1083
1084 #------------------------------------------------------------------------------#
1085
1086 # remove this to prevent git conflicts and complaining
1087 rm -rf $WORKSPACE/fdroidserver.egg-info/
1088
1089 echo SUCCESS