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