Changeset 6ca780c


Ignore:
Timestamp:
05/01/2021 01:00:30 PM (3 years ago)
Author:
Xi Ruoyao <xry111@…>
Branches:
11.0, 11.0-rc1, 11.0-rc2, 11.0-rc3, 11.1, 11.1-rc1, 11.2, 11.2-rc1, 11.3, 11.3-rc1, 12.0, 12.0-rc1, 12.1, 12.1-rc1, arm, bdubbs/gcc13, ml-11.0, multilib, renodr/libudev-from-systemd, s6-init, trunk, xry111/arm64, xry111/arm64-12.0, xry111/clfs-ng, xry111/lfs-next, xry111/loongarch, xry111/loongarch-12.0, xry111/loongarch-12.1, xry111/mips64el, xry111/pip3, xry111/rust-wip-20221008, xry111/update-glibc
Children:
54ee51d4, 803a28b2
Parents:
2013a74
git-author:
Xi Ruoyao <xry111@…> (05/01/2021 12:57:42 PM)
git-committer:
Xi Ruoyao <xry111@…> (05/01/2021 01:00:30 PM)
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • git-version.sh

    r2013a74 r6ca780c  
    1515
    1616commit_date=$(git show -s --format=format:"%cd" --date=local)
    17 short_date=$(date --date "$commit_date" "+%Y%m%d")
    1817
    1918year=$(date --date "$commit_date" "+%Y")
     
    3130full_date="$month $day$suffix, $year"
    3231
    33 sha="g$(git describe --always)"
    34 version="GIT-$short_date-$sha"
    35 versiond="GIT-$short_date-$sha-systemd"
     32sha="$(git describe --abbrev=1)"
     33if git describe --all --match trunk > /dev/null 2> /dev/null; then
     34        sha=$(echo "$sha" | sed 's/-g[^-]*$//')
     35fi
     36version="$sha"
     37versiond="$sha-systemd"
    3638
    3739if [ "$(git diff HEAD | wc -l)" != "0" ]; then
    38         version="$version-MODIFIED"
    39         versiond="$versiond-MODIFIED"
     40        version="$version+"
     41        versiond="$versiond+"
    4042fi
    4143
Note: See TracChangeset for help on using the changeset viewer.