mirror of
https://git.linuxfromscratch.org/lfs.git
synced 2025-01-18 21:17:38 +00:00
git-version: simplify the versioning scheme
Now the version for trunk head is simply rx.y-z. x.y is the last release, and z is the number of commits after x.y. For other commits, the version is rx.y-z-g{sha}. An abbreviated sha hash is added to distinguish commits with same x, y, and z on different branches. If there are uncommited changes, a "+" is appended to the version, indicating the version is "unclean". To make it works correctly, a tag "rx.y" have to be created on the last commit on trunk of x.y release.
This commit is contained in:
parent
2013a74b0d
commit
6ca780c12d
@ -14,7 +14,6 @@ export LC_ALL=en_US.utf8
|
|||||||
export TZ=US/Pacific
|
export TZ=US/Pacific
|
||||||
|
|
||||||
commit_date=$(git show -s --format=format:"%cd" --date=local)
|
commit_date=$(git show -s --format=format:"%cd" --date=local)
|
||||||
short_date=$(date --date "$commit_date" "+%Y%m%d")
|
|
||||||
|
|
||||||
year=$(date --date "$commit_date" "+%Y")
|
year=$(date --date "$commit_date" "+%Y")
|
||||||
month=$(date --date "$commit_date" "+%B")
|
month=$(date --date "$commit_date" "+%B")
|
||||||
@ -30,13 +29,16 @@ esac
|
|||||||
|
|
||||||
full_date="$month $day$suffix, $year"
|
full_date="$month $day$suffix, $year"
|
||||||
|
|
||||||
sha="g$(git describe --always)"
|
sha="$(git describe --abbrev=1)"
|
||||||
version="GIT-$short_date-$sha"
|
if git describe --all --match trunk > /dev/null 2> /dev/null; then
|
||||||
versiond="GIT-$short_date-$sha-systemd"
|
sha=$(echo "$sha" | sed 's/-g[^-]*$//')
|
||||||
|
fi
|
||||||
|
version="$sha"
|
||||||
|
versiond="$sha-systemd"
|
||||||
|
|
||||||
if [ "$(git diff HEAD | wc -l)" != "0" ]; then
|
if [ "$(git diff HEAD | wc -l)" != "0" ]; then
|
||||||
version="$version-MODIFIED"
|
version="$version+"
|
||||||
versiond="$versiond-MODIFIED"
|
versiond="$versiond+"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "<!ENTITY version \"$version\">" > version.ent
|
echo "<!ENTITY version \"$version\">" > version.ent
|
||||||
|
Loading…
Reference in New Issue
Block a user