builddata: generate more build information
authorFerry Huberts <ferry.huberts@pelagic.nl>
Sat, 5 Mar 2016 21:03:12 +0000 (22:03 +0100)
committerFerry Huberts <ferry.huberts@pelagic.nl>
Sun, 6 Mar 2016 09:54:20 +0000 (10:54 +0100)
Signed-off-by: Ferry Huberts <ferry.huberts@pelagic.nl>
make/hash_source.sh
src/builddata.h

index 5c41c57..1bbefd1 100755 (executable)
@@ -23,15 +23,28 @@ gitSha="$(git log -1 --pretty=%h 2> /dev/null)"
 if [ -z "$gitSha" ]; then
   gitSha="0000000"
 fi
+
+gitShaFull="$(git rev-list -1 HEAD 2> /dev/null)"
+if [ -z "$gitShaFull" ]; then
+  gitShaFull="0000000000000000000000000000000000000000"
+fi
+
+gitDescriptor="$(git describe --dirty --always 2> /dev/null)"
+
 sourceHash="$(cat $(find . -name *.[ch] | grep -v -E '[/\\]?builddata.c$') | "$md5Command" | awk '{ print $1; }')"
 hostName="$(hostname)"
 buildDate="$(date +"%Y-%m-%d %H:%M:%S")"
 
 tmpBuildDataTxt="$(mktemp -t olsrd.hash_source.XXXXXXXXXX)"
 cat > "$tmpBuildDataTxt" << EOF
-const char olsrd_version[] = "olsr.org - $version-git_$gitSha-hash_$sourceHash";
-const char build_host[]    = "$hostName";
-const char build_date[]    = "$buildDate";
+const char olsrd_version[]   = "olsr.org - $version-git_$gitSha-hash_$sourceHash";
+
+const char build_date[]      = "$buildDate";
+const char build_host[]      = "$hostName";
+const char git_descriptor[]  = "$gitDescriptor";
+const char git_sha[]         = "$gitShaFull";
+const char release_version[] = "$version";
+const char source_hash[]     = "$sourceHash";
 EOF
 
 
index 3ae62d6..cac24f4 100644 (file)
 #define _OLSR_BUILDDATA_H
 
 extern const char olsrd_version[];
+
 extern const char build_date[];
 extern const char build_host[];
+extern const char git_descriptor[];
+extern const char git_sha[];
+extern const char release_version[];
+extern const char source_hash[];
 
 #endif /* _OLSR_BUILDDATA_H */