From 73662e8a89a686d3561d891e3547080b2b326ce0 Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Mon, 22 May 2023 02:12:07 -0700 Subject: [PATCH] delete script should not accept RLVER=8 --- sync/common | 20 ++++++ sync/prep-staging-8.sh | 123 --------------------------------- sync/sync-to-staging.delete.sh | 4 ++ 3 files changed, 24 insertions(+), 123 deletions(-) delete mode 100644 sync/prep-staging-8.sh diff --git a/sync/common b/sync/common index 76823c3..da23ca9 100644 --- a/sync/common +++ b/sync/common @@ -29,6 +29,7 @@ COMPOSE_ROOT="/mnt/compose" # relative to ${ENV}_ROOT CATEGORY_STUB="mirror/pub/rocky" SIG_CATEGORY_STUB="mirror/pub/sig" +VAULT_STUB="mirror/vault/rocky" # Override: Required #RELEASE_DIR="${CATEGORY_STUB}/${REVISION}${APPEND_TO_DIR}" @@ -132,9 +133,26 @@ function rsync_delete_staging_with_excludes() { sudo -l && rsync -vrlptDSHog --chown=10004:10005 --progress --human-readable \ --exclude "${EXCLUDE}" \ --exclude Minimal \ + --delete \ compose/ "${TARGET}" } +function rsync_delete_subdirectory() { + local SUBDIR="${1}" + local TARGET="${2}" + sudo -l && rsync -vrlptDSHog --chown=10004:10005 --progress --human-readable \ + --delete \ + "compose/${SUBDIR}/" "${TARGET}" +} + +function rsync_delete_generic() { + local SOURCE="${1}" + local TARGET="${2}" + sudo -l && rsync -vrlptDSHog --chown=10004:10005 --progress --human-readable \ + --delete \ + "${SOURCE}/" "${TARGET}" +} + function rsync_no_delete_prod() { local REV="${1}" local TARGET="${2}" @@ -288,6 +306,8 @@ export -f rsync_no_delete_prod export -f rsync_delete_staging export -f rsync_delete_staging_with_excludes export -f rsync_delete_prod +export -f rsync_delete_subdirectory +export -f rsync_delete_generic # dry rsync export -f rsync_no_delete_staging_dry export -f rsync_no_delete_staging_with_excludes_dry diff --git a/sync/prep-staging-8.sh b/sync/prep-staging-8.sh deleted file mode 100644 index fd9269c..0000000 --- a/sync/prep-staging-8.sh +++ /dev/null @@ -1,123 +0,0 @@ -#!/bin/bash -# This should only be ran during straight updates during a minor release cadence. -# In the case of point releases, this will need to be changed accordingly so that -# way it can be ran properly. -# -# The point of this script is to basically allow all old versions of a package -# or set of packages to be available during the life of a point release. As it -# currently stands, CentOS has started doing this for both 8 and 8-stream. RHEL -# also does this (and has always done this, except they take it a step further -# and provide everything, even if it's not installable). -# -# Compose dir example: /mnt/repos-staging/mirror/pub/rocky/8.4-RC2 - -# Source common variables -export RLVER=8 -# shellcheck disable=SC2046,1091,1090 -source "$(dirname "$0")/common" - -echo "** Updating source repos" -for y in "${ALL_REPOS[@]}"; do - test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree" - ret_val=$? - if [ "$ret_val" -eq 0 ]; then - createrepo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree" \ - "--distro=cpe:/o:rocky:rocky:${REVISION:0:1},Rocky Linux ${REVISION:0:1}" \ - --workers 12 - sed -i '/<\/open-size>/d' \ - "${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree/repodata/repomd.xml" - test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \ - "${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree/repodata/repomd.xml" - else - echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/source/tree does not exist" - fi -done - -# Sync up some stuff -echo "** Updating arch repos as necessary **" -for x in "${ARCHES[@]}"; do - echo "${x}: Sync up repos that do not use comps/groups" - # regular repos, no comps - for y in "${NONMODS_REPOS[@]}"; do - # os and debug/tree directories - for z in os debug/tree kickstart; do - test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z}" - ret_val=$? - if [ "$ret_val" -eq 0 ]; then - createrepo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z}" \ - "--distro=cpe:/o:rocky:rocky:${REVISION:0:1},Rocky Linux ${REVISION:0:1}" \ - --workers 12 - sed -i '/<\/open-size>/d' \ - "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z}/repodata/repomd.xml" - test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \ - "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z}/repodata/repomd.xml" - else - echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/${z} does not exist" - fi - done - done - # repos with comps/groups involved, but only debug - for y in "${MODS_REPOS[@]}"; do - test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree" - ret_val=$? - if [ "$ret_val" -eq 0 ]; then - createrepo --update "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree" \ - "--distro=cpe:/o:rocky:rocky:${REVISION:0:1},Rocky Linux ${REVISION:0:1}" \ - --workers 12 --retain-old-md-by-age 1d - sed -i '/<\/open-size>/d' \ - "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree/repodata/repomd.xml" - test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \ - "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree/repodata/repomd.xml" - else - echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/debug/tree does not exist" - fi - done - - echo "** Update all repos with comps/groups" - for y in "${MODS_REPOS[@]}"; do - echo "${y}: ${x}" - test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os" - ret_val=$? - if [ "$ret_val" -eq 0 ]; then - createrepo --update "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os" \ - --groupfile="/mnt/compose/8/latest-Rocky-8/work/${x}/comps/comps-${y}.${x}.xml" \ - --xz --revision="${REVISION}" \ - "--distro=cpe:/o:rocky:rocky:${REVISION:0:1},Rocky Linux ${REVISION:0:1}" \ - --workers=12 --checksum=sha256 --retain-old-md-by-age 1d - sed -i '/<\/open-size>/d' \ - "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata/repomd.xml" - sed -i '/<\/open-size>/d' \ - "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/kickstart/repodata/repomd.xml" - test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \ - "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata/repomd.xml" - else - echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os does not exist" - fi - done - - echo "** Update modules" - for y in "${MODS[@]}"; do - echo "Modules: ${y} ${x}" - cp "/mnt/compose/8_metadata/${x}/${y}-modules.yaml" /tmp/modules.yaml - test -d "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os" - ret_val=$? - if [ "$ret_val" -eq 0 ]; then - modifyrepo --mdtype=modules /tmp/modules.yaml \ - "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata" \ - --compress --compress-type=xz - # This might not be necessary, but it does not hurt incase repomd is modified - sed -i '/<\/open-size>/d' \ - "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata/repomd.xml" - test -f /root/bin/sign-repo.sh && /root/bin/sign-repo.sh \ - "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os/repodata/repomd.xml" - else - echo "${STAGING_ROOT}/${RELEASE_DIR}/${y}/${x}/os does not exist" - fi - - rm /tmp/modules.yaml - sleep 1 - done - - echo "** Fix variants" - treeinfoFixer "${x}" -done diff --git a/sync/sync-to-staging.delete.sh b/sync/sync-to-staging.delete.sh index 857317c..3da73ef 100644 --- a/sync/sync-to-staging.delete.sh +++ b/sync/sync-to-staging.delete.sh @@ -12,6 +12,10 @@ if [[ $# -eq 0 ]]; then exit 1 fi +if [[ "${RLVER}" -eq "8" ]]; then + echo "This is only used for Rocky Linux 9+ releases." +fi + # Major Version (eg, 8) MAJ=${RLVER}