From 3c4bc461e2f95ddf58ce2292da590fab7282465e Mon Sep 17 00:00:00 2001 From: Louis Abel Date: Sun, 3 Sep 2023 16:38:07 -0700 Subject: [PATCH] minor adjustments --- mangle/generators/common.py | 14 +++++- .../generate_prepopulate_from_self_lh | 43 +++++++++++++++++++ mangle/generators/prepopulate_parser.py | 3 +- 3 files changed, 58 insertions(+), 2 deletions(-) create mode 100755 mangle/generators/generate_prepopulate_from_self_lh diff --git a/mangle/generators/common.py b/mangle/generators/common.py index 34c8e6d..2b6a397 100644 --- a/mangle/generators/common.py +++ b/mangle/generators/common.py @@ -3,7 +3,7 @@ import sys class common: def rlver(self, rlver, stream=False, all_repo=False): default = "Not Supported" - if stream and all_repo: + if (stream and all_repo): print("incompatible options used") sys.exit(1) @@ -54,6 +54,12 @@ class common: } return REPOS + def rl8all(self): + REPOS = { + 'dist-rocky8-lookahead-build': ['aarch64', 'x86_64', 'i386'], + } + return REPOS + def rl9all(self): REPOS = { 'all': ['aarch64', 'ppc64le', 's390x', 'x86_64'], @@ -85,4 +91,10 @@ class common: } return REPOS + def r8lh(self): + REPOS = { + 'dist-rocky8-lookahead-build': ['aarch64', 'i386', 'x86_64'], + } + return REPOS + switcher = common() diff --git a/mangle/generators/generate_prepopulate_from_self_lh b/mangle/generators/generate_prepopulate_from_self_lh new file mode 100755 index 0000000..cdb5261 --- /dev/null +++ b/mangle/generators/generate_prepopulate_from_self_lh @@ -0,0 +1,43 @@ +#!/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="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 + repodatas=( $(dnf 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) ) + 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" diff --git a/mangle/generators/prepopulate_parser.py b/mangle/generators/prepopulate_parser.py index cb9046b..e396f80 100755 --- a/mangle/generators/prepopulate_parser.py +++ b/mangle/generators/prepopulate_parser.py @@ -23,11 +23,12 @@ parser = argparse.ArgumentParser() parser.add_argument('--version', type=str, required=True) parser.add_argument("--pungi", help="local pungi is here", action='store_true') parser.add_argument('--stream', action='store_true', help="Stream koji only") +parser.add_argument('--all', action='store_true', help="All repo") results = parser.parse_args() REPOS = switcher.rlver(results.version, - stream=results.stream) + stream=results.stream, all_repo=results.all) if results.pungi: APPEND_TO_PATH = '/os'