2014-04-10 18:31:14 +02:00
|
|
|
#!/bin/bash
|
2014-04-01 22:16:24 +02:00
|
|
|
|
2014-06-05 22:55:52 +02:00
|
|
|
set -e # quit script on error
|
2014-04-01 22:16:24 +02:00
|
|
|
|
2014-05-30 03:43:16 +02:00
|
|
|
echo_header() {
|
2015-11-01 13:51:25 +01:00
|
|
|
{ echo -e "==============================================================================\n$1"; } 2>/dev/null
|
2014-05-30 03:43:16 +02:00
|
|
|
}
|
|
|
|
|
2018-05-03 15:00:17 +02:00
|
|
|
get_fdroid_apk_filename() {
|
|
|
|
if [ -z $aapt ]; then
|
|
|
|
python3 -c "from androguard.core.bytecodes.apk import APK; a=APK('$1'); print(a.package+'_'+a.get_androidversion_code()+'.apk')"
|
|
|
|
else
|
|
|
|
$aapt dump badging "$1" | sed -n "s,^package: name='\(.*\)' versionCode='\([0-9][0-9]*\)' .*,\1_\2.apk,p"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2014-04-04 04:17:52 +02:00
|
|
|
copy_apks_into_repo() {
|
2014-06-05 22:55:52 +02:00
|
|
|
set +x
|
2017-09-19 10:57:29 +02:00
|
|
|
find $APKDIR -type f -name '*.apk' -print0 | while IFS= read -r -d '' f; do
|
2017-12-11 18:36:21 +01:00
|
|
|
echo $f | grep -F -v -e unaligned -e unsigned -e badsig -e badcert -e bad-unicode -e janus.apk || continue
|
2018-05-03 15:00:17 +02:00
|
|
|
apk=`get_fdroid_apk_filename "$f"`
|
2017-09-19 10:57:29 +02:00
|
|
|
test "$f" -nt repo/$apk && rm -f repo/$apk # delete existing if $f is newer
|
2014-06-02 19:21:54 +02:00
|
|
|
if [ ! -e repo/$apk ] && [ ! -e archive/$apk ]; then
|
|
|
|
echo "$f --> repo/$apk"
|
2017-09-19 10:57:29 +02:00
|
|
|
ln "$f" $1/repo/$apk || \
|
|
|
|
rsync -axv "$f" $1/repo/$apk # rsync if hard link is not possible
|
2020-10-12 17:39:40 +02:00
|
|
|
touch $1/.found-apks
|
2014-06-02 19:21:54 +02:00
|
|
|
fi
|
2014-04-04 04:17:52 +02:00
|
|
|
done
|
2020-10-12 17:39:40 +02:00
|
|
|
if [ ! -e $1/.found-apks ]; then
|
|
|
|
echo "ERROR: The dir APKDIR must have APKs in it! $APKDIR does not."
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-06-05 22:55:52 +02:00
|
|
|
set -x
|
2014-04-04 04:17:52 +02:00
|
|
|
}
|
|
|
|
|
2014-06-30 17:28:38 +02:00
|
|
|
# keep this as an old version to test the automatic parsing of build-tools
|
|
|
|
# verion numbers in `fdroid init`
|
2014-04-24 01:21:22 +02:00
|
|
|
create_fake_android_home() {
|
2014-07-03 22:33:40 +02:00
|
|
|
mkdir $1/tools
|
|
|
|
mkdir $1/platform-tools
|
2014-04-24 01:21:22 +02:00
|
|
|
mkdir $1/build-tools
|
2014-06-30 17:28:38 +02:00
|
|
|
mkdir $1/build-tools/19.0.2
|
|
|
|
touch $1/build-tools/19.0.2/aapt
|
2014-04-24 01:21:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
create_test_dir() {
|
|
|
|
test -e $WORKSPACE/.testfiles || mkdir $WORKSPACE/.testfiles
|
2016-02-15 15:29:11 +01:00
|
|
|
mktemp -d $WORKSPACE/.testfiles/run-tests.XXXX
|
2014-04-24 01:21:22 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
create_test_file() {
|
|
|
|
test -e $WORKSPACE/.testfiles || mkdir $WORKSPACE/.testfiles
|
2015-07-27 20:34:01 +02:00
|
|
|
TMPDIR=$WORKSPACE/.testfiles mktemp
|
2014-04-24 01:21:22 +02:00
|
|
|
}
|
|
|
|
|
2017-12-20 17:03:48 +01:00
|
|
|
fdroid_init_with_prebuilt_keystore() {
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
keystore=$WORKSPACE/tests/keystore.jks
|
|
|
|
else
|
|
|
|
keystore="$1"
|
|
|
|
fi
|
|
|
|
$fdroid init --keystore $keystore --repo-keyalias=sova
|
2020-10-22 23:34:47 +02:00
|
|
|
echo 'keystorepass: r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI=' >> config.yml
|
|
|
|
echo 'keypass: r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI=' >> config.yml
|
2017-12-20 17:03:48 +01:00
|
|
|
}
|
|
|
|
|
2017-04-12 15:26:51 +02:00
|
|
|
# the < is reverse since 0 means success in exit codes
|
|
|
|
have_git_2_3() {
|
|
|
|
python3 -c "import sys; from distutils.version import LooseVersion as V; sys.exit(V(sys.argv[3]) < V('2.3'))" `git --version`
|
|
|
|
}
|
|
|
|
|
2017-09-19 20:01:15 +02:00
|
|
|
is_MD5_disabled() {
|
|
|
|
javac $WORKSPACE/tests/IsMD5Disabled.java && java -cp $WORKSPACE/tests IsMD5Disabled
|
|
|
|
return $?
|
|
|
|
}
|
|
|
|
|
2014-06-02 19:21:54 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
# "main"
|
|
|
|
|
2014-11-17 17:40:48 +01:00
|
|
|
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
2014-06-27 23:06:18 +02:00
|
|
|
set +x
|
2014-06-02 19:21:54 +02:00
|
|
|
echo "Usage: $0 '/path/to/folder/with/apks'"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2014-11-17 17:40:48 +01:00
|
|
|
if [ -z "$ANDROID_HOME" ]; then
|
2018-05-03 14:27:26 +02:00
|
|
|
if python3 -c "import androguard"; then
|
|
|
|
echo "ANDROID_HOME is not set, using androguard"
|
|
|
|
else
|
|
|
|
echo "ERROR: ANDROID_HOME is not set, androguard is not available!"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
else
|
|
|
|
echo "Using ANDROID_HOME=$ANDROID_HOME"
|
2014-06-17 01:18:28 +02:00
|
|
|
fi
|
|
|
|
|
2015-11-01 13:48:25 +01:00
|
|
|
if [ -d tests ]; then
|
|
|
|
cd tests
|
|
|
|
fi
|
|
|
|
|
2014-11-17 17:40:48 +01:00
|
|
|
if [ -z "$1" ]; then
|
2014-06-27 23:06:18 +02:00
|
|
|
APKDIR=`pwd`
|
|
|
|
else
|
|
|
|
APKDIR=$1
|
|
|
|
fi
|
2019-09-25 12:21:04 +02:00
|
|
|
if [ ! -d "$APKDIR" ]; then
|
|
|
|
echo "ERROR: '$APKDIR' does not exist!"
|
|
|
|
exit 1
|
|
|
|
fi
|
2014-06-02 19:21:54 +02:00
|
|
|
|
2014-04-01 22:16:24 +02:00
|
|
|
if [ -z $WORKSPACE ]; then
|
|
|
|
WORKSPACE=`dirname $(pwd)`
|
|
|
|
echo "Setting Workspace to $WORKSPACE"
|
|
|
|
fi
|
|
|
|
|
|
|
|
# allow the location of the script to be overridden
|
|
|
|
if [ -z $fdroid ]; then
|
|
|
|
fdroid="$WORKSPACE/fdroid"
|
|
|
|
fi
|
|
|
|
|
2014-06-17 01:18:28 +02:00
|
|
|
# allow the location of aapt to be overridden
|
|
|
|
if [ -z $aapt ]; then
|
2018-05-18 10:51:24 +02:00
|
|
|
aapt=`ls -1 $ANDROID_HOME/build-tools/*/aapt 2> /dev/null | sort | tail -1`
|
2014-06-17 01:18:28 +02:00
|
|
|
fi
|
|
|
|
|
2017-09-16 10:03:17 +02:00
|
|
|
# try to use GNU sed on OSX/BSD cuz BSD sed sucks
|
|
|
|
if which gsed; then
|
|
|
|
sed=gsed
|
|
|
|
else
|
|
|
|
sed=sed
|
|
|
|
fi
|
|
|
|
|
2015-11-01 13:52:16 +01:00
|
|
|
set -x # show each command as it is executed
|
2014-06-27 23:06:52 +02:00
|
|
|
|
2014-07-01 03:40:31 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "run commit hooks"
|
|
|
|
|
|
|
|
cd $WORKSPACE
|
2019-07-03 19:39:52 +02:00
|
|
|
test -x ./hooks/pre-commit && ./hooks/pre-commit
|
2014-07-01 03:40:31 +02:00
|
|
|
|
|
|
|
|
2014-08-30 17:07:29 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "test python getsig replacement"
|
|
|
|
|
|
|
|
cd $WORKSPACE/tests/getsig
|
|
|
|
./make.sh
|
2016-11-07 21:47:53 +01:00
|
|
|
|
|
|
|
cd $WORKSPACE/tests
|
2018-08-06 16:12:10 +02:00
|
|
|
for testcase in $WORKSPACE/tests/*.TestCase; do
|
2018-02-21 14:08:03 +01:00
|
|
|
if [ $testcase == $WORKSPACE/tests/install.TestCase ]; then
|
|
|
|
echo "skipping install.TestCase, its too troublesome in CI builds"
|
|
|
|
continue
|
|
|
|
fi
|
2014-12-09 15:15:36 +01:00
|
|
|
$testcase
|
|
|
|
done
|
2014-08-30 17:07:29 +02:00
|
|
|
|
|
|
|
|
2015-09-01 11:23:23 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "print fdroid version"
|
|
|
|
|
|
|
|
$fdroid --version
|
|
|
|
|
|
|
|
|
2017-03-16 18:51:43 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header 'run process when building and signing are on separate machines'
|
|
|
|
|
2018-05-14 14:41:49 +02:00
|
|
|
if which zipalign || ls -1 $ANDROID_HOME/build-tools/*/zipalign; then
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
cp $WORKSPACE/tests/keystore.jks $REPOROOT/
|
|
|
|
$fdroid init --keystore keystore.jks --repo-keyalias=sova
|
2020-10-22 23:34:47 +02:00
|
|
|
echo 'make_current_version_link: true' >> config.yml
|
|
|
|
echo 'keystorepass: r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI=' >> config.yml
|
|
|
|
echo 'keypass: r9aquRHYoI8+dYz6jKrLntQ5/NJNASFBacJh7Jv2BlI=' >> config.yml
|
|
|
|
echo 'keydname: "CN=Birdman, OU=Cell, O=Alcatraz, L=Alcatraz, S=California, C=US"' >> config.yml
|
2018-05-14 14:41:49 +02:00
|
|
|
test -d archive || mkdir archive
|
|
|
|
test -d metadata || mkdir metadata
|
|
|
|
cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/
|
|
|
|
test -d repo || mkdir repo
|
|
|
|
test -d unsigned || mkdir unsigned
|
|
|
|
cp $WORKSPACE/tests/urzip-release-unsigned.apk unsigned/info.guardianproject.urzip_100.apk
|
|
|
|
$fdroid publish --verbose
|
|
|
|
$fdroid update --verbose --nosign
|
|
|
|
$fdroid signindex --verbose
|
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
|
|
|
test -e repo/index-v1.jar
|
2018-09-03 18:07:40 +02:00
|
|
|
test -e tmp/apkcache.json
|
|
|
|
! test -z tmp/apkcache.json
|
2018-05-14 14:41:49 +02:00
|
|
|
test -L urzip.apk
|
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
|
|
|
fi
|
2017-03-16 18:51:43 +01:00
|
|
|
|
2016-02-16 23:36:27 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "test UTF-8 metadata"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
|
2017-12-20 17:03:48 +01:00
|
|
|
fdroid_init_with_prebuilt_keystore
|
2020-10-22 23:34:47 +02:00
|
|
|
$sed -i.tmp 's,^ *repo_description.*,repo_description: |\n 获取已安装在您的设备上的应用的,' config.yml
|
|
|
|
echo "mirrors: ['https://foo.bar/fdroid', 'http://secret.onion/fdroid']" >> config.yml
|
2016-02-16 23:36:27 +01:00
|
|
|
mkdir metadata
|
2017-09-19 16:48:20 +02:00
|
|
|
cp $WORKSPACE/tests/urzip.apk $WORKSPACE/tests/bad-unicode*.apk repo/
|
2016-12-06 16:11:25 +01:00
|
|
|
cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/
|
2016-02-16 23:36:27 +01:00
|
|
|
|
|
|
|
$fdroid readmeta
|
|
|
|
$fdroid update
|
|
|
|
|
|
|
|
|
2016-11-07 21:47:53 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
2017-09-19 16:41:50 +02:00
|
|
|
echo_header 'run "fdroid build" in fresh git checkout from import.TestCase'
|
2016-11-07 21:47:53 +01:00
|
|
|
|
|
|
|
cd $WORKSPACE/tests/tmp/importer
|
2017-02-23 22:32:08 +01:00
|
|
|
git remote update -p
|
|
|
|
git clean -fdx
|
|
|
|
# stick with known working commit, in case future commits break things for this code
|
2017-11-09 13:11:31 +01:00
|
|
|
git reset --hard fea54e1161d5eb9eb1a54e26253ef84d3ab63705
|
2017-11-09 14:07:28 +01:00
|
|
|
if [ -d $ANDROID_HOME/platforms/android-23 && -d $ANDROID_HOME/build-tools/23.0.3 ]; then
|
2016-11-07 21:47:53 +01:00
|
|
|
$fdroid build --verbose org.fdroid.ci.test.app:300
|
|
|
|
else
|
2017-09-19 16:41:50 +02:00
|
|
|
echo 'WARNING: Skipping "fdroid build" test since android-23 is missing!'
|
2016-11-07 21:47:53 +01:00
|
|
|
fi
|
|
|
|
|
2017-05-25 20:39:15 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
2017-09-19 16:41:50 +02:00
|
|
|
echo_header 'copy git import and run "fdroid scanner" on it'
|
2017-05-25 20:39:15 +02:00
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
cp $WORKSPACE/examples/fdroid-icon.png $REPOROOT/
|
|
|
|
mkdir metadata
|
2020-06-09 22:34:23 +02:00
|
|
|
echo "AutoName: Just A Test" > metadata/org.fdroid.ci.test.app.yml
|
|
|
|
echo "WebSite: " >> metadata/org.fdroid.ci.test.app.yml
|
|
|
|
echo "Builds:" >> metadata/org.fdroid.ci.test.app.yml
|
|
|
|
echo " - versionName: 0.3" >> metadata/org.fdroid.ci.test.app.yml
|
|
|
|
echo " versionCode: 300" >> metadata/org.fdroid.ci.test.app.yml
|
|
|
|
echo " commit: 0.3" >> metadata/org.fdroid.ci.test.app.yml
|
|
|
|
echo " subdir: app" >> metadata/org.fdroid.ci.test.app.yml
|
|
|
|
echo " gradle:" >> metadata/org.fdroid.ci.test.app.yml
|
|
|
|
echo " - yes" >> metadata/org.fdroid.ci.test.app.yml
|
|
|
|
echo "" >> metadata/org.fdroid.ci.test.app.yml
|
|
|
|
echo "Repo: https://gitlab.com/fdroid/ci-test-app.git" >> metadata/org.fdroid.ci.test.app.yml
|
|
|
|
echo "RepoType: git" >> metadata/org.fdroid.ci.test.app.yml
|
2017-05-25 20:39:15 +02:00
|
|
|
mkdir build
|
|
|
|
cp -a $WORKSPACE/tests/tmp/importer build/org.fdroid.ci.test.app
|
|
|
|
ls -l build/org.fdroid.ci.test.app
|
|
|
|
$fdroid scanner org.fdroid.ci.test.app --verbose
|
|
|
|
|
2016-11-07 21:47:53 +01:00
|
|
|
|
2016-06-23 17:11:49 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
2016-11-03 10:26:38 +01:00
|
|
|
echo_header "copy tests/repo, generate java/gpg keys, update, and gpgsign"
|
2016-06-23 17:11:49 +02:00
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
2016-11-03 10:26:38 +01:00
|
|
|
GNUPGHOME=$REPOROOT/gnupghome
|
2016-06-23 17:11:49 +02:00
|
|
|
cd $REPOROOT
|
2017-12-20 17:03:48 +01:00
|
|
|
fdroid_init_with_prebuilt_keystore
|
2017-02-23 21:23:45 +01:00
|
|
|
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/
|
2016-11-03 10:26:38 +01:00
|
|
|
cp -a $WORKSPACE/tests/gnupghome $GNUPGHOME
|
|
|
|
chmod 0700 $GNUPGHOME
|
2020-10-22 23:34:47 +02:00
|
|
|
echo "install_list: org.adaway" >> config.yml
|
|
|
|
echo "uninstall_list: [com.android.vending, com.facebook.orca]" >> config.yml
|
|
|
|
echo "gpghome: $GNUPGHOME" >> config.yml
|
|
|
|
echo "gpgkey: CE71F7FB" >> config.yml
|
|
|
|
echo "mirrors: ['http://foobarfoobarfoobar.onion/fdroid', 'https://foo.bar/fdroid']" >> config.yml
|
2017-02-23 21:23:45 +01:00
|
|
|
$fdroid update --verbose --pretty
|
2016-06-23 17:11:49 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2016-06-23 17:11:49 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2016-08-16 21:02:15 +02:00
|
|
|
grep -F '<install packageName=' repo/index.xml > /dev/null
|
2016-08-23 20:30:27 +02:00
|
|
|
grep -F '<uninstall packageName=' repo/index.xml > /dev/null
|
2017-09-14 14:34:29 +02:00
|
|
|
# OSX tests are run on Travis-CI, and gpg fails to launch gpg-agent there
|
2018-06-22 10:11:16 +02:00
|
|
|
if [ "$TRAVIS_OS_NAME" != "osx" ] && which gpg; then
|
2017-09-14 14:34:29 +02:00
|
|
|
$fdroid gpgsign --verbose
|
|
|
|
$fdroid gpgsign --verbose
|
|
|
|
test -e repo/obb.mainpatch.current_1619.apk.asc
|
|
|
|
test -e repo/obb.main.twoversions_1101617_src.tar.gz.asc
|
|
|
|
! test -e repo/obb.mainpatch.current_1619.apk.asc.asc
|
|
|
|
! test -e repo/obb.main.twoversions_1101617_src.tar.gz.asc.asc
|
|
|
|
! test -e repo/index.xml.asc
|
|
|
|
fi
|
2016-06-23 17:11:49 +02:00
|
|
|
|
2018-04-25 14:20:19 +02:00
|
|
|
v0timestamp=`$sed -n -e 's,.*timestamp="\([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\)".*,\1,p' repo/index.xml`
|
|
|
|
v1timestamp=`$sed -n -e 's,.*"timestamp": \([0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]\).*,\1,p' repo/index-v1.json`
|
|
|
|
test $v0timestamp -eq $v1timestamp
|
|
|
|
|
2017-02-23 21:23:45 +01:00
|
|
|
# we can't easily reproduce the timestamps for things, so just hardcode them
|
2017-09-16 10:03:17 +02:00
|
|
|
$sed -i.tmp -e 's,timestamp="[0-9]*",timestamp="1480431575",' repo/index.xml
|
2017-06-27 23:33:24 +02:00
|
|
|
diff -uw $WORKSPACE/tests/repo/index.xml repo/index.xml
|
2017-09-22 16:12:41 +02:00
|
|
|
sed -i --expression='s,"timestamp": [0-9]*,"timestamp": 1502845383782,' repo/index-v1.json
|
|
|
|
diff -uw $WORKSPACE/tests/repo/index-v1.json repo/index-v1.json
|
2017-06-27 23:33:24 +02:00
|
|
|
|
|
|
|
|
2017-06-27 21:40:39 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header 'test moving lots of APKs to the archive'
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
2017-12-20 17:03:48 +01:00
|
|
|
fdroid_init_with_prebuilt_keystore
|
2020-10-22 23:34:47 +02:00
|
|
|
$sed -i.tmp '/allow_disabled_algorithms/d' config.yml
|
2017-06-27 21:40:39 +02:00
|
|
|
test -d metadata || mkdir metadata
|
2020-06-09 22:34:23 +02:00
|
|
|
cp $WORKSPACE/tests/metadata/*.yml metadata/
|
|
|
|
echo 'Summary: good test version of urzip' > metadata/info.guardianproject.urzip.yml
|
|
|
|
echo 'Summary: good MD5 sig, which is disabled algorithm' > metadata/org.bitbucket.tickytacky.mirrormirror.yml
|
|
|
|
$sed -i.tmp '/ArchivePolicy:/d' metadata/*.yml
|
2017-06-27 21:40:39 +02:00
|
|
|
test -d repo || mkdir repo
|
|
|
|
cp $WORKSPACE/tests/urzip.apk \
|
|
|
|
$WORKSPACE/tests/org.bitbucket.tickytacky.mirrormirror_[0-9].apk \
|
|
|
|
$WORKSPACE/tests/repo/com.politedroid_[0-9].apk \
|
|
|
|
$WORKSPACE/tests/repo/obb.main.twoversions_110161[357].apk \
|
|
|
|
repo/
|
2020-10-22 23:34:47 +02:00
|
|
|
$sed -i.tmp 's,archive_older: [0-9],archive_older: 3,' config.yml
|
2017-06-27 21:40:39 +02:00
|
|
|
|
|
|
|
$fdroid update --pretty --nosign
|
2019-07-10 13:22:55 +02:00
|
|
|
if which apksigner; then
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 2
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 10
|
|
|
|
else
|
|
|
|
echo "This will fail when jarsigner allows MD5 for APK signatures"
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 5
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 7
|
|
|
|
fi
|
2017-06-27 21:40:39 +02:00
|
|
|
|
2017-06-27 23:33:24 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
2019-07-10 13:22:55 +02:00
|
|
|
if ! which apksigner; then
|
|
|
|
echo_header 'test per-app "Archive Policy"'
|
2017-06-23 23:55:12 +02:00
|
|
|
|
2019-07-10 13:22:55 +02:00
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
fdroid_init_with_prebuilt_keystore
|
|
|
|
test -d metadata || mkdir metadata
|
2020-06-09 22:01:31 +02:00
|
|
|
cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/
|
2019-07-10 13:22:55 +02:00
|
|
|
test -d repo || mkdir repo
|
|
|
|
cp $WORKSPACE/tests/repo/com.politedroid_[0-9].apk repo/
|
2020-10-22 23:34:47 +02:00
|
|
|
$sed -i.tmp 's,archive_older: [0-9],archive_older: 3,' config.yml
|
2019-07-10 13:22:55 +02:00
|
|
|
|
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 0
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 4
|
|
|
|
grep -F com.politedroid_3.apk repo/index.xml
|
|
|
|
grep -F com.politedroid_4.apk repo/index.xml
|
|
|
|
grep -F com.politedroid_5.apk repo/index.xml
|
|
|
|
grep -F com.politedroid_6.apk repo/index.xml
|
|
|
|
test -e repo/com.politedroid_3.apk
|
|
|
|
test -e repo/com.politedroid_4.apk
|
|
|
|
test -e repo/com.politedroid_5.apk
|
|
|
|
test -e repo/com.politedroid_6.apk
|
|
|
|
|
|
|
|
echo "enable one app in the repo"
|
2020-06-09 22:34:23 +02:00
|
|
|
$sed -i.tmp 's,^ArchivePolicy: 4,ArchivePolicy: 1,' metadata/com.politedroid.yml
|
2019-07-10 13:22:55 +02:00
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 3
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 1
|
|
|
|
grep -F com.politedroid_3.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_4.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_5.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_6.apk repo/index.xml
|
|
|
|
test -e archive/com.politedroid_3.apk
|
|
|
|
test -e archive/com.politedroid_4.apk
|
|
|
|
test -e archive/com.politedroid_5.apk
|
|
|
|
test -e repo/com.politedroid_6.apk
|
|
|
|
|
|
|
|
echo "remove all apps from the repo"
|
2020-06-09 22:34:23 +02:00
|
|
|
$sed -i.tmp 's,^ArchivePolicy: 1,ArchivePolicy: 0,' metadata/com.politedroid.yml
|
2019-07-10 13:22:55 +02:00
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 4
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 0
|
|
|
|
grep -F com.politedroid_3.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_4.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_5.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_6.apk archive/index.xml
|
|
|
|
test -e archive/com.politedroid_3.apk
|
|
|
|
test -e archive/com.politedroid_4.apk
|
|
|
|
test -e archive/com.politedroid_5.apk
|
|
|
|
test -e archive/com.politedroid_6.apk
|
|
|
|
! test -e repo/com.politedroid_6.apk
|
|
|
|
|
|
|
|
echo "move back one from archive to the repo"
|
2020-06-09 22:34:23 +02:00
|
|
|
$sed -i.tmp 's,^ArchivePolicy: 0,ArchivePolicy: 1,' metadata/com.politedroid.yml
|
2019-07-10 13:22:55 +02:00
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 3
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 1
|
|
|
|
grep -F com.politedroid_3.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_4.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_5.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_6.apk repo/index.xml
|
|
|
|
test -e archive/com.politedroid_3.apk
|
|
|
|
test -e archive/com.politedroid_4.apk
|
|
|
|
test -e archive/com.politedroid_5.apk
|
|
|
|
! test -e archive/com.politedroid_6.apk
|
|
|
|
test -e repo/com.politedroid_6.apk
|
2019-12-23 20:07:56 +01:00
|
|
|
|
|
|
|
echo "set an earlier version as CVC and test that it's the only one not archived"
|
2020-06-09 22:34:23 +02:00
|
|
|
$sed -i.tmp 's,^CurrentVersionCode: 6,CurrentVersionCode: 5,' metadata/com.politedroid.yml
|
2019-12-23 20:07:56 +01:00
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 3
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 1
|
|
|
|
grep -F com.politedroid_3.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_4.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_5.apk repo/index.xml
|
|
|
|
grep -F com.politedroid_6.apk archive/index.xml
|
|
|
|
test -e archive/com.politedroid_3.apk
|
|
|
|
test -e archive/com.politedroid_4.apk
|
|
|
|
test -e repo/com.politedroid_5.apk
|
|
|
|
! test -e repo/com.politedroid_6.apk
|
|
|
|
test -e archive/com.politedroid_6.apk
|
2019-07-10 13:22:55 +02:00
|
|
|
fi
|
2017-06-23 23:55:12 +02:00
|
|
|
|
2017-06-27 23:33:24 +02:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header 'test moving old APKs to and from the archive'
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
2017-12-20 17:03:48 +01:00
|
|
|
fdroid_init_with_prebuilt_keystore
|
2017-06-27 23:33:24 +02:00
|
|
|
test -d metadata || mkdir metadata
|
2020-06-09 22:01:31 +02:00
|
|
|
cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/
|
2020-06-09 22:34:23 +02:00
|
|
|
$sed -i.tmp '/ArchivePolicy:/d' metadata/com.politedroid.yml
|
2017-06-27 23:33:24 +02:00
|
|
|
test -d repo || mkdir repo
|
|
|
|
cp $WORKSPACE/tests/repo/com.politedroid_[0-9].apk repo/
|
2020-10-22 23:34:47 +02:00
|
|
|
$sed -i.tmp 's,archive_older: [0-9],archive_older: 3,' config.yml
|
2017-06-27 23:33:24 +02:00
|
|
|
|
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 1
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 3
|
|
|
|
grep -F com.politedroid_3.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_4.apk repo/index.xml
|
|
|
|
grep -F com.politedroid_5.apk repo/index.xml
|
|
|
|
grep -F com.politedroid_6.apk repo/index.xml
|
|
|
|
test -e archive/com.politedroid_3.apk
|
|
|
|
test -e repo/com.politedroid_4.apk
|
|
|
|
test -e repo/com.politedroid_5.apk
|
|
|
|
test -e repo/com.politedroid_6.apk
|
|
|
|
|
2020-10-22 23:34:47 +02:00
|
|
|
$sed -i.tmp 's,archive_older: 3,archive_older: 1,' config.yml
|
2017-06-27 23:33:24 +02:00
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 3
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 1
|
|
|
|
grep -F com.politedroid_3.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_4.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_5.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_6.apk repo/index.xml
|
|
|
|
test -e archive/com.politedroid_3.apk
|
|
|
|
test -e archive/com.politedroid_4.apk
|
|
|
|
test -e archive/com.politedroid_5.apk
|
|
|
|
test -e repo/com.politedroid_6.apk
|
|
|
|
|
|
|
|
# disabling deletes from the archive
|
2020-06-09 22:34:23 +02:00
|
|
|
$sed -i.tmp 's/\(versionCode: 4\)/\1\n disable: testing deletion/' metadata/com.politedroid.yml
|
2017-06-27 23:33:24 +02:00
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 2
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 1
|
|
|
|
grep -F com.politedroid_3.apk archive/index.xml
|
|
|
|
! grep -F com.politedroid_4.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_5.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_6.apk repo/index.xml
|
|
|
|
test -e archive/com.politedroid_3.apk
|
|
|
|
! test -e archive/com.politedroid_4.apk
|
|
|
|
test -e archive/com.politedroid_5.apk
|
|
|
|
test -e repo/com.politedroid_6.apk
|
|
|
|
|
|
|
|
# disabling deletes from the repo, and promotes one from the archive
|
2020-06-09 22:34:23 +02:00
|
|
|
$sed -i.tmp 's/\(versionCode: 6\)/\1\n disable: testing deletion/' metadata/com.politedroid.yml
|
2017-06-27 23:33:24 +02:00
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 1
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 1
|
|
|
|
grep -F com.politedroid_3.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_5.apk repo/index.xml
|
|
|
|
! grep -F com.politedroid_6.apk repo/index.xml
|
|
|
|
test -e archive/com.politedroid_3.apk
|
|
|
|
test -e repo/com.politedroid_5.apk
|
|
|
|
! test -e repo/com.politedroid_6.apk
|
2016-06-23 17:11:49 +02:00
|
|
|
|
2017-05-31 21:20:35 +02:00
|
|
|
|
2018-05-25 11:56:13 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header 'test that verify can succeed and fail'
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
test -d tmp || mkdir tmp
|
|
|
|
test -d unsigned || mkdir unsigned
|
|
|
|
cp $WORKSPACE/tests/repo/com.politedroid_6.apk tmp/
|
|
|
|
cp $WORKSPACE/tests/repo/com.politedroid_6.apk unsigned/
|
|
|
|
$fdroid verify --reuse-remote-apk --verbose com.politedroid
|
|
|
|
# force a fail
|
|
|
|
cp $WORKSPACE/tests/repo/com.politedroid_5.apk unsigned/com.politedroid_6.apk
|
|
|
|
! $fdroid verify --reuse-remote-apk --verbose com.politedroid
|
|
|
|
|
|
|
|
|
2017-06-27 21:40:39 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header 'test allowing disabled signatures in repo and archive'
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
2017-12-20 17:03:48 +01:00
|
|
|
fdroid_init_with_prebuilt_keystore
|
2020-10-22 23:34:47 +02:00
|
|
|
echo 'allow_disabled_algorithms: true' >> config.yml
|
|
|
|
$sed -i.tmp 's,archive_older: [0-9],archive_older: 3,' config.yml
|
2017-06-27 21:40:39 +02:00
|
|
|
test -d metadata || mkdir metadata
|
2020-06-09 22:01:31 +02:00
|
|
|
cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/
|
2020-06-09 22:34:23 +02:00
|
|
|
echo 'Summary: good test version of urzip' > metadata/info.guardianproject.urzip.yml
|
|
|
|
echo 'Summary: good MD5 sig, disabled algorithm' > metadata/org.bitbucket.tickytacky.mirrormirror.yml
|
|
|
|
$sed -i.tmp '/ArchivePolicy:/d' metadata/*.yml
|
2017-06-27 21:40:39 +02:00
|
|
|
test -d repo || mkdir repo
|
|
|
|
cp $WORKSPACE/tests/repo/com.politedroid_[0-9].apk \
|
|
|
|
$WORKSPACE/tests/org.bitbucket.tickytacky.mirrormirror_[0-9].apk \
|
|
|
|
$WORKSPACE/tests/urzip-badsig.apk \
|
|
|
|
repo/
|
|
|
|
|
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 2
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 6
|
|
|
|
grep -F com.politedroid_3.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_4.apk repo/index.xml
|
|
|
|
grep -F com.politedroid_5.apk repo/index.xml
|
|
|
|
grep -F com.politedroid_6.apk repo/index.xml
|
|
|
|
grep -F org.bitbucket.tickytacky.mirrormirror_1.apk archive/index.xml
|
|
|
|
grep -F org.bitbucket.tickytacky.mirrormirror_2.apk repo/index.xml
|
|
|
|
grep -F org.bitbucket.tickytacky.mirrormirror_3.apk repo/index.xml
|
|
|
|
grep -F org.bitbucket.tickytacky.mirrormirror_4.apk repo/index.xml
|
|
|
|
! grep -F urzip-badsig.apk repo/index.xml
|
|
|
|
! grep -F urzip-badsig.apk archive/index.xml
|
|
|
|
test -e archive/com.politedroid_3.apk
|
|
|
|
test -e repo/com.politedroid_4.apk
|
|
|
|
test -e repo/com.politedroid_5.apk
|
|
|
|
test -e repo/com.politedroid_6.apk
|
|
|
|
test -e archive/org.bitbucket.tickytacky.mirrormirror_1.apk
|
|
|
|
test -e repo/org.bitbucket.tickytacky.mirrormirror_2.apk
|
|
|
|
test -e repo/org.bitbucket.tickytacky.mirrormirror_3.apk
|
|
|
|
test -e repo/org.bitbucket.tickytacky.mirrormirror_4.apk
|
|
|
|
test -e archive/urzip-badsig.apk
|
|
|
|
|
2019-07-10 13:22:55 +02:00
|
|
|
if ! which apksigner; then
|
2020-10-22 23:34:47 +02:00
|
|
|
$sed -i.tmp '/allow_disabled_algorithms/d' config.yml
|
2019-07-10 13:22:55 +02:00
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 5
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 3
|
|
|
|
grep -F org.bitbucket.tickytacky.mirrormirror_1.apk archive/index.xml
|
|
|
|
grep -F org.bitbucket.tickytacky.mirrormirror_2.apk archive/index.xml
|
|
|
|
grep -F org.bitbucket.tickytacky.mirrormirror_3.apk archive/index.xml
|
|
|
|
grep -F org.bitbucket.tickytacky.mirrormirror_4.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_3.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_4.apk repo/index.xml
|
|
|
|
grep -F com.politedroid_5.apk repo/index.xml
|
|
|
|
grep -F com.politedroid_6.apk repo/index.xml
|
|
|
|
! grep -F urzip-badsig.apk repo/index.xml
|
|
|
|
! grep -F urzip-badsig.apk archive/index.xml
|
|
|
|
test -e archive/org.bitbucket.tickytacky.mirrormirror_1.apk
|
|
|
|
test -e archive/org.bitbucket.tickytacky.mirrormirror_2.apk
|
|
|
|
test -e archive/org.bitbucket.tickytacky.mirrormirror_3.apk
|
|
|
|
test -e archive/org.bitbucket.tickytacky.mirrormirror_4.apk
|
|
|
|
test -e archive/com.politedroid_3.apk
|
|
|
|
test -e archive/urzip-badsig.apk
|
|
|
|
test -e repo/com.politedroid_4.apk
|
|
|
|
test -e repo/com.politedroid_5.apk
|
|
|
|
test -e repo/com.politedroid_6.apk
|
|
|
|
fi
|
2017-06-27 21:40:39 +02:00
|
|
|
|
2019-12-24 17:18:42 +01:00
|
|
|
# test unarchiving when disabled_algorithms are allowed again
|
2020-10-22 23:34:47 +02:00
|
|
|
echo 'allow_disabled_algorithms: true' >> config.yml
|
2019-12-24 17:18:42 +01:00
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
test `grep '<package>' archive/index.xml | wc -l` -eq 2
|
|
|
|
test `grep '<package>' repo/index.xml | wc -l` -eq 6
|
|
|
|
grep -F com.politedroid_3.apk archive/index.xml
|
|
|
|
grep -F com.politedroid_4.apk repo/index.xml
|
|
|
|
grep -F com.politedroid_5.apk repo/index.xml
|
|
|
|
grep -F com.politedroid_6.apk repo/index.xml
|
|
|
|
grep -F org.bitbucket.tickytacky.mirrormirror_1.apk archive/index.xml
|
|
|
|
grep -F org.bitbucket.tickytacky.mirrormirror_2.apk repo/index.xml
|
|
|
|
grep -F org.bitbucket.tickytacky.mirrormirror_3.apk repo/index.xml
|
|
|
|
grep -F org.bitbucket.tickytacky.mirrormirror_4.apk repo/index.xml
|
|
|
|
! grep -F urzip-badsig.apk repo/index.xml
|
|
|
|
! grep -F urzip-badsig.apk archive/index.xml
|
|
|
|
test -e archive/com.politedroid_3.apk
|
|
|
|
test -e repo/com.politedroid_4.apk
|
|
|
|
test -e repo/com.politedroid_5.apk
|
|
|
|
test -e repo/com.politedroid_6.apk
|
|
|
|
test -e archive/org.bitbucket.tickytacky.mirrormirror_1.apk
|
|
|
|
test -e repo/org.bitbucket.tickytacky.mirrormirror_2.apk
|
|
|
|
test -e repo/org.bitbucket.tickytacky.mirrormirror_3.apk
|
|
|
|
test -e repo/org.bitbucket.tickytacky.mirrormirror_4.apk
|
|
|
|
test -e archive/urzip-badsig.apk
|
2017-06-27 21:40:39 +02:00
|
|
|
|
2017-05-31 21:20:35 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
2017-05-31 21:43:40 +02:00
|
|
|
echo_header 'rename apks with `fdroid update --rename-apks`, --nosign for speed'
|
2017-05-31 21:20:35 +02:00
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
2017-12-20 17:03:48 +01:00
|
|
|
fdroid_init_with_prebuilt_keystore
|
2020-10-22 23:34:47 +02:00
|
|
|
echo 'keydname: "CN=Birdman, OU=Cell, O=Alcatraz, L=Alcatraz, S=California, C=US"' >> config.yml
|
2017-05-31 21:20:35 +02:00
|
|
|
test -d metadata || mkdir metadata
|
|
|
|
cp $WORKSPACE/tests/metadata/info.guardianproject.urzip.yml metadata/
|
|
|
|
test -d repo || mkdir repo
|
|
|
|
cp $WORKSPACE/tests/urzip.apk "repo/asdfiuhk urzip-πÇÇπÇÇ现代汉语通用字-български-عربي1234 ö.apk"
|
2017-05-31 21:43:40 +02:00
|
|
|
$fdroid update --rename-apks --pretty --nosign
|
2017-05-31 21:20:35 +02:00
|
|
|
test -e repo/info.guardianproject.urzip_100.apk
|
2017-05-31 21:43:40 +02:00
|
|
|
grep -F 'info.guardianproject.urzip_100.apk' repo/index-v1.json repo/index.xml
|
2017-05-31 21:20:35 +02:00
|
|
|
cp $WORKSPACE/tests/urzip-release.apk repo/
|
2017-05-31 21:43:40 +02:00
|
|
|
$fdroid update --rename-apks --pretty --nosign
|
2017-05-31 21:20:35 +02:00
|
|
|
test -e repo/info.guardianproject.urzip_100.apk
|
|
|
|
test -e repo/info.guardianproject.urzip_100_b4964fd.apk
|
2017-05-31 21:43:40 +02:00
|
|
|
grep -F 'info.guardianproject.urzip_100.apk' repo/index-v1.json repo/index.xml
|
|
|
|
grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index-v1.json
|
|
|
|
! grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index.xml
|
2017-05-31 21:20:35 +02:00
|
|
|
cp $WORKSPACE/tests/urzip-release.apk repo/
|
2017-05-31 21:43:40 +02:00
|
|
|
$fdroid update --rename-apks --pretty --nosign
|
2017-05-31 21:20:35 +02:00
|
|
|
test -e repo/info.guardianproject.urzip_100.apk
|
|
|
|
test -e repo/info.guardianproject.urzip_100_b4964fd.apk
|
|
|
|
test -e duplicates/repo/info.guardianproject.urzip_100_b4964fd.apk
|
2017-05-31 21:43:40 +02:00
|
|
|
grep -F 'info.guardianproject.urzip_100.apk' repo/index-v1.json repo/index.xml
|
|
|
|
grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index-v1.json
|
|
|
|
! grep -F 'info.guardianproject.urzip_100_b4964fd.apk' repo/index.xml
|
2017-05-31 21:20:35 +02:00
|
|
|
|
2020-06-29 21:56:52 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "test for added date being set correctly for repo and archive"
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
fdroid_init_with_prebuilt_keystore
|
|
|
|
mkdir -p {repo,archive,metadata,stats}
|
|
|
|
cp $WORKSPACE/tests/repo/com.politedroid_5.apk archive
|
|
|
|
cp $WORKSPACE/tests/repo/com.politedroid_6.apk repo
|
|
|
|
cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata
|
|
|
|
#TODO: the timestamp of the oldest apk in the file should be used, even if that
|
|
|
|
# doesn't exist anymore
|
|
|
|
echo "com.politedroid_4.apk com.politedroid 2016-01-01" > stats/known_apks.txt
|
|
|
|
echo "com.politedroid_5.apk com.politedroid 2017-01-01" >> stats/known_apks.txt
|
|
|
|
echo "com.politedroid_6.apk com.politedroid 2018-01-01" >> stats/known_apks.txt
|
|
|
|
sed -i -e 's/ArchivePolicy:.*/ArchivePolicy: 1 versions/' metadata/com.politedroid.yml
|
2020-10-01 20:53:06 +02:00
|
|
|
timestamp=1483228800 # $(date -u --date=2017-01-01 +%s)000
|
2020-06-29 21:56:52 +02:00
|
|
|
|
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
grep -F "\"added\": $timestamp" repo/index-v1.json
|
|
|
|
# the archive will have the added timestamp for the app and for the apk, both need to be there
|
|
|
|
if [ $(grep -F "\"added\": $timestamp" archive/index-v1.json | wc -l) == 2 ]; then true; else false;fi
|
|
|
|
|
2020-06-02 13:32:11 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "test whatsnew from fastlane without CVC set"
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
fdroid_init_with_prebuilt_keystore
|
|
|
|
mkdir -p metadata/com.politedroid/en-US/changelogs/
|
|
|
|
cp $WORKSPACE/tests/repo/com.politedroid_6.apk repo
|
2020-06-24 20:30:26 +02:00
|
|
|
cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata
|
2020-06-02 13:32:11 +02:00
|
|
|
echo "whatsnew test" > metadata/com.politedroid/en-US/changelogs/6.txt
|
2020-06-24 20:30:26 +02:00
|
|
|
sed -i -e '/CurrentVersion/d' metadata/com.politedroid.yml
|
2020-06-02 13:32:11 +02:00
|
|
|
$fdroid update --pretty --nosign
|
|
|
|
grep -F 'whatsnew' repo/index-v1.json
|
2017-05-31 21:20:35 +02:00
|
|
|
|
2015-08-05 12:53:17 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "test metadata checks"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
|
|
|
|
mkdir repo
|
|
|
|
cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
|
|
|
|
|
|
|
|
set +e
|
|
|
|
$fdroid build
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because there is no metadata!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "testing metadata checks passed"
|
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
mkdir $REPOROOT/metadata/
|
2020-06-09 22:01:31 +02:00
|
|
|
cp $WORKSPACE/tests/metadata/org.smssecure.smssecure.yml $REPOROOT/metadata/
|
2015-08-05 12:53:17 +02:00
|
|
|
$fdroid readmeta
|
|
|
|
|
|
|
|
|
2016-02-11 23:49:54 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "ensure commands that don't need the JDK work without a JDK configed"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
mkdir repo
|
|
|
|
mkdir metadata
|
2020-06-09 22:34:23 +02:00
|
|
|
echo "License: GPL-2.0-only" >> metadata/fake.yml
|
|
|
|
echo "Summary: Yup still fake" >> metadata/fake.yml
|
|
|
|
echo "Categories: [Internet]" >> metadata/fake.yml
|
|
|
|
echo "Description: |" >> metadata/fake.yml
|
|
|
|
echo " this is fake" >> metadata/fake.yml
|
2016-02-11 23:49:54 +01:00
|
|
|
|
|
|
|
# fake that no JDKs are available
|
2020-10-22 23:34:47 +02:00
|
|
|
echo 'java_paths: {}' > config.yml
|
2016-02-11 23:49:54 +01:00
|
|
|
|
|
|
|
LOCAL_COPY_DIR=`create_test_dir`/fdroid
|
|
|
|
mkdir -p $LOCAL_COPY_DIR/repo
|
2020-10-22 23:34:47 +02:00
|
|
|
echo "local_copy_dir: $LOCAL_COPY_DIR" >> config.yml
|
2016-02-11 23:49:54 +01:00
|
|
|
|
2018-03-06 20:50:23 +01:00
|
|
|
$fdroid checkupdates --allow-dirty
|
2018-06-22 10:11:16 +02:00
|
|
|
which gpg && $fdroid gpgsign
|
2016-02-11 23:49:54 +01:00
|
|
|
$fdroid lint
|
|
|
|
$fdroid readmeta
|
|
|
|
$fdroid rewritemeta fake
|
2018-05-25 09:52:17 +02:00
|
|
|
$fdroid deploy
|
2020-10-21 09:52:58 +02:00
|
|
|
$fdroid deploy
|
2016-02-11 23:49:54 +01:00
|
|
|
$fdroid scanner
|
|
|
|
|
|
|
|
# run these to get their output, but the are not setup, so don't fail
|
|
|
|
$fdroid build || true
|
|
|
|
$fdroid import || true
|
|
|
|
$fdroid install || true
|
|
|
|
|
|
|
|
|
2014-06-27 23:06:52 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
2019-07-03 22:33:01 +02:00
|
|
|
# only run this test if running from a git repo, not all files are in the tarball
|
|
|
|
if [ -e .git/config ]; then
|
|
|
|
echo_header "create a source tarball"
|
2014-06-27 23:06:52 +02:00
|
|
|
|
2019-07-03 22:33:01 +02:00
|
|
|
cd $WORKSPACE
|
|
|
|
./setup.py compile_catalog sdist
|
2014-06-27 23:06:52 +02:00
|
|
|
|
2019-07-03 22:33:01 +02:00
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
tar xzf `ls -1 $WORKSPACE/dist/fdroidserver-*.tar.gz | sort -n | tail -1`
|
|
|
|
cd $REPOROOT
|
|
|
|
./fdroidserver-*/fdroid init
|
|
|
|
copy_apks_into_repo $REPOROOT
|
|
|
|
./fdroidserver-*/fdroid update --create-metadata --verbose
|
|
|
|
fi
|
2014-06-27 23:06:52 +02:00
|
|
|
|
2014-06-26 17:57:40 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "test config checks of local_copy_dir"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2020-10-21 09:52:58 +02:00
|
|
|
$fdroid deploy --local-copy-dir=/tmp/fdroid
|
2018-05-25 09:52:17 +02:00
|
|
|
$fdroid deploy --local-copy-dir=/tmp/fdroid --verbose
|
2014-06-26 17:57:40 +02:00
|
|
|
|
|
|
|
# now test the errors work
|
|
|
|
set +e
|
2020-10-21 09:52:58 +02:00
|
|
|
$fdroid deploy --local-copy-dir=thisisnotanabsolutepath
|
2014-06-26 17:57:40 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because thisisnotanabsolutepath is not an absolute path!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "testing absolute path checker passed"
|
|
|
|
fi
|
2020-10-21 09:52:58 +02:00
|
|
|
$fdroid deploy --local-copy-dir=/tmp/IReallyDoubtThisPathExistsasdfasdf
|
2014-06-26 17:57:40 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because the path does not end with 'fdroid'!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "testing dirname exists checker passed"
|
|
|
|
fi
|
2020-10-21 09:52:58 +02:00
|
|
|
$fdroid deploy --local-copy-dir=/tmp/IReallyDoubtThisPathExistsasdfasdf/fdroid
|
2014-06-26 17:57:40 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because the dirname path does not exist!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "testing dirname exists checker passed"
|
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
2014-04-01 22:16:24 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
2014-06-26 20:18:29 +02:00
|
|
|
echo_header "setup a new repo from scratch using ANDROID_HOME and do a local sync"
|
2014-04-01 22:16:24 +02:00
|
|
|
|
2014-04-24 01:21:22 +02:00
|
|
|
REPOROOT=`create_test_dir`
|
2014-04-01 22:16:24 +02:00
|
|
|
cd $REPOROOT
|
2017-12-20 17:03:48 +01:00
|
|
|
fdroid_init_with_prebuilt_keystore
|
2014-04-04 04:17:52 +02:00
|
|
|
copy_apks_into_repo $REPOROOT
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2015-04-21 03:52:41 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2014-04-01 22:16:24 +02:00
|
|
|
|
2014-06-26 20:18:29 +02:00
|
|
|
LOCALCOPYDIR=`create_test_dir`/fdroid
|
2020-10-21 09:52:58 +02:00
|
|
|
$fdroid deploy --local-copy-dir=$LOCALCOPYDIR
|
2014-06-26 20:18:29 +02:00
|
|
|
NEWREPOROOT=`create_test_dir`
|
|
|
|
cd $NEWREPOROOT
|
2017-12-20 17:03:48 +01:00
|
|
|
fdroid_init_with_prebuilt_keystore
|
2020-10-22 23:34:47 +02:00
|
|
|
echo "sync_from_local_copy_dir: true" >> config.yml
|
2020-10-21 09:52:58 +02:00
|
|
|
$fdroid deploy --local-copy-dir=$LOCALCOPYDIR
|
2014-06-26 20:18:29 +02:00
|
|
|
|
2014-04-01 22:16:24 +02:00
|
|
|
|
2014-04-04 04:17:52 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
2014-04-24 01:21:22 +02:00
|
|
|
# check that --android-home fails when dir does not exist or is not a dir
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
2020-09-09 19:01:53 +02:00
|
|
|
KEYSTORE=$REPOROOT/keystore.p12
|
2014-04-24 01:21:22 +02:00
|
|
|
cd $REPOROOT
|
|
|
|
set +e
|
|
|
|
$fdroid init --keystore $KEYSTORE --android-home /opt/fakeandroidhome
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because /opt/fakeandroidhome does not exist!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "testing android-home path checker passed"
|
|
|
|
fi
|
|
|
|
TESTFILE=`create_test_file`
|
|
|
|
$fdroid init --keystore $KEYSTORE --android-home $TESTFILE
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because $TESTFILE is a file not a dir!"
|
|
|
|
exit 1
|
|
|
|
else
|
|
|
|
echo "testing android-home not-dir checker passed"
|
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
2014-07-01 03:37:46 +02:00
|
|
|
echo_header "check that fake android home passes 'fdroid init'"
|
2014-05-30 03:43:16 +02:00
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
FAKE_ANDROID_HOME=`create_test_dir`
|
|
|
|
create_fake_android_home $FAKE_ANDROID_HOME
|
2020-09-09 19:01:53 +02:00
|
|
|
KEYSTORE=$REPOROOT/keystore.p12
|
2014-05-30 03:43:16 +02:00
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init --keystore $KEYSTORE --android-home $FAKE_ANDROID_HOME
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "check that 'fdroid init' fails when build-tools cannot be found"
|
|
|
|
|
2018-05-03 15:00:17 +02:00
|
|
|
if [ -e /usr/bin/aapt ] || python3 -c 'import androguard'; then
|
|
|
|
echo "/usr/bin/aapt or androguard installed, not running test"
|
2014-12-09 14:12:41 +01:00
|
|
|
else
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
FAKE_ANDROID_HOME=`create_test_dir`
|
|
|
|
create_fake_android_home $FAKE_ANDROID_HOME
|
|
|
|
rm -f $FAKE_ANDROID_HOME/build-tools/*/aapt
|
2020-09-09 19:01:53 +02:00
|
|
|
KEYSTORE=$REPOROOT/keystore.p12
|
2014-12-09 14:12:41 +01:00
|
|
|
cd $REPOROOT
|
|
|
|
set +e
|
|
|
|
$fdroid init --keystore $KEYSTORE --android-home $FAKE_ANDROID_HOME
|
|
|
|
[ $? -eq 0 ] && exit 1
|
|
|
|
set -e
|
|
|
|
fi
|
2014-05-30 03:43:16 +02:00
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "check that --android-home overrides ANDROID_HOME"
|
2014-04-24 01:21:22 +02:00
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
FAKE_ANDROID_HOME=`create_test_dir`
|
|
|
|
create_fake_android_home $FAKE_ANDROID_HOME
|
2020-09-09 19:01:53 +02:00
|
|
|
KEYSTORE=$REPOROOT/keystore.p12
|
2014-04-24 01:21:22 +02:00
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init --keystore $KEYSTORE --android-home $FAKE_ANDROID_HOME
|
|
|
|
set +e
|
2020-10-22 23:34:47 +02:00
|
|
|
grep $FAKE_ANDROID_HOME $REPOROOT/config.yml
|
2014-04-24 01:21:22 +02:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
echo "the value set in --android-home '$FAKE_ANDROID_HOME' should override ANDROID_HOME '$ANDROID_HOME'"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
2014-06-05 00:45:06 +02:00
|
|
|
# In this case, ANDROID_HOME is set to a fake, non-working version that will
|
|
|
|
# be detected by fdroid as an Android SDK install. It should use the path set
|
|
|
|
# by --android-home over the one in ANDROID_HOME, therefore if it uses the one
|
|
|
|
# in ANDROID_HOME, it won't work because it is a fake one. Only
|
|
|
|
# --android-home provides a working one.
|
2018-05-03 15:00:17 +02:00
|
|
|
if [ -z "$ANDROID_HOME" ]; then
|
|
|
|
echo_header "SKIP setup a new repo from scratch with keystore and android-home set on cmd line"
|
|
|
|
else
|
|
|
|
echo_header "setup a new repo from scratch with keystore and android-home set on cmd line"
|
2014-04-24 01:21:22 +02:00
|
|
|
|
2018-05-03 15:00:17 +02:00
|
|
|
REPOROOT=`create_test_dir`
|
2020-09-09 19:01:53 +02:00
|
|
|
KEYSTORE=$REPOROOT/keystore.p12
|
2018-05-03 15:00:17 +02:00
|
|
|
FAKE_ANDROID_HOME=`create_test_dir`
|
|
|
|
create_fake_android_home $FAKE_ANDROID_HOME
|
|
|
|
STORED_ANDROID_HOME=$ANDROID_HOME
|
|
|
|
unset ANDROID_HOME
|
|
|
|
echo "ANDROID_HOME: $ANDROID_HOME"
|
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init --keystore $KEYSTORE --android-home $STORED_ANDROID_HOME --no-prompt
|
|
|
|
test -e $KEYSTORE
|
|
|
|
copy_apks_into_repo $REPOROOT
|
|
|
|
$fdroid update --create-metadata --verbose
|
|
|
|
$fdroid readmeta
|
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
|
|
|
test -e repo/index-v1.jar
|
2018-09-03 18:07:40 +02:00
|
|
|
test -e tmp/apkcache.json
|
|
|
|
! test -z tmp/apkcache.json
|
2018-05-03 15:00:17 +02:00
|
|
|
export ANDROID_HOME=$STORED_ANDROID_HOME
|
|
|
|
fi
|
2014-04-24 01:21:22 +02:00
|
|
|
|
2017-05-30 14:52:33 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "check duplicate files are properly handled by fdroid update"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
2017-12-20 17:03:48 +01:00
|
|
|
fdroid_init_with_prebuilt_keystore
|
2017-05-30 14:52:33 +02:00
|
|
|
mkdir $REPOROOT/metadata
|
2020-06-09 22:01:31 +02:00
|
|
|
cp -a $WORKSPACE/tests/metadata/obb.mainpatch.current.yml $REPOROOT/metadata
|
2017-05-30 14:52:33 +02:00
|
|
|
cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619.apk $REPOROOT/repo/
|
|
|
|
cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619_another-release-key.apk $REPOROOT/repo/
|
|
|
|
$fdroid update --pretty
|
2017-05-31 21:43:40 +02:00
|
|
|
grep -F 'obb.mainpatch.current_1619.apk' repo/index.xml repo/index-v1.json
|
|
|
|
grep -F 'obb.mainpatch.current_1619_another-release-key.apk' repo/index-v1.json
|
|
|
|
! grep -F 'obb.mainpatch.current_1619_another-release-key.apk' repo/index.xml
|
2017-05-30 14:52:33 +02:00
|
|
|
# die if there are exact duplicates
|
|
|
|
cp $WORKSPACE/tests/repo/obb.mainpatch.current_1619.apk $REPOROOT/repo/duplicate.apk
|
|
|
|
! $fdroid update
|
|
|
|
|
|
|
|
|
2014-04-24 01:21:22 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
2014-05-30 03:43:16 +02:00
|
|
|
echo_header "setup new repo from scratch using ANDROID_HOME, putting APKs in repo first"
|
2014-04-04 04:17:52 +02:00
|
|
|
|
2014-04-24 01:21:22 +02:00
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
mkdir repo
|
|
|
|
copy_apks_into_repo $REPOROOT
|
2017-12-20 17:03:48 +01:00
|
|
|
fdroid_init_with_prebuilt_keystore
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2015-04-21 03:52:41 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2014-04-24 01:21:22 +02:00
|
|
|
|
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
2014-05-30 03:43:16 +02:00
|
|
|
echo_header "setup a new repo from scratch and generate a keystore"
|
2014-04-24 01:21:22 +02:00
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
2020-09-09 19:01:53 +02:00
|
|
|
KEYSTORE=$REPOROOT/keystore.p12
|
2014-04-04 04:17:52 +02:00
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init --keystore $KEYSTORE
|
|
|
|
test -e $KEYSTORE
|
|
|
|
copy_apks_into_repo $REPOROOT
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2014-04-04 04:17:52 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2018-09-03 18:07:40 +02:00
|
|
|
test -e tmp/apkcache.json
|
|
|
|
! test -z tmp/apkcache.json
|
2015-04-21 03:52:41 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2014-04-04 06:05:22 +02:00
|
|
|
|
|
|
|
|
2015-04-21 03:38:52 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "setup a new repo manually and generate a keystore"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
2020-09-09 19:01:53 +02:00
|
|
|
KEYSTORE=$REPOROOT/keystore.p12
|
2015-04-21 03:38:52 +02:00
|
|
|
cd $REPOROOT
|
|
|
|
cp $WORKSPACE/examples/fdroid-icon.png $REPOROOT/
|
|
|
|
! test -e $KEYSTORE
|
|
|
|
set +e
|
|
|
|
$fdroid update
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because this repo has no keystore!"
|
|
|
|
exit 1
|
|
|
|
else
|
2015-08-05 13:26:35 +02:00
|
|
|
echo '`fdroid update` prompted to add keystore'
|
2015-04-21 03:38:52 +02:00
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
$fdroid update --create-key
|
|
|
|
test -e $KEYSTORE
|
|
|
|
copy_apks_into_repo $REPOROOT
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2015-04-21 03:38:52 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2018-09-03 18:07:40 +02:00
|
|
|
test -e tmp/apkcache.json
|
|
|
|
! test -z tmp/apkcache.json
|
2015-04-21 03:38:52 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
|
|
|
|
|
|
|
|
2014-05-30 22:50:32 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "setup a new repo from scratch, generate a keystore, then add APK and update"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
2020-09-09 19:01:53 +02:00
|
|
|
KEYSTORE=$REPOROOT/keystore.p12
|
2014-05-30 22:50:32 +02:00
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init --keystore $KEYSTORE
|
|
|
|
test -e $KEYSTORE
|
|
|
|
copy_apks_into_repo $REPOROOT
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2014-05-30 22:50:32 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2015-04-21 03:52:41 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2015-07-25 00:52:13 +02:00
|
|
|
test -e $REPOROOT/repo/info.guardianproject.urzip_100.apk || \
|
|
|
|
cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2014-05-30 22:50:32 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2018-09-03 18:07:40 +02:00
|
|
|
test -e tmp/apkcache.json
|
|
|
|
! test -z tmp/apkcache.json
|
2015-04-21 03:52:41 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2014-05-30 22:50:32 +02:00
|
|
|
|
|
|
|
|
2014-04-04 06:05:22 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
2014-05-30 03:43:16 +02:00
|
|
|
echo_header "setup a new repo from scratch with a HSM/smartcard"
|
2014-04-24 01:21:22 +02:00
|
|
|
REPOROOT=`create_test_dir`
|
2014-04-04 06:05:22 +02:00
|
|
|
cd $REPOROOT
|
|
|
|
$fdroid init --keystore NONE
|
|
|
|
test -e opensc-fdroid.cfg
|
|
|
|
test ! -e NONE
|
2014-04-24 01:21:22 +02:00
|
|
|
|
2015-04-21 01:09:50 +02:00
|
|
|
|
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "setup a new repo with no keystore, add APK, and update"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
2020-09-09 19:01:53 +02:00
|
|
|
KEYSTORE=$REPOROOT/keystore.p12
|
2015-04-21 01:09:50 +02:00
|
|
|
cd $REPOROOT
|
|
|
|
touch fdroid-icon.png
|
2015-07-25 00:52:13 +02:00
|
|
|
mkdir repo
|
|
|
|
cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
|
2015-04-21 01:09:50 +02:00
|
|
|
set +e
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-04-21 01:09:50 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because this repo has no keystore!"
|
|
|
|
exit 1
|
|
|
|
else
|
2015-08-05 13:26:35 +02:00
|
|
|
echo '`fdroid update` prompted to add keystore'
|
2015-04-21 01:09:50 +02:00
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# now set up fake, non-working keystore setup
|
|
|
|
touch $KEYSTORE
|
2020-10-22 23:34:47 +02:00
|
|
|
echo "keystore: $KEYSTORE" >> config.yml
|
|
|
|
echo 'repo_keyalias: foo' >> config.yml
|
|
|
|
echo 'keystorepass: foo' >> config.yml
|
|
|
|
echo 'keypass: foo' >> config.yml
|
2015-04-21 01:09:50 +02:00
|
|
|
set +e
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-04-21 01:09:50 +02:00
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because this repo has a bad/fake keystore!"
|
|
|
|
exit 1
|
|
|
|
else
|
2015-08-05 13:26:35 +02:00
|
|
|
echo '`fdroid update` prompted to add keystore'
|
2015-04-21 01:09:50 +02:00
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
2017-03-16 19:22:32 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "copy tests/repo, update with binary transparency log"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
2017-04-11 23:46:14 +02:00
|
|
|
GIT_REMOTE=`create_test_dir`
|
2017-03-16 19:22:32 +01:00
|
|
|
GNUPGHOME=$REPOROOT/gnupghome
|
|
|
|
cd $REPOROOT
|
2017-12-20 17:03:48 +01:00
|
|
|
fdroid_init_with_prebuilt_keystore
|
2017-03-16 19:22:32 +01:00
|
|
|
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $REPOROOT/
|
2020-10-22 23:34:47 +02:00
|
|
|
echo "binary_transparency_remote: $GIT_REMOTE" >> config.yml
|
2017-04-10 20:28:43 +02:00
|
|
|
$fdroid update --verbose
|
2017-04-12 15:26:51 +02:00
|
|
|
if have_git_2_3; then
|
2020-10-21 09:52:58 +02:00
|
|
|
$fdroid deploy --verbose
|
2017-04-12 15:26:51 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
|
|
|
test -e repo/index-v1.jar
|
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
|
|
|
cd binary_transparency
|
|
|
|
[ `git rev-list --count HEAD` == "2" ]
|
|
|
|
cd $GIT_REMOTE
|
|
|
|
[ `git rev-list --count HEAD` == "2" ]
|
|
|
|
else
|
|
|
|
echo "Skipping test, `git --version` older than 2.3"
|
|
|
|
fi
|
2017-03-16 19:22:32 +01:00
|
|
|
|
|
|
|
|
2015-04-21 01:09:50 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "setup a new repo with keystore with APK, update, then without key"
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
KEYSTORE=$REPOROOT/keystore.jks
|
|
|
|
cd $REPOROOT
|
2017-12-20 17:03:48 +01:00
|
|
|
cp $WORKSPACE/tests/keystore.jks $KEYSTORE
|
|
|
|
fdroid_init_with_prebuilt_keystore $KEYSTORE
|
2015-04-21 01:09:50 +02:00
|
|
|
test -e $KEYSTORE
|
|
|
|
cp $WORKSPACE/tests/urzip.apk $REPOROOT/repo/
|
run-tests: verbose output for `fdroid update` to aid debugging
I'm stumped by this stacktrace, hopefully debug logging will help:
Unknown exception found!
Traceback (most recent call last):
File "./fdroidserver-0.4.0/fdroid", line 141, in <module>
main()
File "./fdroidserver-0.4.0/fdroid", line 119, in main
mod.main()
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 1146, in main
apks, cachechanged = scan_apks(apps, apkcache, repodirs[0], knownapks)
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 543, in scan_apks
thisinfo['sig'] = getsig(os.path.join(os.getcwd(), apkfile))
File "<http://localhost:18080/job/fdroidserver/ws/.testfiles/tmp.9hr9NiSmZs/fdroidserver-0.4.0/fdroidserver/update.py",> line 361, in getsig
with zipfile.ZipFile(apkpath, 'r') as apk:
File "/usr/lib/python2.7/zipfile.py", line 770, in __init__
self._RealGetContents()
File "/usr/lib/python2.7/zipfile.py", line 857, in _RealGetContents
x._decodeExtra()
File "/usr/lib/python2.7/zipfile.py", line 388, in _decodeExtra
tp, ln = unpack('<HH', extra[:4])
struct.error: unpack requires a string argument of length 4
2015-09-16 17:19:12 +02:00
|
|
|
$fdroid update --create-metadata --verbose
|
2015-07-25 00:39:00 +02:00
|
|
|
$fdroid readmeta
|
2015-04-21 01:09:50 +02:00
|
|
|
test -e repo/index.xml
|
|
|
|
test -e repo/index.jar
|
2016-11-28 21:09:07 +01:00
|
|
|
test -e repo/index-v1.jar
|
2018-09-03 18:07:40 +02:00
|
|
|
test -e tmp/apkcache.json
|
|
|
|
! test -z tmp/apkcache.json
|
2015-04-21 03:52:41 +02:00
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
2015-04-21 01:09:50 +02:00
|
|
|
|
|
|
|
# now set fake repo_keyalias
|
2020-10-22 23:34:47 +02:00
|
|
|
$sed -i.tmp 's,^ *repo_keyalias.*,repo_keyalias: fake,' $REPOROOT/config.yml
|
2015-04-21 01:09:50 +02:00
|
|
|
set +e
|
|
|
|
$fdroid update
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because this repo has a bad repo_keyalias!"
|
|
|
|
exit 1
|
|
|
|
else
|
2015-08-05 13:26:35 +02:00
|
|
|
echo '`fdroid update` prompted to add keystore'
|
2015-04-21 01:09:50 +02:00
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
2015-04-21 03:38:52 +02:00
|
|
|
# try creating a new keystore, but fail because the old one is there
|
|
|
|
test -e $KEYSTORE
|
|
|
|
set +e
|
|
|
|
$fdroid update --create-key
|
|
|
|
if [ $? -eq 0 ]; then
|
|
|
|
echo "This should have failed because a keystore is already there!"
|
|
|
|
exit 1
|
|
|
|
else
|
2015-08-05 13:26:35 +02:00
|
|
|
echo '`fdroid update` complained about existing keystore'
|
2015-04-21 03:38:52 +02:00
|
|
|
fi
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# now actually create the key with the existing settings
|
|
|
|
rm -f $KEYSTORE
|
|
|
|
! test -e $KEYSTORE
|
|
|
|
$fdroid update --create-key
|
|
|
|
test -e $KEYSTORE
|
|
|
|
|
2015-04-21 01:09:50 +02:00
|
|
|
|
2020-01-13 11:48:23 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "setup a new repo from scratch using ANDROID_HOME with git mirror"
|
|
|
|
|
|
|
|
# fake git remote server for repo mirror
|
|
|
|
SERVER_GIT_MIRROR=`create_test_dir`
|
|
|
|
cd $SERVER_GIT_MIRROR
|
|
|
|
git init
|
|
|
|
git config receive.denyCurrentBranch updateInstead
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
GIT_MIRROR=$REPOROOT/git-mirror
|
|
|
|
cd $REPOROOT
|
|
|
|
fdroid_init_with_prebuilt_keystore
|
2020-10-22 23:34:47 +02:00
|
|
|
echo "servergitmirrors: $SERVER_GIT_MIRROR" >> config.yml
|
2020-01-13 11:48:23 +01:00
|
|
|
|
|
|
|
cp $WORKSPACE/tests/repo/com.politedroid_[345].apk repo/
|
|
|
|
$fdroid update --create-metadata
|
|
|
|
$fdroid deploy
|
|
|
|
test -e $GIT_MIRROR/fdroid/repo/com.politedroid_3.apk
|
|
|
|
test -e $GIT_MIRROR/fdroid/repo/com.politedroid_4.apk
|
|
|
|
test -e $GIT_MIRROR/fdroid/repo/com.politedroid_5.apk
|
|
|
|
test -e $SERVER_GIT_MIRROR/fdroid/repo/com.politedroid_3.apk
|
|
|
|
test -e $SERVER_GIT_MIRROR/fdroid/repo/com.politedroid_4.apk
|
|
|
|
test -e $SERVER_GIT_MIRROR/fdroid/repo/com.politedroid_5.apk
|
|
|
|
date > $GIT_MIRROR/.git/test-stamp
|
|
|
|
|
|
|
|
# add one more APK to trigger archiving
|
|
|
|
cp $WORKSPACE/tests/repo/com.politedroid_6.apk repo/
|
|
|
|
$fdroid update
|
|
|
|
$fdroid deploy
|
|
|
|
test -e $REPOROOT/archive/com.politedroid_3.apk
|
|
|
|
! test -e $GIT_MIRROR/fdroid/archive/com.politedroid_3.apk
|
|
|
|
! test -e $SERVER_GIT_MIRROR/fdroid/archive/com.politedroid_3.apk
|
|
|
|
test -e $GIT_MIRROR/fdroid/repo/com.politedroid_4.apk
|
|
|
|
test -e $GIT_MIRROR/fdroid/repo/com.politedroid_5.apk
|
|
|
|
test -e $GIT_MIRROR/fdroid/repo/com.politedroid_6.apk
|
|
|
|
test -e $SERVER_GIT_MIRROR/fdroid/repo/com.politedroid_4.apk
|
|
|
|
test -e $SERVER_GIT_MIRROR/fdroid/repo/com.politedroid_5.apk
|
|
|
|
test -e $SERVER_GIT_MIRROR/fdroid/repo/com.politedroid_6.apk
|
|
|
|
before=`du -s --bytes $GIT_MIRROR/.git/ | awk '{print $1}'`
|
|
|
|
|
2020-10-22 23:34:47 +02:00
|
|
|
echo "git_mirror_size_limit: 60kb" >> config.yml
|
2020-01-13 11:48:23 +01:00
|
|
|
$fdroid update
|
|
|
|
$fdroid deploy
|
|
|
|
test -e $REPOROOT/archive/com.politedroid_3.apk
|
|
|
|
! test -e $SERVER_GIT_MIRROR/fdroid/archive/com.politedroid_3.apk
|
|
|
|
after=`du -s --bytes $GIT_MIRROR/.git/ | awk '{print $1}'`
|
|
|
|
! test -e $GIT_MIRROR/.git/test-stamp
|
|
|
|
git -C $GIT_MIRROR gc
|
|
|
|
git -C $SERVER_GIT_MIRROR gc
|
|
|
|
test $before -gt $after
|
|
|
|
|
|
|
|
|
2017-04-11 23:46:14 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header "sign binary repo in offline box, then publishing from online box"
|
|
|
|
|
2017-04-12 15:26:51 +02:00
|
|
|
if have_git_2_3; then
|
2018-05-14 15:24:21 +02:00
|
|
|
OFFLINE_ROOT=`create_test_dir`
|
2020-09-09 19:01:53 +02:00
|
|
|
KEYSTORE=$WORKSPACE/tests/keystore.p12
|
2018-05-14 15:24:21 +02:00
|
|
|
LOCAL_COPY_DIR=`create_test_dir`/fdroid
|
|
|
|
mkdir $LOCAL_COPY_DIR
|
|
|
|
ONLINE_ROOT=`create_test_dir`
|
|
|
|
SERVERWEBROOT=`create_test_dir`
|
|
|
|
|
|
|
|
# create offline binary transparency log
|
|
|
|
cd $OFFLINE_ROOT
|
|
|
|
mkdir binary_transparency
|
|
|
|
cd binary_transparency
|
|
|
|
git init
|
|
|
|
|
|
|
|
# fake git remote server for binary transparency log
|
|
|
|
BINARY_TRANSPARENCY_REMOTE=`create_test_dir`
|
|
|
|
|
|
|
|
# fake git remote server for repo mirror
|
|
|
|
SERVER_GIT_MIRROR=`create_test_dir`
|
|
|
|
cd $SERVER_GIT_MIRROR
|
|
|
|
git init
|
2017-04-12 15:26:51 +02:00
|
|
|
git config receive.denyCurrentBranch updateInstead
|
2017-04-11 23:46:14 +02:00
|
|
|
|
2018-05-14 15:24:21 +02:00
|
|
|
cd $OFFLINE_ROOT
|
|
|
|
fdroid_init_with_prebuilt_keystore
|
|
|
|
cp -a $WORKSPACE/tests/metadata $WORKSPACE/tests/repo $WORKSPACE/tests/stats $OFFLINE_ROOT/
|
2017-04-11 23:46:14 +02:00
|
|
|
|
2020-10-22 23:34:47 +02:00
|
|
|
echo "mirrors: ['http://foo.bar/fdroid', 'http://asdflkdsfjafdsdfhkjh.onion/fdroid']" >> config.yml
|
|
|
|
echo "servergitmirrors: $SERVER_GIT_MIRROR" >> config.yml
|
|
|
|
echo "local_copy_dir: $LOCAL_COPY_DIR" >> config.yml
|
2018-05-14 15:24:21 +02:00
|
|
|
$fdroid update --pretty
|
|
|
|
grep -F '<application id=' repo/index.xml > /dev/null
|
|
|
|
grep -F '/fdroid/repo</mirror>' repo/index.xml
|
|
|
|
grep -F '/fdroid/archive</mirror>' archive/index.xml
|
|
|
|
test `grep '<mirror>' repo/index.xml | wc -l` -eq 2
|
|
|
|
test `grep '<mirror>' archive/index.xml | wc -l` -eq 2
|
|
|
|
cd binary_transparency
|
|
|
|
[ `git rev-list --count HEAD` == "1" ]
|
|
|
|
cd ..
|
2020-10-21 09:52:58 +02:00
|
|
|
$fdroid deploy --verbose
|
2018-05-14 15:24:21 +02:00
|
|
|
grep -F '<application id=' $LOCAL_COPY_DIR/repo/index.xml > /dev/null
|
|
|
|
cd $ONLINE_ROOT
|
2020-10-22 23:34:47 +02:00
|
|
|
echo "local_copy_dir: $LOCAL_COPY_DIR" >> config.yml
|
|
|
|
echo "sync_from_local_copy_dir: True" >> config.yml
|
|
|
|
echo "serverwebroots: $SERVERWEBROOT" >> config.yml
|
|
|
|
echo "servergitmirrors: $SERVER_GIT_MIRROR" >> config.yml
|
|
|
|
echo "local_copy_dir: $LOCAL_COPY_DIR" >> config.yml
|
|
|
|
echo "binary_transparency_remote: $BINARY_TRANSPARENCY_REMOTE" >> config.yml
|
2020-10-21 09:52:58 +02:00
|
|
|
$fdroid deploy --verbose
|
2018-05-14 15:24:21 +02:00
|
|
|
cd $BINARY_TRANSPARENCY_REMOTE
|
|
|
|
[ `git rev-list --count HEAD` == "1" ]
|
|
|
|
cd $SERVER_GIT_MIRROR
|
|
|
|
[ `git rev-list --count HEAD` == "1" ]
|
|
|
|
fi
|
2017-04-11 23:46:14 +02:00
|
|
|
|
|
|
|
|
2019-04-11 13:30:23 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header 'test extracting and publishing with developer signature'
|
|
|
|
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $REPOROOT
|
|
|
|
fdroid_init_with_prebuilt_keystore
|
2020-10-22 23:34:47 +02:00
|
|
|
echo 'keydname: "CN=Birdman, OU=Cell, O=Alcatraz, L=Alcatraz, S=California, C=US"' >> config.yml
|
2019-04-11 13:30:23 +02:00
|
|
|
test -d metadata || mkdir metadata
|
2020-06-09 22:01:31 +02:00
|
|
|
cp $WORKSPACE/tests/metadata/com.politedroid.yml metadata/
|
2019-04-11 13:30:23 +02:00
|
|
|
test -d repo || mkdir repo
|
|
|
|
test -d unsigned || mkdir unsigned
|
|
|
|
cp $WORKSPACE/tests/repo/com.politedroid_6.apk unsigned/
|
|
|
|
$fdroid signatures unsigned/com.politedroid_6.apk
|
|
|
|
test -d metadata/com.politedroid/signatures/6
|
|
|
|
test -f metadata/com.politedroid/signatures/6/MANIFEST.MF
|
|
|
|
test -f metadata/com.politedroid/signatures/6/RELEASE.RSA
|
|
|
|
test -f metadata/com.politedroid/signatures/6/RELEASE.SF
|
|
|
|
! test -f repo/com.politedroid_6.apk
|
|
|
|
$fdroid publish
|
|
|
|
test -f repo/com.politedroid_6.apk
|
|
|
|
if which jarsigner; then
|
|
|
|
jarsigner -verify repo/com.politedroid_6.apk
|
|
|
|
fi
|
|
|
|
if which apksigner; then
|
|
|
|
apksigner verify repo/com.politedroid_6.apk
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
2020-11-30 12:35:51 +01:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
echo_header 'test mirroring a repo'
|
|
|
|
|
|
|
|
if which wget; then
|
|
|
|
REPOROOT=`create_test_dir`
|
|
|
|
cd $WORKSPACE/tests
|
|
|
|
test -d archive || mkdir archive
|
|
|
|
cp repo/index-v1.json $REPOROOT/
|
|
|
|
$fdroid signindex
|
|
|
|
mv $REPOROOT/index-v1.json repo/index-v1.json
|
|
|
|
|
2020-12-14 23:08:32 +01:00
|
|
|
port=321${RANDOM:3}
|
2021-01-07 17:09:44 +01:00
|
|
|
test $(printf $port | wc -m) -le 3 && port=52734 # when $RANDOM doesn't work
|
2020-12-10 08:48:10 +01:00
|
|
|
timeout 5m python3 -m http.server $port --bind 127.0.0.1 > $REPOROOT/http.server.log 2>&1 &
|
2020-11-30 12:35:51 +01:00
|
|
|
http_server_pid=$!
|
|
|
|
|
|
|
|
cd $REPOROOT
|
|
|
|
http_proxy= HTTP_PROXY= $fdroid mirror http://127.0.0.1:${port}/
|
|
|
|
test -e 127.0.0.1\:${port}/repo/souch.smsbypass_9.apk
|
|
|
|
test -e 127.0.0.1\:${port}/repo/icons-640/souch.smsbypass.9.png
|
|
|
|
# the index shouldn't be saved unless it was verified
|
|
|
|
! test -e 127.0.0.1\:${port}/repo/index-v1.jar
|
|
|
|
! http_proxy= HTTP_PROXY= $fdroid mirror "http://127.0.0.1:${port}/?fingerprint=asdfasdf"
|
|
|
|
! test -e 127.0.0.1\:${port}/repo/index-v1.jar
|
|
|
|
http_proxy= HTTP_PROXY= $fdroid mirror "http://127.0.0.1:${port}/?fingerprint=F49AF3F11EFDDF20DFFD70F5E3117B9976674167ADCA280E6B1932A0601B26F6"
|
|
|
|
test -e 127.0.0.1\:${port}/repo/index-v1.jar
|
|
|
|
|
|
|
|
# clean up
|
|
|
|
kill -9 $http_server_pid
|
|
|
|
rm -f 127.0.0.1\:${port}/repo/*.apk 127.0.0.1\:${port}/repo/*/*/*/*.png
|
|
|
|
else
|
|
|
|
echo "WARNING: wget not installed, skipping"
|
|
|
|
fi
|
|
|
|
|
2015-04-21 01:09:50 +02:00
|
|
|
#------------------------------------------------------------------------------#
|
|
|
|
|
|
|
|
# remove this to prevent git conflicts and complaining
|
2014-09-17 08:54:02 +02:00
|
|
|
rm -rf $WORKSPACE/fdroidserver.egg-info/
|
2014-04-24 01:21:22 +02:00
|
|
|
|
|
|
|
echo SUCCESS
|