mirror of
https://github.com/ipmitool/ipmitool.git
synced 2025-05-10 10:37:22 +00:00
The previously introduced mechanism of generating a git revision was only using the abbreviated hash. That approach doesn't give a clue whether version 1.8.18.2c99bf6 is newer or older than 1.8.18.7f8d374. The project uses tags, so `git describe` can be employed to produce an incremental revision number since the last tag. Version 1.8.18.13 is much more understandable and comparable. Howerver that doesn't answer the question "what codebase was used". To address that, the abbreviated hash should also be preserved. Hence, this commit introduces a new versioning scheme like `1.8.18.13.gee01aa5`. For git snapshots when git program is absent the version will be like `1.8.18.0.gsnapshot`. For cases when .git directory is missing (Release compilation?) the suffix part will be omitted completely yielding a version like `1.8.18`. The suffix generation has been moved to the added csv-revision script. The script is absolutely POSIX-ly correct and doesn't require XSI or any other POSIX extensions.
11 lines
190 B
Bash
Executable File
11 lines
190 B
Bash
Executable File
#!/bin/sh
|
|
|
|
git describe --first-parent --tags 2>/dev/null | (
|
|
IFS=- read tag rev hash
|
|
if [ $? ] && [ -n "$rev" ]; then
|
|
echo .$rev.$hash
|
|
elif [ -d .git ]; then
|
|
echo .0.gsnapshot
|
|
fi
|
|
)
|