emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@posteo.net>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Tom Gillespie <tgbugs@gmail.com>,
	"emacs-orgmode@gnu.org" <emacs-orgmode@gnu.org>,
	Bastien <bzg@gnu.org>
Subject: Re: org-assert-version considered harmful
Date: Wed, 16 Aug 2023 12:41:08 +0000	[thread overview]
Message-ID: <87r0o3p3bv.fsf@localhost> (raw)
In-Reply-To: <jwvzg2rjht3.fsf-monnier+emacs@gnu.org>

[-- Attachment #1: Type: text/plain, Size: 1233 bytes --]

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> After trying several more approaches,
>
> [ Side note: did you keep notes about the various approaches you tried
>   and their respective downsides?  E.g. I'm curious what were the
>   problems linked to my proposal of using a `require-with-check` like
>   the one below my sig.  ]

My attempt to use shadowcheck idea you proposed failed with some very
strange errors and I gave up.
See https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62762#311

Although, part of the problem was
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=65286 which does not seem
to be reproducible by others.

>> I now came up with yet another idea.  Instead of fiddling with load
>> internals, compilation, or load-path, what about making sure that Org
>> libraries include version info directly?
>
> That should work.  It implies a fair bit more churn in the code, tho,
> but I guess you plan to automate it via some scripts?

Yeah. It will require search-and-replace across Org between releases.
But, at least, it is the most reliable way I can see without falling
into subtle details of Emacs load system.

I did some automation in a form of =make test= barking when `provide' do
not match Org version:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-testing-lisp-test-org-version.el-New-test-library.patch --]
[-- Type: text/x-patch, Size: 2759 bytes --]

From 9caf9ca7207ecebed3499432828833187436940d Mon Sep 17 00:00:00 2001
Message-ID: <9caf9ca7207ecebed3499432828833187436940d.1692189593.git.yantar92@posteo.net>
From: Ihor Radchenko <yantar92@posteo.net>
Date: Wed, 16 Aug 2023 13:59:49 +0300
Subject: [PATCH] * testing/lisp/test-org-version.el: New test library

(test-org-version/provide): Test for all the versioned features to be
provided according to current Org version.
---
 testing/lisp/test-org-version.el | 54 ++++++++++++++++++++++++++++++++
 1 file changed, 54 insertions(+)
 create mode 100644 testing/lisp/test-org-version.el

diff --git a/testing/lisp/test-org-version.el b/testing/lisp/test-org-version.el
new file mode 100644
index 000000000..3c12c8d46
--- /dev/null
+++ b/testing/lisp/test-org-version.el
@@ -0,0 +1,54 @@
+;;; test-org-version.el --- Test Org version consistency  -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2023  Ihor Radchenko
+
+;; Author: Ihor Radchenko <yantar92@posteo.net>
+;; Keywords: internal
+
+;; This program is free software; you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; This program is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+;; This file implements internal checks for Org versioning.
+
+;;; Code:
+
+(require 'org-version)
+
+(ert-deftest test-org-version/provide ()
+  "Test versioned `provide' calls in Org libraries."
+  (let* (org-library)
+    (dolist (org-library-file
+             (directory-files
+              (expand-file-name
+	       (concat org-test-dir "../lisp"))
+              t "\\.el$"))
+      (setq org-library
+            (file-name-nondirectory
+             (file-name-sans-extension org-library-file)))
+      (unless (member org-library '("org-loaddefs" "org-version"))
+        (with-temp-buffer
+          (insert-file-contents org-library-file)
+          (goto-char (point-max))
+          (should (re-search-backward
+                   (rx-to-string
+                    `(seq
+                      bol (0+ space)
+                      "(provide" (0+ space)
+                      "'" ,(concat org-library "-" (org-release))
+                      (0+ space) ")"))
+                   nil t)))))))
+
+(provide 'test-org-version)
+;;; test-org-version.el ends here
-- 
2.41.0


[-- Attachment #3: Type: text/plain, Size: 224 bytes --]


-- 
Ihor Radchenko // yantar92,
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	other threads:[~2023-08-16 12:40 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-09-12 18:27 org-assert-version considered harmful Stefan Monnier
2022-09-13  1:52 ` Ihor Radchenko
2022-09-13  2:16   ` Timothy
2022-09-13  2:53   ` Stefan Monnier
2022-09-13  3:18     ` Ihor Radchenko
2022-09-13 13:26       ` Stefan Monnier
2022-09-13 14:42         ` Ihor Radchenko
2022-09-13 16:13           ` Stefan Monnier
2022-09-14  2:46             ` Ihor Radchenko
2022-09-14 14:08               ` Stefan Monnier
2022-09-14 19:13                 ` Tim Cross
2022-09-25  2:39               ` Bastien
2022-09-25  3:15                 ` Ihor Radchenko
2022-09-25  4:27                   ` Timothy
2022-09-25  9:37                   ` Bastien
2022-09-25  9:55                     ` Ihor Radchenko
2022-09-25 10:24                       ` Bastien
2022-09-25 11:10                         ` Ihor Radchenko
2022-09-25 11:26                           ` Bastien
2022-09-25 12:16                             ` Ihor Radchenko
2022-09-25 13:18                               ` Bastien
2022-09-26 11:15                                 ` Ihor Radchenko
2022-09-25 12:20                             ` Ihor Radchenko
2022-09-25 13:16                               ` Bastien
2022-09-26 11:29                 ` Ihor Radchenko
2022-09-27 21:35                   ` Bastien
2022-10-31 14:11                     ` Cook, Malcolm
2022-10-31 20:16                       ` [External] : " Daniel Ortmann
2022-10-31 20:40                         ` Cook, Malcolm
2022-10-31 23:16                       ` Tim Cross
2022-11-01  6:09                       ` Ihor Radchenko
2022-11-02 20:42                         ` Cook, Malcolm
2022-11-03  7:51                           ` Ihor Radchenko
2022-11-03 17:30                             ` Cook, Malcolm
2022-12-02  8:16                               ` Tom Gillespie
2022-12-02  6:45                                 ` Ihor Radchenko
2022-12-04  4:22                                   ` Tom Gillespie
2022-12-04  4:33                                     ` Stefan Monnier
2022-12-04 11:12                                       ` Ihor Radchenko
2023-08-16 11:08                                         ` Ihor Radchenko
2023-08-16 12:30                                           ` Stefan Monnier
2023-08-16 12:41                                             ` Ihor Radchenko [this message]
2023-08-16 13:41                                               ` Stefan Monnier
2023-08-18  9:37                                                 ` Ihor Radchenko
2023-08-18 13:19                                                   ` Stefan Monnier
2023-08-18 13:33                                                     ` Ihor Radchenko
2023-08-18 13:45                                                       ` Stefan Monnier
2023-08-18 14:26                                                         ` Ihor Radchenko
2023-08-18 14:29                                                           ` Ihor Radchenko
2023-08-17 16:43                                           ` Max Nikulin
2023-08-17 16:59                                             ` Ihor Radchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87r0o3p3bv.fsf@localhost \
    --to=yantar92@posteo.net \
    --cc=bzg@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    --cc=tgbugs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).