chromium,chromedriver: 129.0.6668.91 -> 129.0.6668.100
[NixPkgs.git] / pkgs / common-updater / scripts / list-archive-two-levels-versions
blobe7c02ed90b06e9b9d8622f3a79a09de2e4a17a8c
1 #!/usr/bin/env bash
3 # lists all available versions listed for a package in a site (http)
5 pname="" # package name
6 attr_path="" # package attribute path
7 url="" # directory listing url
8 file="" # file for writing debugging information
10 while (( $# > 0 )); do
11 flag="$1"
12 shift 1
13 case "$flag" in
14 --pname=*)
15 pname="${flag#*=}"
17 --attr-path=*)
18 attr_path="${flag#*=}"
20 --url=*)
21 url="${flag#*=}"
23 --file=*)
24 file="${flag#*=}"
27 echo "$0: unknown option ‘${flag}’"
28 exit 1
30 esac
31 done
33 if [[ -z "$pname" ]]; then
34 pname="$UPDATE_NIX_PNAME"
37 if [[ -z "$attr_path" ]]; then
38 attr_path="$UPDATE_NIX_ATTR_PATH"
41 # by default set url to the base dir of the first url in src.urls
42 if [[ -z "$url" ]]; then
43 url="$(nix-instantiate $systemArg --eval -E \
44 "with import ./. {}; dirOf (dirOf (lib.head $attr_path.src.urls))" \
45 | tr -d '"')"
48 # print a debugging message
49 if [[ -n "$file" ]]; then
50 echo "# Listing versions for '$pname' at $url" >> $file
53 # list all major-minor versions from url
54 tags1=$(curl -sS "$url/")
55 tags1=$(echo "$tags1" | sed -rne 's,^<a href="([0-9]+\.[0-9]+)/">.*,\1,p')
57 # print available versions
58 for tag in $tags1; do
59 tags2=$(curl -sS "$url/$tag/")
60 tags2=$(echo "$tags2" | sed -rne "s,^<a href=\"$pname-([0-9.]+)\\.[^0-9].*\">.*,\\1,p")
61 echo "$tags2"
62 done