u-boot-brain/tools/setlocalversion
Wolfgang Denk 881a87ecba Add GIT version information (commid ID) to untagged U-Boot versions
As done in the linux kernel, the U-Boot version (U_BOOT_VERSION)
of all unreleased (untagged) U-Boot images will be automatically
extended upon compiletime with a part of the GIT commit ID and
possibly with "dirty" if uncommited changes are detected.

Here an example for the resulting version:
"U-Boot 1.1.4-g3457ac18-dirty"

The version is now maintained in the toplevel Makefile and the
version headers are autogenerated.

Patch by Stefan Roese, 9 Feb 2006
2006-02-21 17:33:04 +01:00

23 lines
486 B
Bash
Executable File

#!/bin/sh
# Print additional version information for non-release trees.
usage() {
echo "Usage: $0 [srctree]" >&2
exit 1
}
cd "${1:-.}" || usage
# Check for git and a git repo.
if head=`git rev-parse --verify HEAD 2>/dev/null`; then
# Do we have an untagged version?
if [ "`git name-rev --tags HEAD`" = "HEAD undefined" ]; then
printf '%s%s' -g `echo "$head" | cut -c1-8`
fi
# Are there uncommitted changes?
if git diff-files | read dummy; then
printf '%s' -dirty
fi
fi