emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: org-assert-version considered harmful


From: Ihor Radchenko
Subject: Re: org-assert-version considered harmful
Date: Sun, 25 Sep 2022 17:55:38 +0800

Bastien <bzg@gnu.org> writes:

>> Should we use the next planned release version number on main branch as
>> a convention?
>
> I'd rather use the value set in the ";; Version:" header.
>
> It is "9.5.5" in the bugfix branch and "9.6-dev" on the main branch.

Makes sense.

> I'm not even sure we should keep `org-git-version' at all: if we need
> to distinguish between pre-release states, it seems easy enough to set
> the header as 9.6rc1, 9.6rc2, etc.
>
> WDYT?

org-git-version is very useful when people report bugs.
M-x org-submit-bug-report supplies org-git-version output for bug
subject. Thus, we can easily check which git commit their build
corresponds to.

> PS: I have a vague memory that Stefan suggested to look at how things
> are done on bbdb.el:
>
> https://git.savannah.gnu.org/cgit/emacs/elpa.git/tree/lisp/bbdb.el?h=externals/bbdb#n4750
>
> If we can remove the complex Make machinery we have right now, I'd be
> very happy.  One reason for this machinery was to avoid merge conflict
> (thanks to getting rid of the Version: header), but we do have these
> conflicts (now that the header is back) and they are easy to solve.

I am not very familiar with all the code paths our Makefile and
autoloads take from setting ORG-VERSION to generating the appropriate
Elisp constants.

However, I do note that mk/targets.mk contains the following:

ifneq ($(wildcard .git),)
  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 := $(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)
  endif
  GITSTATUS  ?= $(shell git status -uno --porcelain)
else
 -include mk/version.mk
  GITVERSION ?= N/A
  ORGVERSION ?= N/A
endif

Note that we already have a way to parse Org version from lisp/org.el,
similar to what the commit you referenced does.
It is just that this code path is not used by default.

We can remove the current default and simply use

    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)

all the time.

I do not know if more involved fix is required (because I am not
familiar enough with the relevant code).

-- 
Ihor Radchenko,
Org mode contributor,
Learn more about Org mode at https://orgmode.org/.
Support Org development at https://liberapay.com/org-mode,
or support my work at https://liberapay.com/yantar92



reply via email to

[Prev in Thread] Current Thread [Next in Thread]