Steve,
Can you define a canonical directory on
ftp.xemacs.org
where package-get-base.el will live? That will allow me
to hack up a little package update code which first loads
the current one via efs.
Also, will package versions always be in printf "%.2f" format?
It seems fsf-compat and mew are not so in the current package-get-base.
They are both "1.0", not "1.00". Just a minor inconsistency that
would be nice to fix. Also why must packages-package-list have
the versions stored as floats rather than strings?
Could we also make the directory in which to install packages
(via package-admin-add-binary-package) an optional argument to
package-get? I'll submit a patch.
greg
btw - here's what i've just hacked up. it has minimal
error checking and much functionality needs to be written, so
be warned. also i've not actually told it to fetch any
packages yet so that might not even work.
--[[text/plain; type=emacs-lisp
Content-Disposition: attachment; filename="package-junk.el"][7bit]]
(require 'package-get)
;; should be the EFS specification of the directory on
XEMACS.ORG
;; where the current package-get-base lives.
;;
(defvar package-get-base-directory
"/proj/mstar/software/xemacs/xemacs-21.0/build/xemacs-20/lisp")
(defvar package-get-base-filename "package-get-base.el")
(defun package-get-update-all-interactive (arg)
"Offer to fetch and install the latest versions of all currently
installed packages. With ARG, do not compute dependencies, simply
install new versions of packages we have already got."
(interactive "P")
(package-get-interactive-load-base)
(package-get-interactive
(mapcar (lambda (pkg) (car pkg)) packages-package-list) arg))
;; need to somehow keep track of packages that the user has decided
;; not to get and don't prompt again
(defun package-get-all-interactive ()
"Offer to fetch and install the latest versions of all known packages."
(interactive)
(package-get-interactive-load-base)
(package-get-interactive
(mapcar (lambda (pkg) (car pkg)) package-get-base) t))
(defun package-get-interactive-load-base ()
(let ((pgb-file (read-file-name "Package get base file: "
(file-name-as-directory
package-get-base-directory)
(expand-file-name
package-get-base-filename
package-get-base-directory)
t
package-get-base-filename)))
(load-file pgb-file)))
(defun package-get-interactive (pkgs nodepend)
(when (or (not (listp late-packages))
(not late-packages))
(error "No package path"))
(let ((packages-to-get nil)
(have-pkgs (mapcar (lambda (pkg) (car pkg))
packages-package-list))
(pkg-dir (car (last late-packages))))
(or (yes-or-no-p (format "Install packages in %s: " pkg-dir))
(error "Can't specify package install directory yet"))
(while pkgs
(if (not (assq (car pkgs) packages-to-get))
(let ((have-vers (nth 2 (assq (car pkgs)
packages-package-list)))
(curr-vers
(package-get-info-prop
(package-get-info-version
(package-get-info-find-package package-get-base
(car pkgs)) nil)
'version)))
(if have-vers
(setq have-vers (format "%.2f" have-vers)))
(when (not (equal have-vers curr-vers))
(setq packages-to-get
(cons (list (car pkgs) have-vers curr-vers nil)
packages-to-get))
(if (not nodepend)
;; fill this in...
(error "don't handle dependencies yet")))))
(setq pkgs (cdr pkgs)))
(setq packages-to-get
(sort packages-to-get
(lambda (a b)
(string-lessp (symbol-name (car a))
(symbol-name (car b))))))
(mapcar (lambda (pkg)
(if (y-or-n-p (if (memq (car pkg) have-pkgs)
(format "Update %s from %s to %s: "
(car pkg) (nth 1 pkg) (nth 2 pkg))
(format "Get %s %s (required by %s): "
(car pkg) (nth 2 pkg) (nth 3 pkg))))
(package-get (car pkg) (nth 2 pkg))
(message "skipped %s %s" (car pkg) (nth 2 pkg))))
packages-to-get)))