Subject: bug#46841: [PATCH] Make package downloading in inversion.el obsolete

From: Stefan Kangas <[email-masked]>
Date: Wed, 3 Mar 2021 13:02:00 -0600

tags 46841 + fixed
close 46841 28.1
thanks

Eric Ludlam <[email-masked]> writes:

> I used to have a lot of issues with different versions of things when
> CEDET was
> separate from Emacs and new versions of CEDET could overlay on top of an
> Emacs
> with an earlier version of CEDET included.  Inversion was a way of getting
> things tied together, and upgrading save files to new versions, and
> things like that.
>
> None of those old issues exist anymore since external CEDET is too hard
> to merge back
> into Emacs and I now post patches direct to Emacs instead, so it makes
> sense to clean this up.

Thanks for giving the background.  Since you agree, I think we should
make the entire library obsolete.

So I've installed the attached patch on master and I'm closing this bug.
From 356636c6a1ebba3e95d0e6609ae0401992008ccf Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Wed, 3 Mar 2021 19:54:37 +0100
Subject: [PATCH] Make inversion.el obsolete (Bug#46841)

* lisp/cedet/inversion.el:
* test/lisp/cedet/inversion-tests.el: Move from here...
* lisp/obsolete/inversion.el:
* test/lisp/obsolete/inversion-tests.el: ...to here.

* lisp/cedet/cedet.el (cedet-version): Make obsolete.
* lisp/cedet/cedet-cscope.el (cedet-cscope-version-check):
* lisp/cedet/cedet-global.el (cedet-gnu-global-version-check):
* lisp/cedet/cedet-idutils.el (cedet-idutils-version-check):
* lisp/cedet/ede/make.el (ede-make-check-version): Use 'version<'
instead of 'inversion-check-version'.
* lisp/cedet/semantic/db-file.el (semanticdb-load-database): Don't
use 'inversion-test'.
* lisp/cedet/semantic/ede-grammar.el
(ede-proj-makefile-insert-variables): Don't add inversion to
loadpath.
* lisp/speedbar.el: Remove stale comment.
---
 etc/NEWS                                      |  5 +++-
 lisp/cedet/cedet-cscope.el                    |  5 +---
 lisp/cedet/cedet-global.el                    |  5 +---
 lisp/cedet/cedet-idutils.el                   |  5 +---
 lisp/cedet/cedet.el                           |  1 +
 lisp/cedet/ede/make.el                        | 15 ++++------
 lisp/cedet/semantic.el                        |  1 +
 lisp/cedet/semantic/db-file.el                | 29 +++++--------------
 lisp/cedet/semantic/ede-grammar.el            |  6 ++--
 lisp/{cedet => obsolete}/inversion.el         | 26 +----------------
 lisp/speedbar.el                              | 19 ------------
 .../{cedet => obsolete}/inversion-tests.el    |  0
 12 files changed, 25 insertions(+), 92 deletions(-)
 rename lisp/{cedet => obsolete}/inversion.el (95%)
 rename test/lisp/{cedet => obsolete}/inversion-tests.el (100%)

diff --git a/etc/NEWS b/etc/NEWS
index 73f136cfa7..6babbbf5a7 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2259,7 +2259,10 @@ This is no longer supported, and setting this variable has no effect.
 Use macro 'with-current-buffer-window' with action alist entry 'body-function'.
 
 ---
-** The metamail.el library is now marked obsolete.
+** The inversion.el library is now obsolete.
+
+---
+** The metamail.el library is now obsolete.
 
 ---
 ** Some obsolete variable and function aliases in dbus.el have been removed.
diff --git a/lisp/cedet/cedet-cscope.el b/lisp/cedet/cedet-cscope.el
index 75a69db0a8..4d4a9f78d5 100644
--- a/lisp/cedet/cedet-cscope.el
+++ b/lisp/cedet/cedet-cscope.el
@@ -26,8 +26,6 @@
 
 ;;; Code:
 
-(declare-function inversion-check-version "inversion")
-
 (defvar cedet-cscope-min-version "15.7"
   "Minimum version of CScope required.")
 
@@ -139,7 +137,6 @@ cedet-cscope-version-check
 then instead of throwing an error if CScope isn't available,
 return nil."
   (interactive)
-  (require 'inversion)
   (let ((b (condition-case nil
 	       (cedet-cscope-call (list "-V"))
 	     (error nil)))
@@ -153,7 +150,7 @@ cedet-cscope-version-check
 	(goto-char (point-min))
 	(re-search-forward "cscope: version \\([0-9.]+\\)" nil t)
 	(setq rev (match-string 1))
-	(if (inversion-check-version rev nil cedet-cscope-min-version)
+        (if (version< rev cedet-cscope-min-version)
 	    (if noerror
 		nil
 	      (error "Version of CScope is %s.  Need at least %s"
diff --git a/lisp/cedet/cedet-global.el b/lisp/cedet/cedet-global.el
index 5878ec1f48..77b4474439 100644
--- a/lisp/cedet/cedet-global.el
+++ b/lisp/cedet/cedet-global.el
@@ -24,8 +24,6 @@
 ;;
 ;; Basic support for calling GNU Global, and testing version numbers.
 
-(declare-function inversion-check-version "inversion")
-
 (defvar cedet-global-min-version "5.0"
   "Minimum version of GNU Global required.")
 
@@ -143,7 +141,6 @@ cedet-gnu-global-version-check
 then instead of throwing an error if Global isn't available,
 return nil."
   (interactive)
-  (require 'inversion)
   (let ((b (condition-case nil
 	       (cedet-gnu-global-call (list "--version"))
 	     (error nil)))
@@ -157,7 +154,7 @@ cedet-gnu-global-version-check
 	(goto-char (point-min))
 	(re-search-forward "(?GNU GLOBAL)? \\([0-9.]+\\)" nil t)
 	(setq rev (match-string 1))
-	(if (inversion-check-version rev nil cedet-global-min-version)
+        (if (version< rev cedet-global-min-version)
 	    (if noerror
 		nil
 	      (error "Version of GNU Global is %s.  Need at least %s"
diff --git a/lisp/cedet/cedet-idutils.el b/lisp/cedet/cedet-idutils.el
index fc5e05af88..3e3d6a5e94 100644
--- a/lisp/cedet/cedet-idutils.el
+++ b/lisp/cedet/cedet-idutils.el
@@ -29,8 +29,6 @@
 
 ;;; Code:
 
-(declare-function inversion-check-version "inversion")
-
 (defvar cedet-idutils-min-version "4.0"
   "Minimum version of ID Utils required.")
 
@@ -167,7 +165,6 @@ cedet-idutils-version-check
 then instead of throwing an error if Global isn't available,
 return nil."
   (interactive)
-  (require 'inversion)
   (let ((b (condition-case nil
 	       (cedet-idutils-fnid-call (list "--version"))
 	     (error nil)))
@@ -182,7 +179,7 @@ cedet-idutils-version-check
 	(if (re-search-forward "fnid - \\([0-9.]+\\)" nil t)
 	    (setq rev (match-string 1))
 	  (setq rev "0"))
-	(if (inversion-check-version rev nil cedet-idutils-min-version)
+        (if (version< rev cedet-idutils-min-version)
 	    (if noerror
 		nil
 	      (error "Version of ID Utils is %s.  Need at least %s"
diff --git a/lisp/cedet/cedet.el b/lisp/cedet/cedet.el
index caaec473a2..5d98a1939d 100644
--- a/lisp/cedet/cedet.el
+++ b/lisp/cedet/cedet.el
@@ -85,6 +85,7 @@ cedet-version
 LOADED VERSION is the version of PACKAGE currently loaded in Emacs
 memory and (presumably) running in this Emacs instance.  Value is X
 if the package has not been loaded."
+  (declare (obsolete emacs-version "28.1"))
   (interactive)
   (require 'inversion)
   (with-output-to-temp-buffer "*CEDET*"
diff --git a/lisp/cedet/ede/make.el b/lisp/cedet/ede/make.el
index 4f86558c62..d9811ce52f 100644
--- a/lisp/cedet/ede/make.el
+++ b/lisp/cedet/ede/make.el
@@ -30,8 +30,6 @@
 
 ;;; Code:
 
-(declare-function inversion-check-version "inversion")
-
 (defsubst ede--find-executable (exec)
   "Return an expanded file name for a program EXEC on the exec path."
   (declare (obsolete locate-file "28.1"))
@@ -60,8 +58,7 @@ ede-make-check-version
   (let ((b (get-buffer-create "*EDE Make Version*"))
 	(cd default-directory)
 	(rev nil)
-	(ans nil)
-	)
+        (ans nil))
     (with-current-buffer b
       ;; Setup, and execute make.
       (setq default-directory cd)
@@ -70,18 +67,18 @@ ede-make-check-version
 		    "--version")
       ;; Check the buffer for the string
       (goto-char (point-min))
-      (when (looking-at "GNU Make\\(?: version\\)? \\([0-9][^,]+\\),")
+      (when (looking-at "GNU Make\\(?: version\\)? \\([0-9][^,[:space:]]+\\),?")
 	(setq rev (match-string 1))
-	(require 'inversion)
-	(setq ans (not (inversion-check-version rev nil ede-make-min-version))))
+        (setq ans (not (version< rev ede-make-min-version))))
 
       ;; Answer reporting.
       (when (and (called-interactively-p 'interactive) ans)
 	(message "GNU Make version %s.  Good enough for CEDET." rev))
 
       (when (and (not noerror) (not ans))
-	(error "EDE requires GNU Make version %s or later.  Configure `ede-make-command' to fix"
-	       ede-make-min-version))
+        (error "EDE requires GNU Make version %s or later (found %s).  Configure `ede-make-command' to fix"
+               ede-make-min-version
+               rev))
       ans)))
 
 (provide 'ede/make)
diff --git a/lisp/cedet/semantic.el b/lisp/cedet/semantic.el
index 44bd4b0cd8..797ff753a6 100644
--- a/lisp/cedet/semantic.el
+++ b/lisp/cedet/semantic.el
@@ -57,6 +57,7 @@ semantic-require-version
 It is assumed that if the current version is newer than that specified,
 everything passes.  Exceptions occur when known incompatibilities are
 introduced."
+  (declare (obsolete emacs-version "28.1"))
   (require 'inversion)
   (inversion-test 'semantic
 		  (concat major "." minor
diff --git a/lisp/cedet/semantic/db-file.el b/lisp/cedet/semantic/db-file.el
index 59e9db9cc0..d99b94f49e 100644
--- a/lisp/cedet/semantic/db-file.el
+++ b/lisp/cedet/semantic/db-file.el
@@ -154,8 +154,6 @@ semanticdb-create-database
 
 ;;; File IO
 
-(declare-function inversion-test "inversion")
-
 (defun semanticdb-load-database (filename)
   "Load the database FILENAME."
   (condition-case foo
@@ -163,32 +161,19 @@ semanticdb-load-database
                                        'semanticdb-project-database-file))
 	     (c (semanticdb-get-database-tables r))
 	     (tv (oref r semantic-tag-version))
-	     (fv (oref r semanticdb-version))
-	     )
+             (fv (oref r semanticdb-version)))
 	;; Restore the parent-db connection
 	(while c
 	  (oset (car c) parent-db r)
 	  (setq c (cdr c)))
 	(unless (and (equal semanticdb-file-version fv)
 		     (equal semantic-tag-version tv))
-	  ;; Try not to load inversion unless we need it:
-	  (require 'inversion)
-	  (if (not (inversion-test 'semanticdb-file fv))
-	      (when (inversion-test 'semantic-tag tv)
-		;; Incompatible version.  Flush tables.
-		(semanticdb-flush-database-tables r)
-		;; Reset the version to new version.
-		(oset r semantic-tag-version semantic-tag-version)
-		;; Warn user
-		(message "Semanticdb file is old.  Starting over for %s"
-			 filename))
-	    ;; Version is not ok.  Flush whole system
-	    (message "semanticdb file is old.  Starting over for %s"
-		     filename)
-	    ;; This database is so old, we need to replace it.
-	    ;; We also need to delete it from the instance tracker.
-	    (delete-instance r)
-	    (setq r nil)))
+          ;; Version is not ok.  Flush whole system
+          (message "semanticdb file is old.  Starting over for %s" filename)
+          ;; This database is so old, we need to replace it.
+          ;; We also need to delete it from the instance tracker.
+          (delete-instance r)
+          (setq r nil))
 	r)
     (error (message "Cache Error: [%s] %s, Restart"
 		    filename foo)
diff --git a/lisp/cedet/semantic/ede-grammar.el b/lisp/cedet/semantic/ede-grammar.el
index bd0795acbd..64fc07fe1b 100644
--- a/lisp/cedet/semantic/ede-grammar.el
+++ b/lisp/cedet/semantic/ede-grammar.el
@@ -162,10 +162,9 @@ ede-proj-makefile-insert-variables
   "Insert variables needed by target THIS."
   (ede-proj-makefile-insert-loadpath-items
    (ede-proj-elisp-packages-to-loadpath
-    (list "eieio" "semantic" "inversion" "ede")))
+    (list "eieio" "semantic" "ede")))
   ;; eieio for object system needed in ede
   ;; semantic because it is
-  ;; Inversion for versioning system.
   ;; ede for project regeneration
   (ede-pmake-insert-variable-shared
       (concat (ede-pmake-varname this) "_SEMANTIC_GRAMMAR_EL")
@@ -174,8 +173,7 @@ ede-proj-makefile-insert-variables
 		  (with-current-buffer (find-file-noselect src)
 		    (concat (semantic-grammar-package) ".el")))
 		(oref this source)
-		" ")))
-  )
+                " "))))
 
 (cl-defmethod ede-proj-makefile-insert-rules :after ((this semantic-ede-proj-target-grammar))
     "Insert rules needed by THIS target.
diff --git a/lisp/cedet/inversion.el b/lisp/obsolete/inversion.el
similarity index 95%
rename from lisp/cedet/inversion.el
rename to lisp/obsolete/inversion.el
index 2ef7e0df96..f192d88868 100644
--- a/lisp/cedet/inversion.el
+++ b/lisp/obsolete/inversion.el
@@ -5,6 +5,7 @@
 ;; Author: Eric M. Ludlam <[email-masked]>
 ;; Version: 1.3
 ;; Keywords: OO, lisp
+;; Obsolete-since: 28.1
 
 ;; This file is part of GNU Emacs.
 
@@ -524,31 +525,6 @@ inversion-download-package-ask
 
 	  (copy-file (cdr (car files)) dest))))))
 
-;;; How we upgrade packages in Emacs has yet to be ironed out.
-
-;; (defun inversion-upgrade-package (package &optional directory)
-;;   "Try to upgrade PACKAGE in DIRECTORY is available."
-;;   (interactive "sPackage to upgrade: ")
-;;   (if (stringp package) (setq package (intern package)))
-;;   (if (not directory)
-;;       ;; Hope that the package maintainer specified.
-;;       (setq directory (symbol-value (or (intern-soft
-;; 					 (concat (symbol-name package)
-;; 						 "-url"))
-;; 					(intern-soft
-;; 					 (concat (symbol-name package)
-;; 						 "-directory"))))))
-;;   (let ((files (inversion-locate-package-files-and-split
-;; 		package directory))
-;; 	(cver (inversion-package-version package))
-;; 	(newer nil))
-;;     (mapc (lambda (f)
-;; 	    (if (inversion-< cver (inversion-decode-version (car f)))
-;; 		(setq newer (cons f newer))))
-;; 	    files)
-;;     newer
-;;     ))
-
 (provide 'inversion)
 
 ;;; inversion.el ends here
diff --git a/lisp/speedbar.el b/lisp/speedbar.el
index 0e2a3749be..4a78562380 100644
--- a/lisp/speedbar.el
+++ b/lisp/speedbar.el
@@ -141,25 +141,6 @@ speedbar-use-images
 
 ;;; Code:
 
-;; Note: `inversion-test' requires parts of the CEDET package that are
-;; not included with Emacs.
-;;
-;; (defun speedbar-require-version (major minor &optional beta)
-;;   "Non-nil if this version of SPEEDBAR does not satisfy a specific version.
-;; Arguments can be:
-;;
-;;   (MAJOR MINOR &optional BETA)
-;;
-;;   Values MAJOR and MINOR must be integers.  BETA can be an integer, or
-;; excluded if a released version is required.
-;;
-;; It is assumed that if the current version is newer than that specified,
-;; everything passes.  Exceptions occur when known incompatibilities are
-;; introduced."
-;;   (inversion-test 'speedbar
-;; 		  (concat major "." minor
-;; 			  (when beta (concat "beta" beta)))))
-
 (defvar speedbar-initial-expansion-mode-alist
   '(("buffers" speedbar-buffer-easymenu-definition speedbar-buffers-key-map
      speedbar-buffer-buttons)
diff --git a/test/lisp/cedet/inversion-tests.el b/test/lisp/obsolete/inversion-tests.el
similarity index 100%
rename from test/lisp/cedet/inversion-tests.el
rename to test/lisp/obsolete/inversion-tests.el
-- 
2.30.1