556d6f0562
GitOrigin-RevId: e4ef597edfd8a0ba5f12362932fc9b1dd01a0aef
35 lines
936 B
Bash
Executable file
35 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
|