dracut/backport-fix-Makefile-use-of-potentially-unset-variable.patch
hongjinghao 9d9fb131b3 backport patchs from upstream
(cherry picked from commit 74c55dc789a3aacb444c42ab40cd308bd213f5e3)
2024-02-22 16:48:54 +08:00

38 lines
1.4 KiB
Diff

From 1354d6339a2e603fe0787bc028f9e7e1d49cbf82 Mon Sep 17 00:00:00 2001
From: Conrad Hoffmann <ch@bitfehler.net>
Date: Thu, 2 Jun 2022 10:31:50 +0200
Subject: [PATCH] fix(Makefile): use of potentially unset variable
`CWD` is not a Make variable. This may have worked accidentally for some
people if their shell happend to provide `CWD` and Make picked it up.
As is, this tends to pick up git versions of unrelated parent
directories, e.g. when packaging for distributions.
Reference:https://github.com/dracutdevs/dracut/commit/1354d6339a2e603fe0787bc028f9e7e1d49cbf82
Conflict:NA
---
Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Makefile b/Makefile
index ab47fed8..97e189b4 100644
--- a/Makefile
+++ b/Makefile
@@ -1,10 +1,10 @@
-include dracut-version.sh
-DRACUT_MAIN_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CWD)/.. git describe --abbrev=0 --tags --always 2>/dev/null || :)
+DRACUT_MAIN_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CURDIR)/.. git describe --abbrev=0 --tags --always 2>/dev/null || :)
ifeq ($(DRACUT_MAIN_VERSION),)
DRACUT_MAIN_VERSION = $(DRACUT_VERSION)
endif
-DRACUT_FULL_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CWD)/.. git describe --tags --always 2>/dev/null || :)
+DRACUT_FULL_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CURDIR)/.. git describe --tags --always 2>/dev/null || :)
ifeq ($(DRACUT_FULL_VERSION),)
DRACUT_FULL_VERSION = $(DRACUT_VERSION)
endif
--
2.23.0