From 0be430f8117e22c35d0ff91a1ada0299a8c0e152 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Mon, 12 Aug 2024 09:14:59 +0900 Subject: [PATCH] PRE_BUILD_AUTOMATION: added THISREPO placeholder --- automation_tools/pre_build_automation.sh | 20 ++++++++++++++++++++ net.retrodeck.retrodeck.yml | 6 +++--- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/automation_tools/pre_build_automation.sh b/automation_tools/pre_build_automation.sh index 3dabcc85..c05a9879 100755 --- a/automation_tools/pre_build_automation.sh +++ b/automation_tools/pre_build_automation.sh @@ -51,7 +51,18 @@ get_current_branch() { fi } +# Retrieve the repository URL +get_repo_url() { + local repo_url=$(git config --get remote.origin.url) + # Convert SSH URL to HTTPS if needed + if [[ "$repo_url" == git@* ]]; then + repo_url=$(echo "$repo_url" | sed -e 's|git@|https://|' -e 's|:|/|') + fi + echo "$repo_url" +} + current_branch=$(get_current_branch) +current_repo_url=$(get_repo_url) echo "Manifest location: $rd_manifest" echo "Automation task list location: $automation_task_list" @@ -170,6 +181,13 @@ handle_url() { /bin/sed -i 's^'"$placeholder"'^'"$calculated_url"'^g' "$rd_manifest" } +# Handle the THISREPO placeholder +handle_thisrepo() { + local placeholder="$1" + echo "Replacing placeholder $placeholder with repository URL $current_repo_url" + /bin/sed -i 's^'"$placeholder"'^'"$current_repo_url"'^g' "$rd_manifest" +} + # Process the task list while IFS="^" read -r action placeholder url branch || [[ -n "$action" ]]; do if [[ ! "$action" == "#"* ]] && [[ -n "$action" ]]; then @@ -184,6 +202,8 @@ while IFS="^" read -r action placeholder url branch || [[ -n "$action" ]]; do "outside_env_var" ) handle_outside_env_var "$placeholder" "$url" ;; "custom_command" ) handle_custom_command "$url" ;; "url" ) handle_url "$placeholder" "$url" ;; + "THISREPO" ) handle_thisrepo "$placeholder" ;; esac fi done < "$automation_task_list" + diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml index 02b96588..15688331 100644 --- a/net.retrodeck.retrodeck.yml +++ b/net.retrodeck.retrodeck.yml @@ -90,7 +90,7 @@ modules: echo "Version is $VERSION" sources: - type: git - url: https://github.com/RetroDECK/RetroDECK.git + url: THISREPO branch: THISBRANCH - name: xmlstarlet @@ -178,7 +178,7 @@ modules: sha256: f5f359d6332861bd497570848fcb42520964a9e83d5e3abe397b6b6db9bcaaf4 dest: fontconfig - type: git - url: https://github.com/RetroDECK/RetroDECK.git + url: THISREPO branch: THISBRANCH # RetroArch @@ -649,5 +649,5 @@ modules: sources: - type: git - url: https://github.com/RetroDECK/RetroDECK.git + url: THISREPO branch: THISBRANCH \ No newline at end of file