+(defcustom package-get-dir (temp-directory)
+ "*Where to store temporary files for staging."
+ :tag "Temporary directory"
+ :type 'directory
+ :group 'package-get)
+
+;;;###autoload
+(defcustom package-get-package-index-file-location
+ (car (split-path (or (getenv "EMACSPACKAGEPATH") user-init-directory)))
+ "*The directory where the package-index file can be found."
+ :type 'directory
+ :group 'package-get)
+
+;;;###autoload
+(defcustom package-get-install-to-user-init-directory nil
+ "*If non-nil install packages under `user-init-directory'."
+ :type 'boolean
+ :group 'package-get)
+
+(define-widget 'host-name 'string
+ "A Host name."
+ :tag "Host")
+
+(defcustom package-get-remote nil
+ "*The remote site to contact for downloading packages.
+Format is '(site-name directory-on-site). As a special case, `site-name'
+can be `nil', in which case `directory-on-site' is treated as a local
+directory."
+ :tag "Package repository"
+ :type '(set (choice (const :tag "None" nil)
+ (list :tag "Local" (const :tag "Local" nil) directory)
+ (list :tag "Remote" host-name directory)))
+ :group 'package-get)
+
+;;;###autoload
+(defcustom package-get-download-sites
+ '(
+ ;; Main XEmacs Site (ftp.xemacs.org)
+ ("US (Main XEmacs Site)"
+ "ftp.xemacs.org" "pub/xemacs/packages")
+ ;; In alphabetical order of Country, our mirrors...
+ ("Australia (aarnet.edu.au)" "mirror.aarnet.edu.au" "pub/xemacs/packages")
+ ("Australia (au.xemacs.org)" "ftp.au.xemacs.org" "pub/xemacs/packages")
+ ("Austria (at.xemacs.org)" "ftp.at.xemacs.org" "editors/xemacs/packages")
+ ("Belgium (be.xemacs.org)" "ftp.be.xemacs.org" "xemacs/packages")
+ ("Brazil (br.xemacs.org)" "ftp.br.xemacs.org" "pub/xemacs/packages")
+ ("Canada (ca.xemacs.org)" "ftp.ca.xemacs.org" "pub/Mirror/xemacs/packages")
+ ("Canada (crc.ca)" "ftp.crc.ca" "pub/packages/editors/xemacs/packages")
+ ("Canada (ualberta.ca)" "sunsite.ualberta.ca" "pub/Mirror/xemacs/packages")
+ ("Czech Republic (cz.xemacs.org)" "ftp.cz.xemacs.org" "MIRRORS/ftp.xemacs.org/pub/xemacs/packages")
+ ("Denmark (dk.xemacs.org)" "ftp.dk.xemacs.org" "pub/emacs/xemacs/packages")
+ ("Finland (fi.xemacs.org)" "ftp.fi.xemacs.org" "pub/mirrors/ftp.xemacs.org/pub/tux/xemacs/packages")
+ ("France (fr.xemacs.org)" "ftp.fr.xemacs.org" "pub/xemacs/packages")
+ ("France (mirror.cict.fr)" "mirror.cict.fr" "xemacs/packages")
+ ("France (pasteur.fr)" "ftp.pasteur.fr" "pub/computing/xemacs/packages")
+ ("Germany (de.xemacs.org)" "ftp.de.xemacs.org" "pub/ftp.xemacs.org/tux/xemacs/packages")
+ ("Germany (tu-darmstadt.de)" "ftp.tu-darmstadt.de" "pub/editors/xemacs/packages")
+ ("Ireland (ie.xemacs.org)" "ftp.ie.xemacs.org" "mirrors/ftp.xemacs.org/pub/xemacs/packages")
+ ("Italy (it.xemacs.org)" "ftp.it.xemacs.org" "unix/packages/XEMACS/packages")
+ ("Japan (aist.go.jp)" "ring.aist.go.jp" "pub/text/xemacs/packages")
+ ("Japan (asahi-net.or.jp)" "ring.asahi-net.or.jp" "pub/text/xemacs/packages")
+ ("Japan (dti.ad.jp)" "ftp.dti.ad.jp" "pub/unix/editor/xemacs/packages")
+ ("Japan (jaist.ac.jp)" "ftp.jaist.ac.jp" "pub/GNU/xemacs/packages")
+ ("Japan (jp.xemacs.org)" "ftp.jp.xemacs.org" "pub/GNU/xemacs/packages")
+ ("Japan (nucba.ac.jp)" "mirror.nucba.ac.jp" "mirror/xemacs/packages")
+ ("Japan (sut.ac.jp)" "sunsite.sut.ac.jp" "pub/archives/packages/xemacs/packages")
+ ("Korea (kr.xemacs.org)" "ftp.kr.xemacs.org" "pub/tools/emacs/xemacs/packages")
+ ("New Zealand (nz.xemacs.org)" "ftp.nz.xemacs.org" "mirror/ftp.xemacs.org/packages")
+ ("Norway (no.xemacs.org)" "ftp.no.xemacs.org" "pub/xemacs/packages")
+ ("Poland (pl.xemacs.org)" "ftp.pl.xemacs.org" "pub/unix/editors/xemacs/packages")
+ ("Russia (ru.xemacs.org)" "ftp.ru.xemacs.org" "pub/xemacs/packages")
+ ("Slovakia (sk.xemacs.org)" "ftp.sk.xemacs.org" "pub/mirrors/xemacs/packages")
+ ("South Africa (za.xemacs.org)" "ftp.za.xemacs.org" "mirrorsites/ftp.xemacs.org/packages")
+ ("Sweden (se.xemacs.org)" "ftp.se.xemacs.org" "pub/gnu/xemacs/packages")
+ ("Switzerland (ch.xemacs.org)" "ftp.ch.xemacs.org" "mirror/xemacs/packages")
+ ("UK (uk.xemacs.org)" "ftp.uk.xemacs.org" "sites/ftp.xemacs.org/pub/xemacs/packages")
+ ("US (ibiblio.org)" "ibiblio.org" "pub/packages/editors/xemacs/packages")
+ ("US (stealth.net)" "ftp.stealth.net" "pub/mirrors/ftp.xemacs.org/pub/xemacs/packages")
+ ("US (unc.edu)" "metalab.unc.edu" "pub/packages/editors/xemacs/packages")
+ ("US (us.xemacs.org)" "ftp.us.xemacs.org" "pub/xemacs/packages")
+ ("US (utk.edu)" "ftp.sunsite.utk.edu" "pub/xemacs/packages")
+ )
+ "*List of remote sites available for downloading packages.
+List format is '(site-description site-name directory-on-site).
+SITE-DESCRIPTION is a textual description of the site. SITE-NAME
+is the internet address of the download site. DIRECTORY-ON-SITE
+is the directory on the site in which packages may be found.
+This variable is used to initialize `package-get-remote', the
+variable actually used to specify package download sites."
+ :tag "Package download sites"
+ :type '(repeat (list (string :tag "Name") host-name directory))
+ :group 'package-get)
+
+;;;###autoload
+(defcustom package-get-pre-release-download-sites
+ '(
+ ;; Main XEmacs Site (ftp.xemacs.org)
+ ("Pre-Releases (Main XEmacs Site)" "ftp.xemacs.org"
+ "pub/xemacs/beta/experimental/packages")
+ ;; In alphabetical order of Country, our mirrors...
+ ("Australia Pre-Releases (aarnet.edu.au)" "mirror.aarnet.edu.au"
+ "pub/xemacs/beta/experimental/packages")
+ ("Australia Pre-Releases (au.xemacs.org)" "ftp.au.xemacs.org"
+ "pub/xemacs/beta/experimental/packages")
+ ("Austria Pre-Releases (at.xemacs.org)" "ftp.at.xemacs.org"
+ "editors/xemacs/beta/experimentsl/packages")
+ ("Brazil Pre-Releases (br.xemacs.org)" "ftp.br.xemacs.org"
+ "pub/xemacs/xemacs-21.5/experimental/packages")
+ ("Canada Pre-Releases (ca.xemacs.org)" "ftp.ca.xemacs.org"
+ "pub/Mirror/xemacs/beta/experimental/packages")
+ ("Canada Pre-Releases (crc.ca)" "ftp.crc.ca"
+ "pub/packages/editors/xemacs/beta/experimental/packages")
+ ("Canada Pre-Releases (ualberta.ca)" "sunsite.ualberta.ca"
+ "pub/Mirror/xemacs/beta/experimental/packages")
+ ("Czech Republic Pre-Releases (cz.xemacs.org)" "ftp.cz.xemacs.org"
+ "MIRRORS/ftp.xemacs.org/pub/xemacs/xemacs-21.5/experimental/packages")
+ ("Denmark Pre-Releases (dk.xemacs.org)" "ftp.dk.xemacs.org"
+ "pub/emacs/xemacs/beta/experimental/packages")
+ ("Finland Pre-Releases (fi.xemacs.org)" "ftp.fi.xemacs.org"
+ "pub/mirrors/ftp.xemacs.org/pub/tux/xemacs/beta/experimental/packages")
+ ("France Pre-Releases (fr.xemacs.org)" "ftp.fr.xemacs.org"
+ "pub/xemacs/beta/experimental/packages")
+ ("France Pre-Releases (mirror.cict.fr)" "mirror.cict.fr"
+ "xemacs/beta/experimental/packages")
+ ("France Pre-Releases (pasteur.fr)" "ftp.pasteur.fr"
+ "pub/computing/xemacs/beta/experimental/packages")
+ ("Germany Pre-Releases (de.xemacs.org)" "ftp.de.xemacs.org"
+ "pub/ftp.xemacs.org/tux/xemacs/beta/experimental/packages")
+ ("Germany Pre-Releases (tu-darmstadt.de)" "ftp.tu-darmstadt.de"
+ "pub/editors/xemacs/beta/experimental/packages")
+ ("Ireland Pre-Releases (ie.xemacs.org)" "ftp.ie.xemacs.org"
+ "mirrors/ftp.xemacs.org/pub/xemacs/beta/experimental/packages")
+ ("Italy Pre-Releases (it.xemacs.org)" "ftp.it.xemacs.org"
+ "unix/packages/XEMACS/beta/experimental/packages")
+ ("Japan Pre-Releases (aist.go.jp)" "ring.aist.go.jp"
+ "pub/text/xemacs/beta/experimental/packages")
+ ("Japan Pre-Releases (asahi-net.or.jp)" "ring.asahi-net.or.jp"
+ "pub/text/xemacs/beta/experimental/packages")
+ ("Japan Pre-Releases (dti.ad.jp)" "ftp.dti.ad.jp"
+ "pub/unix/editor/xemacs/beta/experimental/packages")
+ ("Japan Pre-Releases (jaist.ac.jp)" "ftp.jaist.ac.jp"
+ "pub/GNU/xemacs/beta/experimental/packages")
+ ("Japan Pre-Releases (jp.xemacs.org)" "ftp.jp.xemacs.org"
+ "pub/GNU/xemacs/beta/experimental/packages")
+ ("Japan Pre-Releases (sut.ac.jp)" "sunsite.sut.ac.jp"
+ "pub/archives/packages/xemacs/xemacs-21.5/experimental/packages")
+ ("New Zealand Pre-Releases (nz.xemacs.org)" "ftp.nz.xemacs.org" "mirror/ftp.xemacs.org/packages")
+ ("Norway Pre-Releases (no.xemacs.org)" "ftp.no.xemacs.org"
+ "pub/xemacs/beta/experimental/packages")
+ ("Poland Pre-Releases (pl.xemacs.org)" "ftp.pl.xemacs.org"
+ "pub/unix/editors/xemacs/beta/experimental/packages")
+ ("Russia Pre-Releases (ru.xemacs.org)" "ftp.ru.xemacs.org"
+ "pub/xemacs/beta/experimental/packages")
+ ("Saudi Arabia Pre-Releases (sa.xemacs.org)" "ftp.sa.xemacs.org"
+ "pub/mirrors/ftp.xemacs.org/xemacs/xemacs-21.5/experimental/packages")
+ ("Slovakia Pre-Releases (sk.xemacs.org)" "ftp.sk.xemacs.org"
+ "pub/mirrors/xemacs/beta/experimental/packages")
+ ("South Africa Pre-Releases (za.xemacs.org)" "ftp.za.xemacs.org"
+ "mirrorsites/ftp.xemacs.org/beta/experimental/packages")
+ ("Sweden Pre-Releases (se.xemacs.org)" "ftp.se.xemacs.org"
+ "pub/gnu/xemacs/beta/experimental/packages")
+ ("Switzerland Pre-Releases (ch.xemacs.org)" "ftp.ch.xemacs.org"
+ "mirror/xemacs/beta/experimental/packages")
+ ("UK Pre-Releases (uk.xemacs.org)" "ftp.uk.xemacs.org"
+ "sites/ftp.xemacs.org/pub/xemacs/beta/experimental/packages")
+ ("US Pre-Releases (ibiblio.org)" "ibiblio.org"
+ "pub/packages/editors/xemacs/beta/experimental/packages")
+ ("US Pre-Releases (stealth.net)" "ftp.stealth.net"
+ "pub/mirrors/ftp.xemacs.org/pub/xemacs/beta/experimental/packages")
+ ("US Pre-Releases (unc.edu)" "metalab.unc.edu"
+ "pub/packages/editors/xemacs/beta/experimental/packages")
+ ("US Pre-Releases (us.xemacs.org)" "ftp.us.xemacs.org"
+ "pub/xemacs/beta/experimental/packages")
+ ("US Pre-Releases (utk.edu)" "ftp.sunsite.utk.edu"
+ "pub/xemacs/beta/experimental/packages"))
+ "*List of remote sites available for downloading \"Pre-Release\" packages.
+List format is '(site-description site-name directory-on-site).
+SITE-DESCRIPTION is a textual description of the site. SITE-NAME
+is the internet address of the download site. DIRECTORY-ON-SITE
+is the directory on the site in which packages may be found.
+This variable is used to initialize `package-get-remote', the
+variable actually used to specify package download sites."
+ :tag "Pre-Release Package download sites"
+ :type '(repeat (list (string :tag "Name") host-name directory))
+ :group 'package-get)
+
+;;;###autoload
+(defcustom package-get-site-release-download-sites
+ nil
+ "*List of remote sites available for downloading \"Site Release\" packages.
+List format is '(site-description site-name directory-on-site).
+SITE-DESCRIPTION is a textual description of the site. SITE-NAME
+is the internet address of the download site. DIRECTORY-ON-SITE
+is the directory on the site in which packages may be found.
+This variable is used to initialize `package-get-remote', the
+variable actually used to specify package download sites."
+ :tag "Site Release Package download sites"
+ :type '(repeat (list (string :tag "Name") host-name directory))
+ :group 'package-get)
+
+(defcustom package-get-remove-copy t
+ "*After copying and installing a package, if this is t, then remove the
+copy. Otherwise, keep it around."
+ :type 'boolean
+ :group 'package-get)
+
+;; #### it may make sense for this to be a list of names.
+;; #### also, should we rename "*base*" to "*index*" or "*db*"?
+;; "base" is a pretty poor name.
+(defcustom package-get-base-filename "package-index.LATEST.gpg"
+ "*Name of the default package-get database file.
+This may either be a relative path, in which case it is interpreted
+with respect to `package-get-remote', or an absolute path."
+ :type 'file
+ :group 'package-get)
+
+(defcustom package-get-always-update nil
+ "*If Non-nil always make sure we are using the latest package index (base).
+Otherwise respect the `force-current' argument of `package-get-require-base'."
+ :type 'boolean
+ :group 'package-get)
+
+(defun package-get-pgp-available-p ()
+ "Checks the availability of Mailcrypt and PGP executable.
+
+Returns t if both are found, nil otherwise. As a side effect, set
+`mc-default-scheme' dependent on the PGP executable found."
+ (let (result)
+ (when (featurep 'mailcrypt-autoloads)
+ (autoload 'mc-setversion "mc-setversion"))
+ (when (fboundp 'mc-setversion)
+ (cond ((locate-file "gpg" exec-path
+ '("" ".btm" ".bat" ".cmd" ".exe" ".com")
+ 'executable)
+ (mc-setversion "gpg")
+ (setq result t))
+ ((locate-file "pgpe" exec-path
+ '("" ".btm" ".bat" ".cmd" ".exe" ".com")
+ 'executable)
+ (mc-setversion "5.0")
+ (setq result t))
+ ((locate-file "pgp" exec-path
+ '("" ".btm" ".bat" ".cmd" ".exe" ".com")
+ 'executable)
+ (mc-setversion "2.6")
+ (setq result t))))
+ (if result
+ result
+ nil)))
+
+(defcustom package-get-require-signed-base-updates nil
+ "*If non-nil, try to verify the package index database via PGP.
+
+If nil, no PGP verification is done. If the package index database
+entries are not PGP signed and this variable is non-nil, require user
+confirmation to continue with the package-get procedure."
+ :type 'boolean
+ :group 'package-get)
+
+(defvar package-entries-are-signed nil
+ "Non-nil when the package index file has been PGP signed.")
+
+(defvar package-get-continue-update-base nil
+ "Non-nil update the index even if it hasn't been signed.")
+
+(defvar package-get-was-current nil
+ "Non-nil we did our best to fetch a current database.")
+
+;;;###autoload
+(defun package-get-require-base (&optional force-current)
+ "Require that a package-get database has been loaded.
+If the optional FORCE-CURRENT argument or the value of
+`package-get-always-update' is Non-nil, try to update the database
+from a location in `package-get-remote'. Otherwise a local copy is used
+if available and remote access is never done.
+
+Please use FORCE-CURRENT only when the user is explictly dealing with packages
+and remote access is likely in the near future."
+ (setq force-current (or force-current package-get-always-update))
+ (unless (and (boundp 'package-get-base)
+ package-get-base
+ (or (not force-current) package-get-was-current))
+ (package-get-update-base nil force-current))
+ (if (or (not (boundp 'package-get-base))
+ (not package-get-base))
+ (error 'void-variable
+ "Package-get database not loaded")
+ (setq package-get-was-current force-current)))
+
+(defconst package-get-pgp-signed-begin-line "^-----BEGIN PGP SIGNED MESSAGE-----"
+ "Text for start of PGP signed messages.")
+(defconst package-get-pgp-signature-begin-line "^-----BEGIN PGP SIGNATURE-----"
+ "Text for beginning of PGP signature.")
+(defconst package-get-pgp-signature-end-line "^-----END PGP SIGNATURE-----"
+ "Text for end of PGP signature.")
+
+;;;###autoload
+(defun package-get-update-base-entry (entry)
+ "Update an entry in `package-get-base'."
+ (let ((existing (assq (car entry) package-get-base)))
+ (if existing
+ (setcdr existing (cdr entry))
+ (setq package-get-base (cons entry package-get-base)))))
+
+(defun package-get-locate-file (file &optional nil-if-not-found no-remote)
+ "Locate an existing FILE with respect to `package-get-remote'.
+If FILE is an absolute path or is not found, simply return FILE.
+If optional argument NIL-IF-NOT-FOUND is non-nil, return nil
+if FILE can not be located.
+If NO-REMOTE is non-nil never search remote locations."
+ (if (file-name-absolute-p file)
+ file
+ (let ((site package-get-remote)
+ (expanded nil))
+ (when site
+ (unless (and no-remote (caar (list site)))
+ (let ((expn (package-get-remote-filename (car (list site)) file)))
+ (if (and expn (file-exists-p expn))
+ (setq site nil
+ expanded expn)))))
+ (or expanded
+ (and (not nil-if-not-found)
+ file)))))
+
+(defun package-get-locate-index-file (no-remote)
+ "Locate the package-get index file.
+
+Do not return remote paths if NO-REMOTE is non-nil. If the index
+file doesn't exist in `package-get-package-index-file-location', ask
+the user if one should be created using the index file in core as a
+template."
+ (or (package-get-locate-file package-get-base-filename t no-remote)
+ (if (file-exists-p (expand-file-name package-get-base-filename
+ package-get-package-index-file-location))
+ (expand-file-name package-get-base-filename
+ package-get-package-index-file-location)
+ (if (y-or-n-p (format "No index file, shall I create one in %s? "
+ package-get-package-index-file-location))
+ (progn
+ (save-excursion
+ (set-buffer
+ (find-file-noselect (expand-file-name
+ package-get-base-filename
+ package-get-package-index-file-location)))
+ (let ((coding-system-for-write 'binary))
+ (erase-buffer)
+ (insert-file-contents-literally
+ (locate-data-file package-get-base-filename))
+ (save-buffer (current-buffer))
+ (kill-buffer (current-buffer))))
+ (expand-file-name package-get-base-filename
+ package-get-package-index-file-location))
+ (error 'search-failed
+ "Can't locate a package index file.")))))
+
+(defun package-get-maybe-save-index (filename)
+ "Offer to save the current buffer as the local package index file,
+if different."
+ (let ((location (package-get-locate-index-file t)))
+ (unless (and filename (equal filename location))
+ (unless (and location
+ (equal (md5 (current-buffer))
+ (with-temp-buffer
+ (insert-file-contents-literally location)
+ (md5 (current-buffer)))))
+ (when (not (file-writable-p location))
+ (if (y-or-n-p (format "Sorry, %s is read-only, can I use %s? "
+ location user-init-directory))
+ (setq location (expand-file-name
+ package-get-base-filename
+ package-get-package-index-file-location))
+ (error 'file-error
+ (format "%s is read-only" location))))
+ (when (y-or-n-p (concat "Update package index in " location "? "))
+ (let ((coding-system-for-write 'binary))
+ (write-file location)))))))
+
+;;;###autoload
+(defun package-get-update-base (&optional db-file force-current)
+ "Update the package-get database file with entries from DB-FILE.
+Unless FORCE-CURRENT is non-nil never try to update the database."
+ (interactive
+ (let ((dflt (package-get-locate-index-file nil)))
+ (list (read-file-name "Load package-get database: "
+ (file-name-directory dflt)
+ dflt
+ t
+ (file-name-nondirectory dflt)))))
+ (setq db-file (expand-file-name (or db-file
+ (package-get-locate-index-file
+ (not force-current)))))
+ (if (not (file-exists-p db-file))
+ (error 'file-error
+ (format "Package-get database file `%s' does not exist" db-file)))
+ (if (not (file-readable-p db-file))
+ (error 'file-error
+ (format "Package-get database file `%s' not readable" db-file)))
+ (let ((buf (get-buffer-create "*package database*")))
+ (unwind-protect
+ (save-excursion
+ (set-buffer buf)
+ (erase-buffer buf)
+ (insert-file-contents-literally db-file)
+ (package-get-update-base-from-buffer buf)
+ (if (file-remote-p db-file)
+ (package-get-maybe-save-index db-file)))
+ (kill-buffer buf))))
+
+;; This is here because the `process-error' datum doesn't exist in
+;; 21.4. --SY.
+(define-error 'process-error "Process error")
+
+;;;###autoload
+(defun package-get-update-base-from-buffer (&optional buf)
+ "Update the package-get database with entries from BUFFER.
+BUFFER defaults to the current buffer. This command can be
+used interactively, for example from a mail or news buffer."
+ (interactive)
+ (setq buf (or buf (current-buffer)))
+ (let ((coding-system-for-read 'binary)
+ (coding-system-for-write 'binary)
+ content-beg content-end)
+ (save-excursion
+ (set-buffer buf)
+ (goto-char (point-min))
+ (setq content-beg (point))
+ (setq content-end (save-excursion (goto-char (point-max)) (point)))
+ (when (re-search-forward package-get-pgp-signed-begin-line nil t)
+ (setq content-beg (match-end 0)))
+ (when (re-search-forward package-get-pgp-signature-begin-line nil t)
+ (setq content-end (match-beginning 0))
+ (setq package-entries-are-signed t))
+ (re-search-forward package-get-pgp-signature-end-line nil t)
+ (setq package-get-continue-update-base t)
+ ;; This is a little overkill because the default value of
+ ;; `package-get-require-signed-base-updates' is the return of
+ ;; `package-get-pgp-available-p', but we have to allow for
+ ;; someone explicitly setting
+ ;; `package-get-require-signed-base-updates' to t. --SY
+ (when (and package-get-require-signed-base-updates
+ (package-get-pgp-available-p))
+ (if package-entries-are-signed
+ (let (good-sig)
+ (setq package-get-continue-update-base nil)
+ (autoload 'mc-verify "mc-toplev")
+ (when (mc-verify)
+ (setq good-sig t))
+ (if good-sig
+ (setq package-get-continue-update-base t)
+ (error 'process-error
+ "GnuPG error. Package database not updated")))
+ (if (yes-or-no-p
+ "Package Index is not PGP signed. Continue anyway? ")
+ (setq package-get-continue-update-base t)
+ (setq package-get-continue-update-base nil)
+ (warn "Package database not updated"))))
+ ;; ToDo: We should call package-get-maybe-save-index on the region
+ (when package-get-continue-update-base
+ (package-get-update-base-entries content-beg content-end)
+ (message "Updated package database")))))
+
+(defun package-get-update-base-entries (start end)
+ "Update the package-get database with the entries found between
+START and END in the current buffer."
+ (save-excursion
+ (goto-char start)
+ (if (not (re-search-forward "^(package-get-update-base-entry" nil t))
+ (error 'search-failed
+ "Buffer does not contain package-get database entries"))
+ (beginning-of-line)
+ (let ((count 0))
+ (while (and (< (point) end)
+ (re-search-forward "^(package-get-update-base-entry" nil t))
+ (beginning-of-line)
+ (let ((entry (read (current-buffer))))
+ (if (or (not (consp entry))
+ (not (eq (car entry) 'package-get-update-base-entry)))
+ (error 'syntax-error
+ "Invalid package-get database entry found"))
+ (package-get-update-base-entry
+ (car (cdr (car (cdr entry)))))
+ (setq count (1+ count))))
+ (message "Got %d package-get database entries" count))))