Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1#!/usr/bin/env nix-shell
2#!nix-shell -i bash -p common-updater-scripts curl xmlstarlet
3
4attr=libopenmpt
5
6set -eu -o pipefail
7
8# Get update notifications, remove updates for libopenmpt-modplug, find latest eligible & extract versions
9versions="$(
10 curl -s 'https://lib.openmpt.org/libopenmpt/feed.xml' |
11 xmlstarlet sel -N atom="http://www.w3.org/2005/Atom" -t -m /atom:feed/atom:entry -v atom:title -n |
12 grep -v 'libopenmpt-modplug' | head -n1 |
13 grep -Eo '([0-9][^,\s]+)' | tr '\n' ' '
14)"
15echo "Latest $attr versions: $versions"
16
17# Find a version that is > current version and not a rc
18# rc's have different download path and a full release will usually follow shortly
19currentVersion="$(nix-instantiate --eval -E "with import ./. {}; $attr.version" | tr -d '"')"
20echo "Current $attr version: $currentVersion"
21for version in $versions; do
22 (echo "$version" | grep -q 'rc') && continue
23 [ "$version" = "$(printf '%s\n%s' "$version" "$currentVersion" | sort -V | head -n1)" ] && continue
24
25 echo "Updating to $version. Please check if other versions qualify for backport to stable!"
26 update-source-version "$attr" "$version"
27 exit 0
28done
29
30echo "No version eligible for bump."
31exit 0