Skip to content

Commit

Permalink
package-register: Improve status de-duplication.
Browse files Browse the repository at this point in the history
If a package with a new status is registered, make sure to update its entry in
`package-registry'.

Signed-off-by: Dan Hackney <dan@haxney.org>
  • Loading branch information
haxney committed Jun 20, 2010
1 parent 725b09c commit 7381fcf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
16 changes: 16 additions & 0 deletions package-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -1043,6 +1043,22 @@
(package-register addy)
(package-register addy)
package-registry))
(expect `((addy ,(make-package :name 'addy
:version '(1 0)
:type 'single
:status 'installed
:archive 'manual)))
(let (package-registry)
(package-register (make-package :name 'addy
:version '(1 0)
:type 'single
:archive 'manual))
(package-register (make-package :name 'addy
:version '(1 0)
:type 'single
:status 'installed
:archive 'manual))
package-registry))

(desc "package-archive-url")
(expect (package (concat "file://" test-dir "upstream/"))
Expand Down
7 changes: 4 additions & 3 deletions package.el
Original file line number Diff line number Diff line change
Expand Up @@ -590,9 +590,10 @@ present."
(if existing-pkgs
(unless (loop for other in existing-pkgs
when (and (eq (package-name pkg) (package-name other))
(equal (package-version pkg) (package-version other))
(eq (package-archive pkg) (package-archive other)))
return t)
(equal (package-version pkg) (package-version other))
(eq (package-archive pkg) (package-archive other)))
do (setf (package-status other) (package-status pkg))
and return t)
(nconc existing-pkgs (list pkg))
pkg)
(aput 'package-registry pkg-name (list pkg)))))
Expand Down

0 comments on commit 7381fcf

Please sign in to comment.