Files
spotifast/packaging/flatpak/flathub.sh
T
Carmine Paolino 8bd25261c9 Rename the app to Spotifast while preserving installation identities
Use Spotifast across the native app, commands, packages and documentation. Keep existing state, credential stores, protocol identities and package names; provide both command names and compatible updater payloads. Rename the guides with jekyll-redirect-from and prepare spotifast.rocks as the website domain. Keep product descriptions name-free.
2026-09-14 10:43:11 +02:00

33 lines
1.5 KiB
Bash
Executable File

#!/usr/bin/env bash
# Writes the manifest Flathub builds from, for one release tag:
#
# packaging/flatpak/flathub.sh v0.4.0 /path/to/flathub-checkout
#
# It pins the source to the tag and its commit, and generates
# cargo-sources.json from the lockfile with flatpak-cargo-generator, which
# needs python3 with aiohttp and toml (pip install aiohttp toml).
set -euo pipefail
tag="${1:?tag, like v0.4.0}"
out="${2:?directory to write into}"
here="$(cd "$(dirname "$0")" && pwd)"
root="$(cd "$here/../.." && pwd)"
commit="$(git -C "$root" rev-list -n 1 "$tag")"
generator="$here/flatpak-cargo-generator.py"
if [ ! -f "$generator" ]; then
curl -fsSL -o "$generator" \
https://raw.githubusercontent.com/flatpak/flatpak-builder-tools/master/cargo/flatpak-cargo-generator.py
fi
mkdir -p "$out"
python3 "$generator" "$root/Cargo.lock" -o "$out/cargo-sources.json"
python3 - "$here/rocks.fastpotify.Fastpotify.yml" "$out/rocks.fastpotify.Fastpotify.yml" "$tag" "$commit" <<'PY'
import sys
src, dst, tag, commit = sys.argv[1:]
text = open(src).read()
old = " - type: dir\n path: ../..\n"
new = f" - type: git\n url: https://github.com/crmne/spotifast.git\n tag: {tag}\n commit: {commit}\n"
assert old in text, "the source block moved"
open(dst, "w").write(text.replace(old, new))
PY
cp "$here/rocks.fastpotify.Fastpotify.metainfo.xml" "$out/" 2>/dev/null || true
echo "wrote $out/rocks.fastpotify.Fastpotify.yml and cargo-sources.json for $tag ($commit)"