From 6434de30375e77670d0b4d5aabdf0394c752dcc7 Mon Sep 17 00:00:00 2001 From: miao_kaibo Date: Mon, 18 Jan 2021 14:28:31 +0800 Subject: [PATCH] change mkeuler to oemaker --- build.py | 4 ++++ script/common_function.sh | 7 +++++-- script/config/unable_install_list | 0 script/make_version.sh | 5 +++-- script/step/make_debug_everything.sh | 23 ++++++++++----------- script/step/make_iso.sh | 27 ++++++++++--------------- script/step/make_iso_everysrc.sh | 28 ++++++++++++++------------ script/step/make_iso_everything.sh | 30 +++++++++++++++------------- script/step/make_netinst_iso.sh | 16 +++++---------- script/tools/sshcmd.sh | 2 +- script/tools/util.sh | 18 +++++++++++------ 11 files changed, 82 insertions(+), 78 deletions(-) create mode 100644 script/config/unable_install_list diff --git a/build.py b/build.py index cd538fd..d2fc778 100644 --- a/build.py +++ b/build.py @@ -105,6 +105,10 @@ class Build(object): return -1 if step: + cmd = 'echo "export STEP=%s" >> script/setup_env.sh' % step + if os.system(cmd) != 0: + logger.error("build fail") + return -1 code = trace_execute("bash -x {0} {1}".format( self.local_build_shell_path, step), env=self.env, logger=logger) if code != 0 and code != "0": diff --git a/script/common_function.sh b/script/common_function.sh index de7817d..c6dca1f 100644 --- a/script/common_function.sh +++ b/script/common_function.sh @@ -97,8 +97,11 @@ source "${BUILD_SCRIPT_DIR}"/step/get_version.sh source "${BUILD_SCRIPT_DIR}"/step/release_dir.sh #source "${BUILD_SCRIPT_DIR}"/step/createrepo.sh source "${BUILD_SCRIPT_DIR}"/step/make_docker_image.sh -source "${BUILD_SCRIPT_DIR}"/step/make_raspi_image.sh -source "${BUILD_SCRIPT_DIR}"/step/make_microvm_image.sh +if [ "$STEP" == "make_raspi_image" ];then + source "${BUILD_SCRIPT_DIR}"/step/make_raspi_image.sh +else + source "${BUILD_SCRIPT_DIR}"/step/make_microvm_image.sh +fi source "${BUILD_SCRIPT_DIR}"/step/make_gcov.sh source "${BUILD_SCRIPT_DIR}"/step/merge_release_html.sh #source "${BUILD_SCRIPT_DIR}"/step/build_and_wait.sh diff --git a/script/config/unable_install_list b/script/config/unable_install_list new file mode 100644 index 0000000..e69de29 diff --git a/script/make_version.sh b/script/make_version.sh index 3aefe0c..f5c8da0 100644 --- a/script/make_version.sh +++ b/script/make_version.sh @@ -9,6 +9,7 @@ export HOME="/root" export OUTPUT_PATH="${BUILD_SCRIPT_DIR}/output" export PROJECT_PATH="${BUILD_SCRIPT_DIR}/../../../../.." export ERROR_LOG="${OUTPUT_PATH}/error_log" +export UNABLE_INSTALL_LIST="${BUILD_SCRIPT_DIR}"/config/unable_install_list if [ ! -d "${OUTPUT_PATH}" ]; then mkdir -p "${OUTPUT_PATH}" @@ -27,7 +28,7 @@ source "${BUILD_SCRIPT_DIR}"/tools/common.sh || exit 1 source "${BUILD_SCRIPT_DIR}"/tools/chroot.sh || exit 1 #source "${BUILD_SCRIPT_DIR}"/tools/obs.sh || exit 1 -function get_private_ip() +function get_repose() { expect -c " spawn $* @@ -41,7 +42,7 @@ function get_private_ip() } for((i=0;i<3;i++)); do -ret=$(get_private_ip ssh -i ~/.ssh/super_publish_rsa root@${RELEASE_SERVER_IP} ip addr | grep "172." | tr -cd "[0-9].[0-9]/ " | awk '{print $3}' | awk -F "/" '{print $1}') +ret=$(get_repose ssh -i ~/.ssh/super_publish_rsa root@${RELEASE_SERVER_IP} ip addr | grep "172." | tr -cd "[0-9].[0-9]/ " | awk '{print $3}' | awk -F "/" '{print $1}') if [ "$ret" != "${RELEASE_SERVER_IP}" ];then break fi diff --git a/script/step/make_debug_everything.sh b/script/step/make_debug_everything.sh index 051c89e..8040b9c 100644 --- a/script/step/make_debug_everything.sh +++ b/script/step/make_debug_everything.sh @@ -30,27 +30,21 @@ function make_debug_everything_inchroot() yum_conf="${BUILD_SCRIPT_DIR}/config/repo_conf/obs-repo.conf" yum clean all -c "${yum_conf}" - if rpm -q mkeuleros &> /dev/null; then - yum remove mkeuleros -y + if rpm -q oemaker &> /dev/null; then + yum remove oemaker -y fi if rpm -q lorax &> /dev/null; then yum remove lorax -y fi - yum install mkeuleros lorax -y -c "${yum_conf}" - cd /opt/mkeuleros - - if [ "${ARCH}" = "x86_64" ]; then - mkeuleros_conf="config/standard/standard.conf" - elif [ "${ARCH}" = "aarch64" ]; then - mkeuleros_conf="config/aarch64/standard.conf" - fi + yum install oemaker lorax -y -c "${yum_conf}" + cd /opt/oemaker set +e num=0 while [ "${num}" -lt 3 ] do - bash -x mkeuleros.sh -f "${mkeuleros_conf}" -n "${OS_NAME}" -v "${OS_VERSION}" -s "SP1" -a "${ARCH}" -r "${OBS_STANDARD_REPO_URL}" -i 1 + bash -x oemaker -t everything_debug -p ${PRODUCTS} -v "${OS_VERSION}" -r "" -s "${OBS_STANDARD_REPO_URL}" if [ $? -eq 0 ];then break elif [ $? -eq 133 ]; then @@ -84,8 +78,11 @@ function make_debug_everything_inchroot() sshcmd "${SSH_CMD}" sshscp "${TGZ_NAME} ${TGZ_NAME}${SHA256SUM}" "${RELEASE_DIR}" set +e - SSH_CMD="losetup -a | grep ${TGZ_NAME} | grep ${OS_VERSION} | awk -F ':' '{print \$1}' | xargs umount" - sshcmd "${SSH_CMD}" + ret=$(get_repose ssh -i ~/.ssh/super_publish_rsa root@${RELEASE_SERVER_IP} mount | grep ${RELEASE_VERSION_DIR} | grep OS/${ARCH} | awk '{print $3}') + for mp in $ret + do + ret=$(get_repose ssh -i ~/.ssh/super_publish_rsa root@${RELEASE_SERVER_IP} umount $mp) + done SSH_CMD="mount -t iso9660 -o loop ${RELEASE_DIR}/${TGZ_NAME} ${MOUNT_DIR}" sshcmd "${SSH_CMD}" set -e diff --git a/script/step/make_iso.sh b/script/step/make_iso.sh index 54430e3..744ccc4 100644 --- a/script/step/make_iso.sh +++ b/script/step/make_iso.sh @@ -28,27 +28,21 @@ function make_iso_inchroot() TIME=${TIME#"${version}"-} yum_conf="${BUILD_SCRIPT_DIR}/config/repo_conf/obs-repo.conf" yum clean all -c "${yum_conf}" - if rpm -q mkeuleros &> /dev/null; then - yum remove mkeuleros -y + if rpm -q oemaker &> /dev/null; then + yum remove oemaker -y fi if rpm -q lorax &> /dev/null; then yum remove lorax -y fi - - yum install mkeuleros lorax -y -c "${yum_conf}" - cd /opt/mkeuleros - - if [ "${ARCH}" = "x86_64" ]; then - mkeuleros_conf="config/standard/standard.conf" - elif [ "${ARCH}" = "aarch64" ]; then - mkeuleros_conf="config/aarch64/standard.conf" - fi + yum install oemaker lorax -y -c "${yum_conf}" + cd /opt/oemaker set +e num=0 + set +u while [ "${num}" -lt 3 ] do - bash -x mkeuleros.sh -f "${mkeuleros_conf}" -n "${OS_NAME}" -v "${OS_VERSION}" -s "SP1" -a "${ARCH}" -r "${OBS_STANDARD_REPO_URL}" + bash -x oemaker -t standard -p ${PRODUCTS} -v "${OS_VERSION}" -r "" -s "${OBS_STANDARD_REPO_URL}" if [ $? -eq 0 ];then break elif [ $? -eq 133 ]; then @@ -84,11 +78,13 @@ function make_iso_inchroot() sshcmd "${SSH_CMD}" sshscp "${TGZ_NAME} ${TGZ_NAME}${SHA256SUM} ${iso_rpmlist}" "${RELEASE_DIR}" set +e - SSH_CMD="losetup -a | grep ${TGZ_NAME} | grep ${OS_VERSION} | awk -F ':' '{print \$1}' | xargs umount" - sshcmd "${SSH_CMD}" + ret=$(get_repose ssh -i ~/.ssh/super_publish_rsa root@${RELEASE_SERVER_IP} mount | grep ${RELEASE_VERSION_DIR} | grep OS/${ARCH} | awk '{print $3}') + for mp in $ret + do + ret=$(get_repose ssh -i ~/.ssh/super_publish_rsa root@${RELEASE_SERVER_IP} umount $mp) + done SSH_CMD="mount -t iso9660 -o loop ${RELEASE_DIR}/${TGZ_NAME} ${MOUNT_DIR}" sshcmd "${SSH_CMD}" - set -e [ -n "${iso_rpmlist}" ] && rm -rf "${iso_rpmlist}" release_file="release_iso" @@ -106,7 +102,6 @@ function make_iso_inchroot() echo "

