From 56ef716a4eba81fe5b7365443e8e26adf8c2420e Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Thu, 23 Feb 2017 21:23:45 +0100 Subject: [PATCH] test for original "v0" index XML compatibility The original index.xml format needs to stay around for backwards compatibility, but we shouldn't touch it anymore once the new format is in place. This is a test to make sure `fdroid update` can still generate the correct XML. install_list and uninstall_list should be tuples or lists in order to ensure that the order is preserved. These tests also check that the added and lastupdated dates are working correct, based on the dates in tests/stats/known_apks.txt. I could see no useful way to test the timestamp, it is just hardcoded using a regexp search-and-replace. Running these tests manually might require deleting tmp/apkcache. --- .gitignore | 10 ++- examples/config.py | 14 ++-- tests/config.py | 35 ++++++++ tests/keystore.jks | Bin 0 -> 3760 bytes tests/repo/categories.txt | 7 ++ tests/repo/index.xml | 162 +++++++++++++++++++++++++++++++++++++ tests/run-tests | 15 +++- tests/stats/known_apks.txt | 6 ++ 8 files changed, 236 insertions(+), 13 deletions(-) create mode 100644 tests/config.py create mode 100644 tests/keystore.jks create mode 100644 tests/repo/categories.txt create mode 100644 tests/repo/index.xml create mode 100644 tests/stats/known_apks.txt diff --git a/.gitignore b/.gitignore index 40e2cd2b..4652e8a2 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ *.pyc *.class *.box +TAGS # files generated by build build/ @@ -17,6 +18,7 @@ docs/html/ # files generated by tests tmp/ /tests/repo/icons* +/tests/repo/latestapps.dat # files used in manual testing /config.py @@ -26,10 +28,14 @@ tmp/ makebuildserver.config.py /tests/.fdroid.keypass.txt /tests/.fdroid.keystorepass.txt -/tests/config.py /tests/fdroid-icon.png -/tests/keystore.jks +/tests/OBBMainOldVersion.apk /tests/OBBMainPatchCurrent.apk /tests/OBBMainTwoVersions.apk +/tests/archive/categories.txt +/tests/archive/icons* +/tests/archive/index.jar +/tests/archive/index.xml +/tests/repo/index.jar /tests/urzip-πÇÇπÇÇ现代汉语通用字-български-عربي1234.apk /unsigned/ diff --git a/examples/config.py b/examples/config.py index a047a71d..026cd3e6 100644 --- a/examples/config.py +++ b/examples/config.py @@ -175,10 +175,10 @@ The repository of older versions of applications from the main demo repository. # and the archive, if it is enabled. So these URLs should end in the # 'fdroid' base of the F-Droid part of the web server like serverwebroot. # -# mirrors = { +# mirrors = ( # 'https://foo.bar/fdroid', # 'http://foobarfoobarfoobar.onion/fdroid', -# } +# ) # optionally specific which identity file to use when using rsync over SSH # @@ -253,7 +253,7 @@ The repository of older versions of applications from the main demo repository. # By default, fdroid will use YAML .yml and the custom .txt metadata formats. It # is also possible to have metadata in JSON by adding 'json'. -# accepted_formats = ['txt', 'yml'] +# accepted_formats = ('txt', 'yml') # Limit in number of characters that fields can take up # Only the fields listed here are supported, defaults shown @@ -269,13 +269,13 @@ The repository of older versions of applications from the main demo repository. # the packageNames listed. This is protected by the same signing key # as the app index metadata. # -# install_list = { +# install_list = ( # 'at.bitfire.davdroid', # 'com.fsck.k9', # 'us.replicant', -# } +# ) # -# uninstall_list = { +# uninstall_list = ( # 'com.facebook.orca', # 'com.android.vending', -# } +# ) diff --git a/tests/config.py b/tests/config.py new file mode 100644 index 00000000..16917a64 --- /dev/null +++ b/tests/config.py @@ -0,0 +1,35 @@ + +repo_url = "https://MyFirstFDroidRepo.org/fdroid/repo" +repo_name = "My First F-Droid Repo Demo" +repo_icon = "fdroid-icon.png" +repo_description = """ +This is a repository of apps to be used with F-Droid. Applications in this +repository are either official binaries built by the original application +developers, or are binaries built from source by the admin of f-droid.org +using the tools on https://gitlab.com/u/fdroid. +""" + +archive_older = 3 +archive_url = "https://f-droid.org/archive" +archive_name = "My First F-Droid Archive Demo" +archive_icon = "fdroid-icon.png" +archive_description = """ +The repository of older versions of applications from the main demo repository. +""" + +repo_keyalias = "sova" +keystore = "keystore.jks" +keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI=" +keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI=" +keydname = "CN=sova, OU=F-Droid" + +mirrors = ( + 'https://foo.bar/fdroid', + 'http://foobarfoobarfoobar.onion/fdroid', +) + +update_stats = True +accepted_formats = ('json', 'txt', 'yml') + +install_list = 'org.adaway' +uninstall_list = ('com.android.vending', 'com.facebook.orca', ) diff --git a/tests/keystore.jks b/tests/keystore.jks new file mode 100644 index 0000000000000000000000000000000000000000..1eb91fe78cd6b773f05764a10a25b2809392c3d7 GIT binary patch literal 3760 zcma);S2P@q)`q9*!!Vc-Ef|E5QKH5mdI>@F2vLG4qYpkw5H%*cFcDou??j7E)Tkkt z=w0+)^XLE8xj2{SVqd)bV()$NthJx(t?MlS008=1z<&$kf%Sg&HyEMBNb>;z@=$aT zc@UbKghGG>2m$hgXn{Z|01`y*vUHD>kd&=s-=e|*Wi#Juzc73uEreVz;iaw?4@_b$ z?LabK-az>??984TFis&9@M;dk8S1clMqRDL#u6)iyRO)_E>EuB(ro+vzG}pYm!L=e zn!?4^u#9`?ZR0rsds9)CCL{!RR`4)hS3@(R1+m%n>aG?IgBs1jIcidmE&906ch9?~ zZ;`sroKq%2L@PWFnS~EMz-L@qjFDMX-oq#tk9}(0nh@Q{GoMi@6!)?K6LxPqHH zzJqGL0&&H~7cdmDMIaJ=ahr!G&}Fxw+lRDQ&Im51ocqU@uQK@QAMYyl52Hlj**uVy z*W{3nlEHzsgcqi|)rqEs;ejsI2Jh0+Y8jl<;{6pT-a;JC-dCRMm<8A^6;Os6lhi#h zU9!JEoII|jP<;cNY$`}0b!A4zV?GAPbdIH-CCAGO$c9_&oeGk**LO2nFqKy6 zEX28N3S9!ENyRg|Zx=DEb&h_-S)aRoj(byBFx;Ia)M+ziw?f5H@-9JUxKTt6>cL++ z#w}E{EW0HV+au;=6-D^*&qc<7Br7N;>1U4iz)3Kc_B^6kF>%WVstEW9Ah>E3uPa97b(TaW2My_X}1 zvT6e z?Y_^t?tJZb^-5@tBqK*6S|m=a?AFHjq~qS%yQs9}CT!02tz92GDfbcBqce<60Ih|T zEMT$GNW#D1OGkF9LL`OL*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}Q`Ib)*0Cy#7S_>`mia}!mQu_$l_^EGnz4e*>WTT%BeqcXmpnHmB~OnT z3w++NK6|GyV(d-~q)OoktInTS=}m0%1Tzw+`*6bAT!mp{YQBhCKsoJw67U9R!i`9` z(WPXsS@M4j&lu=vFYQIne5szi8TJg^(-`$-xMI}NnLr$S@G~588`0NljoW_xN@i%e zAzJ*>HIdjszndlnw$zY6@8_b=WN3kyRa2)PL|quo*RJ-%EyO5zwyR#$)8yLS*56*; zI}_}ak1}K;Zy5V}n3I5iXw+dh!ki`9u9+h<_ed&o-I|F#t16kVkxhGhgu4pXl-j=R z8bRTf@0oR|_iFkkDg2R}mo9XxkAHvP;e4<*HXugYh@VhpW4H#>0NR@dREYA1L-)JA z?V>!`wL6YDyh?T)1wfdK+HC7rN2DF?{=7?k3_`7eulsW4i!E8o(%pA27Dha?6hL4g z0GNFX&5maMOCBpVgb_mD7I`51BR|taa=CmsckAc3VTCQq|Ay!SC$az`GDJiY7kJJlzSk?1A9s^846xdNU% z7s5Ve640&-uN^3BU<PypXHEN>{7$DnNt84yJ$#UG3k6)mRO-7Gl9!6rK&2t41QK*lxDtSypP$ww{7hv9_sC;!3sUt~VQ zhHyba{CZ+XhfI{}Iy1(B_u!GKxztm~&06ILovtyMjVeigmRq`esw{pa*$+EL?0=rS zugefei2aJ7-$kl*tBXGyQ&dJ+hLXZGxPRP!9B_lkL~~@{Rq!C1;_22OW-%N(p2c%7 z4yPZbZsVshfzr`p`!+U3*S|i0K56MCw(_Ei!m!F?a$@m^^%b~x1S(K0{>1e5Y02Z= z6wB#e%xC)vZ~rD1#QhBXDyp?rf<~h-%FKlit4E|<8%h>1tr~LL-zm3pw*0cCOBDUl J@&YD%n literal 0 HcmV?d00001 diff --git a/tests/repo/categories.txt b/tests/repo/categories.txt new file mode 100644 index 00000000..a0aab2be --- /dev/null +++ b/tests/repo/categories.txt @@ -0,0 +1,7 @@ +Development +GuardianProject +Multimedia +None +Phone & SMS +Security +System diff --git a/tests/repo/index.xml b/tests/repo/index.xml new file mode 100644 index 00000000..14ee0205 --- /dev/null +++ b/tests/repo/index.xml @@ -0,0 +1,162 @@ + + + + This is a repository of apps to be used with F-Droid. Applications in this repository are either official binaries built by the original application developers, or are binaries built from source by the admin of f-droid.org using the tools on https://gitlab.com/u/fdroid. + http://foobarfoobarfoobar.onion/fdroid/repo + https://foo.bar/fdroid/repo + + + + + + obb.main.oldversion + 2013-12-31 + 2013-12-31 + OBB Main Old Version + + obb.main.oldversion.1444412523.png + <p>No description available</p> + GPLv3 + Development + Development + + https://github.com/eighthave/urzip + + 1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk + + 99999999 + + 0.1 + 1444412523 + obb.main.oldversion_1444412523.apk + 7562a36c9e2b38013b96663cf41f0f290dc7a248a81befa8d89e14f390c94c7f + 11470 + 4 + 18 + main.1434483388.obb.main.oldversion.obb + d3eb539a556352f3f47881d71fb0e5777b2f3e9a4251d283c18c67ce996774b7 + 2013-12-31 + b4964fd759edaa54e65bb476d0276880 + + + + obb.main.twoversions + 2015-10-12 + 2016-06-20 + OBB Main Two Versions + + obb.main.twoversions.1101617.png + <p>No description available</p> + GPLv3 + Development + Development + + https://github.com/eighthave/urzip + + 1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk + + 99999999 + + 0.1 + 1101617 + obb.main.twoversions_1101617.apk + obb.main.twoversions_1101617_src.tar.gz + 9bc74566f089ef030ac33e7fbd99d92f1a38f363fb499fed138d9e7b774e821c + 11481 + 4 + 18 + main.1101615.obb.main.twoversions.obb + d3eb539a556352f3f47881d71fb0e5777b2f3e9a4251d283c18c67ce996774b7 + 2016-06-20 + b4964fd759edaa54e65bb476d0276880 + + + 0.1 + 1101615 + obb.main.twoversions_1101615.apk + 7b0b7b9ba248e15751a16e3a0e01e1e24cbb673686c38422030cb75d5c33f0bb + 11480 + 4 + 18 + main.1101615.obb.main.twoversions.obb + d3eb539a556352f3f47881d71fb0e5777b2f3e9a4251d283c18c67ce996774b7 + 2016-01-01 + b4964fd759edaa54e65bb476d0276880 + + + 0.1 + 1101613 + obb.main.twoversions_1101613.apk + cce97a52ff18d843185be7f22ecb1a557c36b7a9f8ba07a8be94e328e00b35dc + 11477 + 4 + 18 + main.1101613.obb.main.twoversions.obb + d3eb539a556352f3f47881d71fb0e5777b2f3e9a4251d283c18c67ce996774b7 + 2015-10-12 + b4964fd759edaa54e65bb476d0276880 + + + + obb.mainpatch.current + 2016-04-23 + 2016-04-23 + OBB Main/Patch Current + + obb.mainpatch.current.1619.png + <p>No description available</p> + GPLv3 + Development + Development + + https://github.com/eighthave/urzip + + 1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk + + 99999999 + + 0.1 + 1619 + obb.mainpatch.current_1619.apk + eda5fc3ecfdac3252717e36bdbc9820865baeef162264af9ba5db7364f0e7a0c + 11479 + 4 + 18 + main.1619.obb.mainpatch.current.obb + d3eb539a556352f3f47881d71fb0e5777b2f3e9a4251d283c18c67ce996774b7 + patch.1619.obb.mainpatch.current.obb + d3eb539a556352f3f47881d71fb0e5777b2f3e9a4251d283c18c67ce996774b7 + 2016-04-23 + b4964fd759edaa54e65bb476d0276880 + + + + info.guardianproject.urzip + 2016-06-23 + 2016-06-23 + urzip-πÇÇπÇÇ现代汉语通用字-български-عربي1234 + 一个实用工具,获取已安装在您的设备上的应用的有关信息 + info.guardianproject.urzip.100.png + <p>It’s Urzip 是一个获得已安装 APK 相关信息的实用工具。它从您的设备上已安装的所有应用开始,一键触摸即可显示 APK 的指纹,并且提供到达 virustotal.com 和 androidobservatory.org 的快捷链接,让您方便地了解特定 APK 的档案。它还可以让您导出签名证书和生成 ApkSignaturePin Pin 文件供 TrustedIntents 库使用。</p><p>★ Urzip 支持下列语言: Deutsch, English, español, suomi, 日本語, 한국어, Norsk, português (Portugal), Русский, Slovenščina, Türkçe 没看到您的语言?帮忙翻译本应用吧: https://www.transifex.com/projects/p/urzip</p><p>★ 致用户:我们还缺少你喜欢的功能?发现了一个 bug?请告诉我们!我们乐于听取您的意见。请发送电子邮件至: support@guardianproject.info 或者加入我们的聊天室 https://guardianproject.info/contact</p> + GPLv3 + Development,GuardianProject + Development + https://dev.guardianproject.info/projects/urzip + https://github.com/guardianproject/urzip + https://dev.guardianproject.info/projects/urzip/issues + 1Fi5xUHiAPRKxHvyUGVFGt9extBe8Srdbk + + 9999999 + + 0.1 + 100 + urzip-πÇÇπÇÇ现代汉语通用字-български-عربي1234.apk + 15c0ec72c74a3791f42cdb43c57df0fb11a4dbb656851bbb8cf05b26a8372789 + 11471 + 4 + 18 + 2016-06-23 + b4964fd759edaa54e65bb476d0276880 + + + diff --git a/tests/run-tests b/tests/run-tests index fd58024a..09f401c1 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -158,17 +158,21 @@ echo_header "copy tests/repo, generate java/gpg keys, update, and gpgsign" REPOROOT=`create_test_dir` GNUPGHOME=$REPOROOT/gnupghome +KEYSTORE=$WORKSPACE/tests/keystore.jks cd $REPOROOT -$fdroid init -cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $REPOROOT/ +$fdroid init --keystore $KEYSTORE --repo-keyalias=sova +echo 'keystorepass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py +echo 'keypass = "r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI="' >> config.py +cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/ cp -a $WORKSPACE/tests/gnupghome $GNUPGHOME chmod 0700 $GNUPGHOME echo "accepted_formats = ['json', 'txt', 'yml']" >> config.py echo "install_list = 'org.adaway'" >> config.py -echo "uninstall_list = {'com.android.vending', 'com.facebook.orca',}" >> config.py +echo "uninstall_list = ('com.android.vending', 'com.facebook.orca',)" >> config.py echo "gpghome = '$GNUPGHOME'" >> config.py echo "gpgkey = 'CE71F7FB'" >> config.py -$fdroid update --verbose +echo "mirrors = ('http://foobarfoobarfoobar.onion/fdroid','https://foo.bar/fdroid',)" >> config.py +$fdroid update --verbose --pretty test -e repo/index.xml test -e repo/index.jar grep -F '