From baad79f9e887ba70e4355661338b76823ce3d6a3 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Fri, 11 Mar 2016 20:59:04 +0100 Subject: [PATCH 1/5] travis-ci osx: make sure build-tools are always installed It seems that sometimes build-tools packages will not be installed unless the --all flag is specified. --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index bf7c479a..b606d254 100644 --- a/.travis.yml +++ b/.travis.yml @@ -27,7 +27,7 @@ install: 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; + echo y | android --verbose update sdk --no-ui --all --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; From 0fef06a5c90d935cfc70084150cec9214ce19570 Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 14 Mar 2016 09:35:23 +0100 Subject: [PATCH 2/5] jenkins-build-makebuildserver: make sure fdroiddata is on master on the GP jenkins, I got this: + git pull From https://gitlab.com/fdroid/fdroiddata 1df2d03..621ef4f master -> origin/master You are not currently on a branch. Please specify which branch you want to merge with. See git-pull(1) for details. git pull --- jenkins-build-makebuildserver | 1 + 1 file changed, 1 insertion(+) diff --git a/jenkins-build-makebuildserver b/jenkins-build-makebuildserver index 193718b2..36df83af 100755 --- a/jenkins-build-makebuildserver +++ b/jenkins-build-makebuildserver @@ -51,6 +51,7 @@ echo "apt_package_cache = True" >> $WORKSPACE/makebuildserver.config.py # this can be handled in the jenkins job, or here: if [ -e fdroiddata ]; then cd fdroiddata + git checkout master git pull cd .. else From 20d082dfed10c08a38e0728a3384908916692ccd Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 14 Mar 2016 11:02:01 +0100 Subject: [PATCH 3/5] travis-ci: move python deps to 3 --- .travis.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.travis.yml b/.travis.yml index b606d254..8fe55874 100644 --- a/.travis.yml +++ b/.travis.yml @@ -22,21 +22,21 @@ licenses: # 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 .; + brew update > /dev/null; + brew install android-sdk dash gnu-sed jpeg python3; + sudo pip3 install pep8 pyflakes pylint; + sudo pip3 install -e .; sudo rm -rf fdroidserver.egg-info; echo y | android --verbose update sdk --no-ui --all --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; + sudo apt-get -q install -y --no-install-recommends python3 python3-dev + python3-git python3-pil python3-libcloud python3-logilab-astng + python3-paramiko python3-pip python3-pyasn1 python3-pyasn1-modules + python3-requests python3-virtualenv python3-yaml rsync + pyflakes pylint3 pep8 dash bash ruby libjpeg-dev zlib1g-dev; + sudo pip3 install pylint; fi script: From 7039d16046c485d94e1c71705a58368d341f0b3e Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 14 Mar 2016 11:05:06 +0100 Subject: [PATCH 4/5] always parse versions as strings, not bytes Fixes a couple errors like: File "./makebuildserver", line 30, in vagrant out += line TypeError: Can't convert 'bytes' object to str implicitly If universal_newlines=False, the default, then Popen will return bytes if the newlines in the data do not match the system's newlines. Setting it to true enables auto-conversion, and then guarantees that the data is always str. "If universal_newlines is True, the file objects stdin, stdout and stderr are opened as text streams in universal newlines mode, as described above in Frequently Used Arguments, otherwise they are opened as binary streams." https://docs.python.org/3/library/subprocess.html#subprocess.Popen --- fdroid | 6 ++++-- fdroidserver/build.py | 1 + makebuildserver | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/fdroid b/fdroid index 045f2aac..53cc00c5 100755 --- a/fdroid +++ b/fdroid @@ -76,9 +76,11 @@ def main(): import subprocess try: output = subprocess.check_output(['git', 'describe'], - stderr=subprocess.STDOUT) + stderr=subprocess.STDOUT, + universal_newlines=True) except subprocess.CalledProcessError: - output = 'git commit ' + subprocess.check_output(['git', 'rev-parse', 'HEAD']) + output = 'git commit ' + subprocess.check_output(['git', 'rev-parse', 'HEAD'], + universal_newlines=True) elif os.path.exists('setup.py'): import re m = re.search(r'''.*[\s,\(]+version\s*=\s*["']([0-9a-z.]+)["'].*''', diff --git a/fdroidserver/build.py b/fdroidserver/build.py index 10f40dc4..3837694b 100644 --- a/fdroidserver/build.py +++ b/fdroidserver/build.py @@ -176,6 +176,7 @@ def get_clean_vm(reset=False): os.mkdir('builder') p = subprocess.Popen(['vagrant', '--version'], + universal_newlines=True, stdout=subprocess.PIPE) vver = p.communicate()[0].strip().split(' ')[1] if vver.split('.')[0] != '1' or int(vver.split('.')[1]) < 4: diff --git a/makebuildserver b/makebuildserver index dc9d1f44..48e0f197 100755 --- a/makebuildserver +++ b/makebuildserver @@ -19,7 +19,8 @@ def vagrant(params, cwd=None, printout=False): is the stdout (and stderr) from vagrant """ p = subprocess.Popen(['vagrant'] + params, cwd=cwd, - stdout=subprocess.PIPE, stderr=subprocess.STDOUT) + stdout=subprocess.PIPE, stderr=subprocess.STDOUT, + universal_newlines=True) out = '' if printout: while True: From aa0ea4646517716f7198ea5c5331123c4bdabb6e Mon Sep 17 00:00:00 2001 From: Hans-Christoph Steiner Date: Mon, 14 Mar 2016 11:33:07 +0100 Subject: [PATCH 5/5] not all UNIX `echo` commands support -n FreeBSD and OSX's does not, for example, and the shell should just treat the '\n' as white space in the command line. --- hooks/pre-commit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hooks/pre-commit b/hooks/pre-commit index f0e4d657..0f083d00 100755 --- a/hooks/pre-commit +++ b/hooks/pre-commit @@ -75,7 +75,7 @@ find_command() { for suff in "3" "-python3" ""; do cmd=${1}${suff} if cmd_exists $cmd; then - echo -n $cmd + echo $cmd return 0 fi done