centos-mirror-update: handle non-x86 architectures

CentOS keeps non-x86 architectures in /altarch/ directory (contrary to
/centos/ one for x86-64). We have aarch64 (arm64) machines in infra and
they fail due to lack of CentOS altarch mirror.

List of wanted alternative architectures is controlled by ALTARCHS
variable (aarch64 and ppc64le enabled). As CentOS has several other
architectures too they are listed in ALTARCHS_IGNORED so we do not fetch
them.

Current CentOS mirror lands in same /mirror/centos/7/ directory. Altarch
mirrors goes to /mirror/centos/altarch/7/ one.

Change-Id: I0e110ef51c8ed301fd8280ae7fc039e3b01db92c
This commit is contained in:
Marcin Juszkiewicz 2019-06-03 11:40:47 +02:00
parent 478cd9f1e0
commit ac5acbca92

View File

@ -24,28 +24,50 @@ fi
BASE="/afs/.openstack.org/mirror/centos" BASE="/afs/.openstack.org/mirror/centos"
MIRROR="rsync://mirror.lstn.net" MIRROR="rsync://mirror.lstn.net"
MIRROR_ALTARCH="rsync://mirror.freethought-internet.co.uk/centos-altarch/"
K5START="k5start -t -f /etc/centos.keytab service/centos-mirror -- $TIMEOUT" K5START="k5start -t -f /etc/centos.keytab service/centos-mirror -- $TIMEOUT"
REPO=7 REPOS="7 altarch/7"
if ! [ -f $BASE/$REPO ]; then ALTARCHS="aarch64 ppc64le"
$K5START mkdir -p $BASE/$REPO ALTARCHS_IGNORED="armhfp i386 power9 ppc64 x86_64" # altarch/kernel/ has x86_64 dir we do not want
fi
date --iso-8601=ns for REPO in $REPOS; do
echo "Running rsync..." if ! [ -f $BASE/$REPO ]; then
$K5START rsync -rlptDvz \ $K5START mkdir -p $BASE/$REPO
fi
MIRROR_PATH=$MIRROR/$REPO/
EXTRA_OPTS="--links" # -l
if [[ $REPO == "altarch"* ]]; then
MIRROR_PATH=$MIRROR_ALTARCH/7/
EXTRA_OPTS="--copy-links" # copy because altarch has symlinks to ../7.6.1810/
for arch in $ALTARCHS_IGNORED; do
EXTRA_OPTS="$EXTRA_OPTS --exclude=$arch"
done
for arch in $ALTARCHS; do
EXTRA_OPTS="$EXTRA_OPTS --include *.${arch}.rpm"
done
fi
date --iso-8601=ns
echo "Running rsync..."
$K5START rsync -rptDvz \
--delete \ --delete \
--delete-excluded \ --delete-excluded \
--exclude="atomic" \ --exclude="atomic" \
--exclude="centosplus" \ --exclude="centosplus" \
--exclude="experimental" \
--exclude="fasttrack" \ --exclude="fasttrack" \
--exclude="isos" \ --exclude="isos" \
--exclude="paas" \ --exclude="paas" \
--exclude="sclo" \ --exclude="sclo" \
--exclude="x86_64/drpms" \ --exclude="*/drpms" \
$MIRROR/centos/$REPO/ $BASE/$REPO/ $EXTRA_OPTS \
$MIRROR_PATH $BASE/$REPO/
# TODO(pabelanger): Validate rsync process # TODO(pabelanger): Validate rsync process
done
date --iso-8601=ns | $K5START tee $BASE/timestamp.txt date --iso-8601=ns | $K5START tee $BASE/timestamp.txt
echo "rsync completed successfully, running vos release." echo "rsync completed successfully, running vos release."