From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id gFNqDeHZsmNGHwEAbAwnHQ (envelope-from ) for ; Mon, 02 Jan 2023 14:19:29 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id OHk8DeHZsmM7owAAauVa8A (envelope-from ) for ; Mon, 02 Jan 2023 14:19:29 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9309D1051D for ; Mon, 2 Jan 2023 14:19:28 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pCKhp-00014L-8J; Mon, 02 Jan 2023 08:18:21 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pCKhQ-00012d-Fv for guix-devel@gnu.org; Mon, 02 Jan 2023 08:18:19 -0500 Received: from sender4-of-o50.zoho.com ([136.143.188.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pCKhE-0001wr-6k for guix-devel@gnu.org; Mon, 02 Jan 2023 08:17:48 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1672665445; cv=none; d=zohomail.com; s=zohoarc; b=FadBwLf89V3qaBAGMF8rz+jauve0NlbwBPwYVpOexMPwkY2o7FHA5/kcupdSOM8WTikrepd2CwRQ4KTf2JCvypJK5yXREWXu1aioKQEiXDbOrnxLCaREhUrdiB5iD2FSPCMvXcCGONfUMXHgoKyAJIqJDQSndhE5DOArxssLHhU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672665445; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=GQv5tac9J/9b8/DWU12akXHuXb3IPE7WGwAwKeF4oQs=; b=Pv7tqIIj3ES6pr0rH1/oDKteVu1hoMmid5/KnR2OQ0JYmlaeHfhtV6HjyGQ2gK1NU5XhEDZcUzNdMV5B/wrp8Sd8p8om3sBK2Um+jzNmpU7Nj7cFFB8Bgtkc+jdwzKMt1J+Qen2i3jn4OnxMy/SBkpMFZG1F3CHQ3hQQ60v/xls= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=elephly.net; spf=pass smtp.mailfrom=rekado@elephly.net; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1672665445; s=zoho; d=elephly.net; i=rekado@elephly.net; h=References:From:From:To:To:Cc:Cc:Subject:Subject:Date:Date:In-reply-to:Message-ID:MIME-Version:Content-Type:Message-Id:Reply-To; bh=GQv5tac9J/9b8/DWU12akXHuXb3IPE7WGwAwKeF4oQs=; b=LfND0IF4Yo+qEetQC6HiLpY8WEPEyCPCIEL12BVKLUnwSkSy160xMphefYubFh6W n7d3jjIIDvjgi6/luaFocN/ldy7HfPM0j5QVSpsvbJGHBQtnYlUSHDPtMW/9sBqQZrv lKb7dx838wk6WZgfYgVb6IvWPMQjyBeSixqIynXQ= Received: from localhost (75-111-142-46.pool.kielnet.net [46.142.111.75]) by mx.zohomail.com with SMTPS id 1672665443471572.4449377354628; Mon, 2 Jan 2023 05:17:23 -0800 (PST) References: <874jtb7icl.fsf@elephly.net> <875ydp5ctv.fsf@elephly.net> User-agent: mu4e 1.8.13; emacs 28.2 From: Ricardo Wurmus To: Hartmut Goebel Cc: guix-devel@gnu.org Subject: Re: All updaters are broken Date: Mon, 02 Jan 2023 14:16:05 +0100 In-reply-to: <875ydp5ctv.fsf@elephly.net> X-URL: https://elephly.net X-PGP-Key: https://elephly.net/rekado.pubkey X-PGP-Fingerprint: BCA6 89B6 3655 3801 C3C6 2150 197A 5888 235F ACAC Message-ID: <871qod5b4v.fsf@elephly.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-ZohoMailClient: External X-Zoho-Virus-Status: 1 Received-SPF: pass client-ip=136.143.188.50; envelope-from=rekado@elephly.net; helo=sender4-of-o50.zoho.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: guix-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+larch=yhetil.org@gnu.org Sender: guix-devel-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=2; s=key1; d=yhetil.org; t=1672665569; a=rsa-sha256; cv=pass; b=bhqimVIikGhZ1GQ+pmNAgc8174/BIjZiCiCMP4WHLPqW6yllqdZtNdifA+pcrH3/+ZperO aSe/JbLbTiEDkNp38Gu9PaoFuiKO2b5qcfJbb29v540zFaGM7EITDyrrsnnPrGGGw1ygNc wXnU2Tk/18buYdcb4fpHz0Hz3lMSP3wkKwo6/1syKFTyCI6uEWFuAiboP4EB44zl88SZjz 3FbSrRJ30Rpa7StR/GjTnVXtyW6CFrHuksboV2HC+I6hBmbngy9fztKaijmPhSO5ChEXsH B7vQhbkeIzFAe7h1amuIztOBVRbIGeudy/lyGrELXQ9O+GqB74B20Ya4BKdlcg== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=elephly.net header.s=zoho header.b=LfND0IF4; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=none; arc=pass ("zohomail.com:s=zohoarc:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1672665569; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=GQv5tac9J/9b8/DWU12akXHuXb3IPE7WGwAwKeF4oQs=; b=XbcPHK8hLJ6XOa3wvYuIpMg+CoYRQgfHGibKGEY/EFtaG5QSma9eZu/P/iQ1mWVc6GFMMI MWYIvGhBF8Kr8nBmi+auvo7D8q4vRgq8/fhw+H3EjQpjj+dhxSafemJgvSIf5UAs5XfT/g G8wfbl+iMOF9tMtKMT7sZ6uZtVfcbdPX3r6TkOM5VfAgmAZ5N5djgHXFqhYiaT0zN7sWRZ Hb7D8bol33gRxIkMzgoI7ZBdoPm3PdoM1tRuRcmQuXKYKwESWaLn9bTcv6Gz7xMOJ7uE9t KkCI9d7bRXZ/ositg4ySeqsyfbsZht1Pct2XhpEm/4hmDor42/3qikRz/PRXMg== X-Spam-Score: -8.35 X-Migadu-Queue-Id: 9309D1051D Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=elephly.net header.s=zoho header.b=LfND0IF4; spf=pass (aspmx1.migadu.com: domain of "guix-devel-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-devel-bounces+larch=yhetil.org@gnu.org"; dmarc=none; arc=pass ("zohomail.com:s=zohoarc:i=1") X-Migadu-Scanner: scn0.migadu.com X-Migadu-Spam-Score: -8.35 X-TUID: FwlUGCl9Ak4j --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ricardo Wurmus writes: > It=E2=80=99s a bit messy because options->update-specs is poorly typed no= w. We > could also have it return a compound value (or a union type) with a list > of values and a list of values, and process the > components separately. Attached is a crude implementation of that. I just consed the lists together instead of returning multiple values, because the compound value is to be used inside the store monad where we can=E2=80=99t easily ac= cess multiple values. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=refresh.diff diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index e0b94ce48d..b2e9e81299 100644 --- a/guix/scripts/refresh.scm +++ b/guix/scripts/refresh.scm @@ -183,9 +183,9 @@ (define (show-help) (newline) (show-bug-report-information)) -(define (options->update-specs opts) - "Return the list of packages requested by OPTS, honoring options like -'--recursive'." +(define (options->packages+update-specs opts) + "Return the list of packages and update specs requested by OPTS, honoring +options like '--recursive'." (define core-package? (let* ((input->package (match-lambda ((name (? package? package) _ ...) package) @@ -220,15 +220,15 @@ (define (keep-newest package lst) (_ (cons package lst))))) - (define args-packages + (define args-packages+update-specs ;; Packages explicitly passed as command-line arguments. (match (filter-map (match-lambda (('argument . spec) ;; Take either the specified version or the ;; latest one. - (update-specification->update-spec spec)) + (cons '() (update-specification->update-spec spec))) (('expression . exp) - (read/eval-package-expression exp)) + (cons (read/eval-package-expression exp) '())) (_ #f)) opts) (() ;default to all packages @@ -236,25 +236,29 @@ (define args-packages ('core core-package?) ('non-core (negate core-package?)) (_ (const #t))))) - (fold-packages (lambda (package result) - (if (select? package) - (keep-newest package result) - result)) - '()))) + (cons (fold-packages (lambda (package result) + (if (select? package) + (keep-newest package result) + result)) + '()) + '()))) (some ;user-specified packages some))) - (define packages + (define packages+update-specs (match (assoc-ref opts 'manifest) - (#f args-packages) - ((? string? file) (packages-from-manifest file)))) + (#f args-packages+update-specs) + ((? string? file) (cons (packages-from-manifest file) '())))) (if (assoc-ref opts 'recursive?) - (mlet %store-monad ((edges (node-edges %bag-node-type - (all-packages)))) - (return (node-transitive-edges packages edges))) + (match packages+update-specs + ((packages . update-specs) + (mlet %store-monad ((edges (node-edges %bag-node-type + (all-packages)))) + (return (values (node-transitive-edges packages edges) + update-specs))))) (with-monad %store-monad - (return packages)))) + (return packages+update-specs)))) ;;; @@ -561,35 +565,47 @@ (define (options->updaters opts) (with-error-handling (with-store store (run-with-store store - (mlet %store-monad ((update-specs (options->update-specs opts))) - (cond - (list-dependent? - (list-dependents (map update-spec-package update-specs))) - (list-transitive? - (list-transitive (map update-spec-package update-specs))) - (update? - (parameterize ((%openpgp-key-server - (or (assoc-ref opts 'key-server) - (%openpgp-key-server))) - (%gpg-command - (or (assoc-ref opts 'gpg-command) - (%gpg-command))) - (current-keyring - (or (assoc-ref opts 'keyring) - (string-append (config-directory) - "/upstream/trustedkeys.kbx")))) - (for-each - (lambda (update) - (update-package store - (update-spec-package update) - (update-spec-version update) - updaters - #:key-download key-download - #:warn? warn?)) - update-specs) - (return #t))) - (else - (for-each (cut check-for-package-update <> updaters - #:warn? warn?) - (map update-spec-package update-specs)) - (return #t))))))))) + (mlet %store-monad ((packages+update-specs (options->packages+update-specs opts))) + (match packages+update-specs + ((pkgs . update-specs) + (pk 'pkgs (length pkgs) 'specs (length update-specs)) + (cond + (list-dependent? + (list-dependents (append pkgs (map update-spec-package update-specs)))) + (list-transitive? + (list-transitive (append pkgs (map update-spec-package update-specs)))) + (update? + (parameterize ((%openpgp-key-server + (or (assoc-ref opts 'key-server) + (%openpgp-key-server))) + (%gpg-command + (or (assoc-ref opts 'gpg-command) + (%gpg-command))) + (current-keyring + (or (assoc-ref opts 'keyring) + (string-append (config-directory) + "/upstream/trustedkeys.kbx")))) + (for-each + (lambda (update) + (update-package store + (update-spec-package update) + (update-spec-version update) + updaters + #:key-download key-download + #:warn? warn?)) + update-specs) + (for-each + (lambda (pkg) + (update-package store + pkg + #false + updaters + #:key-download key-download + #:warn? warn?)) + pkgs) + (return #t))) + (else + (for-each (cut check-for-package-update <> updaters + #:warn? warn?) + (map update-spec-package update-specs)) + (return #t))))))))))) --=-=-= Content-Type: text/plain -- Ricardo --=-=-=--