From ef3a893db1d027c0a6f7b9243ea0270e0936cbef Mon Sep 17 00:00:00 2001 From: Yong Fu Date: Tue, 28 Apr 2020 16:26:13 +0800 Subject: [PATCH] CentOS 8: Build layering, scripts update for centos8 (1)Use dnf instead of yum (2)add repo for centos8 (3)upgrade python2 to python3 Change-Id: I39ec30eec33d9c912f9c56aa855fb3f71ebd08d4 Story: 2006729 Task: 39591 Signed-off-by: Yong Fu --- centos-mirror-tools/dl_other_from_centos_repo.sh | 4 ++-- centos-mirror-tools/dl_rpms_from_url.sh | 4 ++-- centos-mirror-tools/make_stx_mirror_yum_conf.sh | 6 ++++-- centos-mirror-tools/utils.sh | 11 ++++++++++- .../StarlingX_CentOS-OpenStack-train.repo | 16 ++++++++++++++++ tb.sh | 2 +- toCOPY/builder-constraints.txt | 2 +- 7 files changed, 36 insertions(+), 9 deletions(-) diff --git a/centos-mirror-tools/dl_other_from_centos_repo.sh b/centos-mirror-tools/dl_other_from_centos_repo.sh index 45fa9fce..50faf7cb 100755 --- a/centos-mirror-tools/dl_other_from_centos_repo.sh +++ b/centos-mirror-tools/dl_other_from_centos_repo.sh @@ -5,7 +5,7 @@ # # -# Download non-RPM files from http://vault.centos.org/7.4.1708/os/x86_64/ +# Download non-RPM files from http://vault.centos.org/8.1.1911/os/x86_64/ # DL_OTHER_FROM_CENTOS_REPO_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )" @@ -98,7 +98,7 @@ if [ ! -e $download_list ];then fi save_path=$2 -upstream_url_prefix="http://mirror.centos.org/centos/8/BaseOS/x86_64/os/" +upstream_url_prefix="http://mirror.centos.org/centos/8.1.1911/BaseOS/x86_64/os/" stx_mirror_url_prefix="$(url_to_stx_mirror_url "$upstream_url_prefix" "$distro")" echo "NOTE: please assure Internet access to $upstream_url_prefix !!" diff --git a/centos-mirror-tools/dl_rpms_from_url.sh b/centos-mirror-tools/dl_rpms_from_url.sh index 59103477..843de4be 100755 --- a/centos-mirror-tools/dl_rpms_from_url.sh +++ b/centos-mirror-tools/dl_rpms_from_url.sh @@ -8,7 +8,7 @@ set -o errexit set -o nounset -# By default, we use "sudo" and we don't use a local yum.conf. These can +# By default, we use "sudo" and we don't use a local dnf.conf. These can # be overridden via flags. DL_RPMS_DIR="$(dirname "$(readlink -f "${BASH_SOURCE[0]}" )" )" @@ -40,7 +40,7 @@ distro="centos" while getopts "u:h" o; do case "${o}" in u) - # Use an alternate yum.conf + # Use an alternate dnf.conf BASE_URL="$OPTARG" ;; h) diff --git a/centos-mirror-tools/make_stx_mirror_yum_conf.sh b/centos-mirror-tools/make_stx_mirror_yum_conf.sh index b22956c6..99521644 100755 --- a/centos-mirror-tools/make_stx_mirror_yum_conf.sh +++ b/centos-mirror-tools/make_stx_mirror_yum_conf.sh @@ -155,8 +155,9 @@ CENGN_DNF_CONF="$TEMP_DIR/dnf.conf" CENGN_DNF_LOG="$TEMP_DIR/dnf.log" CENGN_DNF_CACHDIR="$TEMP_DIR/cache/dnf/\$basearch/\$releasever" -RELEASEVER=$(get_releasever) -ARCH=$(get_arch) +RELEASEVER="8" +ARCH="x86_64" +CONTENTDIR="centos" # # Copy as yet unmodified dnf.conf and yum.repos.d from source to dest. @@ -232,6 +233,7 @@ for REPO in $(find "$CENGN_REPOS_DIR" -type f -name '*repo'); do # sed "s#/[$]releasever/#/$RELEASEVER/#g" -i "$REPO" sed "s#/[$]basearch/#/$ARCH/#g" -i "$REPO" + sed "s#/[$]contentdir/#/$CONTENTDIR/#g" -i "$REPO" # # Turn off gpgcheck for now. diff --git a/centos-mirror-tools/utils.sh b/centos-mirror-tools/utils.sh index 1e3ae99e..51776c8f 100644 --- a/centos-mirror-tools/utils.sh +++ b/centos-mirror-tools/utils.sh @@ -12,9 +12,18 @@ get_dnf_command() { local _file=$1 local _level=$2 local rpm_name="" + local arr=( $(split_filename $_file) ) + local arch=${arr[3]} + local dnf_download_extra_opts="" rpm_name="$(get_rpm_level_name $_file $_level)" - echo "dnf download -q ${DNFCONFOPT} ${RELEASEVER} $rpm_name" + if [ "$arch" == "src" ]; then + dnf_download_extra_opts="--source" + else + dnf_download_extra_opts="--exclude='*.i686' --archlist=$arch" + fi + + echo "dnf download -q -C ${DNFCONFOPT} ${RELEASEVER} $dnf_download_extra_opts $rpm_name" } get_wget_command() { diff --git a/centos-mirror-tools/yum.repos.d/StarlingX_CentOS-OpenStack-train.repo b/centos-mirror-tools/yum.repos.d/StarlingX_CentOS-OpenStack-train.repo index a483d13a..13dba5aa 100644 --- a/centos-mirror-tools/yum.repos.d/StarlingX_CentOS-OpenStack-train.repo +++ b/centos-mirror-tools/yum.repos.d/StarlingX_CentOS-OpenStack-train.repo @@ -39,3 +39,19 @@ name=OpenStack train Trunk Tested baseurl=https://trunk.rdoproject.org/centos7-train/current-passed-ci/ gpgcheck=0 enabled=0 + +[centos8-openstack-train] +name=CentOS-8 - OpenStack train +baseurl=http://mirror.centos.org/centos/8/cloud/$basearch/openstack-train/ +gpgcheck=1 +enabled=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud +exclude=sip,PyQt4 + +[centos8-openstack-train-source] +name=CentOS-8 - OpenStack train - Source +baseurl=http://vault.centos.org/centos/8.0.1905/cloud/Source/openstack-train/ +gpgcheck=1 +enabled=1 +gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud +exclude=sip,PyQt4 diff --git a/tb.sh b/tb.sh index 3def12c4..d1c24584 100755 --- a/tb.sh +++ b/tb.sh @@ -22,7 +22,7 @@ fi CMD=$1 TC_CONTAINER_NAME=${MYUNAME}-centos-builder -TC_CONTAINER_TAG=local/${MYUNAME}-stx-builder:8 +TC_CONTAINER_TAG=local/${MYUNAME}-stx-builder:8.1.1911 TC_DOCKERFILE=Dockerfile function create_container { diff --git a/toCOPY/builder-constraints.txt b/toCOPY/builder-constraints.txt index 04c829e9..4ef1c83b 100644 --- a/toCOPY/builder-constraints.txt +++ b/toCOPY/builder-constraints.txt @@ -1,2 +1,2 @@ -more-itertools===5.0.0;python_version=='2.7' # Last version with official 2.7 support +more-itertools===5.0.0;python_version=='3.6' # Last version with official 3.6 support