diff options
author | Alyssa Ross <hi@alyssa.is> | 2022-03-15 10:36:38 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2022-03-16 11:37:19 +0000 |
commit | d435710923ac6e6f9fc155534800745004f2ce93 (patch) | |
tree | 386f9401476f96bdc6ec25173a090198942b5d5b /nixpkgs/pkgs/common-updater/scripts/list-archive-two-levels-versions | |
parent | c725f0011e91ae49d351b981690eb66b862b6104 (diff) | |
parent | 3239fd2b8f728106491154b44625662e10259af2 (diff) | |
download | nixlib-d435710923ac6e6f9fc155534800745004f2ce93.tar nixlib-d435710923ac6e6f9fc155534800745004f2ce93.tar.gz nixlib-d435710923ac6e6f9fc155534800745004f2ce93.tar.bz2 nixlib-d435710923ac6e6f9fc155534800745004f2ce93.tar.lz nixlib-d435710923ac6e6f9fc155534800745004f2ce93.tar.xz nixlib-d435710923ac6e6f9fc155534800745004f2ce93.tar.zst nixlib-d435710923ac6e6f9fc155534800745004f2ce93.zip |
Merge commit '3239fd2b8f728106491154b44625662e10259af2'
Conflicts: nixpkgs/pkgs/applications/window-managers/sway/default.nix
Diffstat (limited to 'nixpkgs/pkgs/common-updater/scripts/list-archive-two-levels-versions')
-rwxr-xr-x | nixpkgs/pkgs/common-updater/scripts/list-archive-two-levels-versions | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/common-updater/scripts/list-archive-two-levels-versions b/nixpkgs/pkgs/common-updater/scripts/list-archive-two-levels-versions new file mode 100755 index 000000000000..4263a9de3ca3 --- /dev/null +++ b/nixpkgs/pkgs/common-updater/scripts/list-archive-two-levels-versions @@ -0,0 +1,54 @@ +#!/usr/bin/env bash + +# lists all available versions listed for a package in a site (http) + +archive="" # archive url +pname="" # package name +file="" # file for writing debugging information + +while (( $# > 0 )); do + flag="$1" + shift 1 + case "$flag" in + --url=*) + archive="${flag#*=}" + ;; + --pname=*) + pname="${flag#*=}" + ;; + --file=*) + file="${flag#*=}" + ;; + *) + echo "$0: unknown option ‘${flag}’" + exit 1 + ;; + esac +done + +# by default set url to the base dir of the first url in src.urls +if [[ -z "$archive" ]]; then + archive="$(nix-instantiate $systemArg --eval -E \ + "with import ./. {}; dirOf (dirOf (lib.head $UPDATE_NIX_ATTR_PATH.src.urls))" \ + | tr -d '"')" +fi + +if [[ -z "$pname" ]]; then + pname="$UPDATE_NIX_ATTR_PATH" +fi + +# print a debugging message +if [[ -n "$file" ]]; then + echo "# Listing versions for '$pname' at $archive" >> $file +fi + +# list all major-minor versions from archive +tags1=$(curl -sS "$archive/") +tags1=$(echo "$tags1" | sed -rne 's,^<a href="([0-9]+\.[0-9]+)/">.*,\1,p') + +# print available versions +for tag in $tags1; do + tags2=$(curl -sS "$archive/$tag/") + tags2=$(echo "$tags2" | sed -rne "s,^<a href=\"$pname-([0-9.]+)\\.[^0-9].*\">.*,\\1,p") + echo "$tags2" +done |