Add script to query latest snapshot identifiers

This commit is contained in:
Paul Schaub 2019-06-10 02:56:51 +02:00
parent fafd8b9f6f
commit ead5ef6ae3
Signed by: vanitasvitae
GPG Key ID: 62BEE9264BF17311
1 changed files with 44 additions and 0 deletions

44
utils/smack-unique-snapshots.sh Executable file
View File

@ -0,0 +1,44 @@
#!/bin/sh
if [ $# -eq 0 ]; then
echo "Usage: smack-unique-snapshots.sh 4.4.0-alpha1-SNAPSHOT";
exit 1;
fi
VERSION=$1
SMACK="https://igniterealtime.org/repo/org/igniterealtime/smack"
META="maven-metadata.xml"
TEMPD=$(mktemp -d)
cd $TEMPD
# Determine avail smack projects by recursively fetching subdirs
wget -q -r -l1 -nH --cut-dirs=4 --no-parent -e robots=off $SMACK
PROJECTS=()
VERSIONS=()
# smack projects will result in subdir
# get index.html of project with descending change date
# from the html, extract first .pom file name, which is latest version
for d in `ls` ; do
if [[ -d $d ]]; then
PRO=$(wget -q "$SMACK/$d/$VERSION?C=M;O=D" -O- | grep -Po '(?<=a href=").*?(?=\.pom")' | head -n1);
# Repair missing projects
if [ ${#PRO} -le ${#d} ]; then
PRO="$d MISSING"
fi
echo $PRO
PROJECTS+=("$PRO")
PROJ_LEN=$((${#d} + 1))
SNAP=${PRO:$PROJ_LEN}
VER="$(echo $d | sed -r 's/(^|-)(\w)/\U\2/g')Version = \"$SNAP\""
VERSIONS+=("$VER")
fi
done
printf "\n"
echo "Gradle Versions:"
for v in "${VERSIONS[@]}"; do
echo $v
done
# clean up
rm -rf $TEMPD