From d856e8075b567352c0f7f53284c0fc5a606b1e7b Mon Sep 17 00:00:00 2001 From: Gregory Schier Date: Tue, 10 Feb 2026 06:42:35 -0800 Subject: [PATCH] Rewrite update-manifest.sh in pure bash --- flatpak/update-manifest.sh | 55 +++++++++----------------------------- 1 file changed, 12 insertions(+), 43 deletions(-) diff --git a/flatpak/update-manifest.sh b/flatpak/update-manifest.sh index 584ce1a7..4ccf3306 100755 --- a/flatpak/update-manifest.sh +++ b/flatpak/update-manifest.sh @@ -47,58 +47,27 @@ echo " SHA256: $SHA_ARM64" echo "" echo "Updating manifest: $MANIFEST" -# Use Python for reliable YAML-like replacement (avoids sed edge cases) -python3 << PYEOF -import re +# Update URLs by matching the arch-specific deb filename +sed -i "s|url: .*amd64\.deb|url: $BASE_URL/$DEB_AMD64|" "$MANIFEST" +sed -i "s|url: .*arm64\.deb|url: $BASE_URL/$DEB_ARM64|" "$MANIFEST" -with open("$MANIFEST", "r") as f: - content = f.read() +# Update SHA256 hashes by finding the current ones and replacing +OLD_SHA_AMD64=$(grep -A2 "amd64\.deb" "$MANIFEST" | grep sha256 | sed 's/.*"\(.*\)"/\1/') +OLD_SHA_ARM64=$(grep -A2 "arm64\.deb" "$MANIFEST" | grep sha256 | sed 's/.*"\(.*\)"/\1/') -# Replace x86_64 source block -content = re.sub( - r'(dest-filename: yaak\.deb\n\s+url: )https://.*?\.deb(\n\s+sha256: )"[^"]*"(\n\s+only-arches:\n\s+- x86_64)', - rf'\g<1>${BASE_URL}/${DEB_AMD64}\2"${SHA_AMD64}"\3', - content, -) +sed -i "s|$OLD_SHA_AMD64|$SHA_AMD64|" "$MANIFEST" +sed -i "s|$OLD_SHA_ARM64|$SHA_ARM64|" "$MANIFEST" -# Replace aarch64 source block -content = re.sub( - r'(dest-filename: yaak\.deb\n\s+url: )https://.*?\.deb(\n\s+sha256: )"[^"]*"(\n\s+only-arches:\n\s+- aarch64)', - rf'\g<1>${BASE_URL}/${DEB_ARM64}\2"${SHA_ARM64}"\3', - content, -) - -with open("$MANIFEST", "w") as f: - f.write(content) - -print(" Manifest updated.") -PYEOF +echo " Manifest updated." echo "Updating metainfo: $METAINFO" TODAY=$(date +%Y-%m-%d) -python3 << PYEOF -import re +# Insert new release entry after +sed -i "s| | \n |" "$METAINFO" -with open("$METAINFO", "r") as f: - content = f.read() - -release_entry = f' \n ' - -# Replace existing block opening (add new release at the top) -content = re.sub( - r' \n(\s+