toolkit/mangle/generators/generate_prepopulate_from_epr
2023-07-12 14:35:59 -07:00

44 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Parses a koji tag for a branch out
#set -x
if [ -n "$1" ]; then
MAJOR=$1
else
echo "Major version not specified"
exit 1
fi
export RLVER=$MAJOR
source common
drop="${PREPOPDROP}"
current=$(pwd)
tmpdir=$(mktemp -d)
tag_template="eln-build"
eln_repo_url="${ELN_KOJI_REPO}/${tag_template}/latest"
pushd "${tmpdir}" || { echo "Could not change directory"; exit 1; }
for y in "${ARCH[@]}"; do
repodatas=( $(dnf reposync --repofrompath ${tag_template},${eln_repo_url}/${y} --download-metadata --repoid=${tag_template} -p ${tag_template}/${y} --forcearch ${y} --norepopath --remote-time --assumeyes -u | grep repodata) )
mkdir -p "${tag_template}/${y}/repodata"
pushd "${tag_template}/${y}/repodata" || { echo "Could not change directory"; exit 1; }
for z in "${repodatas[@]}"; do
wget -q -nc "${z}"
done
wget -q -nc "${eln_repo_url}/${y}/repodata/repomd.xml"
popd || { echo "Could not change back..."; exit 1; }
done
mv eln-build "c${MAJOR}s-build"
/usr/bin/python3 "${current}/prepopulate_parser.py" --version $RLVER --stream
ret_val=$?
popd || { echo "Could not change back..."; exit 1; }
if [ "$ret_val" -ne "0" ]; then
echo "There was an error running through the parser."
exit 1
fi
sed -i "s|${tag_template}|branched|g" $drop
echo "File located at: $drop"