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

From: Stefan Kangas <[email-masked]>
Date: Sun, 28 Feb 2021 20:30:29 -0800

Severity: wishlist

There is some code to download packages in cedet/inversion.el which
seems completely redundant now that we have package.el.  I suggest
marking that part as obsolete, see the attached patch.

To be honest, I don't exactly see that there is any need for
inversion.el since the problem it tries to solve is already solved by
package.el.  Perhaps we should just move the entire library to
obsolete/.
From 66fec856d110c61964f1ab4729d58317f29abcb2 Mon Sep 17 00:00:00 2001
From: Stefan Kangas <[email-masked]>
Date: Mon, 1 Mar 2021 05:10:21 +0100
Subject: [PATCH] Make package downloading in inversion.el obsolete

* lisp/cedet/inversion.el (inversion-incompatible-version)
(inversion-locate-package-files, inversion-package-common-tails)
(inversion-locate-package-files-and-split)
(inversion-download-package-ask): Make obsolete.  Fix callers.
(inversion-require): Update advertised calling convention to no
longer support downloading packages.  Doc fix.
---
 lisp/cedet/inversion.el | 45 +++++++++--------------------------------
 1 file changed, 10 insertions(+), 35 deletions(-)

diff --git a/lisp/cedet/inversion.el b/lisp/cedet/inversion.el
index 2ef7e0df96..1e1bda4503 100644
--- a/lisp/cedet/inversion.el
+++ b/lisp/cedet/inversion.el
@@ -22,7 +22,7 @@
 ;; along with GNU Emacs.  If not, see <https://www.gnu.org/licenses/>.
 
 ;;; Commentary:
-;;
+
 ;; Keeping track of rapidly developing software is a tough thing to
 ;; do, especially if you want to have co-dependent packages which all
 ;; move at different rates.
@@ -61,9 +61,6 @@
 ;; 		  (intern-soft (concat (symbol-string p) "-version"))))))
 ;;
 ;; Or modify to specify `inversion-require' instead.
-;;
-;; TODO:
-;;  Offer to download newer versions of a package.
 
 ;;; History:
 ;;
@@ -76,6 +73,7 @@ inversion-version
 
 (defvar inversion-incompatible-version "0.1alpha1"
   "An earlier release which is incompatible with this release.")
+(make-obsolete-variable 'inversion-incompatible-version nil "28.1")
 
 (defconst inversion-decoders
   '(
@@ -332,11 +330,9 @@ inversion-require
 				  &rest reserved)
   "Declare that you need PACKAGE with at least VERSION.
 PACKAGE might be found in FILE.  (See `require'.)
-Throws an error if VERSION is incompatible with what is installed.
-Optional argument DIRECTORY is a location where new versions of
-this tool can be located.  If there is a versioning problem and
-DIRECTORY is provided, inversion will offer to download the file.
-Optional argument RESERVED is saved for later use."
+Throws an error if VERSION is incompatible with what is installed."
+  (declare (advertised-calling-convention
+            (package version &optional file) "28.1"))
   (require package file)
   (let ((err (inversion-test package version)))
     (when err
@@ -443,7 +439,7 @@ inversion-add-to-load-path
 	      (error "Outdated %s %s just installed" package (car newver)))
 	  )))))
 
-;;; URL and downloading code
+;;; Obsolete URL and downloading code
 ;;
 (defun inversion-locate-package-files (package directory &optional version)
   "Get a list of distributions of PACKAGE from DIRECTORY.
@@ -455,6 +451,7 @@ inversion-locate-package-files
 ;;DIRECTORY should also allow a URL:
 ;; \"http://ftp1.sourceforge.net/PACKAGE\"
 ;; but then I can get file listings easily.
+  (declare (obsolete nil "28.1"))
   (if (symbolp package) (setq package (symbol-name package)))
   (directory-files directory t
 		   (if version
@@ -467,6 +464,7 @@ inversion-package-common-tails
 					 ".gz"
 					 )
   "Common distribution mechanisms for Emacs Lisp packages.")
+(make-obsolete-variable 'inversion-package-common-tails nil "28.1")
 
 (defun inversion-locate-package-files-and-split (package directory &optional version)
   "Use `inversion-locate-package-files' to get a list of PACKAGE files.
@@ -474,6 +472,7 @@ inversion-locate-package-files-and-split
 VERSION is an optional argument specifying a version to restrict to.
 The return list is an alist with the version string in the CAR,
 and the full path name in the CDR."
+  (declare (obsolete nil "28.1"))
   (if (symbolp package) (setq package (symbol-name package)))
   (let ((f (inversion-locate-package-files package directory version))
 	(out nil))
@@ -499,6 +498,7 @@ inversion-locate-package-files-and-split
 (defun inversion-download-package-ask (err package directory version)
   "Due to ERR, offer to download PACKAGE from DIRECTORY.
 The package should have VERSION available for download."
+  (declare (obsolete package-install "28.1"))
   (if (symbolp package) (setq package (symbol-name package)))
   (let ((files (inversion-locate-package-files-and-split
 		package directory version)))
@@ -524,31 +524,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
-- 
2.30.0