From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Seb Newsgroups: gmane.emacs.help Subject: Re: upgrading packages via script Date: Wed, 27 Sep 2017 17:39:51 -0500 Organization: Church of Emacs Message-ID: <873777bwaw.fsf@gmail.com> References: <87poadcxx2.fsf@gmail.com> <877ewkz38p.fsf@web.de> <878th0yx41.fsf@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1506552046 30110 195.159.176.226 (27 Sep 2017 22:40:46 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Wed, 27 Sep 2017 22:40:46 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 28 00:40:38 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dxL0O-0007BP-9d for geh-help-gnu-emacs@m.gmane.org; Thu, 28 Sep 2017 00:40:36 +0200 Original-Received: from localhost ([::1]:56594 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxL0V-0004G4-Op for geh-help-gnu-emacs@m.gmane.org; Wed, 27 Sep 2017 18:40:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60189) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dxL00-0004FX-8R for help-gnu-emacs@gnu.org; Wed, 27 Sep 2017 18:40:13 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dxKzw-0006Ni-A0 for help-gnu-emacs@gnu.org; Wed, 27 Sep 2017 18:40:12 -0400 Original-Received: from [195.159.176.226] (port=38854 helo=blaine.gmane.org) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dxKzw-0006Ml-2b for help-gnu-emacs@gnu.org; Wed, 27 Sep 2017 18:40:08 -0400 Original-Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1dxKzj-0004SI-FU for help-gnu-emacs@gnu.org; Thu, 28 Sep 2017 00:39:55 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 45 Original-X-Complaints-To: usenet@blaine.gmane.org Cancel-Lock: sha1:uxXj+2em/e+E4O/fVfM7sRgMitQ= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 195.159.176.226 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:114447 Archived-At: On Wed, 27 Sep 2017 10:33:50 -0500, Seb wrote: > On Wed, 27 Sep 2017 15:21:26 +0200, > Michael Heerdegen wrote: >> Seb writes: >>> ╭───── [ upgrade_packages.el ] │ (setq package-archives │ (quote │ >>> (("gnu" . "http://elpa.gnu.org/packages/") │ ("melpa" >>> . "http://melpa.org/packages/") │ ("marmalade" >>> . "https://marmalade-repo.org/packages/") │ ("org" >>> . "http://orgmode.org/elpa/")))) │ (package-initialize) │ >>> (list-packages) │ (package-menu-mark-upgrades) │ >>> (package-menu-execute t) ╰───── >> My first guess would be that in nature, one has to wait until the >> package manager has refreshed the view before one can select packages >> to upgrade. Your script finishes before that because updating the >> package list happens asynchronously. > That was also my first guess, but in that case shouldn't > (package-menu-execute t) fail altogether? Well, I found the variable package-menu-async, which if toggled answers my question. If set to nil in the script, then packages to upgrade are found successfully against the latest candidates. If non-nil, as by default, then things go wrong as shown, so answer is no. And the working script boils down to: ╭───── [ upgrade_packages.el ] │ (setq package-archives │ (quote │ (("gnu" . "http://elpa.gnu.org/packages/") │ ("melpa" . "http://melpa.org/packages/") │ ("marmalade" . "https://marmalade-repo.org/packages/") │ ("org" . "http://orgmode.org/elpa/"))) │ package-menu-async nil) │ (list-packages) │ (package-menu-mark-upgrades) │ (package-menu-execute t) ╰───── -- Seb