mirror of
https://github.com/gluster/glusterd2.git
synced 2026-02-05 12:45:38 +01:00
make dist creates source tarballs of the GD2 source directory. make dist-vendor creates tarballs including the vendor directory. The generated tarballs contain a VERSION file, which is used by the build script to set proper versions, gitsha and build-ids when building GD2 from tarballs.
54 lines
1.4 KiB
Bash
Executable File
54 lines
1.4 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# To override version/release from git,
|
|
# create VERSION file containing text with version/release
|
|
# eg. v3.4.0-1
|
|
[[ -f VERSION ]] && source VERSION
|
|
PKG_VERSION=${PKG_VERSION:-$(git describe --tags --match "v[0-9]*")}
|
|
|
|
get_version()
|
|
{
|
|
# tags and output versions:
|
|
# - v3.4.0 => 3.4.0 (upstream clean)
|
|
# - v3.4.0-1 => 3.4.0 (downstream clean)
|
|
# - v3.4.0-2-g34e62f => 3.4.0 (upstream dirty)
|
|
# - v3.4.0-1-2-g34e62f => 3.4.0 (downstream dirty)
|
|
AWK_VERSION='
|
|
BEGIN { FS="-" }
|
|
/^v[0-9]/ {
|
|
sub(/^v/,"") ; print $1
|
|
}'
|
|
|
|
echo $PKG_VERSION | awk "$AWK_VERSION" | tr -cd '[:alnum:].'
|
|
}
|
|
|
|
get_release()
|
|
{
|
|
# tags and output releases:
|
|
# - v3.4.0 => 0 (upstream clean)
|
|
# - v3.4.0-1 => 1 (downstream clean)
|
|
# - v3.4.0-2-g34e62f1 => 2.git34e62f1 (upstream dirty)
|
|
# - v3.4.0-1-2-g34e62f1 => 1.2.git34e62f1 (downstream dirty)
|
|
AWK_RELEASE='
|
|
BEGIN { FS="-"; OFS="." }
|
|
/^v[0-9]/ {
|
|
if (NF == 1) print 0
|
|
else if (NF == 2) print $2
|
|
else if (NF == 3) print $2, "git" substr($3, 2)
|
|
else if (NF == 4) print $2, $3, "git" substr($4, 2)
|
|
}'
|
|
|
|
echo $PKG_VERSION | awk "$AWK_RELEASE" | tr -cd '[:alnum:].'
|
|
}
|
|
|
|
if test "x$1" = "x--full"; then
|
|
echo -n "v$(get_version)-$(get_release)"
|
|
elif test "x$1" = "x--version"; then
|
|
get_version
|
|
elif test "x$1" = "x--release"; then
|
|
get_release
|
|
else
|
|
echo "usage: $0 [--full|--version|--release]"
|
|
exit 1
|
|
fi
|