mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-12-26 23:54:01 +00:00
36 lines
936 B
Bash
Executable File
36 lines
936 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
# lists all available versions listed for a package in a site (http)
|
|
|
|
scriptName=list-archive-two-level-versions # do not use the .wrapped name
|
|
|
|
usage() {
|
|
echo "Usage: $scriptName <archive url> [<package name> [<debug file path>]]"
|
|
}
|
|
|
|
archive="$1" # archive url
|
|
pname="$2" # package name
|
|
file="$3" # file for writing debugging information
|
|
|
|
if [ -z "$archive" ]; then
|
|
echo "$scriptName: Missing archive url"
|
|
usage
|
|
exit 1
|
|
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
|