Permalink
Browse files

Prevent errors when migrating status file

Previously, if a package is listed as installed but it doesn't have a
recipe available, then status file migration would fail with an error
because it requires a recipe to save into the new status format. Now,
when this occurs, it just saves a "dummy" recipe that does nothing
instead. This does not result in any loss of functionality, since
without an available recipe the package in question is unusable
anyway.
  • Loading branch information...
1 parent 1ec4d9e commit 7256607fc24956d018c095e0d61f2f2d69f5fd58 @DarwinAwardWinner DarwinAwardWinner committed Jun 19, 2012
Showing with 12 additions and 4 deletions.
  1. +12 −4 el-get-status.el
View
16 el-get-status.el
@@ -85,10 +85,18 @@
(loop for (p s) on ps by 'cddr
for psym = (el-get-package-symbol p)
when psym
- collect (cons psym
- (list 'status s
- 'recipe (when (string= s "installed")
- (el-get-package-def psym))))))))
+ collect
+ (cons psym
+ (list 'status s
+ 'recipe (when (string= s "installed")
+ (condition-case nil
+ (el-get-package-def psym)
+ ;; If the recipe is not
+ ;; available any more,
+ ;; just provide a
+ ;; placeholder no-op
+ ;; recipe.
+ (error `(:name ,psym :type builtin))))))))))
(defun el-get-package-status-alist (&optional package-status-alist)
"return an alist of (PACKAGE . STATUS)"

0 comments on commit 7256607

Please sign in to comment.