View the history version, please go to : ${RELEASE_HTTP_URL}/${RELEASE_VERSION_DIR}/

" >> "${html}" echo "
" >> "${html}" echo "" >> "${html}" - set +e sshscp "${html}" "${HTTP_DIR}/${PRE_VERSION}/${VERSION}/" SSH_CMD="chmod 755 ${HTTP_DIR}/${PRE_VERSION}/${VERSION}/${html##*/}" sshcmd "${SSH_CMD}" diff --git a/script/step/make_iso_everysrc.sh b/script/step/make_iso_everysrc.sh index 0266295..a25a77b 100644 --- a/script/step/make_iso_everysrc.sh +++ b/script/step/make_iso_everysrc.sh @@ -28,27 +28,26 @@ function make_iso_everysrc_inchroot() yum_conf="${BUILD_SCRIPT_DIR}/config/repo_conf/obs-repo.conf" yum clean all -c "${yum_conf}" - if rpm -q mkeuleros &> /dev/null; then - yum remove mkeuleros -y + if rpm -q oemaker &> /dev/null; then + yum remove oemaker -y fi if rpm -q lorax &> /dev/null; then yum remove lorax -y fi - yum install mkeuleros lorax -y -c "${yum_conf}" - cd /opt/mkeuleros - - if [ "${ARCH}" = "x86_64" ]; then - mkeuleros_conf="config/standard/standard.conf" - elif [ "${ARCH}" = "aarch64" ]; then - mkeuleros_conf="config/aarch64/standard.conf" - fi + yum install oemaker lorax -y -c "${yum_conf}" + cd /opt/oemaker + rpmsnames=`cat ${UNABLE_INSTALL_LIST}` + for rpmsname in $rpmsnames + do + sed -i '//a\ '$rpmsname'' config/rpmlist.xml + done set +e num=0 while [ "${num}" -lt 3 ] do - bash -x mkeuleros.sh -f "${mkeuleros_conf}" -n "${OS_NAME}" -v "${OS_VERSION}" -s "SP1" -a "${ARCH}" -r "${OBS_STANDARD_REPO_URL}" -h 1 + bash -x oemaker -t everything_src -p ${PRODUCTS} -v "${OS_VERSION}" -r "" -s "${OBS_STANDARD_REPO_URL}" if [ $? -eq 0 ];then break elif [ $? -eq 133 ]; then @@ -81,8 +80,11 @@ function make_iso_everysrc_inchroot() sshcmd "${SSH_CMD}" sshscp "${TGZ_NAME} ${TGZ_NAME}${SHA256SUM}" "${RELEASE_DIR}" set +e - SSH_CMD="losetup -a | grep ${TGZ_NAME} | grep ${OS_VERSION} | awk -F ':' '{print \$1}' | xargs umount" - sshcmd "${SSH_CMD}" + ret=$(get_repose ssh -i ~/.ssh/super_publish_rsa root@${RELEASE_SERVER_IP} mount | grep ${RELEASE_VERSION_DIR} | grep source | awk '{print $3}') + for mp in $ret + do + ret=$(get_repose ssh -i ~/.ssh/super_publish_rsa root@${RELEASE_SERVER_IP} umount $mp) + done SSH_CMD="mount -t iso9660 -o loop ${RELEASE_DIR}/${TGZ_NAME} ${MOUNT_DIR}" sshcmd "${SSH_CMD}" set -e diff --git a/script/step/make_iso_everything.sh b/script/step/make_iso_everything.sh index afc6f23..91519c5 100644 --- a/script/step/make_iso_everything.sh +++ b/script/step/make_iso_everything.sh @@ -30,27 +30,26 @@ function make_iso_everything_inchroot() yum_conf="${BUILD_SCRIPT_DIR}/config/repo_conf/obs-repo.conf" yum clean all -c "${yum_conf}" - if rpm -q mkeuleros &> /dev/null; then - yum remove mkeuleros -y + if rpm -q oemaker &> /dev/null; then + yum remove oemaker -y fi if rpm -q lorax &> /dev/null; then yum remove lorax -y fi - - yum install mkeuleros lorax -y -c "${yum_conf}" - cd /opt/mkeuleros - - if [ "${ARCH}" = "x86_64" ]; then - mkeuleros_conf="config/standard/standard.conf" - elif [ "${ARCH}" = "aarch64" ]; then - mkeuleros_conf="config/aarch64/standard.conf" - fi + + yum install oemaker lorax -y -c "${yum_conf}" + cd /opt/oemaker + rpmsnames=`cat ${UNABLE_INSTALL_LIST}` + for rpmsname in $rpmsnames + do + sed -i '//a\ '$rpmsname'' config/rpmlist.xml + done set +e num=0 while [ "${num}" -lt 3 ] do - bash -x mkeuleros.sh -f "${mkeuleros_conf}" -n "${OS_NAME}" -v "${OS_VERSION}" -s "SP1" -a "${ARCH}" -r "${OBS_STANDARD_REPO_URL}" -g 1 + bash -x oemaker -t everything -p ${PRODUCTS} -v "${OS_VERSION}" -r "" -s "${OBS_STANDARD_REPO_URL}" if [ $? -eq 0 ];then break elif [ $? -eq 133 ]; then @@ -84,8 +83,11 @@ function make_iso_everything_inchroot() sshcmd "${SSH_CMD}" sshscp "${TGZ_NAME} ${TGZ_NAME}${SHA256SUM}" "${RELEASE_DIR}" set +e - SSH_CMD="losetup -a | grep ${TGZ_NAME} | grep ${OS_VERSION} | awk -F ':' '{print \$1}' | xargs umount" - sshcmd "${SSH_CMD}" + ret=$(get_repose ssh -i ~/.ssh/super_publish_rsa root@${RELEASE_SERVER_IP} mount | grep ${RELEASE_VERSION_DIR} | grep everything/${ARCH} | awk '{print $3}') + for mp in $ret + do + ret=$(get_repose ssh -i ~/.ssh/super_publish_rsa root@${RELEASE_SERVER_IP} umount $mp) + done SSH_CMD="mount -t iso9660 -o loop ${RELEASE_DIR}/${TGZ_NAME} ${MOUNT_DIR}" sshcmd "${SSH_CMD}" set -e diff --git a/script/step/make_netinst_iso.sh b/script/step/make_netinst_iso.sh index 5a188e1..e253dce 100644 --- a/script/step/make_netinst_iso.sh +++ b/script/step/make_netinst_iso.sh @@ -30,27 +30,21 @@ function make_netinst_iso_inchroot() yum_conf="${BUILD_SCRIPT_DIR}/config/repo_conf/obs-repo.conf" yum clean all -c "${yum_conf}" - if rpm -q mkeuleros &> /dev/null; then - yum remove mkeuleros -y + if rpm -q oemaker &> /dev/null; then + yum remove oemaker -y fi if rpm -q lorax &> /dev/null; then yum remove lorax -y fi - yum install mkeuleros lorax -y -c "${yum_conf}" - cd /opt/mkeuleros - - if [ "${ARCH}" = "x86_64" ]; then - mkeuleros_conf="config/standard/standard.conf" - elif [ "${ARCH}" = "aarch64" ]; then - mkeuleros_conf="config/aarch64/standard.conf" - fi + yum install oemaker lorax -y -c "${yum_conf}" + cd /opt/oemaker set +e num=0 while [ "${num}" -lt 3 ] do - bash -x mkeuleros.sh -f "${mkeuleros_conf}" -n "${OS_NAME}" -N "TRUE" -v "${OS_VERSION}" -s "SP1" -a "${ARCH}" -r "${OBS_STANDARD_REPO_URL}" + bash -x oemaker -t netinst -p ${PRODUCTS} -v "${OS_VERSION}" -r "" -s "${OBS_STANDARD_REPO_URL}" if [ $? -eq 0 ];then break elif [ $? -eq 133 ]; then diff --git a/script/tools/sshcmd.sh b/script/tools/sshcmd.sh index 0cf14c8..8ab6167 100644 --- a/script/tools/sshcmd.sh +++ b/script/tools/sshcmd.sh @@ -36,7 +36,7 @@ function sshcmd_comm() cmd=${cmd//\"/\\\"} cmd=${cmd//\$/\\\$} - + if [ "x${testip}" = "x" -o "x${cmd}" = "x" ];then echo "isup time testmathine [password] [user]" exit 1 diff --git a/script/tools/util.sh b/script/tools/util.sh index ea57520..476f28b 100644 --- a/script/tools/util.sh +++ b/script/tools/util.sh @@ -56,7 +56,8 @@ function log_debug() ###################### function sshcmd() { - sh "${BUILD_SCRIPT_DIR}/tools/safe_sshcmd.sh" -c "$1" -m "${RELEASE_SERVER_IP}" -u "${USER}" -p "${PASSWD}" -t 120 -n 3 + sh "${BUILD_SCRIPT_DIR}/tools/safe_sshcmd.sh" -c "$1" -m "${RELEASE_SERVER_IP}" -t 120 -n 3 + #sh "${BUILD_SCRIPT_DIR}/tools/safe_sshcmd.sh" -c "$1" -m "${RELEASE_SERVER_IP}" -u "${USER}" -p "${PASSWD}" -t 120 -n 3 } ###################### @@ -67,7 +68,8 @@ function sshcmd() ###################### function sshscp() { - sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -p "${PASSWD}" -s "$1" -d "${RELEASE_SERVER_IP}:$2" -r -t 120 -n 3 + sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -s "$1" -d "${RELEASE_SERVER_IP}:$2" -r -t 120 -n 3 + #sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -p "${PASSWD}" -s "$1" -d "${RELEASE_SERVER_IP}:$2" -r -t 120 -n 3 } ###################### @@ -78,7 +80,8 @@ function sshscp() ###################### function sshscp_from() { - sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -p "${PASSWD}" -s "${RELEASE_SERVER_IP}:$1" -d "$2" -r -t 120 -n 3 + sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -s "${RELEASE_SERVER_IP}:$1" -d "$2" -r -t 120 -n 3 + #sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -p "${PASSWD}" -s "${RELEASE_SERVER_IP}:$1" -d "$2" -r -t 120 -n 3 } ###################### @@ -89,7 +92,8 @@ function sshscp_from() ###################### function sshcmd_arm() { - sh "${BUILD_SCRIPT_DIR}/tools/safe_sshcmd.sh" -c "$1" -m "${RELEASE_ROOT_PATH}" -u "${USER}" -p "${PASSWD}" -t 120 -n 3 + sh "${BUILD_SCRIPT_DIR}/tools/safe_sshcmd.sh" -c "$1" -m "${RELEASE_ROOT_PATH}" -t 120 -n 3 + #sh "${BUILD_SCRIPT_DIR}/tools/safe_sshcmd.sh" -c "$1" -m "${RELEASE_ROOT_PATH}" -u "${USER}" -p "${PASSWD}" -t 120 -n 3 } ###################### @@ -100,7 +104,8 @@ function sshcmd_arm() ###################### function sshscp_arm() { - sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -p "${PASSWD}" -s "$1" -d "${RELEASE_SERVER_IP}:$2" -r -t 120 -n 3 + sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -s "$1" -d "${RELEASE_SERVER_IP}:$2" -r -t 120 -n 3 + #sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -p "${PASSWD}" -s "$1" -d "${RELEASE_SERVER_IP}:$2" -r -t 120 -n 3 } ###################### @@ -111,7 +116,8 @@ function sshscp_arm() ###################### function sshscp_from_arm() { - sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -p "${PASSWD}" -s "${RELEASE_ROOT_PATH}:$1" -d "$2" -r -t 120 -n 3 + sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -s "${RELEASE_ROOT_PATH}:$1" -d "$2" -r -t 120 -n 3 + #sh "${BUILD_SCRIPT_DIR}/tools/safe_sshscp.sh" -p "${PASSWD}" -s "${RELEASE_ROOT_PATH}:$1" -d "$2" -r -t 120 -n 3 } ###################### # 安全运行相关命令 -- Gitee