ソースを参照

Merge branch 'feature/idf_docker_updates_v3.3' into 'release/v3.3'

tools/docker: install CMake version provided in tools.json (backport v3.3)

See merge request espressif/esp-idf!7483
Ivan Grokhotkov 6 年 前
コミット
f3c3605fc2
2 ファイル変更23 行追加12 行削除
  1. 5 3
      tools/docker/Dockerfile
  2. 18 9
      tools/idf_tools.py

+ 5 - 3
tools/docker/Dockerfile

@@ -8,7 +8,6 @@ RUN apt-get update && apt-get install -y \
     ca-certificates \
     ccache \
     check \
-    cmake \
     curl \
     flex \
     git \
@@ -53,8 +52,11 @@ RUN echo IDF_CHECKOUT_REF=$IDF_CHECKOUT_REF IDF_CLONE_BRANCH_OR_TAG=$IDF_CLONE_B
       git submodule update --init --recursive; \
     fi
 
-RUN $IDF_PATH/install.sh && \
-  rm -rf $IDF_TOOLS_PATH/dist
+# Install all the required tools, plus CMake
+RUN $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
 
 RUN mkdir -p $HOME/.ccache && \
   touch $HOME/.ccache/ccache.conf

+ 18 - 9
tools/idf_tools.py

@@ -1065,7 +1065,10 @@ def action_download(args):
         tool_for_platform = tool_obj.copy_for_platform(platform)
         tools_info_for_platform[name] = tool_for_platform
 
-    if 'all' in tools_spec:
+    if not tools_spec or 'required' in tools_spec:
+        tools_spec = [k for k, v in tools_info_for_platform.items() if v.get_install_type() == IDFTool.INSTALL_ALWAYS]
+        info('Downloading tools for {}: {}'.format(platform, ', '.join(tools_spec)))
+    elif 'all' in tools_spec:
         tools_spec = [k for k, v in tools_info_for_platform.items() if v.get_install_type() != IDFTool.INSTALL_NEVER]
         info('Downloading tools for {}: {}'.format(platform, ', '.join(tools_spec)))
 
@@ -1084,7 +1087,9 @@ def action_download(args):
             raise SystemExit(1)
         if tool_version is None:
             tool_version = tool_obj.get_recommended_version()
-        assert tool_version is not None
+        if tool_version is None:
+            fatal('tool {} not found for {} platform'.format(tool_name, platform))
+            raise SystemExit(1)
         tool_spec = '{}@{}'.format(tool_name, tool_version)
 
         info('Downloading {}'.format(tool_spec))
@@ -1096,7 +1101,7 @@ def action_download(args):
 def action_install(args):
     tools_info = load_tools_info()
     tools_spec = args.tools
-    if not tools_spec:
+    if not tools_spec or 'required' in tools_spec:
         tools_spec = [k for k, v in tools_info.items() if v.get_install_type() == IDFTool.INSTALL_ALWAYS]
         info('Installing tools: {}'.format(', '.join(tools_spec)))
     elif 'all' in tools_spec:
@@ -1254,15 +1259,19 @@ def main(argv):
                                                 'will be used instead. If this flag is given, the version in PATH ' +
                                                 'will be used.', action='store_true')
     install = subparsers.add_parser('install', help='Download and install tools into the tools directory')
-    install.add_argument('tools', nargs='*', help='Tools to install. ' +
-                                                  'To install a specific version use tool_name@version syntax.' +
-                                                  'Use \'all\' to install all tools, including the optional ones.')
+    install.add_argument('tools', metavar='TOOL', nargs='*', default=['required'],
+                         help='Tools to install. ' +
+                         'To install a specific version use <tool_name>@<version> syntax. ' +
+                         'Use empty or \'required\' to install required tools, not optional ones. ' +
+                         'Use \'all\' to install all tools, including the optional ones.')
 
     download = subparsers.add_parser('download', help='Download the tools into the dist directory')
     download.add_argument('--platform', help='Platform to download the tools for')
-    download.add_argument('tools', nargs='+', help='Tools to download. ' +
-                                                   'To download a specific version use tool_name@version syntax.' +
-                                                   'Use \'all\' to download all tools, including the optional ones.')
+    download.add_argument('tools', metavar='TOOL', nargs='*', default=['required'],
+                          help='Tools to download. ' +
+                          'To download a specific version use <tool_name>@<version> syntax. ' +
+                          'Use empty or \'required\' to download required tools, not optional ones. ' +
+                          'Use \'all\' to download all tools, including the optional ones.')
 
     if IDF_MAINTAINER:
         for subparser in [download, install]: