Browse Source

Update Dockerfile working on both x64 / ARM

Closes https://github.com/espressif/esp-idf/issues/6730
Tomas Sebestik 4 years ago
parent
commit
d22795ea56

+ 6 - 0
requirements.txt

@@ -8,7 +8,13 @@ setuptools>=21
 click>=7.0
 pyserial>=3.3
 future>=0.15.2
+
 cryptography>=2.1.4
+--only-binary cryptography
+# Only binary for cryptography is here to make it work on ARMv7 architecture
+# We do have cryptography binary on https://dl.espressif.com/pypi for ARM
+# On https://pypi.org/ are no ARM binaries as standard now
+
 pyparsing>=2.0.3,<2.4.0
 pyelftools>=0.22
 idf-component-manager>=0.2.99-beta

+ 7 - 16
tools/check_python_dependencies.py

@@ -1,18 +1,7 @@
 #!/usr/bin/env python
 #
-# Copyright 2018 Espressif Systems (Shanghai) PTE LTD
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
+# SPDX-FileCopyrightText: 2018-2021 Espressif Systems (Shanghai) CO LTD
+# SPDX-License-Identifier: Apache-2.0
 
 import argparse
 import os
@@ -39,7 +28,7 @@ def escape_backslash(path):
 if __name__ == '__main__':
     idf_path = os.getenv('IDF_PATH')
 
-    default_requirements_path = os.path.join(idf_path, 'requirements.txt')
+    default_requirements_path = os.path.join(idf_path, 'requirements.txt')  # type: ignore
 
     parser = argparse.ArgumentParser(description='ESP-IDF Python package dependency checker')
     parser.add_argument('--requirements', '-r',
@@ -55,8 +44,10 @@ if __name__ == '__main__':
             # adjustments for options which we use.
             if line.startswith('file://'):
                 line = os.path.basename(line)
+            if line.startswith('--only-binary'):
+                continue
             if line.startswith('-e') and '#egg=' in line:  # version control URLs, take the egg= part at the end only
-                line = re.search(r'#egg=([^\s]+)', line).group(1)
+                line = re.search(r'#egg=([^\s]+)', line).group(1)  # type: ignore
             try:
                 pkg_resources.require(line)
             except Exception:
@@ -76,7 +67,7 @@ if __name__ == '__main__':
                 install_script = 'install.bat'
             else:
                 install_script = 'install.sh'
-            print('To install the missing packages, please run "%s"' % os.path.join(idf_path, install_script))
+            print('To install the missing packages, please run "%s"' % os.path.join(idf_path, install_script))  # type: ignore
         elif sys.platform == 'win32' and os.environ.get('MSYSTEM', None) == 'MINGW32' and '/mingw32/bin/python' in sys.executable:
             print("The recommended way to install a packages is via \"pacman\". Please run \"pacman -Ss <package_name>\" for"
                   ' searching the package database and if found then '

+ 0 - 1
tools/ci/check_copyright_ignore.txt

@@ -4017,7 +4017,6 @@ tools/ble/lib_gap.py
 tools/ble/lib_gatt.py
 tools/build_apps.py
 tools/catch/catch.hpp
-tools/check_python_dependencies.py
 tools/check_term.py
 tools/ci/check_artifacts_expire_time.py
 tools/ci/check_build_warnings.py

+ 18 - 11
tools/docker/Dockerfile

@@ -3,7 +3,9 @@ FROM ubuntu:20.04
 ARG DEBIAN_FRONTEND=noninteractive
 
 # We need libpython2.7 due to GDB tools
-RUN apt-get update && apt-get install -y \
+RUN : \
+  && apt-get update \
+  && apt-get install -y \
     apt-utils \
     bison \
     ca-certificates \
@@ -14,22 +16,25 @@ RUN apt-get update && apt-get install -y \
     git \
     gperf \
     lcov \
+    libffi-dev \
     libncurses-dev \
+    libpython2.7 \
     libusb-1.0-0-dev \
     make \
     ninja-build \
-    libpython2.7 \
     python3 \
     python3-pip \
     unzip \
     wget \
     xz-utils \
     zip \
-   && apt-get autoremove -y \
-   && rm -rf /var/lib/apt/lists/* \
-   && update-alternatives --install /usr/bin/python python /usr/bin/python3 10
-
-RUN python -m pip install --upgrade pip virtualenv
+  && apt-get autoremove -y \
+  && rm -rf /var/lib/apt/lists/* \
+  && update-alternatives --install /usr/bin/python python /usr/bin/python3 10 \
+  && python -m pip install --upgrade \
+    pip \
+    virtualenv \
+  && :
 
 # To build the image for a branch or a tag of IDF, pass --build-arg IDF_CLONE_BRANCH_OR_TAG=name.
 # To build the image with a specific commit ID of IDF, pass --build-arg IDF_CHECKOUT_REF=commit-id.
@@ -54,15 +59,17 @@ RUN echo IDF_CHECKOUT_REF=$IDF_CHECKOUT_REF IDF_CLONE_BRANCH_OR_TAG=$IDF_CLONE_B
       git submodule update --init --recursive; \
     fi
 
-# Install all the required tools, plus CMake
-RUN $IDF_PATH/tools/idf_tools.py --non-interactive install required \
+# Install all the required tools
+RUN : \
+  && update-ca-certificates --fresh \
+  && $IDF_PATH/tools/idf_tools.py --non-interactive install required \
   && $IDF_PATH/tools/idf_tools.py --non-interactive install cmake \
   && $IDF_PATH/tools/idf_tools.py --non-interactive install-python-env \
-  && rm -rf $IDF_TOOLS_PATH/dist
+  && rm -rf $IDF_TOOLS_PATH/dist \
+  && :
 
 # Ccache is installed, enable it by default
 ENV IDF_CCACHE_ENABLE=1
-
 COPY entrypoint.sh /opt/esp/entrypoint.sh
 
 ENTRYPOINT [ "/opt/esp/entrypoint.sh" ]

+ 5 - 0
tools/tools.json

@@ -410,6 +410,11 @@
             "size": 43877847,
             "url": "https://github.com/Kitware/CMake/releases/download/v3.20.3/cmake-3.20.3-linux-x86_64.tar.gz"
           },
+          "linux-armel": {
+            "sha256": "f8bd050c2745f0dcc4b7cef9738bbfef775950a10f5bd377abb0062835e669dc",
+            "size": 13759084,
+            "url": "https://dl.espressif.com/dl/cmake/cmake-3.20.3-Linux-armv7l.tar.gz"
+          },
           "macos": {
             "sha256": "5f72dba3aa5f3800fb29ab6115ae0b31f10bdb2aad66204e14c98f6ac7e6b6ed",
             "size": 66311879,