summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Meyer <kyle@kyleam.com>2021-02-05 01:20:09 -0500
committerKyle Meyer <kyle@kyleam.com>2021-02-05 01:20:09 -0500
commit61336f80dc94a442842289d2f33f91190383e9b2 (patch)
tree2244a438f46e600f4bdbbf61f843313f381e3e1e
parent862048d4cb3bf93fb74832ed490c41faebb7d5b5 (diff)
downloadorg-mode-61336f80dc94a442842289d2f33f91190383e9b2.tar.gz
mk/targets.mk: Add version fallback for tag-less repos
* mk/targets.mk (ORGVERSION, GITVERSION): Get version from lisp/org.el header if it can't be retrieved from git-describe. As of elpa.git's ee03829f90 (Finalize the new master branch, 2020-12-14), org-release and org-git-version are empty strings in https://elpa.gnu.org/packages/org-*.tar files. This is because the new setup executes `make autoloads info' in an elpa.git worktree with an Org branch checked out, but elpa.git of course doesn't have Org's release tags. Maintaining the org.el version header has been a point of contention in the past [1], but the header has been there for a while now. Use it to avoid the above elpa.git issue. In the case of the master branch, the org-release value generated in a tag-less repo will have a different version than the one from a regular repo because org.el's version header has a "-dev" suffix, but that's still better than an empty version. [1] For example: https://orgmode.org/list/87zj1uhix6.fsf@gmx.us/ Reported-by: Pierre Langlois <pierre.langlois@gmx.com> Ref: https://orgmode.org/list/87y2hi9qev.fsf@gmx.com
-rw-r--r--mk/targets.mk10
1 files changed, 9 insertions, 1 deletions
diff --git a/mk/targets.mk b/mk/targets.mk
index 15cbdfa..fc5bed1 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -11,8 +11,16 @@ INSTSUB = $(SUBDIRS:%=install-%)
ORG_MAKE_DOC ?= info html pdf
ifneq ($(wildcard .git),)
- GITVERSION ?= $(shell git describe --match release\* --abbrev=6 HEAD)
ORGVERSION ?= $(subst release_,,$(shell git describe --match release\* --abbrev=0 HEAD))
+ ifeq ($(ORGVERSION),)
+ # In elpa.git, there are no tags available. Fall back to using
+ # the org.el header.
+ ORGVERSION := $(shell $(BATCH) --eval "(require 'lisp-mnt)" \
+ --visit lisp/org.el --eval '(princ (lm-header "version"))')
+ GITVERSION ?= $(ORGVERSION)-g$(shell git rev-parse --short=6 HEAD)
+ else
+ GITVERSION ?= $(shell git describe --match release\* --abbrev=6 HEAD)
+ endif
GITSTATUS ?= $(shell git status -uno --porcelain)
else
-include mk/version.mk