From d3e0a566af5f3a07745cdc3cd7dca9282a56685d Mon Sep 17 00:00:00 2001 From: cc <18856836718@163.com> Date: Wed, 20 Mar 2024 20:08:51 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9devkitpipeline=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E5=B7=A5=E5=85=B7pyinstaller=E6=89=93=E5=8C=85?= =?UTF-8?q?=E5=86=85=E5=AE=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build.sh | 2 +- component/build_component.sh | 14 +++++------- tools/download_dependency/build_download.sh | 4 +--- tools/download_dependency/src/download.py | 22 ++++++++++++++++++- .../src/download_config.py | 16 ++++++++++++++ .../download_dependency/src/download_utils.py | 7 ------ .../src/handler/gather_package.py | 3 ++- .../install_dependency/src/lkp_collect_map.py | 8 ++++--- 8 files changed, 52 insertions(+), 24 deletions(-) diff --git a/build.sh b/build.sh index 0bec869..4315364 100644 --- a/build.sh +++ b/build.sh @@ -5,7 +5,7 @@ set -e current_dir=$(cd $(dirname "$0"); pwd) -tag="v0.1" +tag="v0.2" mkdir -p "${current_dir}"/build diff --git a/component/build_component.sh b/component/build_component.sh index 74c82c3..52235f8 100644 --- a/component/build_component.sh +++ b/component/build_component.sh @@ -13,16 +13,15 @@ umask 077 function build_lkp_tests() { # 单独处理LkpTests mkdir -p "${final_component_dir}"/LkpTests - bash "${current_dir}"/LkpTests/build_lkp_tests_all.sh "${final_component_dir}"/LkpTests - - if [[ "$?" -ne "0" ]]; then - exit 1 - fi cp -rf "${current_dir}"/LkpTests/install.sh "${final_component_dir}"/LkpTests cp -rf "${current_dir}"/LkpTests/check_install_result.sh "${final_component_dir}"/LkpTests } +function build_devkit_distribute() { + bash "${current_dir}"/DevkitDistribute/build_devkit_distribute.sh +} + function main() { if [[ -d ${final_component_dir} ]]; then rm -rf "${final_component_dir}" @@ -31,15 +30,14 @@ function main() { mkdir -p "${final_component_dir}" component_arrays=( - "BiShengCompiler" "BiShengJDK8" "BiShengJDK17" "GCCforOpenEuler" "OpenEulerMirrorISO" "CompatibilityTesting" "CloudTest" + "BiShengCompiler" "BiShengJDK8" "BiShengJDK17" "GCCforOpenEuler" "OpenEulerMirrorISO" "CompatibilityTesting" ) for element in "${component_arrays[@]}"; do cp -rf "${current_dir}/${element}" "${final_component_dir}" done build_lkp_tests - - bash "${current_dir}"/DevkitDistribute/build_devkit_distribute.sh + build_devkit_distribute } main "$@" diff --git a/tools/download_dependency/build_download.sh b/tools/download_dependency/build_download.sh index 500aabd..0d00fc0 100644 --- a/tools/download_dependency/build_download.sh +++ b/tools/download_dependency/build_download.sh @@ -14,6 +14,4 @@ mkdir -p "${build_dir}" cd "${build_dir}" -pyinstaller -F "${current_dir}"/src/download.py -p "${current_dir}"/src \ - --add-data "../../tools/download_dependency/lkp_help:lkp_help" \ - --add-data "../../tools/download_dependency/compatibility_test_help:compatibility_test_help" +pyinstaller -F "${current_dir}"/src/download.py -p "${current_dir}"/src diff --git a/tools/download_dependency/src/download.py b/tools/download_dependency/src/download.py index 7586f9b..eab41a3 100644 --- a/tools/download_dependency/src/download.py +++ b/tools/download_dependency/src/download.py @@ -6,7 +6,7 @@ import shutil import tarfile import time import download_config -from download_utils import download_dependence_handler, download_dependence_file, base_path +from download_utils import download_dependence_handler, download_dependence_file from download_command_line import process_command_line, CommandLine FILE = "file" @@ -36,6 +36,25 @@ component_collection_map = { ) } +lkp_collection_map = { + "LkpTests": { + "download file": { + URL: f"{download_config.LkpTests.get(FILE)}", + SAVE_PATH: f"{os.path.join(DEFAULT_PATH, 'lkp-tests.tar.gz')}", + }, + "download gem dependency": { + URL: f"{download_config.LkpTests.get('gem dependency')}", + SAVE_PATH: f"{os.path.join(DEFAULT_PATH, 'gem_dependencies.zip')}", + }, + }, + "CompatibilityTesting": { + "download file": { + URL: f"{download_config.CompatibilityTesting.get(FILE)}", + SAVE_PATH: f"{os.path.join(DEFAULT_PATH, 'compatibility_testing.tar.gz')}", + } + }, +} + def download_dependence(): if not os.path.exists(DEFAULT_PATH): @@ -47,6 +66,7 @@ def download_dependence(): pass ret = True + component_collection_map.update(lkp_collection_map) for component_name in component_collection_map: shell_dict = component_collection_map.get(component_name) ret = ret and download_dependence_handler(shell_dict) diff --git a/tools/download_dependency/src/download_config.py b/tools/download_dependency/src/download_config.py index 6bda486..9d4d3b5 100644 --- a/tools/download_dependency/src/download_config.py +++ b/tools/download_dependency/src/download_config.py @@ -20,6 +20,22 @@ BiShengJDK17 = { } +LkpTests = { + "component_name": "LkpTests", + "file": "https://gitee.com/openeuler/devkit-pipeline/releases/download/v0.2/lkp-tests.tar.gz", + "gem dependency": "https://gitee.com/openeuler/devkit-pipeline/releases/download/v0.2/gem_dependencies.zip", +} + +CompatibilityTesting = { + "component_name": "CompatibilityTesting", + "file": "https://gitee.com/openeuler/devkit-pipeline/releases/download/v0.2/compatibility_testing.tar.gz", +} + +DevkitDistribute = { + "component_name": "DevkitDistribute", + "file": "https://gitee.com/openeuler/devkit-pipeline/releases/download/v0.2/devkit_distribute.tar.gz", +} + OpenEuler_2003_LTS = { "component_name": "openEuler_2003_LTS", "file": "https://mirrors.huaweicloud.com/openeuler/openEuler-20.03-LTS/ISO/aarch64/openEuler-20.03-LTS-everything-aarch64-dvd.iso", diff --git a/tools/download_dependency/src/download_utils.py b/tools/download_dependency/src/download_utils.py index 85aeda3..6f42217 100644 --- a/tools/download_dependency/src/download_utils.py +++ b/tools/download_dependency/src/download_utils.py @@ -35,10 +35,3 @@ def download_dependence_file(shell_cmd, shell_dict): ret = False return ret - -def base_path(path): - if getattr(sys, 'frozen', False): - base_dir = sys._MEIPASS - else: - base_dir = os.path.dirname(__file__) - return os.path.join(base_dir, path) diff --git a/tools/install_dependency/src/handler/gather_package.py b/tools/install_dependency/src/handler/gather_package.py index a5f4691..edaed4e 100644 --- a/tools/install_dependency/src/handler/gather_package.py +++ b/tools/install_dependency/src/handler/gather_package.py @@ -2,7 +2,7 @@ import logging import os import subprocess import constant -from download import download_dependence, component_collection_map +from download import download_dependence, component_collection_map, lkp_collection_map from handler.handler_and_node import Handler LOGGER = logging.getLogger("install_dependency") @@ -60,6 +60,7 @@ class GatherPackage(Handler): if not os.path.isdir(constant.DEPENDENCY_DIR): LOGGER.warning(f"The directory {constant.DEPENDENCY_DIR} not exists.") return False + component_collection_map.update(lkp_collection_map) for component_name in component_collection_map: shell_dict = component_collection_map.get(component_name) for shell_cmd in shell_dict: diff --git a/tools/install_dependency/src/lkp_collect_map.py b/tools/install_dependency/src/lkp_collect_map.py index 040265e..2303e2c 100644 --- a/tools/install_dependency/src/lkp_collect_map.py +++ b/tools/install_dependency/src/lkp_collect_map.py @@ -2,18 +2,20 @@ import os.path from utils import base_path +CURRENT_DEFAULT_PATH = "./devkitdependencies" + lkp_collection_map = { "LkpTests": { "download file": { - "save_path": f"{os.path.join(base_path('component'), 'LkpTests', 'lkp-tests.tar.gz')}", + "save_path": f"{os.path.join(CURRENT_DEFAULT_PATH, 'lkp-tests.tar.gz')}", }, "download gem dependency": { - "save_path": f"{os.path.join(base_path('component'), 'LkpTests', 'gem_dependencies.zip')}", + "save_path": f"{os.path.join(CURRENT_DEFAULT_PATH, 'gem_dependencies.zip')}", }, }, "CompatibilityTesting": { "download file": { - "save_path": f"{os.path.join(base_path('component'), 'LkpTests', 'compatibility_testing.tar.gz')}", + "save_path": f"{os.path.join(CURRENT_DEFAULT_PATH, 'compatibility_testing.tar.gz')}", } }, "DevkitDistribute": { -- Gitee