mirror of
https://github.com/morgan9e/systemd
synced 2026-04-15 00:47:10 +09:00
Make vcs-tag do something useful for non-developer mode as well
When building packages of arbitrary commits of systemd-stable, distributors might want to include a git sha of the exact commit they're on. Let's extend vcs-tag a little to make this possible. If we're on a commit matching a tag, don't generate a git sha at all. If we're not on a commit matching a tag, generate a vcs tag as usually. However, if we're not in developer mode, don't append a '^' if the tree is dirty to accomodate package builds applying various patches to the tree which shouldn't be considered as "dirty" edits.
This commit is contained in:
committed by
Zbigniew Jędrzejewski-Szmek
parent
733518b413
commit
944faf6598
17
tools/vcs-tag.sh
Executable file
17
tools/vcs-tag.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/bash
|
||||
# SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
set -e
|
||||
|
||||
MODE="$1"
|
||||
|
||||
if ! [[ -d .git ]] || git describe --tags --exact-match &>/dev/null; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [[ "$MODE" == "developer" ]]; then
|
||||
DIRTY="--dirty=^"
|
||||
else
|
||||
DIRTY=""
|
||||
fi
|
||||
|
||||
echo "-g$(git describe --abbrev=7 --match="" --always $DIRTY)"
|
||||
Reference in New Issue
Block a user