From 1e697787a6e481e741306793f12e7941ed28d3ab Mon Sep 17 00:00:00 2001 From: Pavol Rusnak Date: Fri, 11 Jan 2019 12:11:04 +0100 Subject: [PATCH] update Dockerfile and .travis.yml to be more similar to trezor-mcu --- .travis.yml | 55 +++++++++++++++++++++++----------------------- Dockerfile | 23 ++++++++++--------- vendor/micropython | 2 +- 3 files changed, 42 insertions(+), 38 deletions(-) diff --git a/.travis.yml b/.travis.yml index ee7c97855c..10b250a848 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,11 +2,25 @@ sudo: false dist: trusty language: c +addons: + apt: + sources: + - deadsnakes + packages: + - build-essential + - python3.6 + - python3.6-dev + - python3.6-venv + - libusb-1.0-0-dev + - libudev-dev + env: global: + - MAKEFLAGS=-j2 + - PYTHON=python3.6 - PROTOBUF_VERSION=3.4.0 - - TOOLCHAIN_SHORTVER=7-2018q2 - - TOOLCHAIN_LONGVER=gcc-arm-none-eabi-7-2018-q2-update + - TOOLCHAIN_SHORTVER=8-2018q4 + - TOOLCHAIN_LONGVER=gcc-arm-none-eabi-8-2018-q4-major matrix: - GOAL=stm32 - GOAL=unix @@ -17,40 +31,27 @@ matrix: - compiler: clang env: GOAL=unix -addons: - apt: - sources: - - deadsnakes - packages: - - build-essential - - gcc-multilib - - libusb-1.0-0-dev - - libudev-dev - - python3.6 - - python3.6-dev - - python3.6-venv - cache: directories: - $HOME/libsodium before_install: - - python3.6 -m ensurepip --user - - python3.6 -m pip install --user pipenv + - $PYTHON -m ensurepip --user + - $PYTHON -m pip install --user pipenv install: - - curl -LO "https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" - - unzip "protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" -d protoc - - export PATH="$(pwd)/protoc/bin:$PATH" - - ./travis-install-libsodium.sh - - export PKG_CONFIG_PATH=$HOME/libsodium/lib/pkgconfig:$PKG_CONFIG_PATH - - export LD_LIBRARY_PATH=$HOME/libsodium/lib:$LD_LIBRARY_PATH - - pipenv install + - ./travis-install-libsodium.sh + - export PKG_CONFIG_PATH=$HOME/libsodium/lib/pkgconfig:$PKG_CONFIG_PATH + - export LD_LIBRARY_PATH=$HOME/libsodium/lib:$LD_LIBRARY_PATH + - wget "https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" + - unzip "protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" -d protoc + - export PATH="$(pwd)/protoc/bin:$PATH" + - pipenv install before_script: - - test "$GOAL" != "stm32" || wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/$TOOLCHAIN_SHORTVER/$TOOLCHAIN_LONGVER-linux.tar.bz2 - - test "$GOAL" != "stm32" || tar xfj $TOOLCHAIN_LONGVER-linux.tar.bz2 - - test "$GOAL" != "stm32" || export PATH=$PWD/$TOOLCHAIN_LONGVER/bin:$PATH + - test "$GOAL" != "stm32" || wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/$TOOLCHAIN_SHORTVER/$TOOLCHAIN_LONGVER-linux.tar.bz2 + - test "$GOAL" != "stm32" || tar xfj $TOOLCHAIN_LONGVER-linux.tar.bz2 + - test "$GOAL" != "stm32" || export PATH=$PWD/$TOOLCHAIN_LONGVER/bin:$PATH script: - test "$GOAL" != "src" || pipenv run make style_check diff --git a/Dockerfile b/Dockerfile index 4643bbb2f8..79cbd1821d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -8,7 +8,7 @@ ENV TOOLCHAIN_FLAVOR=$TOOLCHAIN_FLAVOR # install build tools and dependencies RUN apt-get update && apt-get install -y \ - build-essential wget git python3-pip gcc-multilib + build-essential wget git python3-pip # install dependencies from toolchain source build @@ -46,20 +46,23 @@ RUN if [ "$TOOLCHAIN_FLAVOR" = "src" ]; then \ popd ; \ fi -# install additional tools +# download protobuf -RUN apt-get install -y protobuf-compiler libprotobuf-dev +ENV PROTOBUF_VERSION=3.4.0 +ENV PROTOBUF_HASH=e4b51de1b75813e62d6ecdde582efa798586e09b5beaebfb866ae7c9eaadace4 +RUN wget "https://github.com/google/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" +RUN echo "${PROTOBUF_HASH} protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" | sha256sum -c # setup toolchain ENV PATH=/opt/$TOOLCHAIN_LONGVER/bin:$PATH +ENV PYTHON=python3 +ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 + +# use zipfile module to extract files world-readable +RUN $PYTHON -m zipfile -e "protoc-${PROTOBUF_VERSION}-linux-x86_64.zip" /usr/local && chmod 755 /usr/local/bin/protoc + # install python dependencies -RUN pip3 install scons trezor - -# workarounds for weird default install - -RUN ln -s python3 /usr/bin/python -RUN ln -s dist-packages /usr/local/lib/python3.5/site-packages -ENV LC_ALL=C.UTF-8 LANG=C.UTF-8 +RUN $PYTHON -m pip install scons trezor diff --git a/vendor/micropython b/vendor/micropython index b98de8b581..c5d8107e2a 160000 --- a/vendor/micropython +++ b/vendor/micropython @@ -1 +1 @@ -Subproject commit b98de8b581dfd691dcb1b4efbe7d489a81e1cbaf +Subproject commit c5d8107e2af090ff4547851297a484652fde4242