2021-07-05 06:50:25 +00:00
|
|
|
#!/bin/bash
|
2021-07-06 17:08:30 +00:00
|
|
|
|
2023-01-13 22:32:50 +00:00
|
|
|
# Short name (eg, NFV, extras, Rocky, gluster9)
|
|
|
|
SHORT=${1}
|
|
|
|
|
2021-07-06 17:08:30 +00:00
|
|
|
# Source common variables
|
2021-07-06 20:33:22 +00:00
|
|
|
# shellcheck disable=SC2046,1091,1090
|
2021-07-06 21:34:26 +00:00
|
|
|
source "$(dirname "$0")/common"
|
2021-07-06 17:08:30 +00:00
|
|
|
|
2021-07-08 02:54:12 +00:00
|
|
|
if [[ $# -eq 0 ]]; then
|
|
|
|
echo "You must specify a short name."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2023-05-17 21:51:12 +00:00
|
|
|
if [[ "${RLVER}" -ne "8" ]]; then
|
|
|
|
echo "This is only used for Rocky Linux 8 releases."
|
|
|
|
fi
|
|
|
|
|
2021-07-05 06:50:25 +00:00
|
|
|
# Major Version (eg, 8)
|
2023-05-18 00:19:35 +00:00
|
|
|
#MAJ=${RLVER}
|
2021-07-06 17:08:30 +00:00
|
|
|
|
2023-05-13 20:44:17 +00:00
|
|
|
#cd "${RELEASE_COMPOSE_ROOT}/compose" || { echo "Failed to change directory"; ret_val=1; exit 1; }
|
|
|
|
cd "${RELEASE_COMPOSE_ROOT}/" || { echo "Failed to change directory"; ret_val=1; exit 1; }
|
2021-07-05 06:50:25 +00:00
|
|
|
ret_val=$?
|
2021-07-06 17:08:30 +00:00
|
|
|
|
2021-07-05 06:50:25 +00:00
|
|
|
if [ $ret_val -eq "0" ]; then
|
2021-07-06 20:16:01 +00:00
|
|
|
TARGET="${STAGING_ROOT}/${CATEGORY_STUB}/${REV}"
|
2023-05-17 21:51:12 +00:00
|
|
|
# The target should already exist as this is used to do simple syncs.
|
2021-07-06 20:16:01 +00:00
|
|
|
mkdir -p "${TARGET}"
|
2023-05-17 21:51:12 +00:00
|
|
|
|
|
|
|
# Find all directories for this compose
|
2023-05-18 00:19:35 +00:00
|
|
|
mapfile -t repo_dirs < <(find compose -name repodata -type d | sed 's/compose\///g')
|
|
|
|
mapfile -t src_dirs < <(find compose -name repodata -type d | sed 's/compose\///g ; s/\/repodata//g' | grep source)
|
|
|
|
mapfile -t arch_dirs < <(find compose -name repodata -type d | sed 's/compose\///g ; s/\/repodata//g' | grep -v source)
|
|
|
|
mapfile -t debug_dirs < <(find compose -name repodata -type d | sed 's/compose\///g ; s/\/repodata//g' | grep debug)
|
2023-05-17 21:51:12 +00:00
|
|
|
|
|
|
|
# Delete all repodata for this compose
|
2023-05-18 00:19:35 +00:00
|
|
|
echo "** Removing all current repo data"
|
2023-05-17 21:51:12 +00:00
|
|
|
for x in "${repo_dirs[@]}"; do
|
|
|
|
test -d "${TARGET}/${x}"
|
|
|
|
ret_val=$?
|
|
|
|
if [ $ret_val -eq "0" ]; then
|
|
|
|
/bin/rm "${TARGET:?}/${x}/"*
|
|
|
|
else
|
|
|
|
echo "${x} not found"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
2023-05-18 00:19:35 +00:00
|
|
|
# Now that we've deleted the repo data, we need to sync
|
|
|
|
echo "** Syncing all new content"
|
2023-05-17 21:51:12 +00:00
|
|
|
rsync_no_delete_staging_pungi "${TARGET}"
|
2023-05-18 00:19:35 +00:00
|
|
|
|
|
|
|
# Now we need to createrepo
|
|
|
|
echo "** Running createrepo on source repos"
|
|
|
|
for src_repo in "${src_dirs[@]}"; do
|
|
|
|
echo "Trying ${src_repo}..."
|
|
|
|
test -d "${TARGET}/${src_repo}"
|
|
|
|
ret_val=$?
|
|
|
|
if [ $ret_val -eq "0" ]; then
|
|
|
|
createrepo_only "${TARGET}/${src_repo}" "${REVISION}"
|
|
|
|
fix_metadata "${TARGET}/${src_repo}/repodata/repomd.xml"
|
|
|
|
sign_data "${TARGET}/${src_repo}/repodata/repomd.xml"
|
|
|
|
else
|
|
|
|
echo "${src_repo} not found"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
# We need to be specific here. If the short name is "Rocky" we have extra
|
|
|
|
# work. Otherwise, normal createrepo is fine.
|
|
|
|
echo "** Running createrepo on arch repos"
|
|
|
|
if [[ "${SHORT}" == "Rocky" ]]; then
|
|
|
|
echo "** Updating all debug repos"
|
|
|
|
for debug_repo in "${debug_dirs[@]}"; do
|
|
|
|
echo "Trying ${debug_repo}..."
|
|
|
|
test -d "${TARGET}/${debug_repo}"
|
|
|
|
ret_val=$?
|
|
|
|
if [ $ret_val -eq "0" ]; then
|
|
|
|
createrepo_only "${TARGET}/${debug_repo}" "${REVISION}"
|
|
|
|
fix_metadata "${TARGET}/${debug_repo}/repodata/repomd.xml"
|
|
|
|
sign_data "${TARGET}/${debug_repo}/repodata/repomd.xml"
|
|
|
|
else
|
|
|
|
echo "${debug_repo} not found"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "** Updating all repos with comps/groups"
|
|
|
|
for arch in "${ARCHES[@]}"; do
|
|
|
|
for comp_repo in "${MODS_REPOS[@]}"; do
|
|
|
|
echo "Trying ${arch} ${comp_repo}..."
|
|
|
|
REPO_PATH="${TARGET}/${comp_repo}/${arch}/os"
|
|
|
|
COMP_PATH="${RELEASE_COMPOSE_ROOT}/work/${arch}/comps/comps-${comp_repo}.${arch}.xml"
|
|
|
|
test -d "${REPO_PATH}"
|
|
|
|
ret_val=$?
|
|
|
|
if [ $ret_val -eq "0" ]; then
|
|
|
|
createrepo_comps "${REPO_PATH}" "${REVISION}" "${COMP_PATH}"
|
|
|
|
fix_metadata "${REPO_PATH}/repodata/repomd.xml"
|
|
|
|
sign_data "${REPO_PATH}/repodata/repomd.xml"
|
|
|
|
else
|
|
|
|
echo "${comp_repo} not found"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
|
|
|
|
echo "** Updating modules"
|
|
|
|
for arch in "${ARCHES[@]}"; do
|
2023-05-18 01:47:31 +00:00
|
|
|
for mod_repo in "${MODS[@]}"; do
|
2023-05-18 00:19:35 +00:00
|
|
|
echo "Trying ${arch} ${mod_repo}..."
|
|
|
|
MOD_PATH="${TARGET}/${mod_repo}/${arch}/os/repodata"
|
|
|
|
MOD_YAML="/mnt/compose/${RLVER}_metadata/${arch}/${mod_repo}-modules.yaml"
|
|
|
|
test -f "${MOD_YAML}"
|
|
|
|
ret_val=$?
|
|
|
|
if [ $ret_val -ne 0 ]; then
|
|
|
|
echo "Module yaml not found"
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
|
|
|
|
test -d "${MOD_PATH}"
|
|
|
|
ret_val=$?
|
|
|
|
|
|
|
|
if [ $ret_val -eq 0 ]; then
|
|
|
|
modifyrepo_module "${MOD_PATH}" "${MOD_YAML}"
|
|
|
|
fix_metadata "${MOD_PATH}/repomd.xml"
|
|
|
|
sign_data "${MOD_PATH}/repomd.xml"
|
|
|
|
else
|
|
|
|
echo "${mod_repo} not found"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
done
|
|
|
|
else
|
|
|
|
for arch_repo in "${arch_dirs[@]}"; do
|
|
|
|
echo "Trying ${arch_repo}..."
|
|
|
|
test -d "${TARGET}/${arch_repo}"
|
|
|
|
ret_val=$?
|
|
|
|
if [ $ret_val -eq "0" ]; then
|
|
|
|
createrepo_only "${TARGET}/${arch_repo}" "${REVISION}"
|
|
|
|
fix_metadata "${TARGET}/${arch_repo}/repodata/repomd.xml"
|
|
|
|
sign_data "${TARGET}/${arch_repo}/repodata/repomd.xml"
|
|
|
|
else
|
|
|
|
echo "${arch_repo} not found"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "** Hardlinking staging directory (${TARGET})"
|
2023-05-13 20:59:58 +00:00
|
|
|
perform_hardlink "${TARGET}"
|
2021-07-05 06:50:25 +00:00
|
|
|
fi
|