diff --git a/.gitignore b/.gitignore index b442d84d..2a4e5024 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,8 @@ *.class *.box # files generated by build -FDroidServer.egg-info/ +build/ +dist/ +env/ +fdroidserver.egg-info/ +pylint.parseable diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..6cd365e1 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,32 @@ +include README +include COPYING +include fd-commit +include fdroid +include jenkins-build.sh +include makebuildserver +include updateplugin +include buildserver/config.buildserver.py +include buildserver/cookbooks +include buildserver/fixpaths.sh +include buildserver/cookbooks/android-ndk/recipes/default.rb +include buildserver/cookbooks/android-sdk/recipes/default.rb +include buildserver/cookbooks/fdroidbuild-general/recipes/default.rb +include buildserver/cookbooks/gradle/recipes/default.rb +include buildserver/cookbooks/gradle/recipes/gradle +include buildserver/cookbooks/kivy/recipes/default.rb +include completion/bash-completion +include docs/fdl.texi +include docs/fdroid.texi +include docs/gendocs.sh +include docs/gendocs_template +include docs/index_versions.md +include docs/update.sh +include examples/config.py +include examples/fdroid-icon.png +include examples/makebs.config.py +include tests/run-tests.sh +include wp-fdroid/AndroidManifest.xml +include wp-fdroid/android-permissions.php +include wp-fdroid/readme.txt +include wp-fdroid/strings.xml +include wp-fdroid/wp-fdroid.php diff --git a/jenkins-build.sh b/jenkins-build.sh new file mode 100755 index 00000000..ccd9492e --- /dev/null +++ b/jenkins-build.sh @@ -0,0 +1,86 @@ +#!/bin/sh +# +# this is the script run by the Jenkins server to run the build and tests. Be +# sure to always run it in its dir, i.e. ./jenkins-build.sh, otherwise it might +# remove things that you don't want it to. + +if [ `dirname $0` != "." ]; then + echo "only run this script like ./`basename $0`" + exit +fi + +set -e +set -x + +if [ -z $WORKSPACE ]; then + export WORKSPACE=`pwd` +fi + +if [ -z $ANDROID_HOME ]; then + if [ -e ~/.android/bashrc ]; then + . ~/.android/bashrc + else + echo "ANDROID_HOME must be set!" + exit + fi +fi + +#------------------------------------------------------------------------------# +# required Java 7 keytool/jarsigner for :file support + +export PATH=/usr/lib/jvm/java-7-openjdk-amd64/bin:$PATH + +#------------------------------------------------------------------------------# +# run local build +cd $WORKSPACE/fdroidserver/getsig +./make.sh + + +#------------------------------------------------------------------------------# +# run local tests +cd $WORKSPACE/tests +./run-tests.sh + + +#------------------------------------------------------------------------------# +# test building the source tarball +cd $WORKSPACE +python setup.py sdist + + +#------------------------------------------------------------------------------# +# test install using site packages +cd $WORKSPACE +rm -rf $WORKSPACE/env +virtualenv --system-site-packages $WORKSPACE/env +. $WORKSPACE/env/bin/activate +pip install -e $WORKSPACE +python setup.py install + +# run tests in new pip+virtualenv install +. $WORKSPACE/env/bin/activate +fdroid=$WORKSPACE/env/bin/fdroid $WORKSPACE/tests/run-tests.sh + + +#------------------------------------------------------------------------------# +# run pyflakes +pyflakes fdroid makebuildserver fdroidserver/*.py setup.py + + +#------------------------------------------------------------------------------# +# run pylint + +cd $WORKSPACE +set +e +# disable E1101 until there is a plugin to handle this properly: +# Module 'sys' has no '_MEIPASS' member +# disable F0401 until there is a plugin to handle this properly: +# keysync-gui:25: [F] Unable to import 'ordereddict' +pylint --output-format=parseable --reports=n \ + fdroidserver/*.py fdroid makebuildserver setup.py > $WORKSPACE/pylint.parseable + +# to only tell jenkins there was an error if we got ERROR or FATAL, uncomment these: +#[ $(($? & 1)) = "1" ] && exit 1 +#[ $(($? & 2)) = "2" ] && exit 2 +set -e + diff --git a/setup.py b/setup.py index f1b63731..2ea13f8c 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,15 @@ #!/usr/bin/env python2 from setuptools import setup +import os +import subprocess +import sys -setup(name='FDroidServer', +if not os.path.exists('fdroidserver/getsig/getsig.class'): + subprocess.check_output('cd fdroidserver/getsig && javac getsig.java', + shell=True) + +setup(name='fdroidserver', version='0.1', description='F-Droid Server Tools', long_description=open('README').read(), @@ -12,11 +19,12 @@ setup(name='FDroidServer', packages=['fdroidserver'], scripts=['fdroid', 'fd-commit'], data_files=[ - ('share/doc/fdroidserver/examples', + (sys.prefix + '/share/doc/fdroidserver/examples', [ 'buildserver/config.buildserver.py', 'examples/config.py', 'examples/makebs.config.py', 'examples/fdroid-icon.png']), + ('fdroidserver/getsig', ['fdroidserver/getsig/getsig.class']) ], install_requires=[ 'python-magic', diff --git a/tests/run-tests.sh b/tests/run-tests.sh new file mode 100755 index 00000000..5c5c31d0 --- /dev/null +++ b/tests/run-tests.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +set -e +set -x + +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 + +#------------------------------------------------------------------------------# +# setup a new repo from scratch + +REPOROOT=`mktemp --directory --tmpdir=$WORKSPACE` +cd $REPOROOT +$fdroid init +for f in `ls -1 ../../*/bin/*.apk`; do + name=$(basename $(dirname `dirname $f`)) + echo "name $name" + apk=${name}_`basename $f` + echo "apk $apk" + cp $f $REPOROOT/repo/$apk +done +# delete any 'unaligned' duplicates +rm -f $REPOROOT/repo/*unaligned*.apk + + +$fdroid update -c +$fdroid update