8ac5e011d6
GitOrigin-RevId: 2c3273caa153ee8eb5786bc8141b85b859e7efd7
35 lines
927 B
Bash
Executable file
35 lines
927 B
Bash
Executable file
#! /bin/sh
|
|
|
|
# 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
|