diff options
Diffstat (limited to 'Tools')
-rwxr-xr-x | Tools/scripts/git-diff-ports.sh | 11 | ||||
-rwxr-xr-x | Tools/scripts/git-get-latest-remote-version.sh | 8 | ||||
-rwxr-xr-x | Tools/scripts/hackage-get-latest-version.sh | 8 | ||||
-rwxr-xr-x | Tools/scripts/npmjs-get-latest-version.sh | 45 | ||||
-rwxr-xr-x | Tools/scripts/pypi-get-latest-version.sh | 6 |
5 files changed, 61 insertions, 17 deletions
diff --git a/Tools/scripts/git-diff-ports.sh b/Tools/scripts/git-diff-ports.sh index e519ca70b216..f13ed0779064 100755 --- a/Tools/scripts/git-diff-ports.sh +++ b/Tools/scripts/git-diff-ports.sh @@ -16,7 +16,7 @@ export LC_ALL=C for dep in git; do if ! which -s $dep; then echo "error: the '$dep' dependency is missing" - if [ $dep == "git" ]; then + if [ $dep = "git" ]; then echo "... please install the 'git' package" fi exit 1 @@ -27,10 +27,5 @@ done # MAIN git diff HEAD "$@" | - grep "^diff " | - grep -v Mk/ | - grep -v Tools/ | - sed -E 's|diff --git a/||; s| .*||; s|([^/]+/[^/]+).*|\1|' | - grep -v '/Makefile$' | - sort | - uniq + awk -F / '/^diff/ && $2 !~ /[[:upper:]]/ && $3 !~ /^Makefile/ { print $2 "/" $3 }' | + sort -u diff --git a/Tools/scripts/git-get-latest-remote-version.sh b/Tools/scripts/git-get-latest-remote-version.sh index 452874881b7d..3148305b4f95 100755 --- a/Tools/scripts/git-get-latest-remote-version.sh +++ b/Tools/scripts/git-get-latest-remote-version.sh @@ -8,7 +8,7 @@ set -o pipefail export LC_ALL=C ## -## git-get-latest-remote-version.sh: retrieves the latest version of a given Git project on github.com +## git-get-latest-remote-version.sh: retrieves the latest version of a remote project at the given Git URL ## # args @@ -26,9 +26,9 @@ fi for dep in git version_sort; do if ! which -s $dep; then echo "error: the '$dep' dependency is missing" - if [ $dep == "git" ]; then + if [ $dep = "git" ]; then echo "... please install the 'git' package" - elif [ $dep == "version_sort" ]; then + elif [ $dep = "version_sort" ]; then echo "... please install the 'libversion' package" fi exit 1 @@ -43,4 +43,4 @@ git ls-remote --refs --tags $REPOSITORY_URL 2>/dev/null | sed -e "s|.*refs/tags/$TAG_PREFIX||" | version_sort | tail -1 || - ! echo "failed to find the git project or tags in it" + ! echo "failed to find the git project '$REPOSITORY_URL' or tags in it" diff --git a/Tools/scripts/hackage-get-latest-version.sh b/Tools/scripts/hackage-get-latest-version.sh index 3b46a809d986..3ad21fcbd73a 100755 --- a/Tools/scripts/hackage-get-latest-version.sh +++ b/Tools/scripts/hackage-get-latest-version.sh @@ -17,6 +17,8 @@ PACKAGE_NAME="$1" if [ -z "$PACKAGE_NAME" ]; then echo "Usage: $0 <package-name>" + echo "Example: $0 cryptol" + echo "Example: $0 ShellCheck" exit 1 fi @@ -25,11 +27,11 @@ fi for dep in curl jq version_sort; do if ! which -s $dep; then echo "error: the '$dep' dependency is missing" - if [ $dep == "curl" ]; then + if [ $dep = "curl" ]; then echo "... please install the 'curl' package" - elif [ $dep == "jq" ]; then + elif [ $dep = "jq" ]; then echo "... please install the 'jq' package" - elif [ $dep == "version_sort" ]; then + elif [ $dep = "version_sort" ]; then echo "... please install the 'libversion' package" fi exit 1 diff --git a/Tools/scripts/npmjs-get-latest-version.sh b/Tools/scripts/npmjs-get-latest-version.sh new file mode 100755 index 000000000000..122211f03df8 --- /dev/null +++ b/Tools/scripts/npmjs-get-latest-version.sh @@ -0,0 +1,45 @@ +#!/bin/sh +# +# MAINTAINER: yuri@FreeBSD.org + +set -e +set -o pipefail + +export LC_ALL=C + +## +## npmjs-get-latest-version.sh: retrieves the latest version of a given Node.js package as registered on https://registry.npmjs.org +## + +# args + +PACKAGE_NAME="$1" + +if [ -z "$PACKAGE_NAME" ]; then + echo "Usage: $0 <package-name>" + echo "Example: $0 @github/copilot" + echo "Example: $0 express" + exit 1 +fi + +# check that packaged dependencies are installed + +for dep in curl jq; do + if ! which $dep >/dev/null 2>&1; then + echo "error: the '$dep' dependency is missing" + if [ $dep = "curl" ]; then + echo "... please install the 'curl' package" + elif [ $dep = "jq" ]; then + echo "... please install the 'jq' package" + fi + exit 1 + fi +done + + +# MAIN + +curl -H "Accept: application/json" https://registry.npmjs.org/$PACKAGE_NAME/latest 2>/dev/null | + grep -v "Not Found" | + jq -r '.version' || + ! echo "failed to find the Node.js package '$PACKAGE_NAME'" diff --git a/Tools/scripts/pypi-get-latest-version.sh b/Tools/scripts/pypi-get-latest-version.sh index 3083eb60764f..580aa282248d 100755 --- a/Tools/scripts/pypi-get-latest-version.sh +++ b/Tools/scripts/pypi-get-latest-version.sh @@ -17,6 +17,8 @@ PACKAGE_NAME="$1" if [ -z "$PACKAGE_NAME" ]; then echo "Usage: $0 <package-name>" + echo "Example: $0 numpy" + echo "Example: $0 scipy" exit 1 fi @@ -25,9 +27,9 @@ fi for dep in jq version_sort; do if ! which -s $dep; then echo "error: the '$dep' dependency is missing" - if [ $dep == "jq" ]; then + if [ $dep = "jq" ]; then echo "... please install the 'jq' package" - elif [ $dep == "version_sort" ]; then + elif [ $dep = "version_sort" ]; then echo "... please install the 'libversion' package" fi exit 1 |