Kyle Meyer <k...@kyleam.com> writes:

On 09/23/21 17:17:48 -0400, No Wayman wrote:

It looks like you've unintentionally added a ')' to the end of the
GITVERSION line.

Apologies. Must've been a stray.

Another approach would be to update org.el's version to contain
something that still signals "-dev" but won't trigger the "Invalid version syntax" (which, based on grepping the Emacs repo, is signaled by version-to-list). But given that in the current setup a clone with tags wouldn't use the header version, stripping -dev for consistency sounds
like the way to go.

I agree we should keep it simple and consistent.

Out of curiosity I ran this against the repo to see if the "Version" metadata had always followed its current convention:

git grep "Version:" $(git rev-list --all) -- lisp/org.el

Looks like the "-dev" suffix goes back to "9.4-dev" and before that we have "8.4-git" and "6.08-pre01". I'm not sure what Org's convention is here, but the patsubst could be adjusted to be more flexible if necessary.

I tried to be more concrete with the commit message.
See attached.

>From 164029cb66eed8d47d7eb69d449660964749195d Mon Sep 17 00:00:00 2001
From: Nicholas Vollmer <iarchivedmywholel...@gmail.com>
Date: Thu, 23 Sep 2021 17:13:34 -0400
Subject: [PATCH] mk/targets.mk: Fix ORGVERSION in tag-less repos

* mk/targets.mk (ORGVERSION, GITVERSION): trim "-dev" suffix from ORGVERSION.

61336f80 uses org.el's Version metadata to generate ORGVERSION when
the source repository has no tags.
This can result in an org-version of "Major.Minor-dev".
The "-dev" suffix is not recognized by `version-to-list' as a valid
version syntax because it is not part of `version-regexp-alist'.
---
 mk/targets.mk | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mk/targets.mk b/mk/targets.mk
index 693e3781f..ee6f3f344 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -15,8 +15,8 @@ ifneq ($(wildcard .git),)
   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"))')
+    ORGVERSION := $(patsubst %-dev,%,$(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)
-- 
2.33.0

Reply via email to