11.0
11.1
11.2
11.3
12.0
12.1
12.2
gimp3
kea
ken/TL2024
ken/inkscape-core-mods
ken/tuningfonts
lazarus
lxqt
plabs/newcss
plabs/python-mods
python3.11
qt5new
rahul/power-profiles-daemon
renodr/vulkan-addition
trunk
upgradedb
xry111/for-12.3
xry111/intltool
xry111/llvm18
xry111/soup3
xry111/spidermonkey128
xry111/test-20220226
xry111/xf86-video-removal
Last change
on this file since ca5e52a was ca5e52a, checked in by Xi Ruoyao <xry111@…>, 3 years ago |
git-version: simplify version number
|
-
Property mode
set to
100755
|
File size:
1.7 KB
|
Line | |
---|
1 | #!/bin/sh
|
---|
2 |
|
---|
3 | if ! git status > /dev/null; then
|
---|
4 | # Either it's not a git repository, or git is unavaliable.
|
---|
5 | # Just workaround.
|
---|
6 | echo "<!ENTITY version \"unknown\">" > version.ent
|
---|
7 | echo "<!ENTITY versiond \"unknown-systemd\">" >> version.ent
|
---|
8 | echo "<!ENTITY releasedate \"unknown\">" >> version.ent
|
---|
9 | echo "<!ENTITY copyrightdate \"1999-2021\">" >> version.ent
|
---|
10 | exit 0
|
---|
11 | fi
|
---|
12 |
|
---|
13 | export LC_ALL=en_US.utf8
|
---|
14 | export TZ=US/Pacific
|
---|
15 |
|
---|
16 | commit_date=$(git show -s --format=format:"%cd" --date=local)
|
---|
17 | short_date=$(date --date "$commit_date" "+%Y-%m-%d")
|
---|
18 |
|
---|
19 | year=$(date --date "$commit_date" "+%Y")
|
---|
20 | month=$(date --date "$commit_date" "+%B")
|
---|
21 | month_digit=$(date --date "$commit_date" "+%m")
|
---|
22 | day_digit=$(date --date "$commit_date" "+%d")
|
---|
23 | day=$(echo $day_digit | sed 's/^0//')
|
---|
24 |
|
---|
25 | case $day in
|
---|
26 | "1" | "21" | "31" ) suffix="st";;
|
---|
27 | "2" | "22" ) suffix="nd";;
|
---|
28 | "3" | "23" ) suffix="rd";;
|
---|
29 | * ) suffix="th";;
|
---|
30 | esac
|
---|
31 |
|
---|
32 | full_date="$month $day$suffix, $year"
|
---|
33 |
|
---|
34 | sha="$(git describe --abbrev=1)"
|
---|
35 | if git describe --all --match trunk > /dev/null 2> /dev/null; then
|
---|
36 | sha=$(echo "$sha" | sed 's/-g[^-]*$//')
|
---|
37 | fi
|
---|
38 | version="$sha"
|
---|
39 |
|
---|
40 | if [ "$(git diff HEAD | wc -l)" != "0" ]; then
|
---|
41 | version="$version+"
|
---|
42 | fi
|
---|
43 |
|
---|
44 | echo "<!ENTITY day \"$day_digit\">" > version.ent
|
---|
45 | echo "<!ENTITY month \"$month_digit\">" >> version.ent
|
---|
46 | echo "<!ENTITY year \"$year\">" >> version.ent
|
---|
47 | echo "<!ENTITY copyrightdate \"2001-$year\">" >> version.ent
|
---|
48 | echo "<!ENTITY version \"$version\">" >> version.ent
|
---|
49 | echo "<!ENTITY releasedate \"$full_date\">" >> version.ent
|
---|
50 | echo "<!ENTITY pubdate \"$short_date\">" >> version.ent
|
---|
Note:
See
TracBrowser
for help on using the repository browser.