From 92c1e44dba757dcdafa458ec189db25f48558d6b Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 2 Apr 2014 14:39:50 -0400 Subject: [PATCH 1/7] ignore files created by setup.py processes --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index b442d84d..d32e4d00 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,7 @@ *.class *.box # files generated by build +build/ +dist/ +env/ FDroidServer.egg-info/ From 434eab6606fdf611994f0a048b291fff393ce6e4 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 2 Apr 2014 14:38:57 -0400 Subject: [PATCH 2/7] downcase setup.py name to match the name in the repo, Debian package, etc. --- .gitignore | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index d32e4d00..47fd9ce8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,4 +8,4 @@ build/ dist/ env/ -FDroidServer.egg-info/ +fdroidserver.egg-info/ diff --git a/setup.py b/setup.py index f1b63731..11e70c65 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup -setup(name='FDroidServer', +setup(name='fdroidserver', version='0.1', description='F-Droid Server Tools', long_description=open('README').read(), From bfa21fb630a374b0466049f06424cd98dfc8a9a5 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 1 Apr 2014 16:16:24 -0400 Subject: [PATCH 3/7] add script to do a test run of creating a new repo This tests/ folder can then be used for all sorts of tests, including standard python tests. --- tests/run-tests.sh | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100755 tests/run-tests.sh 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 From 21fca70d8b3d30902b2a2db3b19d371fca8ac7ad Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 1 Apr 2014 16:17:03 -0400 Subject: [PATCH 4/7] add script for running build and tests in Jenkins --- .gitignore | 1 + jenkins-build.sh | 86 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 87 insertions(+) create mode 100755 jenkins-build.sh diff --git a/.gitignore b/.gitignore index 47fd9ce8..2a4e5024 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,4 @@ build/ dist/ env/ fdroidserver.egg-info/ +pylint.parseable 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 + From 0663d7b19744b597262daf4fc3e59d32f8e716b9 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Tue, 1 Apr 2014 20:04:20 -0400 Subject: [PATCH 5/7] include a setuptools MANIFEST to make sure things get installed Using `python setup.py install`, things in non-standard python paths need to be added to the MANIFEST in order for them to be included and installed. There might be a better solution for this, but I haven't found it. --- MANIFEST.in | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 MANIFEST.in 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 From 1b130950fd9447e8b538f8b93e6da44873cbb65b Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 2 Apr 2014 14:41:20 -0400 Subject: [PATCH 6/7] include prefix in data_files install path so it installs correctly setuptools wants to stick any relative install path in data_files into the .egg package. Things are not setup to use the egg now. We might want to consider using sticking files into the egg via pkg_resource in the future. --- setup.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 11e70c65..898c6a92 100644 --- a/setup.py +++ b/setup.py @@ -1,6 +1,7 @@ #!/usr/bin/env python2 from setuptools import setup +import sys setup(name='fdroidserver', version='0.1', @@ -12,7 +13,7 @@ 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', From f918323e91d1bf63a2ada714d9dcdfb4ce7b0f35 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Wed, 2 Apr 2014 15:15:27 -0400 Subject: [PATCH 7/7] build and install getsig.class with setup.py --- setup.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/setup.py b/setup.py index 898c6a92..2ea13f8c 100644 --- a/setup.py +++ b/setup.py @@ -1,8 +1,14 @@ #!/usr/bin/env python2 from setuptools import setup +import os +import subprocess import sys +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', @@ -18,6 +24,7 @@ setup(name='fdroidserver', 'examples/config.py', 'examples/makebs.config.py', 'examples/fdroid-icon.png']), + ('fdroidserver/getsig', ['fdroidserver/getsig/getsig.class']) ], install_requires=[ 'python-magic',