From 41147e93dbebebe0f1026c6c7cff8f30394f33f7 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Tue, 24 Sep 2024 17:32:45 +0900 Subject: [PATCH 1/4] PRE_BUILD_AUTOMATION: added wildcard support to latestghrelease + sha --- automation_tools/automation_task_list.cfg | 4 +++- automation_tools/pre_build_automation.sh | 29 +++++++++++++---------- 2 files changed, 20 insertions(+), 13 deletions(-) diff --git a/automation_tools/automation_task_list.cfg b/automation_tools/automation_task_list.cfg index 5fe7501e..5ba6b79c 100644 --- a/automation_tools/automation_task_list.cfg +++ b/automation_tools/automation_task_list.cfg @@ -24,7 +24,9 @@ hash^RETRODECKMELONDSLATEST^https://github.com/RetroDECK/net.kuribo64.melonDS/re hash^RETRODECKSOLARUSLATEST^https://github.com/RetroDECK/org.solarus_games.solarus.Launcher/releases/latest/download/RetroDECK-solarus-Artifact.tar.gz hash^RETRODECKGZDOOMLATEST^https://github.com/RetroDECK/org.zdoom.GZDoom/releases/latest/download/RetroDECK-gzdoom-Artifact.tar.gz hash^RETRODECKMAMELATEST^https://github.com/RetroDECK/MAME/releases/latest/download/RetroDECK-MAME-Artifact.tar.gz -hash^RETRODECKSHADPS4LATESTSTABLE^https://github.com/shadps4-emu/shadPS4/releases/download/Pre-release-shadPS4-2024-09-24-1620eea/shadps4-linux-qt-2024-09-24-1620eea.zip + +latestghrelease^SHADPS4LATESTGHREL^https://github.com/shadps4-emu/shadPS4/releases/latest/download/shadps4-linux-qt-*.zip +latestghreleasesha^SHADPS4LATESTSHA^https://github.com/shadps4-emu/shadPS4/releases/latest/download/shadps4-linux-qt-*.zip #This will replace RETRODECKSHADPS4LATESTURL with the URL of the latest artifact and RETRODECKSHADPS4LATESTSHA with its SHA256 hash. #latestghaartifact^RETRODECKSHADPS4LATESTURL^RETRODECKSHADPS4LATESTSHA^https://github.com/shadps4-emu/shadPS4/actions/workflows/linux-qt.yml^shadps4-linux-qt diff --git a/automation_tools/pre_build_automation.sh b/automation_tools/pre_build_automation.sh index dd8d63fd..d0210ad6 100755 --- a/automation_tools/pre_build_automation.sh +++ b/automation_tools/pre_build_automation.sh @@ -107,19 +107,21 @@ handle_latestghtag() { handle_latestghrelease() { local placeholder="$1" local url="$2" - local suffix="$3" + local pattern="$3" echo "Fetching release data from: $url" local release_data=$(curl -s "$url") echo "Release data fetched." - local ghreleaseurl=$(echo "$release_data" | jq -r ".assets[] | select(.name | endswith(\"$suffix\")).browser_download_url") - + + # Find the matching asset using the pattern + local ghreleaseurl=$(echo "$release_data" | jq -r ".assets[] | select(.name | test(\"$pattern\")).browser_download_url") + if [[ -z "$ghreleaseurl" ]]; then - echo "Error: No asset found with suffix $suffix" + echo "Error: No asset found matching pattern $pattern" exit 1 fi - + local ghreleasehash=$(curl -sL "$ghreleaseurl" | sha256sum | cut -d ' ' -f1) - + echo "Replacing placeholder $placeholder with URL $ghreleaseurl and hash $ghreleasehash" /bin/sed -i 's^'"$placeholder"'^'"$ghreleaseurl"'^g' "$rd_manifest" /bin/sed -i 's^'"HASHFOR$placeholder"'^'"$ghreleasehash"'^g' "$rd_manifest" @@ -128,19 +130,22 @@ handle_latestghrelease() { handle_latestghreleasesha() { local placeholder="$1" local url="$2" - local suffix="$3" + local pattern="$3" echo "Fetching release data from: $url" local release_data=$(curl -s "$url") echo "Release data fetched." - local ghreleaseurl=$(echo "$release_data" | jq -r ".assets[] | select(.name | endswith(\"$suffix\")).browser_download_url") - + + # Find the matching asset using the pattern + local ghreleaseurl=$(echo "$release_data" | jq -r ".assets[] | select(.name | test(\"$pattern\")).browser_download_url") + if [[ -z "$ghreleaseurl" ]]; then - echo "Error: No asset found with suffix $suffix" + echo "Error: No asset found matching pattern $pattern" exit 1 fi - + + # Download the file and compute its hash local ghreleasehash=$(curl -sL "$ghreleaseurl" | sha256sum | cut -d ' ' -f1) - + echo "Replacing placeholder $placeholder with hash $ghreleasehash" /bin/sed -i 's^'"$placeholder"'^'"$ghreleasehash"'^g' "$rd_manifest" } From 3508ad6fe0dcb38a58a134bbce338d2dd008a309 Mon Sep 17 00:00:00 2001 From: XargonWan Date: Tue, 24 Sep 2024 17:33:00 +0900 Subject: [PATCH 2/4] SHADPS4: switched to rolling release (latest) --- net.retrodeck.retrodeck.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net.retrodeck.retrodeck.yml b/net.retrodeck.retrodeck.yml index 305579ac..bc3c22e7 100644 --- a/net.retrodeck.retrodeck.yml +++ b/net.retrodeck.retrodeck.yml @@ -554,8 +554,8 @@ modules: - cp -r squashfs-root/usr/* "${FLATPAK_DEST}/" sources: - type: archive - url: https://github.com/shadps4-emu/shadPS4/releases/download/Pre-release-shadPS4-2024-09-24-1620eea/shadps4-linux-qt-2024-09-24-1620eea.zip - sha256: RETRODECKSHADPS4LATESTSTABLE + url: SHADPS4LATESTGHREL + sha256: SHADPS4LATESTSHA # PortMaster - name: PortMaster From 6930fb281a0386c653cf1fe899bf7fe0308caa2b Mon Sep 17 00:00:00 2001 From: XargonWan Date: Tue, 24 Sep 2024 17:39:27 +0900 Subject: [PATCH 3/4] PRE_BUILD_AUTOMATION: added wildcard support to latestghrelease + sha -fix1 --- automation_tools/automation_task_list.cfg | 2 +- automation_tools/pre_build_automation.sh | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/automation_tools/automation_task_list.cfg b/automation_tools/automation_task_list.cfg index 5ba6b79c..fdd0ed1c 100644 --- a/automation_tools/automation_task_list.cfg +++ b/automation_tools/automation_task_list.cfg @@ -26,7 +26,7 @@ hash^RETRODECKGZDOOMLATEST^https://github.com/RetroDECK/org.zdoom.GZDoom/release hash^RETRODECKMAMELATEST^https://github.com/RetroDECK/MAME/releases/latest/download/RetroDECK-MAME-Artifact.tar.gz latestghrelease^SHADPS4LATESTGHREL^https://github.com/shadps4-emu/shadPS4/releases/latest/download/shadps4-linux-qt-*.zip -latestghreleasesha^SHADPS4LATESTSHA^https://github.com/shadps4-emu/shadPS4/releases/latest/download/shadps4-linux-qt-*.zip +latestghreleasesha^SHADPS4LATESTSHA^https://api.github.com/repos/shadps4-emu/shadPS4/releases/latest^shadps4-linux-qt-.*\.zip #This will replace RETRODECKSHADPS4LATESTURL with the URL of the latest artifact and RETRODECKSHADPS4LATESTSHA with its SHA256 hash. #latestghaartifact^RETRODECKSHADPS4LATESTURL^RETRODECKSHADPS4LATESTSHA^https://github.com/shadps4-emu/shadPS4/actions/workflows/linux-qt.yml^shadps4-linux-qt diff --git a/automation_tools/pre_build_automation.sh b/automation_tools/pre_build_automation.sh index d0210ad6..d4151e16 100755 --- a/automation_tools/pre_build_automation.sh +++ b/automation_tools/pre_build_automation.sh @@ -129,10 +129,12 @@ handle_latestghrelease() { handle_latestghreleasesha() { local placeholder="$1" - local url="$2" + local api_url="$2" local pattern="$3" - echo "Fetching release data from: $url" - local release_data=$(curl -s "$url") + echo "Fetching release data from: $api_url" + + # Fetch the release data from GitHub API + local release_data=$(curl -s "$api_url") echo "Release data fetched." # Find the matching asset using the pattern @@ -144,6 +146,7 @@ handle_latestghreleasesha() { fi # Download the file and compute its hash + echo "Downloading asset to compute hash: $ghreleaseurl" local ghreleasehash=$(curl -sL "$ghreleaseurl" | sha256sum | cut -d ' ' -f1) echo "Replacing placeholder $placeholder with hash $ghreleasehash" From 39dd36c4885cbc687fc6d1b4e1a1140000aa2d4d Mon Sep 17 00:00:00 2001 From: XargonWan Date: Tue, 24 Sep 2024 17:49:12 +0900 Subject: [PATCH 4/4] PRE_BUILD_AUTOMATION: added wildcard support to latestghrelease + sha -fix2 --- automation_tools/automation_task_list.cfg | 2 +- automation_tools/pre_build_automation.sh | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/automation_tools/automation_task_list.cfg b/automation_tools/automation_task_list.cfg index fdd0ed1c..e1dd57b8 100644 --- a/automation_tools/automation_task_list.cfg +++ b/automation_tools/automation_task_list.cfg @@ -25,7 +25,7 @@ hash^RETRODECKSOLARUSLATEST^https://github.com/RetroDECK/org.solarus_games.solar hash^RETRODECKGZDOOMLATEST^https://github.com/RetroDECK/org.zdoom.GZDoom/releases/latest/download/RetroDECK-gzdoom-Artifact.tar.gz hash^RETRODECKMAMELATEST^https://github.com/RetroDECK/MAME/releases/latest/download/RetroDECK-MAME-Artifact.tar.gz -latestghrelease^SHADPS4LATESTGHREL^https://github.com/shadps4-emu/shadPS4/releases/latest/download/shadps4-linux-qt-*.zip +latestghrelease^SHADPS4LATESTGHREL^https://api.github.com/repos/shadps4-emu/shadPS4/releases/latest^shadps4-linux-qt-.*\.zip latestghreleasesha^SHADPS4LATESTSHA^https://api.github.com/repos/shadps4-emu/shadPS4/releases/latest^shadps4-linux-qt-.*\.zip #This will replace RETRODECKSHADPS4LATESTURL with the URL of the latest artifact and RETRODECKSHADPS4LATESTSHA with its SHA256 hash. diff --git a/automation_tools/pre_build_automation.sh b/automation_tools/pre_build_automation.sh index d4151e16..c40f5b79 100755 --- a/automation_tools/pre_build_automation.sh +++ b/automation_tools/pre_build_automation.sh @@ -106,10 +106,12 @@ handle_latestghtag() { handle_latestghrelease() { local placeholder="$1" - local url="$2" + local api_url="$2" local pattern="$3" - echo "Fetching release data from: $url" - local release_data=$(curl -s "$url") + echo "Fetching release data from: $api_url" + + # Fetch the release data from GitHub API + local release_data=$(curl -s "$api_url") echo "Release data fetched." # Find the matching asset using the pattern @@ -120,6 +122,7 @@ handle_latestghrelease() { exit 1 fi + # Download the file and compute its hash local ghreleasehash=$(curl -sL "$ghreleaseurl" | sha256sum | cut -d ' ' -f1) echo "Replacing placeholder $placeholder with URL $ghreleaseurl and hash $ghreleasehash"