toolkit/mangle/generators/generate_prepopulate_from_self_lh

50 lines
1.4 KiB
Text
Raw Normal View History

2023-09-03 23:38:07 +00:00
#!/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
2024-10-29 20:10:26 +00:00
if [ -f /usr/bin/dnf4 ]; then
SAFEDNF=/usr/bin/dnf4
else
SAFEDNF=/usr/bin/dnf
fi
2023-09-03 23:38:07 +00:00
export RLVER=$MAJOR
source common
drop="${PREPOPDROP}"
current=$(pwd)
tmpdir=$(mktemp -d)
tag_template="dist-rocky${MAJOR}-lookahead-build"
str_template="dist-rocky${MAJOR}-lookahead-build"
stream_repo_url="https://kojidev.rockylinux.org/kojifiles/repos/${tag_template}/latest"
pushd "${tmpdir}" || { echo "Could not change directory"; exit 1; }
for y in x86_64 aarch64 i386; do
2024-10-29 20:10:26 +00:00
repodatas=( $($SAFEDNF reposync --repofrompath ${str_template},${stream_repo_url}/${y} --download-metadata --repoid=${str_template} -p ${str_template}/${y} --forcearch ${y} --norepopath --remote-time --assumeyes -u | grep repodata) )
2023-09-03 23:38:07 +00:00
mkdir -p "${str_template}/${y}/repodata"
pushd "${str_template}/${y}/repodata" || { echo "Could not change directory"; exit 1; }
for z in "${repodatas[@]}"; do
wget -q -nc "${z}"
done
wget -q -nc "${stream_repo_url}/${y}/repodata/repomd.xml"
popd || { echo "Could not change back..."; exit 1; }
done
/usr/bin/python3 "${current}/prepopulate_parser.py" --version $RLVER --all
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"