Created
July 18, 2022 12:06
-
-
Save slp/4800299052732b513d1ee19864dbc325 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 05446d0ccd5575c5286579780abc75cff27a9e8b Mon Sep 17 00:00:00 2001 | |
From: Sergio Lopez <[email protected]> | |
Date: Mon, 25 Jan 2021 14:55:06 +0100 | |
Subject: [PATCH 4/4] Makefile: allow building without .git | |
Use the same strategy as podman for obtaining the commit id, so we | |
don't fail if this is a release without the ".git" directory. | |
Signed-off-by: Sergio Lopez <[email protected]> | |
(cherry picked from commit 8d9e9d6f73468b6e0b876342b54589281459180a) | |
Signed-off-by: Sergio Lopez <[email protected]> | |
--- | |
Makefile | 3 ++- | |
1 file changed, 2 insertions(+), 1 deletion(-) | |
diff --git a/Makefile b/Makefile | |
index 95ce322b..e6fd31da 100644 | |
--- a/Makefile | |
+++ b/Makefile | |
@@ -26,7 +26,8 @@ export GO_TEST=$(GO) test | |
endif | |
RACEFLAGS := $(shell $(GO_TEST) -race ./pkg/dummy > /dev/null 2>&1 && echo -race) | |
-GIT_COMMIT ?= $(if $(shell git rev-parse --short HEAD),$(shell git rev-parse --short HEAD),$(error "git failed")) | |
+COMMIT_NO ?= $(shell git rev-parse HEAD 2> /dev/null || true) | |
+GIT_COMMIT ?= $(if $(shell git status --porcelain --untracked-files=no),${COMMIT_NO}-dirty,${COMMIT_NO}) | |
SOURCE_DATE_EPOCH ?= $(if $(shell date +%s),$(shell date +%s),$(error "date failed")) | |
STATIC_STORAGETAGS = "containers_image_openpgp exclude_graphdriver_devicemapper $(STORAGE_TAGS)" | |
-- | |
2.35.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment