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