From 5f1e57c7e68f9ce0e2a6f9dbf7024a580b816e34 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 15 Feb 2016 11:40:35 +0100 Subject: [PATCH 1/9] complete-ci-tests: exit with error if setup is not correct --- tests/complete-ci-tests | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/complete-ci-tests b/tests/complete-ci-tests index e9595b03..b536dc9e 100755 --- a/tests/complete-ci-tests +++ b/tests/complete-ci-tests @@ -7,7 +7,7 @@ if [ `dirname $0` != "." ]; then echo "only run this script like ./`basename $0`" - exit + exit 1 fi set -e @@ -22,7 +22,7 @@ if [ -z $ANDROID_HOME ]; then . ~/.android/bashrc else echo "ANDROID_HOME must be set!" - exit + exit 1 fi fi From ff30bded21ddfd4e0742cec82c2e8e78dd28088f Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 15 Feb 2016 14:33:27 +0100 Subject: [PATCH 2/9] only test ./gendocs on GNU/Linux This helps with getting the tests running on OSX and other platforms. --- tests/run-tests | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/run-tests b/tests/run-tests index 7629f431..f7acd069 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -115,7 +115,10 @@ $fdroid --version echo_header "build the TeX manual" cd $WORKSPACE/docs -./gendocs.sh -o html --email admin@f-droid.org fdroid "F-Droid Server Manual" +# this is only ever generated officially on GNU/Linux +if [ `uname -s` == "Linux" ]; then + ./gendocs.sh -o html --email admin@f-droid.org fdroid "F-Droid Server Manual" +fi #------------------------------------------------------------------------------# From c91b715a153d4a2a23a9a47d9c8b183bfd581258 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 15 Feb 2016 15:29:11 +0100 Subject: [PATCH 3/9] run-tests: use OSX/BSD compatible `mktemp -d` -d requires an arg on BSD --- tests/run-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-tests b/tests/run-tests index f7acd069..5efed680 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -33,7 +33,7 @@ create_fake_android_home() { create_test_dir() { test -e $WORKSPACE/.testfiles || mkdir $WORKSPACE/.testfiles - TMPDIR=$WORKSPACE/.testfiles mktemp -d + mktemp -d $WORKSPACE/.testfiles/run-tests.XXXX } create_test_file() { From 2983f3505d80acff04087d6f6ed88ef3fbf97a9f Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 15 Feb 2016 16:17:24 +0100 Subject: [PATCH 4/9] support BSD and GNU sed in tests --- tests/run-tests | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/run-tests b/tests/run-tests index 5efed680..243fbf4c 100755 --- a/tests/run-tests +++ b/tests/run-tests @@ -506,7 +506,7 @@ test -e repo/index.jar grep -F ' Date: Mon, 15 Feb 2016 16:25:43 +0100 Subject: [PATCH 5/9] pre-commit: make pyflakes optional to support older platforms Travis-CI defaults to Ubuntu/precise, which has a very old version of pyflakes that throws false positives. --- hooks/pre-commit | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hooks/pre-commit b/hooks/pre-commit index 5ac72c1c..4bb0a1ed 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -63,6 +63,10 @@ err() { exit 1 } +warn() { + echo WARNING: "$@" +} + cmd_exists() { command -v $1 1>/dev/null } @@ -72,7 +76,8 @@ if cmd_exists pyflakes-python2; then elif cmd_exists pyflakes; then PYFLAKES=pyflakes else - err "pyflakes is not installed!" + PYFLAKES=echo + warn "pyflakes is not installed, using dummy placeholder!" fi if cmd_exists pep8-python2; then From 0bdbadabffb9a738cb67620838cdcb23efd2b737 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 15 Feb 2016 19:58:05 +0100 Subject: [PATCH 6/9] init: check if examples/ exists in layout before using the path There is definitely some odd stuff that happens in all these paths, so let's just check that examples/ exists, and move on from there. --- fdroidserver/init.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fdroidserver/init.py b/fdroidserver/init.py index 3474fba1..f8f71bfb 100644 --- a/fdroidserver/init.py +++ b/fdroidserver/init.py @@ -66,17 +66,17 @@ def main(): # find root install prefix tmp = os.path.dirname(sys.argv[0]) + examplesdir = None if os.path.basename(tmp) == 'bin': - prefix = None egg_link = os.path.join(tmp, '..', 'local/lib/python2.7/site-packages/fdroidserver.egg-link') if os.path.exists(egg_link): # installed from local git repo examplesdir = os.path.join(open(egg_link).readline().rstrip(), 'examples') else: - prefix = os.path.dirname(os.path.dirname(__file__)) # use .egg layout - if not prefix.endswith('.egg'): # use UNIX layout - prefix = os.path.dirname(tmp) - examplesdir = prefix + '/share/doc/fdroidserver/examples' + # try .egg layout + examplesdir = os.path.dirname(os.path.dirname(__file__)) + '/share/doc/fdroidserver/examples' + if not os.path.exists(examplesdir): # use UNIX layout + examplesdir = os.path.dirname(tmp) + '/share/doc/fdroidserver/examples' else: # we're running straight out of the git repo prefix = os.path.normpath(os.path.join(os.path.dirname(__file__), '..')) From 46d754416d47e95999eab749709266cc0def5a67 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 15 Feb 2016 14:00:52 +0100 Subject: [PATCH 7/9] travis-ci: run test suite on OSX and GNU/Linux --- .travis.yml | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..12816ff5 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,55 @@ + +# Use the Android base system since it provides the SDK, etc. +language: java + +matrix: + allow_failures: + - os: linux # this is really about OSX, Ubuntu is just bonus + include: + - os: linux + language: android + sudo: required + # this doesn't actually work yet https://github.com/travis-ci/travis-ci/issues/5337 + dist: trusty + - os: osx + env: ANDROID_HOME=/usr/local/opt/android-sdk + +#jdk: +# - oraclejdk8 +# - oraclejdk7 +# - openjdk7 + +licenses: + - 'android-sdk-preview-license-52d11cd2' + - 'android-sdk-license-.+' + +# the PPA is needed on Ubuntu 14.04 precise, and with python3, trusty too +# the pip thing is a hack that can go away with trusty +install: + - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then + brew update; + brew install android-sdk dash gnu-sed jpeg python; + sudo pip install pep8 pyflakes pylint + apache-libcloud mwclient paramiko pillow pyasn1 pyasn1-modules + pyyaml requests; + echo y | android --verbose update sdk --no-ui --filter platform-tools,build-tools-23.0.2; + elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then + sudo add-apt-repository ppa:guardianproject/fdroidserver -y; + sudo apt-get -q update -y; + sudo apt-get -q install -y --no-install-recommends python + python-git python-imaging python-libcloud python-logilab-astng + python-paramiko python-pip python-pyasn1 + python-requests python-virtualenv python-yaml rsync + pylint pep8 dash bash ruby + python-dev libjpeg-dev zlib1g-dev; + sudo pip install pyasn1-modules; + fi + +script: + - cd tests + - ./complete-ci-tests + +after_failure: + - cd $TRAVIS_BUILD_DIR + - ls -lRa env + - ls -lR | curl -F 'clbin=<-' https://clbin.com From a28ede2b6782ab80fd7469ea3359ac9d4827bb28 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 15 Feb 2016 20:22:17 +0100 Subject: [PATCH 8/9] PEP8 fix E225 missing whitespace around operator --- fdroidserver/build.py | 4 ++-- fdroidserver/scanner.py | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 1b3794cd..2add23a7 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -523,7 +523,7 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir, cmd = [config['gradle']] if build.gradleprops: - cmd += ['-P'+kv for kv in build.gradleprops] + cmd += ['-P' + kv for kv in build.gradleprops] cmd += ['clean'] @@ -731,7 +731,7 @@ def build_local(app, build, vcs, build_dir, output_dir, srclib_dir, extlib_dir, cmd = [config['gradle']] if build.gradleprops: - cmd += ['-P'+kv for kv in build.gradleprops] + cmd += ['-P' + kv for kv in build.gradleprops] cmd += gradletasks diff --git a/fdroidserver/scanner.py b/fdroidserver/scanner.py index 30aaddf8..e41e5570 100644 --- a/fdroidserver/scanner.py +++ b/fdroidserver/scanner.py @@ -211,7 +211,7 @@ def scan_source(build_dir, root_dir, build): for i, line in enumerate(lines): if is_used_by_gradle(line): for name in suspects_found(line): - count += handleproblem('usual supect \'%s\' at line %d' % (name, i+1), fd, fp) + count += handleproblem('usual supect \'%s\' at line %d' % (name, i + 1), fd, fp) noncomment_lines = [l for l in lines if not common.gradle_comment.match(l)] joined = re.sub(r'[\n\r\s]+', ' ', ' '.join(noncomment_lines)) for m in gradle_mavenrepo.finditer(joined): From 78151c04c583c8e6c10a9bffb8cc7d4f5dbbde9b Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 15 Feb 2016 23:06:23 +0100 Subject: [PATCH 9/9] travis-ci: make pip install deps based on setup.py --- .travis.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index 12816ff5..bf7c479a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,11 +14,6 @@ matrix: - os: osx env: ANDROID_HOME=/usr/local/opt/android-sdk -#jdk: -# - oraclejdk8 -# - oraclejdk7 -# - openjdk7 - licenses: - 'android-sdk-preview-license-52d11cd2' - 'android-sdk-license-.+' @@ -29,20 +24,19 @@ install: - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; brew install android-sdk dash gnu-sed jpeg python; - sudo pip install pep8 pyflakes pylint - apache-libcloud mwclient paramiko pillow pyasn1 pyasn1-modules - pyyaml requests; + sudo pip install pep8 pyflakes pylint; + sudo pip install -e .; + sudo rm -rf fdroidserver.egg-info; echo y | android --verbose update sdk --no-ui --filter platform-tools,build-tools-23.0.2; elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then sudo add-apt-repository ppa:guardianproject/fdroidserver -y; sudo apt-get -q update -y; sudo apt-get -q install -y --no-install-recommends python python-git python-imaging python-libcloud python-logilab-astng - python-paramiko python-pip python-pyasn1 + python-paramiko python-pip python-pyasn1 python-pyasn1-modules python-requests python-virtualenv python-yaml rsync pylint pep8 dash bash ruby python-dev libjpeg-dev zlib1g-dev; - sudo pip install pyasn1-modules; fi script: