This lets downstreams embed the unpolluted downstream version;
when building the Debian package (from gbp) the resulting binary yields
$ mkfs.erofs
<E> erofs: missing argument: FILE
mkfs.erofs 1.8.1-
fead89d91-dirty
Try 'mkfs.erofs --help' for more information.
Now, d/rules can
export EROFS_UTILS_VERSION := $(shell IFS="$$IFS()" read -r _ v _ < debian/changelog; echo "$$v")
yielding
$ mkfs.erofs
<E> erofs: missing argument: FILE
mkfs.erofs 1.8.1-1
Try 'mkfs.erofs --help' for more information.
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Link: https://lore.kernel.org/r/gho2b67qax222ewv5xb5cjkkgjgzftr3pyecl536g6jshcfexa@tarta.nabijaczleweli.xyz
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
# If we are at a tagged commit, we ignore it.
if [ -z "$(git describe --exact-match 2>/dev/null)" ]; then
# Add -g and 8 hex chars.
- printf '%s%s' -g "$(echo $head | cut -c1-8)"
+ printf -- '-g%.8s' "$head"
fi
# Check for uncommitted changes.
# This script must avoid any write attempt to the source tree,
fi
}
-echo $(sed -n '1p' VERSION | tr -d '\n')$(scm_version)
+if [ -n "$EROFS_UTILS_VERSION" ]; then
+ echo "$EROFS_UTILS_VERSION"
+else
+ echo $(head -n1 VERSION)$(scm_version)
+fi