tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
_7zz: fix update script
éclairevoyant
2 years ago
cd985d12
7b190567
+6
-7
1 changed file
expand all
collapse all
unified
split
pkgs
tools
archivers
7zz
update.sh
+6
-7
pkgs/tools/archivers/7zz/update.sh
···
1
1
#! /usr/bin/env nix-shell
2
2
-
#! nix-shell -i bash -p coreutils gnused curl jq nix-prefetch
2
2
+
#! nix-shell -i bash -p curl xq-xml nix-prefetch
3
3
set -euo pipefail
4
4
cd "$(dirname "${BASH_SOURCE[0]}")"
5
5
6
6
DRV_DIR="$PWD"
7
7
8
8
OLD_VERSION="$(sed -nE 's/\s*version = "(.*)".*/\1/p' ./default.nix)"
9
9
-
# The best_release.json is not always up-to-date
10
10
-
# In those cases you can force the version by calling `./update.sh <newer_version>`
11
11
-
NEW_VERSION="${1:-$(curl -H "Accept: application/json" 'https://sourceforge.net/projects/sevenzip/best_release.json' | jq '.platform_releases.linux.filename' -r | cut -d/ -f3)}"
9
9
+
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)")"
12
10
13
11
echo "comparing versions $OLD_VERSION => $NEW_VERSION"
14
12
if [[ "$OLD_VERSION" == "$NEW_VERSION" ]]; then
···
26
24
NEW_VERSION_FORMATTED="$(echo "$NEW_VERSION" | tr -d '.')"
27
25
URL="https://7-zip.org/a/7z${NEW_VERSION_FORMATTED}-src.tar.xz"
28
26
27
27
+
# `nix-prefetch` is broken without flakes
28
28
+
# see https://github.com/msteen/nix-prefetch/issues/51
29
29
+
NEW_FREE_HASH=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "_7zz.src" --url "$URL" --option extra-experimental-features flakes)
29
30
30
30
-
NEW_FREE_HASH=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "_7zz.src" --url "$URL")
31
31
-
32
32
-
NEW_UNFREE_OUT=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "(_7zz.override { enableUnfree = true; }).src" --url "$URL" --output raw --print-path)
31
31
+
NEW_UNFREE_OUT=$(nix-prefetch -f "$NIXPKGS_ROOT" -E "(_7zz.override { enableUnfree = true; }).src" --url "$URL" --output raw --print-path --option extra-experimental-features flakes)
33
32
# first line of raw output is the hash
34
33
NEW_UNFREE_HASH="$(echo "$NEW_UNFREE_OUT" | sed -n 1p)"
35
34
# second line of raw output is the src path