aports/testing/openbao/build-do-not-assume-git-repo.patch
2024-07-14 21:50:46 +00:00

31 lines
1.2 KiB
Diff

Description: Project is not built in a relevant git directory, so do not try to
query information from it
Upstream: no
diff --git a/scripts/build.sh b/scripts/build.sh
index 1ef6a20..7aa977b 100755
--- a/scripts/build.sh
+++ b/scripts/build.sh
@@ -20,11 +20,8 @@ cd "$DIR"
# Set build tags
BUILD_TAGS="${BUILD_TAGS:-"openbao"}"
-# Get the git commit
-GIT_COMMIT="$(git rev-parse HEAD)"
-GIT_DIRTY="$(test -n "`git status --porcelain`" && echo "+CHANGES" || true)"
-
-BUILD_DATE="$(git show --no-show-signature -s --format=%cd --date=format:"%Y-%m-%dT%H:%M:%SZ" HEAD)"
+SOURCE_DATE_EPOCH="${SOURCE_DATE_EPOCH:-$(date +%s)}"
+BUILD_DATE="$(date --utc --date="@$SOURCE_DATE_EPOCH" "+%Y-%m-%dT%H:%M:%SZ")"
GOPATH=${GOPATH:-$(${GO_CMD} env GOPATH)}
case $(uname) in
@@ -43,7 +39,7 @@ mkdir -p bin/
echo "==> Building..."
${GO_CMD} build \
-gcflags "${GCFLAGS}" \
- -ldflags "${LD_FLAGS} -X github.com/openbao/openbao/version.GitCommit='${GIT_COMMIT}${GIT_DIRTY}' -X github.com/openbao/openbao/version.BuildDate=${BUILD_DATE}" \
+ -ldflags "${LD_FLAGS} -X github.com/openbao/openbao/version.BuildDate=${BUILD_DATE}" \
-o "bin/bao" \
-tags "${BUILD_TAGS}" \
.