comparison lisp/package-net.el @ 454:d7a9135ec789 r21-2-42

Import from CVS: tag r21-2-42
author cvs
date Mon, 13 Aug 2007 11:40:54 +0200
parents 3d3049ae1304
children 685b588e92d8
comparison
equal deleted inserted replaced
453:270b05afd845 454:d7a9135ec789
183 ;;;###autoload 183 ;;;###autoload
184 (defun package-net-update-installed-db (&optional destdir) 184 (defun package-net-update-installed-db (&optional destdir)
185 "Write out the installed package index in a net install suitable format. 185 "Write out the installed package index in a net install suitable format.
186 If DESTDIR is non-nil then use that as the destination directory. 186 If DESTDIR is non-nil then use that as the destination directory.
187 DESTDIR defaults to the value of `package-net-setup-directory'." 187 DESTDIR defaults to the value of `package-net-setup-directory'."
188 ;; Need the local version 188
189 (package-get-require-base) 189 (when (or (eq system-type 'cygwin32)
190 190 (eq system-type 'window-nt))
191 (setq destdir (file-name-as-directory 191 (setq destdir (file-name-as-directory
192 (or destdir (package-net-setup-directory)))) 192 (or destdir (package-net-setup-directory))))
193 (let ((buf (get-buffer-create "*installed.db*"))) 193 (let ((buf (get-buffer-create "*installed.db*")))
194 (unwind-protect 194 (unwind-protect
195 (save-excursion 195 (save-excursion
196 (set-buffer buf) 196 (set-buffer buf)
197 (erase-buffer buf) 197 (erase-buffer buf)
198 (goto-char (point-min)) 198 (goto-char (point-min))
199 (let ((entries package-get-base) entry plist) 199 ;; we use packages-package-list here as we actually want to
200 (while entries 200 ;; update relative to the installed reality
201 (setq entry (car entries)) 201 (let ((entries packages-package-list) entry version)
202 (setq plist (car (cdr entry))) 202 (while entries
203 (insert (format "%s %s %s\n" (symbol-name (car entry)) 203 (setq entry (car entries))
204 (plist-get plist 'filename) 204 (setq version (plist-get (cdr entry) :version))
205 (plist-get plist 'size))) 205 ;; Unfortunately we can't read the size from this
206 (setq entries (cdr entries)))) 206 (insert (format "%s %s-%3.2f-pkg.tar.gz 0\n" (symbol-name (car entry))
207 (make-directory-path destdir) 207 (symbol-name (car entry))
208 (write-region (point-min) (point-max) (concat destdir "installed.db"))) 208 version))
209 (kill-buffer buf)))) 209 (setq entries (cdr entries))))
210 (make-directory-path destdir)
211 (write-region (point-min) (point-max) (concat destdir "installed.db")))
212 (kill-buffer buf)))))
210 213
211 (defun package-net-convert-download-sites-to-mirrors (&optional destdir) 214 (defun package-net-convert-download-sites-to-mirrors (&optional destdir)
212 "Write out the download site list in a net install suitable format. 215 "Write out the download site list in a net install suitable format.
213 If DESTDIR is non-nil then use that as the destination directory. 216 If DESTDIR is non-nil then use that as the destination directory.
214 DESTDIR defaults to the value of `data-directory'." 217 DESTDIR defaults to the value of `data-directory'."