From ead5ef6ae3f605c40fff672b06beaaacebd22623 Mon Sep 17 00:00:00 2001 From: Paul Schaub Date: Mon, 10 Jun 2019 02:56:51 +0200 Subject: [PATCH] Add script to query latest snapshot identifiers --- utils/smack-unique-snapshots.sh | 44 +++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100755 utils/smack-unique-snapshots.sh diff --git a/utils/smack-unique-snapshots.sh b/utils/smack-unique-snapshots.sh new file mode 100755 index 0000000..ca7228c --- /dev/null +++ b/utils/smack-unique-snapshots.sh @@ -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