From 70e5fd8c5a57315f7ee8b163a02ce727f95ad05d Mon Sep 17 00:00:00 2001 From: wangchong1995924 <15229716099@163.com> Date: Thu, 27 Jan 2022 15:23:52 +0800 Subject: [PATCH] add get_key_file.sh, support check epol install, change obs_repo_ip to optional and modify make_microvm_image.sh --- build.py | 9 +++++---- reset_release_server_ip.sh | 1 + script/step/make_microvm_image.sh | 10 +++++----- script/tools/check_dep.py | 7 +++++-- script/tools/chroot.sh | 2 +- script/tools/common.sh | 1 + script/tools/get_key_file.sh | 29 +++++++++++++++++++++++++++++ 7 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 script/tools/get_key_file.sh diff --git a/build.py b/build.py index cc9329a..1813b82 100644 --- a/build.py +++ b/build.py @@ -69,9 +69,10 @@ class Build(object): cmd = "sed -i 's/checkdep=.*/checkdep=%s/g' script/setup_env.sh" % check_dep rmsg = os.popen(cmd).read() print(rmsg) - cmd = "sed -i 's/OBS_SERVER_IP=.*/OBS_SERVER_IP=%s/g' script/setup_env.sh" % obs_repo_ip - rmsg = os.popen(cmd).read() - print(rmsg) + if obs_repo_ip: + cmd = "sed -i 's/OBS_SERVER_IP=.*/OBS_SERVER_IP=%s/g' script/setup_env.sh" % obs_repo_ip + rmsg = os.popen(cmd).read() + print(rmsg) cmd = "sed -i 's/OBS_STANDARD_PROJECT=.*/OBS_STANDARD_PROJECT=%s/g' script/setup_env.sh" % obs_standard_prj rmsg = os.popen(cmd).read() print(rmsg) @@ -180,7 +181,7 @@ if __name__ == "__main__": par.add_argument("-ex", "--obs_extras_prj", help="obs extras project", required=True) par.add_argument("-ip", "--obs_repo_ip", - help="obs repo ip", required=True) + help="obs repo ip", required=False) par.add_argument("-c", "--check_dep", default="false", help="check rpm dependence", required=False) args = par.parse_args() diff --git a/reset_release_server_ip.sh b/reset_release_server_ip.sh index 86ef1e0..b379775 100644 --- a/reset_release_server_ip.sh +++ b/reset_release_server_ip.sh @@ -1,3 +1,4 @@ source script/tools/common.sh source script/setup_env.sh +source script/tools/get_key_file.sh replace_release_server_ip diff --git a/script/step/make_microvm_image.sh b/script/step/make_microvm_image.sh index 2783051..d202978 100644 --- a/script/step/make_microvm_image.sh +++ b/script/step/make_microvm_image.sh @@ -132,9 +132,9 @@ make_micro_kernel(){ kernel_config="kernel_config_${kernel_main_version}_${arch}" cp ${microvm_dir}/${kernel_config} .config if [ ${arch} == "x86_64" ]; then - make ARCH=x86_64 + make ARCH=x86_64 -j8 elif [ ${arch} == "aarch64" ]; then - make ARCH=arm64 + make ARCH=arm64 -j8 else LOG "${arch} is not supported yet." return 0 @@ -167,12 +167,12 @@ make_standard_kernel(){ cp ${standard_vm_dir}/${kernel_config} .config if [ ${arch} == "x86_64" ]; then std_kernel_file=${std_kernel_file}z - make ARCH=x86_64 - make bzImage + make ARCH=x86_64 -j8 + make bzImage -j8 mv arch/x86/boot/bzImage ${std_kernel_file} elif [ ${arch} == "aarch64" ]; then std_kernel_file=${std_kernel_file}.bin - make ARCH=arm64 + make ARCH=arm64 -j8 objcopy -O binary vmlinux ${std_kernel_file} else LOG "${arch} is not supported yet." diff --git a/script/tools/check_dep.py b/script/tools/check_dep.py index 070d389..8c69ed8 100644 --- a/script/tools/check_dep.py +++ b/script/tools/check_dep.py @@ -82,11 +82,14 @@ def set_exclude(f, arch, err, rpm_list_file, delete_rpm_list_file): def check_dep(rpm_list_file, check_log_file, delete_rpm_list_file, rpm_path, config=None, repo=None): if config and repo: - para = "-c %s --repo %s" % (config, repo) + if "Epol" in repo: + para = "-c %s --repo obs-standard,%s" % (config, repo) + else: + para = "-c %s --repo %s" % (config, repo) elif config: para = "-c %s" % config else: - para = "" + para = "" cmd = "rm -rf %s && rm -rf %s && rm -rf %s && rm -rf %s/*.rpm && touch %s" % (rpm_list_file, check_log_file, delete_rpm_list_file, rpm_path, delete_rpm_list_file) if os.system(cmd) == 0: pass diff --git a/script/tools/chroot.sh b/script/tools/chroot.sh index 5cbc14d..7a231d0 100644 --- a/script/tools/chroot.sh +++ b/script/tools/chroot.sh @@ -20,7 +20,7 @@ function chroot_init() rm -f openEuler_chroot-*.noarch.rpm cp -a "${BUILD_SCRIPT_DIR}"/* "${OPENEULER_CHROOT_PATH}/home" mkdir -p "${OPENEULER_CHROOT_PATH}/root/.ssh/" - cp ~/.ssh/super_publish_rsa "${OPENEULER_CHROOT_PATH}/root/.ssh/" + cp /root/.ssh/super_publish_rsa "${OPENEULER_CHROOT_PATH}/root/.ssh/" if echo "${BUILD_SCRIPT_DIR}" | grep 'gcov-'; then sed -i '/VERSION=/ iexport CI_PROJECT="openeuler_ARM64_gcov"' "${OPENEULER_CHROOT_PATH}"/home/internal.sh fi diff --git a/script/tools/common.sh b/script/tools/common.sh index 0638651..ee5cb00 100644 --- a/script/tools/common.sh +++ b/script/tools/common.sh @@ -112,6 +112,7 @@ function replace_release_server_ip() SSHPORT="" fi setupfile=`find -iname "setup_env.sh"` + get_key_file "/root/.ssh/" for((i=0;i<5;i++)); do ret=$(get_repose ssh -i ~/.ssh/super_publish_rsa ${SSHPORT} root@${RELEASE_SERVER_IP} ip addr | grep inet | awk '{print $2}' | grep -v '127' | awk -F '/' '{print $1}' | sed -n '1p') diff --git a/script/tools/get_key_file.sh b/script/tools/get_key_file.sh new file mode 100644 index 0000000..af7484e --- /dev/null +++ b/script/tools/get_key_file.sh @@ -0,0 +1,29 @@ +#!/bin/bash +###################################### +# description: copy super_publish_rsa +# Usage: get_key_file destination +###################################### + +function get_key_file(){ + destdir=$1 + if [ ! -d "${destdir}" ];then + mkdir -p ${destdir} + fi + expect <<-END1 + set timeout 60 + spawn scp -o StrictHostKeyChecking=no -o ServerAliveInterval=60 ${dogshenguser81}@${OBS_UI_IP}:/root/.ssh/super_publish_rsa ${destdir} + expect { + -re "\[P|p]assword:" { + send "${dogshengpwd81}\r" + } + timeout { + send_user "connection to ${OBS_UI_IP} time out: \$expect_out(buffer)\n" + exit 13 + } + } + expect eof { + catch wait result + exit [lindex \${result} 3] + } + END1 +} -- Gitee