|
Harald Hoyer |
5f0dd7 |
From eb8a7a96351b6e1cfd9dc34f1e854333a8f4a4e0 Mon Sep 17 00:00:00 2001
|
|
Harald Hoyer |
5f0dd7 |
From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?=
|
|
Harald Hoyer |
5f0dd7 |
<congdanhqx@gmail.com>
|
|
Harald Hoyer |
5f0dd7 |
Date: Fri, 6 Mar 2020 08:46:36 +0700
|
|
Harald Hoyer |
5f0dd7 |
Subject: [PATCH] Makefile: merge main-version and git-version earlier
|
|
Harald Hoyer |
5f0dd7 |
|
|
Harald Hoyer |
5f0dd7 |
With GNU Make 4.3 on both ArchLinux, and VoidLinux,
|
|
Harald Hoyer |
5f0dd7 |
GITVERION is always empty because of bad substitution.
|
|
Harald Hoyer |
5f0dd7 |
Change '\#' to simply '#' can fix it,
|
|
Harald Hoyer |
5f0dd7 |
but we don't need that complation.
|
|
Harald Hoyer |
5f0dd7 |
|
|
Harald Hoyer |
5f0dd7 |
We can merge DRACUT_MAIN_VERSION and GITVERSION into DRACUT_FULL_VERSION.
|
|
Harald Hoyer |
5f0dd7 |
Because, GITVERSION will be attached back to DRACUT_MAIN_VERSION in all
|
|
Harald Hoyer |
5f0dd7 |
situation.
|
|
Harald Hoyer |
5f0dd7 |
|
|
Harald Hoyer |
5f0dd7 |
While we're at it, detect if we're in git worktree by:
|
|
Harald Hoyer |
5f0dd7 |
limiting GIT_CEILING_DIRECTORIES to parent directory of
|
|
Harald Hoyer |
5f0dd7 |
dracut's top level directory; instead of checking for .git directory,
|
|
Harald Hoyer |
5f0dd7 |
in order to support git-worktree, in such case, .git will be a file, see
|
|
Harald Hoyer |
5f0dd7 |
gitrepository-layout(5)
|
|
Harald Hoyer |
5f0dd7 |
---
|
|
Harald Hoyer |
5f0dd7 |
Makefile | 13 +++++++------
|
|
Harald Hoyer |
5f0dd7 |
1 file changed, 7 insertions(+), 6 deletions(-)
|
|
Harald Hoyer |
5f0dd7 |
|
|
Harald Hoyer |
5f0dd7 |
diff --git a/Makefile b/Makefile
|
|
Harald Hoyer |
5f0dd7 |
index 22b584f1..c69e2dfc 100644
|
|
Harald Hoyer |
5f0dd7 |
--- a/Makefile
|
|
Harald Hoyer |
5f0dd7 |
+++ b/Makefile
|
|
Harald Hoyer |
5f0dd7 |
@@ -1,8 +1,9 @@
|
|
Harald Hoyer |
5f0dd7 |
-include dracut-version.sh
|
|
Harald Hoyer |
5f0dd7 |
|
|
Harald Hoyer |
5f0dd7 |
-DRACUT_MAIN_VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || :)
|
|
Harald Hoyer |
5f0dd7 |
+DRACUT_MAIN_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CWD)/.. git describe --abbrev=0 --tags --always 2>/dev/null || :)
|
|
Harald Hoyer |
5f0dd7 |
DRACUT_MAIN_VERSION ?= $(DRACUT_VERSION)
|
|
Harald Hoyer |
5f0dd7 |
-GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags --always 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
|
|
Harald Hoyer |
5f0dd7 |
+DRACUT_FULL_VERSION ?= $(shell env GIT_CEILING_DIRECTORIES=$(CWD)/.. git describe --tags --always 2>/dev/null || :)
|
|
Harald Hoyer |
5f0dd7 |
+DRACUT_FULL_VERSION ?= $(DRACUT_VERSION)
|
|
Harald Hoyer |
5f0dd7 |
|
|
Harald Hoyer |
5f0dd7 |
-include Makefile.inc
|
|
Harald Hoyer |
5f0dd7 |
|
|
Harald Hoyer |
5f0dd7 |
@@ -92,14 +93,14 @@ endif
|
|
Harald Hoyer |
5f0dd7 |
|
|
Harald Hoyer |
5f0dd7 |
%.xml: %.asc
|
|
Harald Hoyer |
5f0dd7 |
@rm -f -- "$@"
|
|
Harald Hoyer |
5f0dd7 |
- asciidoc -a "version=$(DRACUT_MAIN_VERSION)$(GITVERSION)" -d manpage -b docbook -o "$@" $<
|
|
Harald Hoyer |
5f0dd7 |
+ asciidoc -a "version=$(DRACUT_FULL_VERSION)" -d manpage -b docbook -o "$@" $<
|
|
Harald Hoyer |
5f0dd7 |
|
|
Harald Hoyer |
5f0dd7 |
dracut.8: dracut.usage.asc dracut.8.asc
|
|
Harald Hoyer |
5f0dd7 |
|
|
Harald Hoyer |
5f0dd7 |
dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
|
|
Harald Hoyer |
5f0dd7 |
@rm -f -- dracut.xml
|
|
Harald Hoyer |
5f0dd7 |
asciidoc -a "mainversion=$(DRACUT_MAIN_VERSION)" \
|
|
Harald Hoyer |
5f0dd7 |
- -a "version=$(DRACUT_MAIN_VERSION)$(GITVERSION)" \
|
|
Harald Hoyer |
5f0dd7 |
+ -a "version=$(DRACUT_FULL_VERSION)" \
|
|
Harald Hoyer |
5f0dd7 |
-a numbered \
|
|
Harald Hoyer |
5f0dd7 |
-d book -b docbook -o dracut.xml dracut.asc
|
|
Harald Hoyer |
5f0dd7 |
@rm -f -- dracut.html
|
|
Harald Hoyer |
5f0dd7 |
@@ -112,7 +113,7 @@ dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
|
|
Harald Hoyer |
5f0dd7 |
dracut.pc: Makefile.inc Makefile
|
|
Harald Hoyer |
5f0dd7 |
@echo "Name: dracut" > dracut.pc
|
|
Harald Hoyer |
5f0dd7 |
@echo "Description: dracut" >> dracut.pc
|
|
Harald Hoyer |
5f0dd7 |
- @echo "Version: $(DRACUT_MAIN_VERSION)$(GITVERSION)" >> dracut.pc
|
|
Harald Hoyer |
5f0dd7 |
+ @echo "Version: $(DRACUT_FULL_VERSION)" >> dracut.pc
|
|
Harald Hoyer |
5f0dd7 |
@echo "dracutdir=$(pkglibdir)" >> dracut.pc
|
|
Harald Hoyer |
5f0dd7 |
@echo "dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.pc
|
|
Harald Hoyer |
5f0dd7 |
@echo "dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.pc
|
|
Harald Hoyer |
5f0dd7 |
@@ -182,7 +183,7 @@ endif
|
|
Harald Hoyer |
5f0dd7 |
|
|
Harald Hoyer |
5f0dd7 |
dracut-version.sh:
|
|
Harald Hoyer |
5f0dd7 |
@rm -f dracut-version.sh
|
|
Harald Hoyer |
5f0dd7 |
- @echo "DRACUT_VERSION=$(DRACUT_MAIN_VERSION)$(GITVERSION)" > dracut-version.sh
|
|
Harald Hoyer |
5f0dd7 |
+ @echo "DRACUT_VERSION=$(DRACUT_FULL_VERSION)" > dracut-version.sh
|
|
Harald Hoyer |
5f0dd7 |
|
|
Harald Hoyer |
5f0dd7 |
clean:
|
|
Harald Hoyer |
5f0dd7 |
$(RM) *~
|
|
Harald Hoyer |
5f0dd7 |
|