From dcf7866712dfa5a0007554c59e54dea91951c746 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Fri, 21 Mar 2014 08:06:52 +0200 Subject: [PATCH] Fix bug#16826 * lisp/emacs-lisp/package.el (package-compute-transaction): Use `version-list-<=' to compare the requirement version against the package version already to be installed. Update the error message. --- lisp/ChangeLog | 5 +++++ lisp/emacs-lisp/package.el | 4 ++-- test/automated/data/package/archive-contents | 4 ++++ .../data/package/simple-two-depend-1.1.el | 17 +++++++++++++++++ test/automated/package-test.el | 12 +++++++++++- 5 files changed, 39 insertions(+), 3 deletions(-) create mode 100644 test/automated/data/package/simple-two-depend-1.1.el diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d77e4e4b4be..07af775379c 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2014-03-21 Dmitry Gutov + * emacs-lisp/package.el (package-compute-transaction): + Use `version-list-<=' to compare the requirement version against + the version of package already to be installed. Update the error + message. (Bug#16826) + * progmodes/ruby-mode.el (ruby-smie-rules): Add indentation rule for ` @ '. (Bug#17050) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index e0d1c99d369..ae2c2862887 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -923,10 +923,10 @@ not included in this list." (setq already pkg))) (cond (already - (if (version-list-< next-version (package-desc-version already)) + (if (version-list-<= next-version (package-desc-version already)) ;; Move to front, so it gets installed early enough (bug#14082). (setq packages (cons already (delq already packages))) - (error "Need package `%s-%s', but only %s is available" + (error "Need package `%s-%s', but only %s is being installed" next-pkg (package-version-join next-version) (package-version-join (package-desc-version already))))) diff --git a/test/automated/data/package/archive-contents b/test/automated/data/package/archive-contents index 8d6f3226ae6..a6df6b8086e 100644 --- a/test/automated/data/package/archive-contents +++ b/test/automated/data/package/archive-contents @@ -6,6 +6,10 @@ (simple-depend . [(1 0) ((simple-single (1 3))) "A single-file package with a dependency." single]) + (simple-two-depend . + [(1 1) + ((simple-depend (1 0)) (simple-single (1 3))) + "A single-file package with two dependencies." single]) (multi-file . [(0 2 3) nil "Example of a multi-file tar package" tar diff --git a/test/automated/data/package/simple-two-depend-1.1.el b/test/automated/data/package/simple-two-depend-1.1.el new file mode 100644 index 00000000000..9cfe5c0d4e2 --- /dev/null +++ b/test/automated/data/package/simple-two-depend-1.1.el @@ -0,0 +1,17 @@ +;;; simple-two-depend.el --- A single-file package with two dependencies. + +;; Author: J. R. Hacker +;; Version: 1.1 +;; Keywords: frobnicate +;; Package-Requires: ((simple-depend "1.0") (simple-single "1.3")) + +;;; Commentary: + +;; Depends on two another packages. + +;;; Code: + +(defvar simple-two-depend "Value" + "Some trivial code") + +;;; simple-two-depend.el ends here diff --git a/test/automated/package-test.el b/test/automated/package-test.el index 34a3ce25a48..72422a8684b 100644 --- a/test/automated/package-test.el +++ b/test/automated/package-test.el @@ -203,12 +203,22 @@ Must called from within a `tar-mode' buffer." (should (package-installed-p 'simple-single)) (should (package-installed-p 'simple-depend)))) +(ert-deftest package-test-install-two-dependencies () + "Install a package which includes a dependency." + (with-package-test () + (package-initialize) + (package-refresh-contents) + (package-install 'simple-two-depend) + (should (package-installed-p 'simple-single)) + (should (package-installed-p 'simple-depend)) + (should (package-installed-p 'simple-two-depend)))) + (ert-deftest package-test-refresh-contents () "Parse an \"archive-contents\" file." (with-package-test () (package-initialize) (package-refresh-contents) - (should (eq 3 (length package-archive-contents))))) + (should (eq 4 (length package-archive-contents))))) (ert-deftest package-test-install-single-from-archive () "Install a single package from a package archive." -- 2.39.2