From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id uJJQI4b0s2PgqgAAbAwnHQ (envelope-from ) for ; Tue, 03 Jan 2023 10:25:26 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id sIZ0Iob0s2MfIwAAG6o9tA (envelope-from ) for ; Tue, 03 Jan 2023 10:25:26 +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 28E781C5A8 for ; Tue, 3 Jan 2023 10:25:23 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pCdT3-0003D1-4M; Tue, 03 Jan 2023 04:20: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 1pCdT1-0003CR-AB for guix-devel@gnu.org; Tue, 03 Jan 2023 04:20: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 1pCdSy-0004OA-I5 for guix-devel@gnu.org; Tue, 03 Jan 2023 04:20:18 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1672737613; cv=none; d=zohomail.com; s=zohoarc; b=aw6mQY6fFkn+zcBheDhDQfs0JTkiGYuMEfaCm5MA2a3ewUS/5+HItvTMl/4bUAjECQZW876xs05/FWc3ftGsyiyVh7mvNteaI3Exfq7dc1qLWQyaHkGIADDmPKUyu5yVNdtq96G2XTIBwvj+7WLAGmwDaAwulgGOkOTYF0w2EGw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672737613; h=Content-Type:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=9D1y/g6hgmUUNoaaHtumrPwXrnENYBp/8zA1gspbQsQ=; b=TGo+q4NqSTVIG9rI4oASvNdBYuzpobgT+DRGhfC3uS6eQNAbZqhl1RE36l8wCbHAjSi0ZBtuNFhgX6lwi/qvpt3D6zs2DA/X8d53GlKEUbUS49U7sEgBNLbNMdQaWkNxoiRsZ0NgnYFu8y3v6K2KaDmX/A96z0HGnGVHDgSzuyI= 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=1672737613; 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=9D1y/g6hgmUUNoaaHtumrPwXrnENYBp/8zA1gspbQsQ=; b=K0KE677pFiTUvIEoWHFKoJ08OtJNLP+mou1hQxSvkUFm/+kSrGbODw+VZDV5eQFx jQz6FP1lD3p4nYbV0dsX14J9PHpYYV3EXJzaEVqMjcSyGAKl1SXF8UcyEx+UBLINV9C sQbdWqxBCxLervqy4c9cLk/FN0dTLptYhOsGjNYE= Received: from localhost (75-111-142-46.pool.kielnet.net [46.142.111.75]) by mx.zohomail.com with SMTPS id 1672737610600726.2604365375454; Tue, 3 Jan 2023 01:20:10 -0800 (PST) References: <874jtb7icl.fsf@elephly.net> <875ydp5ctv.fsf@elephly.net> <871qod5b4v.fsf@elephly.net> <87wn644u9y.fsf@elephly.net> <12f602da-16fb-0c19-1fe2-8e4c9a921868@crazy-compilers.com> 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: Tue, 03 Jan 2023 10:16:41 +0100 In-reply-to: <12f602da-16fb-0c19-1fe2-8e4c9a921868@crazy-compilers.com> 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: <87k0243rg8.fsf@elephly.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Zoho-Virus-Status: 1 X-ZohoMailClient: External 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-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1672737926; 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=9D1y/g6hgmUUNoaaHtumrPwXrnENYBp/8zA1gspbQsQ=; b=Jnn6r23nq+408S8E830KBsD3XZWEyMAg+rrdA5VAbjROM6n3ahr311rQ8EmS+i49fMY+gS 20BQf6nxjR84ssWJxqJuZZ41g970QnFWu3q17rLFfmrBuphK4K69hjpLfzHfscgFy/z+57 02uxPGwswNhQxLiBQ4KmCJJUE4fY1FQdlOBEOtZq+LMVkdaVmLbnWeMyX6mJ4ZKcZtVPQf sChx4Fgvo0hs03B4QGmDQl+NWb378lIx+Tyxhgr4CK26ES2zpBaSgF0l0F16rvsMSkL2X9 zwwZT0DwHozP1UIUjbrRRVYD5QYkfl77vFOnZfZqqLMrz40JuouAMf2fPLcOmQ== ARC-Authentication-Results: i=2; aspmx1.migadu.com; dkim=pass header.d=elephly.net header.s=zoho header.b=K0KE677p; arc=pass ("zohomail.com:s=zohoarc:i=1"); 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-Seal: i=2; s=key1; d=yhetil.org; t=1672737926; a=rsa-sha256; cv=pass; b=hDeoYkKLcDLKnNXkiAjIDRCm+XrMW/ArlGeOaskPDEDJezZYefD3XmgUXj0Y+Ye6fYTEaC 710PcT4twshKaMJGelamCaqSr/HEOx+s+APdFUFM5h32a6rVKOpM6kuFcZyZe6aXNUOOt8 0IJVgzcF5b7fBkK5MSmAsQ7PytjhbNKu7XwHH2NdlXURlJThUrRfGTrdisWDkv46YLMcyd fWgum9XRfLnsfjHjDdzqBxnMuOvNIVGu6o7AUo1AXGnXeiJlUHdcfe1xonYVpu6h35u5JE BJSJdLtC2NHv4reGOlDLQ7pBJhIwvu+V4Ghd+QFy0nczXrGW5IFcsud0QQ2eaw== X-Spam-Score: -6.57 X-Migadu-Queue-Id: 28E781C5A8 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=elephly.net header.s=zoho header.b=K0KE677p; arc=pass ("zohomail.com:s=zohoarc:i=1"); 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 X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -6.57 X-TUID: ToUDuW/uIAP3 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Hartmut, > Am 02.01.23 um 20:17 schrieb Ricardo Wurmus: > > Thanks for providing the patch. For me this looks huge and hard to > maintain. > > =E2=80=9CHard to maintain=E2=80=9D? How so? > > For me this double structure is hard to understand and thus to maintain. = YMMV. Okay. Here=E2=80=99s something simpler using =E2=80=9Cpartition=E2=80=9D: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=refresh-w.diff commit 96fb123832b262a3453fe1b7646758da235a343e Author: Ricardo Wurmus Date: Tue Jan 3 10:14:52 2023 +0100 WIP diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index e0b94ce48d..bbda2df35a 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,7 +220,7 @@ (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) @@ -244,17 +244,18 @@ (define args-packages (some ;user-specified packages some))) - (define packages + (define packages+update-specs (match (assoc-ref opts 'manifest) - (#f args-packages) + (#f args-packages+update-specs) ((? string? file) (packages-from-manifest file)))) (if (assoc-ref opts 'recursive?) + (let ((packages update-specs (partition package? packages+update-specs))) (mlet %store-monad ((edges (node-edges %bag-node-type (all-packages)))) - (return (node-transitive-edges packages edges))) + (return (append (node-transitive-edges packages edges) update-specs)))) (with-monad %store-monad - (return packages)))) + (return packages+update-specs)))) ;;; @@ -561,12 +562,13 @@ (define (options->updaters opts) (with-error-handling (with-store store (run-with-store store - (mlet %store-monad ((update-specs (options->update-specs opts))) + (mlet %store-monad ((packages+update-specs (options->packages+update-specs opts))) + (let ((packages update-specs (partition package? packages+update-specs))) (cond (list-dependent? - (list-dependents (map update-spec-package update-specs))) + (list-dependents (append packages (map update-spec-package update-specs)))) (list-transitive? - (list-transitive (map update-spec-package update-specs))) + (list-transitive (append packages (map update-spec-package update-specs)))) (update? (parameterize ((%openpgp-key-server (or (assoc-ref opts 'key-server) @@ -587,9 +589,18 @@ (define (options->updaters opts) #:key-download key-download #:warn? warn?)) update-specs) + (for-each + (lambda (package) + (update-package store + package + #false + updaters + #:key-download key-download + #:warn? warn?)) + packages) (return #t))) (else (for-each (cut check-for-package-update <> updaters #:warn? warn?) - (map update-spec-package update-specs)) - (return #t))))))))) + (append packages (map update-spec-package update-specs))) + (return #t)))))))))) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable (This patch ignores white-space.)=20 Here=E2=80=99s the patch with white-space changes: --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=refresh.diff commit 96fb123832b262a3453fe1b7646758da235a343e Author: Ricardo Wurmus Date: Tue Jan 3 10:14:52 2023 +0100 WIP diff --git a/guix/scripts/refresh.scm b/guix/scripts/refresh.scm index e0b94ce48d..bbda2df35a 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,7 +220,7 @@ (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) @@ -244,17 +244,18 @@ (define args-packages (some ;user-specified packages some))) - (define packages + (define packages+update-specs (match (assoc-ref opts 'manifest) - (#f args-packages) + (#f args-packages+update-specs) ((? string? file) (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))) + (let ((packages update-specs (partition package? packages+update-specs))) + (mlet %store-monad ((edges (node-edges %bag-node-type + (all-packages)))) + (return (append (node-transitive-edges packages edges) update-specs)))) (with-monad %store-monad - (return packages)))) + (return packages+update-specs)))) ;;; @@ -561,35 +562,45 @@ (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))) + (let ((packages update-specs (partition package? packages+update-specs))) + (cond + (list-dependent? + (list-dependents (append packages (map update-spec-package update-specs)))) + (list-transitive? + (list-transitive (append packages (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 (package) + (update-package store + package + #false + updaters + #:key-download key-download + #:warn? warn?)) + packages) + (return #t))) + (else + (for-each (cut check-for-package-update <> updaters + #:warn? warn?) + (append packages (map update-spec-package update-specs))) + (return #t)))))))))) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable I can=E2=80=99t say whether this is better than your proposal as I=E2=80=99= m biased, so maybe let=E2=80=99s get someone else=E2=80=99s opinion on this before mergi= ng either of them. I have a slight preference for this approach over wrapping and unwrapping. Ideally we would avoid mixing up packages and update specs in the first place, but that=E2=80=99s not easily accomplished now. --=20 Ricardo --=-=-=--