diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000..bf7c479a --- /dev/null +++ b/.travis.yml @@ -0,0 +1,49 @@ + +# 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 + +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; + 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-pyasn1-modules + python-requests python-virtualenv python-yaml rsync + pylint pep8 dash bash ruby + python-dev libjpeg-dev zlib1g-dev; + fi + +script: + - cd tests + - ./complete-ci-tests + +after_failure: + - cd $TRAVIS_BUILD_DIR + - ls -lRa env + - ls -lR | curl -F 'clbin=<-' https://clbin.com 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/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__), '..')) 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): 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 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 diff --git a/tests/run-tests b/tests/run-tests index 7629f431..243fbf4c 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() { @@ -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 #------------------------------------------------------------------------------# @@ -503,7 +506,7 @@ test -e repo/index.jar grep -F '