chiark / gitweb /
update: allow_disabled_algorithms option to keep MD5 sigs in repo
[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 -L urzip.apk
145 grep -F '<application id=' repo/index.xml > /dev/null
146
147
148 #------------------------------------------------------------------------------#
149 echo_header "test UTF-8 metadata"
150
151 REPOROOT=`create_test_dir`
152 cd $REPOROOT
153
154 $fdroid init
155 sed -i.tmp 's,^ *repo_description.*,repo_description = """获取已安装在您的设备上的应用的,' config.py
156 echo "mirrors = ('https://foo.bar/fdroid', 'http://secret.onion/fdroid')" >> config.py
157 mkdir metadata
158 cp $WORKSPACE/tests/urzip.apk repo/
159 cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/
160
161 $fdroid readmeta
162 $fdroid update
163
164
165 #------------------------------------------------------------------------------#
166 echo_header 'run `fdroid build` in fresh git checkout from import.TestCase'
167
168 cd $WORKSPACE/tests/tmp/importer
169 git remote update -p
170 git clean -fdx
171 # stick with known working commit, in case future commits break things for this code
172 git reset --hard cecf00c08aec56ae7a5eba444150c4d1ae868814
173 if [ -d $ANDROID_HOME/platforms/android-23 ]; then
174     echo "build_tools = '`ls -1 $ANDROID_HOME/build-tools/ | sort -n | tail -1`'" > config.py
175     echo "force_build_tools = True" >> config.py
176     $fdroid build --verbose org.fdroid.ci.test.app:300
177 else
178     echo 'WARNING: Skipping `fdroid build` test since android-23 is missing!'
179 fi
180
181 #------------------------------------------------------------------------------#
182 echo_header 'copy git import and run `fdroid scanner` on it'
183
184 REPOROOT=`create_test_dir`
185 cd $REPOROOT
186 touch config.py
187 cp $WORKSPACE/examples/fdroid-icon.png $REPOROOT/
188 mkdir metadata
189 echo "Auto Name:Just A Test" > metadata/org.fdroid.ci.test.app.txt
190 echo "Web Site:" >> metadata/org.fdroid.ci.test.app.txt
191 echo "Build:0.3,300" >> metadata/org.fdroid.ci.test.app.txt
192 echo "    commit=0.3" >> metadata/org.fdroid.ci.test.app.txt
193 echo "    subdir=app" >> metadata/org.fdroid.ci.test.app.txt
194 echo "    gradle=yes" >> metadata/org.fdroid.ci.test.app.txt
195 echo "" >> metadata/org.fdroid.ci.test.app.txt
196 echo "Repo:https://gitlab.com/fdroid/ci-test-app.git" >> metadata/org.fdroid.ci.test.app.txt
197 echo "Repo Type:git" >> metadata/org.fdroid.ci.test.app.txt
198 mkdir build
199 cp -a $WORKSPACE/tests/tmp/importer build/org.fdroid.ci.test.app
200 ls -l build/org.fdroid.ci.test.app
201 $fdroid scanner org.fdroid.ci.test.app --verbose
202
203
204 #------------------------------------------------------------------------------#
205 echo_header "copy tests/repo, generate java/gpg keys, update, and gpgsign"
206
207 REPOROOT=`create_test_dir`
208 GNUPGHOME=$REPOROOT/gnupghome
209 KEYSTORE=$WORKSPACE/tests/keystore.jks
210 cd $REPOROOT
211 $fdroid init --keystore $KEYSTORE --repo-keyalias=sova
212 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
213 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
214 cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/
215 cp -a $WORKSPACE/tests/gnupghome $GNUPGHOME
216 chmod 0700 $GNUPGHOME
217 echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
218 echo "install_list = 'org.adaway'" >> config.py
219 echo "uninstall_list = ('com.android.vending', 'com.facebook.orca',)" >> config.py
220 echo "gpghome = '$GNUPGHOME'" >> config.py
221 echo "gpgkey = 'CE71F7FB'" >> config.py
222 echo "mirrors = ('http://foobarfoobarfoobar.onion/fdroid','https://foo.bar/fdroid',)" >> config.py
223 $fdroid update --verbose --pretty
224 test -e repo/index.xml
225 test -e repo/index.jar
226 test -e repo/index-v1.jar
227 grep -F '<application id=' repo/index.xml > /dev/null
228 grep -F '<install packageName=' repo/index.xml > /dev/null
229 grep -F '<uninstall packageName=' repo/index.xml > /dev/null
230 $fdroid gpgsign --verbose
231 $fdroid gpgsign --verbose
232 test -e repo/obb.mainpatch.current_1619.apk.asc
233 test -e repo/obb.main.twoversions_1101617_src.tar.gz.asc
234 ! test -e repo/obb.mainpatch.current_1619.apk.asc.asc
235 ! test -e repo/obb.main.twoversions_1101617_src.tar.gz.asc.asc
236 ! test -e repo/index.xml.asc
237
238 # we can't easily reproduce the timestamps for things, so just hardcode them
239 sed -i --expression='s,timestamp="[0-9]*",timestamp="1480431575",' repo/index.xml
240 diff -uw $WORKSPACE/tests/repo/index.xml repo/index.xml
241
242
243 #------------------------------------------------------------------------------#
244 echo_header 'test moving lots of APKs to the archive'
245
246 REPOROOT=`create_test_dir`
247 cd $REPOROOT
248 cp $WORKSPACE/tests/keystore.jks $REPOROOT/
249 $fdroid init --keystore keystore.jks --repo-keyalias=sova
250 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
251 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
252 echo "accepted_formats = ['txt']" >> config.py
253 sed -i '/allow_disabled_algorithms/d' config.py
254 test -d metadata || mkdir metadata
255 cp $WORKSPACE/tests/metadata/*.txt metadata/
256 echo 'Summary:good test version of urzip' > metadata/info.guardianproject.urzip.txt
257 echo 'Summary:good MD5 sig, which is disabled algorithm' > metadata/org.bitbucket.tickytacky.mirrormirror.txt
258 sed -i '/Archive Policy:/d' metadata/*.txt
259 test -d repo || mkdir repo
260 cp $WORKSPACE/tests/urzip.apk \
261    $WORKSPACE/tests/org.bitbucket.tickytacky.mirrormirror_[0-9].apk \
262    $WORKSPACE/tests/repo/com.politedroid_[0-9].apk \
263    $WORKSPACE/tests/repo/obb.main.twoversions_110161[357].apk \
264    repo/
265 sed -i 's,archive_older = [0-9],archive_older = 3,' config.py
266
267 $fdroid update --pretty --nosign
268 test `grep '<package>' archive/index.xml | wc -l` -eq 5
269 test `grep '<package>' repo/index.xml | wc -l` -eq 7
270
271
272 #------------------------------------------------------------------------------#
273 echo_header 'test per-app "Archive Policy"'
274
275 REPOROOT=`create_test_dir`
276 cd $REPOROOT
277 cp $WORKSPACE/tests/keystore.jks $REPOROOT/
278 $fdroid init --keystore keystore.jks --repo-keyalias=sova
279 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
280 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
281 echo "accepted_formats = ['txt']" >> config.py
282 test -d metadata || mkdir metadata
283 cp $WORKSPACE/tests/metadata/com.politedroid.txt metadata/
284 test -d repo || mkdir repo
285 cp $WORKSPACE/tests/repo/com.politedroid_[0-9].apk repo/
286 sed -i 's,archive_older = [0-9],archive_older = 3,' config.py
287
288 $fdroid update --pretty --nosign
289 test `grep '<package>' archive/index.xml | wc -l` -eq 0
290 test `grep '<package>' repo/index.xml | wc -l` -eq 4
291 grep -F com.politedroid_3.apk repo/index.xml
292 grep -F com.politedroid_4.apk repo/index.xml
293 grep -F com.politedroid_5.apk repo/index.xml
294 grep -F com.politedroid_6.apk repo/index.xml
295 test -e repo/com.politedroid_3.apk
296 test -e repo/com.politedroid_4.apk
297 test -e repo/com.politedroid_5.apk
298 test -e repo/com.politedroid_6.apk
299
300 echo "enable one app in the repo"
301 sed -i 's,^Archive Policy:4,Archive Policy:1,' metadata/com.politedroid.txt
302 $fdroid update --pretty --nosign
303 test `grep '<package>' archive/index.xml | wc -l` -eq 3
304 test `grep '<package>' repo/index.xml | wc -l` -eq 1
305 grep -F com.politedroid_3.apk archive/index.xml
306 grep -F com.politedroid_4.apk archive/index.xml
307 grep -F com.politedroid_5.apk archive/index.xml
308 grep -F com.politedroid_6.apk repo/index.xml
309 test -e archive/com.politedroid_3.apk
310 test -e archive/com.politedroid_4.apk
311 test -e archive/com.politedroid_5.apk
312 test -e repo/com.politedroid_6.apk
313
314 echo "remove all apps from the repo"
315 sed -i 's,^Archive Policy:1,Archive Policy:0,' metadata/com.politedroid.txt
316 $fdroid update --pretty --nosign
317 test `grep '<package>' archive/index.xml | wc -l` -eq 4
318 test `grep '<package>' repo/index.xml | wc -l` -eq 0
319 grep -F com.politedroid_3.apk archive/index.xml
320 grep -F com.politedroid_4.apk archive/index.xml
321 grep -F com.politedroid_5.apk archive/index.xml
322 grep -F com.politedroid_6.apk archive/index.xml
323 test -e archive/com.politedroid_3.apk
324 test -e archive/com.politedroid_4.apk
325 test -e archive/com.politedroid_5.apk
326 test -e archive/com.politedroid_6.apk
327 ! test -e repo/com.politedroid_6.apk
328
329 echo "move back one from archive to the repo"
330 sed -i 's,^Archive Policy:0,Archive Policy:1,' metadata/com.politedroid.txt
331 $fdroid update --pretty --nosign
332 test `grep '<package>' archive/index.xml | wc -l` -eq 3
333 test `grep '<package>' repo/index.xml | wc -l` -eq 1
334 grep -F com.politedroid_3.apk archive/index.xml
335 grep -F com.politedroid_4.apk archive/index.xml
336 grep -F com.politedroid_5.apk archive/index.xml
337 grep -F com.politedroid_6.apk repo/index.xml
338 test -e archive/com.politedroid_3.apk
339 test -e archive/com.politedroid_4.apk
340 test -e archive/com.politedroid_5.apk
341 ! test -e archive/com.politedroid_6.apk
342 test -e repo/com.politedroid_6.apk
343
344
345
346 #------------------------------------------------------------------------------#
347 echo_header 'test moving old APKs to and from the archive'
348
349 REPOROOT=`create_test_dir`
350 cd $REPOROOT
351 cp $WORKSPACE/tests/keystore.jks $REPOROOT/
352 $fdroid init --keystore keystore.jks --repo-keyalias=sova
353 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
354 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
355 echo "accepted_formats = ['txt']" >> config.py
356 test -d metadata || mkdir metadata
357 cp $WORKSPACE/tests/metadata/com.politedroid.txt metadata/
358 sed -i '/Archive Policy:/d' metadata/com.politedroid.txt
359 test -d repo || mkdir repo
360 cp $WORKSPACE/tests/repo/com.politedroid_[0-9].apk repo/
361 sed -i 's,archive_older = [0-9],archive_older = 3,' config.py
362
363 $fdroid update --pretty --nosign
364 test `grep '<package>' archive/index.xml | wc -l` -eq 1
365 test `grep '<package>' repo/index.xml | wc -l` -eq 3
366 grep -F com.politedroid_3.apk archive/index.xml
367 grep -F com.politedroid_4.apk repo/index.xml
368 grep -F com.politedroid_5.apk repo/index.xml
369 grep -F com.politedroid_6.apk repo/index.xml
370 test -e archive/com.politedroid_3.apk
371 test -e repo/com.politedroid_4.apk
372 test -e repo/com.politedroid_5.apk
373 test -e repo/com.politedroid_6.apk
374
375 sed -i 's,archive_older = 3,archive_older = 1,' config.py
376 $fdroid update --pretty --nosign
377 test `grep '<package>' archive/index.xml | wc -l` -eq 3
378 test `grep '<package>' repo/index.xml | wc -l` -eq 1
379 grep -F com.politedroid_3.apk archive/index.xml
380 grep -F com.politedroid_4.apk archive/index.xml
381 grep -F com.politedroid_5.apk archive/index.xml
382 grep -F com.politedroid_6.apk repo/index.xml
383 test -e archive/com.politedroid_3.apk
384 test -e archive/com.politedroid_4.apk
385 test -e archive/com.politedroid_5.apk
386 test -e repo/com.politedroid_6.apk
387
388 # disabling deletes from the archive
389 sed -i 's/Build:1.3,4/Build:1.3,4\n    disable=testing deletion/' metadata/com.politedroid.txt
390 $fdroid update --pretty --nosign
391 test `grep '<package>' archive/index.xml | wc -l` -eq 2
392 test `grep '<package>' repo/index.xml | wc -l` -eq 1
393 grep -F com.politedroid_3.apk archive/index.xml
394 ! grep -F com.politedroid_4.apk archive/index.xml
395 grep -F com.politedroid_5.apk archive/index.xml
396 grep -F com.politedroid_6.apk repo/index.xml
397 test -e archive/com.politedroid_3.apk
398 ! test -e archive/com.politedroid_4.apk
399 test -e archive/com.politedroid_5.apk
400 test -e repo/com.politedroid_6.apk
401
402 # disabling deletes from the repo, and promotes one from the archive
403 sed -i 's/Build:1.5,6/Build:1.5,6\n    disable=testing deletion/' metadata/com.politedroid.txt
404 $fdroid update --pretty --nosign
405 test `grep '<package>' archive/index.xml | wc -l` -eq 1
406 test `grep '<package>' repo/index.xml | wc -l` -eq 1
407 grep -F com.politedroid_3.apk archive/index.xml
408 grep -F com.politedroid_5.apk repo/index.xml
409 ! grep -F com.politedroid_6.apk repo/index.xml
410 test -e archive/com.politedroid_3.apk
411 test -e repo/com.politedroid_5.apk
412 ! test -e repo/com.politedroid_6.apk
413
414
415 #------------------------------------------------------------------------------#
416 echo_header 'test allowing disabled signatures in repo and archive'
417
418 REPOROOT=`create_test_dir`
419 cd $REPOROOT
420 cp $WORKSPACE/tests/keystore.jks $REPOROOT/
421 $fdroid init --keystore keystore.jks --repo-keyalias=sova
422 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
423 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
424 echo "accepted_formats = ['txt']" >> config.py
425 echo 'allow_disabled_algorithms = True' >> config.py
426 sed -i 's,archive_older = [0-9],archive_older = 3,' config.py
427 test -d metadata || mkdir metadata
428 cp $WORKSPACE/tests/metadata/com.politedroid.txt metadata/
429 echo 'Summary:good test version of urzip' > metadata/info.guardianproject.urzip.txt
430 echo 'Summary:good MD5 sig, disabled algorithm' > metadata/org.bitbucket.tickytacky.mirrormirror.txt
431 sed -i '/Archive Policy:/d' metadata/*.txt
432 test -d repo || mkdir repo
433 cp $WORKSPACE/tests/repo/com.politedroid_[0-9].apk \
434    $WORKSPACE/tests/org.bitbucket.tickytacky.mirrormirror_[0-9].apk \
435    $WORKSPACE/tests/urzip-badsig.apk \
436    repo/
437
438 $fdroid update --pretty --nosign
439 test `grep '<package>' archive/index.xml | wc -l` -eq 2
440 test `grep '<package>' repo/index.xml | wc -l` -eq 6
441 grep -F com.politedroid_3.apk archive/index.xml
442 grep -F com.politedroid_4.apk repo/index.xml
443 grep -F com.politedroid_5.apk repo/index.xml
444 grep -F com.politedroid_6.apk repo/index.xml
445 grep -F org.bitbucket.tickytacky.mirrormirror_1.apk archive/index.xml
446 grep -F org.bitbucket.tickytacky.mirrormirror_2.apk repo/index.xml
447 grep -F org.bitbucket.tickytacky.mirrormirror_3.apk repo/index.xml
448 grep -F org.bitbucket.tickytacky.mirrormirror_4.apk repo/index.xml
449 ! grep -F urzip-badsig.apk repo/index.xml
450 ! grep -F urzip-badsig.apk archive/index.xml
451 test -e archive/com.politedroid_3.apk
452 test -e repo/com.politedroid_4.apk
453 test -e repo/com.politedroid_5.apk
454 test -e repo/com.politedroid_6.apk
455 test -e archive/org.bitbucket.tickytacky.mirrormirror_1.apk
456 test -e repo/org.bitbucket.tickytacky.mirrormirror_2.apk
457 test -e repo/org.bitbucket.tickytacky.mirrormirror_3.apk
458 test -e repo/org.bitbucket.tickytacky.mirrormirror_4.apk
459 test -e archive/urzip-badsig.apk
460
461 sed -i '/allow_disabled_algorithms/d' config.py
462 $fdroid update --pretty --nosign
463 test `grep '<package>' archive/index.xml | wc -l` -eq 5
464 test `grep '<package>' repo/index.xml | wc -l` -eq 3
465 grep -F org.bitbucket.tickytacky.mirrormirror_1.apk archive/index.xml
466 grep -F org.bitbucket.tickytacky.mirrormirror_2.apk archive/index.xml
467 grep -F org.bitbucket.tickytacky.mirrormirror_3.apk archive/index.xml
468 grep -F org.bitbucket.tickytacky.mirrormirror_4.apk archive/index.xml
469 grep -F com.politedroid_3.apk archive/index.xml
470 grep -F com.politedroid_4.apk repo/index.xml
471 grep -F com.politedroid_5.apk repo/index.xml
472 grep -F com.politedroid_6.apk repo/index.xml
473 ! grep -F urzip-badsig.apk repo/index.xml
474 ! grep -F urzip-badsig.apk archive/index.xml
475 test -e archive/org.bitbucket.tickytacky.mirrormirror_1.apk
476 test -e archive/org.bitbucket.tickytacky.mirrormirror_2.apk
477 test -e archive/org.bitbucket.tickytacky.mirrormirror_3.apk
478 test -e archive/org.bitbucket.tickytacky.mirrormirror_4.apk
479 test -e archive/com.politedroid_3.apk
480 test -e archive/urzip-badsig.apk
481 test -e repo/com.politedroid_4.apk
482 test -e repo/com.politedroid_5.apk
483 test -e repo/com.politedroid_6.apk
484
485
486 #------------------------------------------------------------------------------#
487 echo_header 'rename apks with `fdroid update --rename-apks`, --nosign for speed'
488
489 REPOROOT=`create_test_dir`
490 cd $REPOROOT
491 cp $WORKSPACE/tests/keystore.jks $REPOROOT/
492 $fdroid init --keystore keystore.jks --repo-keyalias=sova
493 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
494 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
495 echo "accepted_formats = ['txt', 'yml']" >> config.py
496 echo 'keydname = "CN=Birdman, OU=Cell, O=Alcatraz, L=Alcatraz, S=California, C=US"' >> config.py
497 test -d metadata || mkdir metadata
498 cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/
499 test -d repo || mkdir repo
500 cp $WORKSPACE/tests/urzip.apk "repo/asdfiuhk urzip-πÇÇπÇÇ现代汉语通用字-български-عربي1234 ö.apk"
501 $fdroid update --rename-apks --pretty --nosign
502 test -e repo/info.guardianproject.urzip_100.apk
503 grep -F 'info.guardianproject.urzip_100.apk' repo/index-v1.json repo/index.xml
504 cp $WORKSPACE/tests/urzip-release.apk repo/
505 $fdroid update --rename-apks --pretty --nosign
506 test -e repo/info.guardianproject.urzip_100.apk
507 test -e repo/info.guardianproject.urzip_100_b4964fd.apk
508 grep -F 'info.guardianproject.urzip_100.apk' repo/index-v1.json repo/index.xml
509 grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index-v1.json
510 ! grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index.xml
511 cp $WORKSPACE/tests/urzip-release.apk repo/
512 $fdroid update --rename-apks --pretty --nosign
513 test -e repo/info.guardianproject.urzip_100.apk
514 test -e repo/info.guardianproject.urzip_100_b4964fd.apk
515 test -e duplicates/repo/info.guardianproject.urzip_100_b4964fd.apk
516 grep -F 'info.guardianproject.urzip_100.apk' repo/index-v1.json repo/index.xml
517 grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index-v1.json
518 ! grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index.xml
519
520
521 #------------------------------------------------------------------------------#
522 echo_header "test metadata checks"
523
524 REPOROOT=`create_test_dir`
525 cd $REPOROOT
526
527 touch config.py
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 export ANDROID_HOME=$STORED_ANDROID_HOME
764
765
766 #------------------------------------------------------------------------------#
767 echo_header "check duplicate files are properly handled by fdroid update"
768
769 REPOROOT=`create_test_dir`
770 KEYSTORE=$WORKSPACE/tests/keystore.jks
771 cd $REPOROOT
772 $fdroid init --keystore $KEYSTORE --repo-keyalias=sova
773 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
774 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
775 mkdir $REPOROOT/metadata
776 cp -a $WORKSPACE/tests/metadata/obb.mainpatch.current.txt $REPOROOT/metadata
777 echo "accepted_formats = ['txt']" >> config.py
778 cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619.apk $REPOROOT/repo/
779 cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619_another-release-key.apk $REPOROOT/repo/
780 $fdroid update --pretty
781 grep -F 'obb.mainpatch.current_1619.apk' repo/index.xml repo/index-v1.json
782 grep -F 'obb.mainpatch.current_1619_another-release-key.apk' repo/index-v1.json
783 ! grep -F 'obb.mainpatch.current_1619_another-release-key.apk' repo/index.xml
784 # die if there are exact duplicates
785 cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619.apk $REPOROOT/repo/duplicate.apk
786 ! $fdroid update
787
788
789 #------------------------------------------------------------------------------#
790 echo_header "setup new repo from scratch using ANDROID_HOME, putting APKs in repo first"
791
792 REPOROOT=`create_test_dir`
793 cd $REPOROOT
794 mkdir repo
795 copy_apks_into_repo $REPOROOT
796 $fdroid init
797 $fdroid update --create-metadata --verbose
798 $fdroid readmeta
799 grep -F '<application id=' repo/index.xml > /dev/null
800
801
802 #------------------------------------------------------------------------------#
803 echo_header "setup a new repo from scratch and generate a keystore"
804
805 REPOROOT=`create_test_dir`
806 KEYSTORE=$REPOROOT/keystore.jks
807 cd $REPOROOT
808 $fdroid init --keystore $KEYSTORE
809 test -e $KEYSTORE
810 copy_apks_into_repo $REPOROOT
811 $fdroid update --create-metadata --verbose
812 $fdroid readmeta
813 test -e repo/index.xml
814 test -e repo/index.jar
815 test -e repo/index-v1.jar
816 grep -F '<application id=' repo/index.xml > /dev/null
817
818
819 #------------------------------------------------------------------------------#
820 echo_header "setup a new repo manually and generate a keystore"
821
822 REPOROOT=`create_test_dir`
823 KEYSTORE=$REPOROOT/keystore.jks
824 cd $REPOROOT
825 touch config.py
826 cp $WORKSPACE/examples/fdroid-icon.png $REPOROOT/
827 ! test -e $KEYSTORE
828 set +e
829 $fdroid update
830 if [ $? -eq 0 ]; then
831     echo "This should have failed because this repo has no keystore!"
832     exit 1
833 else
834     echo '`fdroid update` prompted to add keystore'
835 fi
836 set -e
837 $fdroid update --create-key
838 test -e $KEYSTORE
839 copy_apks_into_repo $REPOROOT
840 $fdroid update --create-metadata --verbose
841 $fdroid readmeta
842 test -e repo/index.xml
843 test -e repo/index.jar
844 test -e repo/index-v1.jar
845 grep -F '<application id=' repo/index.xml > /dev/null
846
847
848 #------------------------------------------------------------------------------#
849 echo_header "setup a new repo from scratch, generate a keystore, then add APK and update"
850
851 REPOROOT=`create_test_dir`
852 KEYSTORE=$REPOROOT/keystore.jks
853 cd $REPOROOT
854 $fdroid init --keystore $KEYSTORE
855 test -e $KEYSTORE
856 copy_apks_into_repo $REPOROOT
857 $fdroid update --create-metadata --verbose
858 $fdroid readmeta
859 test -e repo/index.xml
860 test -e repo/index.jar
861 test -e repo/index-v1.jar
862 grep -F '<application id=' repo/index.xml > /dev/null
863 test -e $REPOROOT/repo/info.guardianproject.urzip_100.apk || \
864     cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
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
872
873 #------------------------------------------------------------------------------#
874 echo_header "setup a new repo from scratch with a HSM/smartcard"
875 REPOROOT=`create_test_dir`
876 cd $REPOROOT
877 $fdroid init --keystore NONE
878 test -e opensc-fdroid.cfg
879 test ! -e NONE
880
881
882 #------------------------------------------------------------------------------#
883 echo_header "setup a new repo with no keystore, add APK, and update"
884
885 REPOROOT=`create_test_dir`
886 KEYSTORE=$REPOROOT/keystore.jks
887 cd $REPOROOT
888 touch config.py
889 touch fdroid-icon.png
890 mkdir repo
891 cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
892 set +e
893 $fdroid update --create-metadata --verbose
894 if [ $? -eq 0 ]; then
895     echo "This should have failed because this repo has no keystore!"
896     exit 1
897 else
898     echo '`fdroid update` prompted to add keystore'
899 fi
900 set -e
901
902 # now set up fake, non-working keystore setup
903 touch $KEYSTORE
904 echo "keystore = \"$KEYSTORE\"" >> config.py
905 echo 'repo_keyalias = "foo"' >> config.py
906 echo 'keystorepass = "foo"' >> config.py
907 echo 'keypass = "foo"' >> config.py
908 set +e
909 $fdroid update --create-metadata --verbose
910 if [ $? -eq 0 ]; then
911     echo "This should have failed because this repo has a bad/fake keystore!"
912     exit 1
913 else
914     echo '`fdroid update` prompted to add keystore'
915 fi
916 set -e
917
918
919 #------------------------------------------------------------------------------#
920 echo_header "copy tests/repo, update with binary transparency log"
921
922 REPOROOT=`create_test_dir`
923 GIT_REMOTE=`create_test_dir`
924 GNUPGHOME=$REPOROOT/gnupghome
925 KEYSTORE=$WORKSPACE/tests/keystore.jks
926 cd $REPOROOT
927 $fdroid init --keystore $KEYSTORE --repo-keyalias=sova
928 cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/
929 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
930 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
931 echo "binary_transparency_remote = '$GIT_REMOTE'" >> config.py
932 echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
933 $fdroid update --verbose
934 if have_git_2_3; then
935     $fdroid server update --verbose
936     test -e repo/index.xml
937     test -e repo/index.jar
938     test -e repo/index-v1.jar
939     grep -F '<application id=' repo/index.xml > /dev/null
940     cd binary_transparency
941     [ `git rev-list --count HEAD` == "2" ]
942     cd $GIT_REMOTE
943     [ `git rev-list --count HEAD` == "2" ]
944 else
945     echo "Skipping test, `git --version` older than 2.3"
946 fi
947
948
949 #------------------------------------------------------------------------------#
950 echo_header "setup a new repo with keystore with APK, update, then without key"
951
952 REPOROOT=`create_test_dir`
953 KEYSTORE=$REPOROOT/keystore.jks
954 cd $REPOROOT
955 $fdroid init --keystore $KEYSTORE
956 test -e $KEYSTORE
957 cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
958 $fdroid update --create-metadata --verbose
959 $fdroid readmeta
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
965 # now set fake repo_keyalias
966 sed -i.tmp 's,^ *repo_keyalias.*,repo_keyalias = "fake",' $REPOROOT/config.py
967 set +e
968 $fdroid update
969 if [ $? -eq 0 ]; then
970     echo "This should have failed because this repo has a bad repo_keyalias!"
971     exit 1
972 else
973     echo '`fdroid update` prompted to add keystore'
974 fi
975 set -e
976
977 # try creating a new keystore, but fail because the old one is there
978 test -e $KEYSTORE
979 set +e
980 $fdroid update --create-key
981 if [ $? -eq 0 ]; then
982     echo "This should have failed because a keystore is already there!"
983     exit 1
984 else
985     echo '`fdroid update` complained about existing keystore'
986 fi
987 set -e
988
989 # now actually create the key with the existing settings
990 rm -f $KEYSTORE
991 ! test -e $KEYSTORE
992 $fdroid update --create-key
993 test -e $KEYSTORE
994
995
996 #------------------------------------------------------------------------------#
997 echo_header "sign binary repo in offline box, then publishing from online box"
998
999 OFFLINE_ROOT=`create_test_dir`
1000 KEYSTORE=$WORKSPACE/tests/keystore.jks
1001 LOCAL_COPY_DIR=`create_test_dir`/fdroid
1002 mkdir $LOCAL_COPY_DIR
1003 ONLINE_ROOT=`create_test_dir`
1004 SERVERWEBROOT=`create_test_dir`
1005
1006 # create offline binary transparency log
1007 cd $OFFLINE_ROOT
1008 mkdir binary_transparency
1009 cd binary_transparency
1010 git init
1011
1012 # fake git remote server for binary transparency log
1013 BINARY_TRANSPARENCY_REMOTE=`create_test_dir`
1014
1015 # fake git remote server for repo mirror
1016 SERVER_GIT_MIRROR=`create_test_dir`
1017 cd $SERVER_GIT_MIRROR
1018 git init
1019 if have_git_2_3; then
1020     git config receive.denyCurrentBranch updateInstead
1021 fi
1022
1023 cd $OFFLINE_ROOT
1024 $fdroid init --keystore $KEYSTORE --repo-keyalias=sova
1025 cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $OFFLINE_ROOT/
1026
1027 echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
1028 echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py
1029 echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py
1030 echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
1031 echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py
1032 $fdroid update --verbose
1033 grep -F '<application id=' repo/index.xml > /dev/null
1034 cd binary_transparency
1035 [ `git rev-list --count HEAD` == "1" ]
1036 cd ..
1037 if have_git_2_3; then
1038     $fdroid server update --verbose
1039     grep -F '<application id=' $LOCAL_COPY_DIR/repo/index.xml > /dev/null
1040     cd $ONLINE_ROOT
1041     echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
1042     echo "sync_from_local_copy_dir = True" >> config.py
1043     echo "serverwebroots = '$SERVERWEBROOT'" >> config.py
1044     echo "servergitmirrors = '$SERVER_GIT_MIRROR'" >> config.py
1045     echo "local_copy_dir = '$LOCAL_COPY_DIR'" >> config.py
1046     echo "binary_transparency_remote = '$BINARY_TRANSPARENCY_REMOTE'" >> config.py
1047     $fdroid server update --verbose
1048     cd $BINARY_TRANSPARENCY_REMOTE
1049     [ `git rev-list --count HEAD` == "1" ]
1050     cd $SERVER_GIT_MIRROR
1051     [ `git rev-list --count HEAD` == "1" ]
1052 else
1053     echo "Skipping test, `git --version` older than 2.3"
1054 fi
1055
1056
1057 #------------------------------------------------------------------------------#
1058
1059 # remove this to prevent git conflicts and complaining
1060 rm -rf $WORKSPACE/fdroidserver.egg-info/
1061
1062 echo SUCCESS