arc-browser: use xmlstartlet for passthru.updateScript

(cherry picked from commit 51d4adf6c8)
This commit is contained in:
DontEatOreo
2025-07-05 21:32:54 +03:00
committed by github-actions[bot]
parent 4a59193ced
commit 41300da938

View File

@@ -6,6 +6,7 @@
writeShellApplication,
curl,
common-updater-scripts,
xmlstarlet,
}:
stdenvNoCC.mkDerivation (finalAttrs: {
@@ -37,14 +38,16 @@ stdenvNoCC.mkDerivation (finalAttrs: {
runtimeInputs = [
curl
common-updater-scripts
xmlstarlet
];
text = ''
redirect_url="$(curl -s -L -f "https://releases.arc.net/release/Arc-latest.dmg" -o /dev/null -w '%{url_effective}')"
# The url scheme is: https://releases.arc.net/release/Arc-1.23.4-56789.dmg
# We strip everything before 'Arc-' and after '.dmg'
version="''${redirect_url##*/Arc-}"
version="''${version%.dmg}"
update-source-version arc-browser "$version" --file=./pkgs/by-name/ar/arc-browser/package.nix
latest_version_string="$(curl -s "https://releases.arc.net/updates.xml" | xmlstarlet sel -N sparkle="http://www.andymatuschak.org/xml-namespaces/sparkle" -t -v "//item[1]/sparkle:shortVersionString" -n)"
version_part="''${latest_version_string%% (*}"
build_part="''${latest_version_string##*\(}"
build_part="''${build_part%\)*}"
version="''${version_part}-''${build_part}"
update-source-version arc-browser "$version"
'';
});