From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.devel Subject: Re: Package installation messages Date: Wed, 20 May 2015 21:02:22 +0100 Message-ID: References: <55552452.7050703@yandex.ru> <55553712.2050608@yandex.ru> <21852.47299.65468.476327@retriever.mtv.corp.google.com> Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1432152153 18235 80.91.229.3 (20 May 2015 20:02:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 20 May 2015 20:02:33 +0000 (UTC) Cc: emacs-devel Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 20 22:02:32 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YvACF-0007LB-40 for ged-emacs-devel@m.gmane.org; Wed, 20 May 2015 22:02:31 +0200 Original-Received: from localhost ([::1]:53896 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvACE-0004LY-KC for ged-emacs-devel@m.gmane.org; Wed, 20 May 2015 16:02:30 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53492) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvAC9-0004LE-Dw for emacs-devel@gnu.org; Wed, 20 May 2015 16:02:26 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YvAC7-0008U9-U8 for emacs-devel@gnu.org; Wed, 20 May 2015 16:02:25 -0400 Original-Received: from mail-lb0-x232.google.com ([2a00:1450:4010:c04::232]:36752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YvAC7-0008U3-Iq for emacs-devel@gnu.org; Wed, 20 May 2015 16:02:23 -0400 Original-Received: by lbbqq2 with SMTP id qq2so2777904lbb.3 for ; Wed, 20 May 2015 13:02:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:cc:content-type; bh=K2ZIU7ifsO+bE8ergyPyMEtqYVVjnlYFFGX+YptKzVo=; b=KfyNXu97NJfVm1ZeFbP45FFxNwlU3Cj1zZ+dGjZPyttv7TZOSaJP/svCtZ9Hj51iZJ bHqWgdBM9HJjHqmW3a/uQDjcl5eElZ8FX9BNMDL/SfcS7or3DaKmcO+pTxySW6NtHFp7 nzxp0I2+tAWy1YIUJnvwjBMjY85abbGn93NzNVHdzfqRHwrgBwj2v1XHSB8t7QARJwgT JTWGJY8n58mIJ3j8z2QLVaRYwzRla3U5ZaPHuZCmAWWBSwOpvBC5SeX5HNu1OIreoe16 L7/EnIkrTaJf+CleGY2hGHu9/baA1BwU8h1rF08rQYXuZOuMo+nJZxovW8J9CTkAPssQ Boiw== X-Received: by 10.152.203.233 with SMTP id kt9mr5403608lac.21.1432152142751; Wed, 20 May 2015 13:02:22 -0700 (PDT) Original-Received: by 10.25.150.1 with HTTP; Wed, 20 May 2015 13:02:22 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: uFjw5TvGZxS8fvtv1ahKEy-T0I4 X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::232 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:186681 Archived-At: Here is the patch that I'm about to push. Is it OK that it removes some arguments from some functions? I think it is, since it was never on a stable build, but I'm asking anyway. Subject: [PATCH] * lisp/emacs-lisp/package.el: Revert async package transactions (package-menu-async): Update doc. (package-install-from-archive, package-download-transaction) (package-install, package-menu--perform-transaction) (package-menu-execute): Remove asynchronous functionality. --- lisp/emacs-lisp/package.el | 93 ++++++++++++++++------------------------------ 1 file changed, 32 insertions(+), 61 deletions(-) diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el index 1ab1b4b..faab5c9 100644 --- a/lisp/emacs-lisp/package.el +++ b/lisp/emacs-lisp/package.el @@ -350,8 +350,9 @@ a sane initial value." (defcustom package-menu-async t "If non-nil, package-menu will use async operations when possible. -This includes refreshing archive contents as well as installing -packages." +Currently, only the refreshing of archive contents supports +asynchronous operations. Package transactions are still done +synchronously." :type 'boolean :version "25.1") @@ -1712,31 +1713,26 @@ if all the in-between dependencies are also in PACKAGE-LIST." "Return the archive containing the package NAME." (cdr (assoc (package-desc-archive desc) package-archives))) -(defun package-install-from-archive (pkg-desc &optional async callback) - "Download and install a tar package. -If ASYNC is non-nil, perform the download asynchronously. -If CALLBACK is non-nil, call it with no arguments once the -operation is done." +(defun package-install-from-archive (pkg-desc) + "Download and install a tar package." ;; This won't happen, unless the archive is doing something wrong. (when (eq (package-desc-kind pkg-desc) 'dir) (error "Can't install directory package from archive")) (let* ((location (package-archive-base pkg-desc)) (file (concat (package-desc-full-name pkg-desc) (package-desc-suffix pkg-desc)))) - (package--with-work-buffer-async location file async + (package--with-work-buffer location file (if (or (not package-check-signature) (member (package-desc-archive pkg-desc) package-unsigned-archives)) ;; If we don't care about the signature, unpack and we're ;; done. - (progn (let ((save-silently async) - (inhibit-message async)) - (package-unpack pkg-desc)) - (funcall callback)) + (let ((save-silently t)) + (package-unpack pkg-desc)) ;; If we care, check it and *then* write the file. (let ((content (buffer-string))) (package--check-signature - location file content async + location file content nil ;; This function will be called after signature checking. (lambda (&optional good-sigs) (unless (or good-sigs (eq package-check-signature 'allow-unsigned)) @@ -1746,8 +1742,7 @@ operation is done." (package-desc-name pkg-desc))) ;; Signature checked, unpack now. (with-temp-buffer (insert content) - (let ((save-silently async) - (inhibit-message async)) + (let ((save-silently t)) (package-unpack pkg-desc))) ;; Here the package has been installed successfully, mark it as ;; signed if appropriate. @@ -1763,9 +1758,7 @@ operation is done." (setf (package-desc-signed pkg-desc) t) ;; Update the new (activated) pkg-desc as well. (when-let ((pkg-descs (cdr (assq (package-desc-name pkg-desc) package-alist)))) - (setf (package-desc-signed (car pkg-descs)) t))) - (when (functionp callback) - (funcall callback))))))))) + (setf (package-desc-signed (car pkg-descs)) t)))))))))) (defun package-installed-p (package &optional min-version) "Return true if PACKAGE, of MIN-VERSION or newer, is installed. @@ -1786,25 +1779,13 @@ If PACKAGE is a package-desc object, MIN-VERSION is ignored." ;; Also check built-in packages. (package-built-in-p package min-version)))) -(defun package-download-transaction (packages &optional async callback) +(defun package-download-transaction (packages) "Download and install all the packages in PACKAGES. PACKAGES should be a list of package-desc. -If ASYNC is non-nil, perform the downloads asynchronously. -If CALLBACK is non-nil, call it with no arguments once the -entire operation is done. - This function assumes that all package requirements in PACKAGES are satisfied, i.e. that PACKAGES is computed using `package-compute-transaction'." - (cond - (packages (package-install-from-archive - (car packages) - async - (lambda () - (package-download-transaction (cdr packages)) - (when (functionp callback) - (funcall callback))))) - (callback (funcall callback)))) + (mapc #'package-install-from-archive packages)) (defun package--ensure-init-file () "Ensure that the user's init file has `package-initialize'. @@ -1857,16 +1838,13 @@ add a call to it along with some explanatory comments." (setq package--init-file-ensured t)) ;;;###autoload -(defun package-install (pkg &optional dont-select async callback) +(defun package-install (pkg &optional dont-select) "Install the package PKG. PKG can be a package-desc or the package name of one the available packages in an archive in `package-archives'. Interactively, prompt for its name. If called interactively or if DONT-SELECT nil, add PKG to `package-selected-packages'. -If ASYNC is non-nil, perform the downloads asynchronously. -If CALLBACK is non-nil, call it with no arguments once the -entire operation is done. If PKG is a package-desc and it is already installed, don't try to install it but still mark it as selected." @@ -1899,9 +1877,8 @@ to install it but still mark it as selected." (package-compute-transaction (list pkg) (package-desc-reqs pkg))) (package-compute-transaction () (list (list pkg)))))) - (package-download-transaction transaction async callback) - (message "`%s' is already installed" (package-desc-full-name pkg)) - (funcall callback))) + (package-download-transaction transaction) + (message "`%s' is already installed" (package-desc-full-name pkg)))) (defun package-strip-rcs-id (str) "Strip RCS version ID from the version string STR. @@ -2938,30 +2915,25 @@ nil, but not both." (package-menu--list-to-prompt upg) "? ")))) -(defun package-menu--perform-transaction (install-list delete-list &optional async) - "Install packages in INSTALL-LIST and delete DELETE-LIST. -If ASYNC is non-nil, perform the installation downloads -asynchronously." +(defun package-menu--perform-transaction (install-list delete-list) + "Install packages in INSTALL-LIST and delete DELETE-LIST." ;; While there are packages to install, call `package-install' on ;; the next one and defer deletion to the callback function. (if install-list - (let* ((pkg (car install-list)) - (rest (cdr install-list)) - ;; Don't mark as selected if it's a new version of an - ;; installed package. - (dont-mark (and (not (package-installed-p pkg)) - (package-installed-p - (package-desc-name pkg))))) + (dolist (pkg install-list) (package-install - pkg dont-mark async - (lambda () (package-menu--perform-transaction rest delete-list async)))) - (let ((inhibit-message async)) - ;; Once there are no more packages to install, proceed to - ;; deletion. - (dolist (elt (package--sort-by-dependence delete-list)) - (condition-case-unless-debug err - (package-delete elt) - (error (message (cadr err)))))) + ;; Don't mark as selected if it's a new version of an + ;; installed package. + pkg (and (not (package-installed-p pkg)) + (package-installed-p + (package-desc-name pkg))))) + ;; Once there are no more packages to install, proceed to + ;; deletion. + (dolist (elt (package--sort-by-dependence delete-list)) + (condition-case-unless-debug err + (let ((inhibit-message t)) + (package-delete elt)) + (error (message (cadr err))))) (message "Transaction done") (when package-selected-packages (when-let ((removable (package--removable-packages))) @@ -2997,8 +2969,7 @@ Optional argument NOQUERY non-nil means do not ask the user to confirm." (package-menu--prompt-transaction-p install-list delete-list)) (message "Transaction started") ;; This calls `package-menu--generate' after everything's done. - (package-menu--perform-transaction - install-list delete-list package-menu-async)))) + (package-menu--perform-transaction install-list delete-list)))) (defun package-menu--version-predicate (A B) (let ((vA (or (aref (cadr A) 1) '(0))) -- 2.4.1