add $si command

This commit is contained in:
Martin Michelsen
2023-12-23 10:23:40 -08:00
parent cf7c4674d6
commit 3823fc94f1
12 changed files with 89 additions and 8 deletions
+19
View File
@@ -0,0 +1,19 @@
#!/bin/sh
GIT_REVISION_HASH=$(git rev-parse --short HEAD)
TIMESTAMP_SECS=$(date +%s)
if [ -z "$GIT_REVISION_HASH" ]; then
GIT_REVISION_HASH="????"
else
if ! git diff-index --quiet HEAD -- ; then
GIT_REVISION_HASH="$GIT_REVISION_HASH+"
fi
fi
cat > Revision.cc <<EOF
#include "Revision.hh"
const char* GIT_REVISION_HASH = "$GIT_REVISION_HASH";
const uint64_t BUILD_TIMESTAMP = static_cast<uint64_t>($TIMESTAMP_SECS) * 1000000;
EOF