comparison lisp/package-get.el @ 363:972bbb6d6ca2 r21-1-11

Import from CVS: tag r21-1-11
author cvs
date Mon, 13 Aug 2007 10:59:28 +0200
parents 8e84bee8ddd0
children 1d62742628b6
comparison
equal deleted inserted replaced
362:1e474c183006 363:972bbb6d6ca2
371 (md5 (current-buffer)))) 371 (md5 (current-buffer))))
372 (unless (file-writable-p location) 372 (unless (file-writable-p location)
373 (setq location (expand-file-name package-get-base-filename 373 (setq location (expand-file-name package-get-base-filename
374 (expand-file-name "etc/" package-get-user-package-location)))) 374 (expand-file-name "etc/" package-get-user-package-location))))
375 (when (y-or-n-p (concat "Update package index in " location "? ")) 375 (when (y-or-n-p (concat "Update package index in " location "? "))
376 (write-file location)))))) 376 (let ((coding-system-for-write 'binary))
377 (write-file location)))))))
377 378
378 379
379 ;;;###autoload 380 ;;;###autoload
380 (defun package-get-update-base (&optional db-file force-current) 381 (defun package-get-update-base (&optional db-file force-current)
381 "Update the package-get database file with entries from DB-FILE. 382 "Update the package-get database file with entries from DB-FILE.
397 (let ((buf (get-buffer-create "*package database*"))) 398 (let ((buf (get-buffer-create "*package database*")))
398 (unwind-protect 399 (unwind-protect
399 (save-excursion 400 (save-excursion
400 (set-buffer buf) 401 (set-buffer buf)
401 (erase-buffer buf) 402 (erase-buffer buf)
402 (insert-file-contents-internal db-file) 403 (insert-file-contents-literally db-file)
403 (package-get-update-base-from-buffer buf) 404 (package-get-update-base-from-buffer buf)
404 (if (file-remote-p db-file) 405 (if (file-remote-p db-file)
405 (package-get-maybe-save-index db-file))) 406 (package-get-maybe-save-index db-file)))
406 (kill-buffer buf)))) 407 (kill-buffer buf))))
407 408
844 "No download sites or local package locations specified."))) 845 "No download sites or local package locations specified.")))
845 ;; Validate the md5 checksum 846 ;; Validate the md5 checksum
846 ;; Doing it with XEmacs removes the need for an external md5 program 847 ;; Doing it with XEmacs removes the need for an external md5 program
847 (message "Validating checksum for `%s'..." package) (sit-for 0) 848 (message "Validating checksum for `%s'..." package) (sit-for 0)
848 (with-temp-buffer 849 (with-temp-buffer
849 ;; What ever happened to i-f-c-literally 850 (insert-file-contents-literally full-package-filename)
850 (let (file-name-handler-alist) 851 (if (not (string= (md5 (current-buffer))
851 (insert-file-contents-internal full-package-filename)) 852 (package-get-info-prop this-package
852 (if (not (string= (md5 (current-buffer)) 853 'md5sum)))
853 (package-get-info-prop this-package 854 (error "Package %s does not match md5 checksum" base-filename)))
854 'md5sum)))
855 (error "Package %s does not match md5 checksum" base-filename)))
856
857 (package-admin-delete-binary-package package install-dir) 855 (package-admin-delete-binary-package package install-dir)
858 856
859 (message "Installing package `%s' ..." package) (sit-for 0) 857 (message "Installing package `%s' ..." package) (sit-for 0)
860 (let ((status 858 (let ((status
861 (package-admin-add-binary-package full-package-filename 859 (package-admin-add-binary-package full-package-filename