Files
ports/Tools/scripts/git-get-latest-remote-version.sh
T
Tijl Coosemans b6ec06f079 */*: Use C.UTF-8 locale
Ports 02f27a83b4 fixed the ports tree to the C locale so it would work
correctly in environments where users use a locale that isn't compatible
with the C locale, e.g. xx_YY.UTF-8 where [A-Z] includes more than just
upper case letters.  USE_LOCALE was introduced to let ports use another
locale if they needed it.  The C.UTF-8 locale was created later on to be
mostly compatible with the C locale.

Switch the ports tree locale to C.UTF-8 and remove USE_LOCALE.  The
world has moved to Unicode so all ports either require it or know how to
build correctly in a Unicode environment.

PR:		295945
Exp-run by:	antoine
2026-06-30 22:03:57 +02:00

47 lines
956 B
Bash
Executable File

#!/bin/sh
#
# MAINTAINER: yuri@FreeBSD.org
set -e
set -o pipefail
export LC_ALL=C.UTF-8
##
## git-get-latest-remote-version.sh: retrieves the latest version of a remote project at the given Git URL
##
# args
REPOSITORY_URL="$1" # mandatory
TAG_PREFIX="$2" # optional
if [ -z "$REPOSITORY_URL" ]; then
echo "Usage: $0 <repository-url> <tag-prefix>"
exit 1
fi
# check that packaged dependencies are installed
for dep in git version_sort; do
if ! which -s $dep; then
echo "error: the '$dep' dependency is missing"
if [ $dep = "git" ]; then
echo "... please install the 'git' package"
elif [ $dep = "version_sort" ]; then
echo "... please install the 'libversion' package"
fi
exit 1
fi
done
# MAIN
git ls-remote --refs --tags $REPOSITORY_URL 2>/dev/null |
grep "refs/tags/$TAG_PREFIX" |
sed -e "s|.*refs/tags/$TAG_PREFIX||" |
version_sort |
tail -1 ||
! echo "failed to find the git project '$REPOSITORY_URL' or tags in it"