chiark / gitweb /
use FDroid-standard naming when copying APKs for tests
[fdroidserver.git] / tests / run-tests
1 #!/bin/bash
2
3 set -e
4 set -x
5
6 copy_apks_into_repo() {
7     for f in `ls -1 ../../*/bin/*.apk`; do
8         name=$(basename $(dirname `dirname $f`))
9         echo "name $name"
10         apk=`aapt d badging "$f" | sed -n "s,^package: name='\(.*\)' versionCode='\([0-9][0-9]*\)' .*,\1_\2.apk,p"`
11         echo "apk $apk"
12         cp -f $f $1/repo/$apk
13     done
14 }
15
16 if [ -z $WORKSPACE ]; then
17     WORKSPACE=`dirname $(pwd)`
18     echo "Setting Workspace to $WORKSPACE"
19 fi
20
21 # allow the location of the script to be overridden
22 if [ -z $fdroid ]; then
23     fdroid="$WORKSPACE/fdroid"
24 fi
25
26 #------------------------------------------------------------------------------#
27 # setup a new repo from scratch
28
29 REPOROOT=`mktemp --directory --tmpdir=$WORKSPACE`
30 cd $REPOROOT
31 $fdroid init
32 copy_apks_into_repo $REPOROOT
33 $fdroid update -c
34 $fdroid update
35
36
37 #------------------------------------------------------------------------------#
38 # setup a new repo from scratch and generate a keystore
39
40 REPOROOT=`mktemp --directory --tmpdir=$WORKSPACE`
41 KEYSTORE=$REPOROOT/keystore.jks
42 cd $REPOROOT
43 $fdroid init --keystore $KEYSTORE
44 test -e $KEYSTORE
45 copy_apks_into_repo $REPOROOT
46 $fdroid update -c
47 $fdroid update
48 test -e repo/index.xml
49 test -e repo/index.jar
50
51
52 #------------------------------------------------------------------------------#
53 # setup a new repo from scratch with a HSM/smartcard
54
55 REPOROOT=`mktemp --directory --tmpdir=$WORKSPACE`
56 cd $REPOROOT
57 $fdroid init --keystore NONE
58 test -e opensc-fdroid.cfg
59 test ! -e NONE