From: Don Zickus <dzic...@redhat.com>

Add target_branch for gen_config_patches.sh

To support new config updates in other brances besides os-build, we need
to be more flexible with the staging branch.  Currently new configs get
added to configs/$date/<new CONFIG>.  This won't work when new branches
like os-build-rt-devel and os-build-automotive-devel get implemented as
they will have duplicate entries here and cause script problems.  Add a
$branch name into the configs path to create separation.

configs/$date/<new CONFIG>  -->
configs/$target_branch/$date/<new CONFIG>

This is not expected to impact anything else.

Signed-off-by: Don Zickus <dzic...@redhat.com>

diff --git a/redhat/scripts/ci/ark-update-configs.sh 
b/redhat/scripts/ci/ark-update-configs.sh
index blahblah..blahblah 100755
--- a/redhat/scripts/ci/ark-update-configs.sh
+++ b/redhat/scripts/ci/ark-update-configs.sh
@@ -73,7 +73,7 @@ new_head="$(git rev-parse HEAD)"
 [ "$old_head" != "$new_head" ] && CONFIGS_ADDED="1" || CONFIGS_ADDED=""
 
 if test "$CONFIGS_ADDED"; then
-       ./redhat/scripts/genspec/gen_config_patches.sh
+       ./redhat/scripts/genspec/gen_config_patches.sh "${BRANCH}"
         PUSH_VERB="Pushing"
 else
        printf "No new configuration values exposed from merging %s into 
$BRANCH\n" "$UPSTREAM_REF"
@@ -84,7 +84,7 @@ echo
 PUSH_STR="branch ${BRANCH} to ${GITLAB_PROJECT_URL}"
 PUSH_CMD="git push gitlab ${BRANCH}"
 PUSH_CONFIG_STR="config update branches"
-PUSH_CONFIG_CMD="for branch in \$(git branch | grep configs/\"\$(date +%F)\"); 
do
+PUSH_CONFIG_CMD="for branch in \$(git branch | grep 
configs/${BRANCH}/\"\$(date +%F)\"); do
        git push \\
                -o merge_request.create \\
                -o merge_request.target=\"$BRANCH\" \\
diff --git a/redhat/scripts/genspec/gen_config_patches.sh 
b/redhat/scripts/genspec/gen_config_patches.sh
index blahblah..blahblah 100755
--- a/redhat/scripts/genspec/gen_config_patches.sh
+++ b/redhat/scripts/genspec/gen_config_patches.sh
@@ -8,6 +8,10 @@
 # information for the relevant maintainers using get_maintainers.pl. This
 # requires that you have $RHMAINTAINERS pointing to a valid maintainer file.
 
+target_branch=$1
+prev_branch="$(git rev-parse --abbrev-ref HEAD)"
+git checkout "$target_branch"
+
 if ! git show -s --oneline HEAD | grep -q "AUTOMATIC: New configs"; then
        echo "The git HEAD doesn't look like the correct commit"
        exit 1
@@ -116,12 +120,14 @@ for f in "$config_bundles_dir"/*; do
                rm redhat/configs/pending-rhel/generic/"$line"
        done < "$f"
        # We do a separate branch per config commit
-       if ! git checkout -b "configs/$(date +%F)/$_f"; then
-               printf "Unable to check out configs/%s/%s branch!\n" "$(date 
+%F)" "$_f"
+       if ! git checkout -b "configs/$target_branch/$(date +%F)/$_f"; then
+               printf "Unable to check out configs/%s/%s/%s branch!\n" 
"$target_branch" "$(date +%F)" "$_f"
                exit 1
        fi
        # One file path is done, time to commit!
        git add redhat/configs
        git commit -s -F "$tmpdir"/commit
-       git checkout os-build
+       git checkout "$target_branch"
 done
+
+git checkout "$prev_branch"

--
https://gitlab.com/cki-project/kernel-ark/-/merge_requests/2732
_______________________________________________
kernel mailing list -- kernel@lists.fedoraproject.org
To unsubscribe send an email to kernel-le...@lists.fedoraproject.org
Fedora Code of Conduct: 
https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: 
https://lists.fedoraproject.org/archives/list/kernel@lists.fedoraproject.org
Do not reply to spam, report it: 
https://pagure.io/fedora-infrastructure/new_issue

Reply via email to