From 95515527d2672ffe66814977a43991be0efbd97a Mon Sep 17 00:00:00 2001 From: petr-tik Date: Tue, 24 Apr 2018 23:36:51 +0100 Subject: [PATCH 01/21] WIP: added a travis.yml to trigger a test build --- .travis.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 .travis.yml diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..69514af --- /dev/null +++ b/.travis.yml @@ -0,0 +1,14 @@ +language: python + +matrix: + include: + - os: linux + sudo: required + services: + - docker + install: + - docker pull ffig/ffig-base + - docker build -t ffig/web-test -f ./Dockerfile.test . + + script: + - docker run -it ffig/web-test \ No newline at end of file From 861d97afae98f4ce11d2fdf4a8561e086141f0bb Mon Sep 17 00:00:00 2001 From: petr-tik Date: Wed, 25 Apr 2018 14:10:23 +0100 Subject: [PATCH 02/21] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 69514af..91464bf 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,4 +11,4 @@ matrix: - docker build -t ffig/web-test -f ./Dockerfile.test . script: - - docker run -it ffig/web-test \ No newline at end of file + - docker run -it ffig/web-test From a710388896136d0ca87ec7a0e345e85b89777aef Mon Sep 17 00:00:00 2001 From: petr-tik Date: Wed, 25 Apr 2018 14:42:45 +0100 Subject: [PATCH 03/21] bash script prepares a travis box for testing --- build.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 build.sh diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..a57e12b --- /dev/null +++ b/build.sh @@ -0,0 +1,15 @@ +pip2 install --upgrade pip && \ + pip2 install flask && \ + pip3 install --upgrade pip && \ + pip3 install flask + +mdkir -p home + +cd /home && \ + git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git + +cd /home/ffig && git pull origin master && cd ../ + +touch home/ffig/__init__.py home/ffig/ffig/templates/__init__.py + +export PYTHONPATH="${PYTHONPATH}:/home/ffig/" From 9d32a59495f40175779a3a89984552661857943a Mon Sep 17 00:00:00 2001 From: petr-tik Date: Wed, 25 Apr 2018 14:44:28 +0100 Subject: [PATCH 04/21] Remove docker and run unit tests on travis box Moves ffig upstream dependency from dockerfile to build.sh --- .travis.yml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.travis.yml b/.travis.yml index 91464bf..6956915 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,11 +4,9 @@ matrix: include: - os: linux sudo: required - services: - - docker - install: - - docker pull ffig/ffig-base - - docker build -t ffig/web-test -f ./Dockerfile.test . + install: + - ./build.sh + script: - - docker run -it ffig/web-test + - python3 test_ffig_explorer.py From ff401aebda2885c54419ccb9fbbee99f391c59e8 Mon Sep 17 00:00:00 2001 From: petr-tik Date: Wed, 25 Apr 2018 14:49:40 +0100 Subject: [PATCH 05/21] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 6956915..841de36 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ matrix: sudo: required install: - - ./build.sh + - bash ./build.sh script: - python3 test_ffig_explorer.py From 12c60a553dfedd9b780f852d20cb41a35ef9415e Mon Sep 17 00:00:00 2001 From: petr-tik Date: Wed, 25 Apr 2018 14:57:34 +0100 Subject: [PATCH 06/21] Remove pip2 fix dir paths for ffig main dependency --- build.sh | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/build.sh b/build.sh index a57e12b..277e962 100644 --- a/build.sh +++ b/build.sh @@ -1,14 +1,8 @@ -pip2 install --upgrade pip && \ - pip2 install flask && \ - pip3 install --upgrade pip && \ - pip3 install flask +pip3 install --upgrade pip && pip3 install flask -mdkir -p home +cd ../ && git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git -cd /home && \ - git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git - -cd /home/ffig && git pull origin master && cd ../ +cd /ffig && git pull origin master && cd ../rest-api touch home/ffig/__init__.py home/ffig/ffig/templates/__init__.py From cf17ef8104ff3b51fdc29354b8297429ffbd3380 Mon Sep 17 00:00:00 2001 From: petr-tik Date: Wed, 25 Apr 2018 14:57:50 +0100 Subject: [PATCH 07/21] Request only py3.6 --- .travis.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.travis.yml b/.travis.yml index 841de36..79a4fc8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,4 +1,6 @@ language: python +python: + - "3.6" matrix: include: From c930567d66ffb7ea53d5afa1a24b9fe3aecbc10b Mon Sep 17 00:00:00 2001 From: petr-tik Date: Wed, 25 Apr 2018 23:28:57 +0100 Subject: [PATCH 08/21] Changing the build script and giving it right to execute --- build.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/build.sh b/build.sh index 277e962..1051a15 100644 --- a/build.sh +++ b/build.sh @@ -1,9 +1,13 @@ pip3 install --upgrade pip && pip3 install flask -cd ../ && git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git +ls -al ../ -cd /ffig && git pull origin master && cd ../rest-api +git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git ../ffig -touch home/ffig/__init__.py home/ffig/ffig/templates/__init__.py +touch ../ffig/__init__.py ../ffig/templates/__init__.py + +ls -al ../ + +cd - export PYTHONPATH="${PYTHONPATH}:/home/ffig/" From 2a94bf789a04f0e10eabd878b97697b5b9124eab Mon Sep 17 00:00:00 2001 From: petr-tik Date: Wed, 25 Apr 2018 23:36:32 +0100 Subject: [PATCH 09/21] Move travis install step into a separate shell script --- .travis.yml | 2 +- prepare_deps.sh | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 prepare_deps.sh diff --git a/.travis.yml b/.travis.yml index 79a4fc8..cf63f9c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -8,7 +8,7 @@ matrix: sudo: required install: - - bash ./build.sh + - bash ./prepare_deps.sh script: - python3 test_ffig_explorer.py diff --git a/prepare_deps.sh b/prepare_deps.sh new file mode 100644 index 0000000..7e0987b --- /dev/null +++ b/prepare_deps.sh @@ -0,0 +1,13 @@ +pip3 install --upgrade pip && pip3 install flask + +ls -al ../ + +git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git ../ffig + +touch ../ffig/__init__.py ../ffig/ffig/templates/__init__.py + +ls -al ../ + +cd - + +export PYTHONPATH="${PYTHONPATH}:../ffig/" From f94b22546330e64fe670512faa5d1570f7d4c5c8 Mon Sep 17 00:00:00 2001 From: petr-tik Date: Wed, 25 Apr 2018 23:48:11 +0100 Subject: [PATCH 10/21] Don't need to change to prev directory - we never leave rest-api dir --- prepare_deps.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/prepare_deps.sh b/prepare_deps.sh index 7e0987b..8cead9d 100644 --- a/prepare_deps.sh +++ b/prepare_deps.sh @@ -6,8 +6,6 @@ git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git ../ffi touch ../ffig/__init__.py ../ffig/ffig/templates/__init__.py -ls -al ../ - -cd - +ls -al ../ffig -export PYTHONPATH="${PYTHONPATH}:../ffig/" +export PYTHONPATH="${PYTHONPATH}:../ffig/ffig/" From 00cf693bd8cec5f324f7c708ac2e4bedbefcd0e2 Mon Sep 17 00:00:00 2001 From: petr-tik Date: Wed, 25 Apr 2018 23:54:16 +0100 Subject: [PATCH 11/21] Add both ffig folders to pythonpath --- prepare_deps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prepare_deps.sh b/prepare_deps.sh index 8cead9d..42b7d20 100644 --- a/prepare_deps.sh +++ b/prepare_deps.sh @@ -8,4 +8,5 @@ touch ../ffig/__init__.py ../ffig/ffig/templates/__init__.py ls -al ../ffig -export PYTHONPATH="${PYTHONPATH}:../ffig/ffig/" +PYTHONPATH="${PYTHONPATH}:../ffig/:../ffig/ffig/" + From 0c883c8f335cbabe4b46dab785c40d81989ca6b0 Mon Sep 17 00:00:00 2001 From: petr-tik Date: Thu, 26 Apr 2018 00:16:18 +0100 Subject: [PATCH 12/21] Using the wrong folder for ffig --- ffig_explorer.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffig_explorer.py b/ffig_explorer.py index 41996a7..ddab5ef 100644 --- a/ffig_explorer.py +++ b/ffig_explorer.py @@ -30,7 +30,7 @@ def gen_bindings_from_tu(): bindings_requested = request.form["bindings_to_generate"] # local re-write/copy of ffig functionality - ffig_subfolder = '/home/ffig/ffig/' + ffig_subfolder = '../ffig/ffig/' template_dir = os.path.join(ffig_subfolder, 'templates') env = ffig.FFIG.set_template_env(template_dir) From 425073d12fb9aa24f7a12d451a85fbf941ae5cdd Mon Sep 17 00:00:00 2001 From: petr-tik Date: Thu, 26 Apr 2018 00:19:50 +0100 Subject: [PATCH 13/21] Set python path and grep env for it --- prepare_deps.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/prepare_deps.sh b/prepare_deps.sh index 42b7d20..373da27 100644 --- a/prepare_deps.sh +++ b/prepare_deps.sh @@ -8,5 +8,6 @@ touch ../ffig/__init__.py ../ffig/ffig/templates/__init__.py ls -al ../ffig -PYTHONPATH="${PYTHONPATH}:../ffig/:../ffig/ffig/" +export PYTHONPATH="${PYTHONPATH}:../ffig/:../ffig/ffig/" +env | grep -i python From 6620e2903678ce888acf4d610e78cc14fbfaaf89 Mon Sep 17 00:00:00 2001 From: petr-tik Date: Thu, 26 Apr 2018 00:23:39 +0100 Subject: [PATCH 14/21] Remove dead ls and add another init --- prepare_deps.sh | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/prepare_deps.sh b/prepare_deps.sh index 373da27..3803d7d 100644 --- a/prepare_deps.sh +++ b/prepare_deps.sh @@ -1,13 +1,8 @@ pip3 install --upgrade pip && pip3 install flask -ls -al ../ - git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git ../ffig -touch ../ffig/__init__.py ../ffig/ffig/templates/__init__.py - -ls -al ../ffig +touch ../ffig/__init__.py ../ffig/ffig/__init__.py ../ffig/ffig/templates/__init__.py export PYTHONPATH="${PYTHONPATH}:../ffig/:../ffig/ffig/" -env | grep -i python From c81355bb7d75286d17ade2e14b73217f69d89691 Mon Sep 17 00:00:00 2001 From: petr-tik Date: Thu, 26 Apr 2018 00:42:03 +0100 Subject: [PATCH 15/21] Reduce the import search space --- prepare_deps.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/prepare_deps.sh b/prepare_deps.sh index 3803d7d..fffc034 100644 --- a/prepare_deps.sh +++ b/prepare_deps.sh @@ -2,7 +2,7 @@ pip3 install --upgrade pip && pip3 install flask git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git ../ffig -touch ../ffig/__init__.py ../ffig/ffig/__init__.py ../ffig/ffig/templates/__init__.py +touch ../ffig/__init__.py ../ffig/ffig/templates/__init__.py -export PYTHONPATH="${PYTHONPATH}:../ffig/:../ffig/ffig/" +export PYTHONPATH="${PYTHONPATH}:../ffig/" From 308a5628b23a0ec88068f4c25cc70b82673d2bd2 Mon Sep 17 00:00:00 2001 From: petr-tik Date: Thu, 26 Apr 2018 00:45:00 +0100 Subject: [PATCH 16/21] Investigating sys.path on travis --- test_ffig_explorer.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test_ffig_explorer.py b/test_ffig_explorer.py index 5bac287..f254fc6 100644 --- a/test_ffig_explorer.py +++ b/test_ffig_explorer.py @@ -2,6 +2,8 @@ import json import unittest +import sys +print(sys.path) import ffig_explorer From 883c2b32dccbfb867f40cfcad8b4b669481cc347 Mon Sep 17 00:00:00 2001 From: petr-tik Date: Thu, 26 Apr 2018 00:59:04 +0100 Subject: [PATCH 17/21] Trying to insert into sys path, since pythonpath doesn't work --- ffig_explorer.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ffig_explorer.py b/ffig_explorer.py index ddab5ef..bd13aec 100644 --- a/ffig_explorer.py +++ b/ffig_explorer.py @@ -6,7 +6,13 @@ import json import shutil -import ffig.FFIG +try: + import ffig.FFIG +except ModuleNotFoundError: + import sys + sys.path.insert(0, '/home/travis/build/FFIG/ffig') + import ffig.FFIG + """ Flask app that implements a basic front-end on the home page and a rest-api under the /api/ endpoints """ From 1770b7a57e1ce055f07ac119a5f93d11a6fad868 Mon Sep 17 00:00:00 2001 From: petr-tik Date: Thu, 26 Apr 2018 01:06:46 +0100 Subject: [PATCH 18/21] find and set ld_lib_path with libclang --- prepare_deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prepare_deps.sh b/prepare_deps.sh index fffc034..918ec98 100644 --- a/prepare_deps.sh +++ b/prepare_deps.sh @@ -5,4 +5,4 @@ git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git ../ffi touch ../ffig/__init__.py ../ffig/ffig/templates/__init__.py export PYTHONPATH="${PYTHONPATH}:../ffig/" - +export LD_LIBRARY_PATH=$(dirname $(find / -name libclang*.so)) From 5238ce43ad0d9c786673b0be2462813d4c6f2ffe Mon Sep 17 00:00:00 2001 From: petr-tik Date: Thu, 26 Apr 2018 01:19:14 +0100 Subject: [PATCH 19/21] Explicitly install llvm-5.0 to fix libclang error --- .travis.yml | 6 ++++++ prepare_deps.sh | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index cf63f9c..f9c5ffd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,12 @@ matrix: include: - os: linux sudo: required + addons: + apt: + sources: + - llvm-toolchain-trusty-5.0 + packages: + - clang-5.0 install: - bash ./prepare_deps.sh diff --git a/prepare_deps.sh b/prepare_deps.sh index 918ec98..1c40a48 100644 --- a/prepare_deps.sh +++ b/prepare_deps.sh @@ -5,4 +5,4 @@ git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git ../ffi touch ../ffig/__init__.py ../ffig/ffig/templates/__init__.py export PYTHONPATH="${PYTHONPATH}:../ffig/" -export LD_LIBRARY_PATH=$(dirname $(find / -name libclang*.so)) +export LD_LIBRARY_PATH=$(llvm-config-5.0 --libdir) From 2b54dceca53b3dbb116f5909398f1ddca7bf221c Mon Sep 17 00:00:00 2001 From: petr-tik Date: Thu, 26 Apr 2018 01:26:15 +0100 Subject: [PATCH 20/21] try version-less llvm-config --- prepare_deps.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/prepare_deps.sh b/prepare_deps.sh index 1c40a48..f773d9e 100644 --- a/prepare_deps.sh +++ b/prepare_deps.sh @@ -5,4 +5,4 @@ git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git ../ffi touch ../ffig/__init__.py ../ffig/ffig/templates/__init__.py export PYTHONPATH="${PYTHONPATH}:../ffig/" -export LD_LIBRARY_PATH=$(llvm-config-5.0 --libdir) +export LD_LIBRARY_PATH=$(llvm-config --libdir) From 1f338d9a51889cccd6f865a9e8c7fd72f8b4f71e Mon Sep 17 00:00:00 2001 From: petr-tik Date: Wed, 9 May 2018 01:03:30 +0100 Subject: [PATCH 21/21] Install libclang-50 and make prepare_deps executable --- .travis.yml | 2 +- prepare_deps.sh | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) mode change 100644 => 100755 prepare_deps.sh diff --git a/.travis.yml b/.travis.yml index f9c5ffd..fd6a73d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,7 +14,7 @@ matrix: - clang-5.0 install: - - bash ./prepare_deps.sh + - ./prepare_deps.sh script: - python3 test_ffig_explorer.py diff --git a/prepare_deps.sh b/prepare_deps.sh old mode 100644 new mode 100755 index f773d9e..aad41ff --- a/prepare_deps.sh +++ b/prepare_deps.sh @@ -5,4 +5,6 @@ git clone -b master --recurse-submodules https://github.com/FFIG/ffig.git ../ffi touch ../ffig/__init__.py ../ffig/ffig/templates/__init__.py export PYTHONPATH="${PYTHONPATH}:../ffig/" -export LD_LIBRARY_PATH=$(llvm-config --libdir) + +apt-get install libclang-5.0-dev +export LD_LIBRARY_PATH=/usr/lib/llvm-5.0/lib:$LD_LIBRARY_PATH