depot/third_party/nixpkgs/pkgs/tools/archivers/7zz/update.sh
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

15 lines
715 B
Bash
Executable file

#! /usr/bin/env nix-shell
#! nix-shell -I nixpkgs=./. -i bash -p curl xq-xml common-updater-scripts
set -euo pipefail
OLD_VERSION="$(nix-instantiate --eval --json --expr 'let pkgs = import ./. {}; in pkgs._7zz.version' | sed 's/"//g')"
NEW_VERSION="$(curl -H 'Accept: application/rss+xml' 'https://sourceforge.net/projects/sevenzip/rss?path=/7-Zip' | xq -x "substring((/rss/channel/item[link[contains(., 'src.tar.xz')]])[1]/title, 8, 5)")"
echo "comparing versions $OLD_VERSION => $NEW_VERSION"
if [[ "$OLD_VERSION" == "$NEW_VERSION" ]]; then
echo "Already up to date! Doing nothing"
exit 0
fi
update-source-version _7zz "$NEW_VERSION"
update-source-version _7zz-rar "$NEW_VERSION" --ignore-same-version