From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms13.migadu.com with LMTPS id 4N/9BYKVQGfwDgAAe85BDQ:P1 (envelope-from ) for ; Fri, 22 Nov 2024 14:30:26 +0000 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id 4N/9BYKVQGfwDgAAe85BDQ (envelope-from ) for ; Fri, 22 Nov 2024 15:30:26 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="VxSO3/4s"; dkim=fail ("headers rsa verify failed") header.d=greghogan-com.20230601.gappssmtp.com header.s=20230601 header.b=vFh++7Gi; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1732285825; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=1V5+H53BIfpIVQMYDL+X9jt66teXyyJ9gA1oiNR9W00=; b=XvFiaE4zvv+JVI4Qp62Z6zCjJIolcCxfX0Erx+MmxsbCpeOA3qwIzrLKknlwL9ZVzDJZkD nRh6mpgOJRQch9TcIOP2uYEHbua9wi+YsUixlJDVUJW+RuiIu+tRWylUGp6WBUf0BG8DCj Q7DOlbHALXye1hsAWM/r7ooEFzpRUNu+7gctts57E8K3ZbYy2nmMJJz8tXvq+iZlPe0KgH IZPja3oJ/MR1viVJBfWx8avUyyjy1ZpN3aVCyXt1eVOQpResftJgjnrR8bAHPlV1OH999m A2VrTQqMUNsTjar1Fzmazn4uMX5JXZ/mNpKZVldZ9JwdDHQ2Rc6K2FDpDFMvYQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=debbugs.gnu.org header.s=debbugs-gnu-org header.b="VxSO3/4s"; dkim=fail ("headers rsa verify failed") header.d=greghogan-com.20230601.gappssmtp.com header.s=20230601 header.b=vFh++7Gi; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=none ARC-Seal: i=1; s=key1; d=yhetil.org; t=1732285825; a=rsa-sha256; cv=none; b=fhoZ7KaOPFV33Lby39AYkeAM0L1VQ+46Grgd+AriRm1tLLpUW5Jd0qIuWqTl5cduVD07CT r8xaOG4sscINFphFqbe/8OSXPTma4xWS33z6jxH5VQtN7Z4STOO+7HDha3hb5tbKP8PV9G YJCHRHo0heZwJqE63QaAWGNaSUM43T/X/+IKRzzeMwbKaf6ERpPW9QGdmFqueEF4dp4YCj zl50vT18sN7xpn+uCvbBpGM7Mi3yTIYZJlM41XHBxwwMffv2ifDAqhOxe+gAYEA32JDMjQ Htyboptdr0leRfAQpo9Ds59VwgKLtYQc5LF7rtdNzefnFY4rKNuZd1wy9XELIQ== 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 BEF5A46610 for ; Fri, 22 Nov 2024 15:30:24 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tEUfk-0003tf-Dm; Fri, 22 Nov 2024 09:30:12 -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 1tEUfg-0003tH-28 for guix-patches@gnu.org; Fri, 22 Nov 2024 09:30:08 -0500 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tEUff-0006TC-L1; Fri, 22 Nov 2024 09:30:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=1V5+H53BIfpIVQMYDL+X9jt66teXyyJ9gA1oiNR9W00=; b=VxSO3/4shrQqhumGzma/4KrQlN3UcmOkIo86v8vi4H1498K/rDrdb3uePfbOijxf6dMsUMw0xln8ZvQyaxEmbkp3unz5TMXGnbQe6ysLg7ceAFlxy2HAO7cVjJDtKzc8FVM5WrNxGedFWucBUYo0K38ICf28k7IPYqmQUC9zi8LknIPqHEjYl+XDCdR5njSBkFxJPZyzjfTytJdNq7A6DKc4DCAnM1JI7yJfZS7BtFtDv6yeyay2xhCEKlylNr9tGYL/MQdQySOZzlhurbANNM/CXwX+tOucwY1W+kMpMdR2+/XdbJDgBqOsRb0FOWhdj3OEWwnQ8bH+j1gPHcuaWw==; Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tEUfb-00052G-3B; Fri, 22 Nov 2024 09:30:03 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#74475] [PATCH core-team] packages: 'package-input-rewriting/spec' optionally replace hidden. Resent-From: Greg Hogan Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, maxim.cournoyer@gmail.com, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Fri, 22 Nov 2024 14:30:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74475 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 74475@debbugs.gnu.org Cc: Greg Hogan , Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-To: guix-patches@gnu.org X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?UTF-8?Q?Court=C3=A8s?= , Mathieu Othacehe , Maxim Cournoyer , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by submit@debbugs.gnu.org id=B.173228579019308 (code B ref -1); Fri, 22 Nov 2024 14:30:02 +0000 Received: (at submit) by debbugs.gnu.org; 22 Nov 2024 14:29:50 +0000 Received: from localhost ([127.0.0.1]:53771 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tEUfO-00051M-AV for submit@debbugs.gnu.org; Fri, 22 Nov 2024 09:29:50 -0500 Received: from lists.gnu.org ([209.51.188.17]:34882) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tEUfN-00051F-3T for submit@debbugs.gnu.org; Fri, 22 Nov 2024 09:29:49 -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 1tEUfM-0003pJ-Sr for guix-patches@gnu.org; Fri, 22 Nov 2024 09:29:48 -0500 Received: from mail-qk1-x72b.google.com ([2607:f8b0:4864:20::72b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tEUfK-0006GJ-Ka for guix-patches@gnu.org; Fri, 22 Nov 2024 09:29:48 -0500 Received: by mail-qk1-x72b.google.com with SMTP id af79cd13be357-7b14df8f821so156123185a.2 for ; Fri, 22 Nov 2024 06:29:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=greghogan-com.20230601.gappssmtp.com; s=20230601; t=1732285785; x=1732890585; darn=gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=1V5+H53BIfpIVQMYDL+X9jt66teXyyJ9gA1oiNR9W00=; b=vFh++7GiIk2cPoLb9Oul+bbgBUBnMNr4Przzqh3NlrEGpLvMSFc1FkSGdRIt7elbBR hOd8GlOPdGsUt/5AKA8kk9Zp0LKxKzkP6GWs/zLrluzUEAqfOpfNxteyk8QrA/YC3ZIi mlD1OnwP7isrCbtj5jjL0C5U0QRvo+nigI/8hopWKST2sJlu5AOcclsQTR0LhPZdnImf QXm/Bf4gClgvrPSA5HRuWKRQhs5rrK8UkV87V1T1hJrY23i84cNf3AVS1iwjMilZBXsC m9U4ECiQAkogGb+y60rLEe6IhXY4+5Up03WGTcj9l6sFIk0e6abNpDLVMjkzu/gTWWJA 9RHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732285785; x=1732890585; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=1V5+H53BIfpIVQMYDL+X9jt66teXyyJ9gA1oiNR9W00=; b=X/UG+O4Z4MnhSB7sv5NM3mb74AcpywX+sGnyaEeGu6Xk7luul146ketfCZu7Ss8C6u 28v4KPOkyKTiJ0zCuyOgmj8L6fijiQqyMbIGY5EKsACCEGB+AU6on4IXegHBvEgjqhuc JvVCKQBB9jwJmkNhT94oHGrhI/vKacdp3CMVnwjDNioD8RBzwiMRtl5ev3e+uEAu6rZ9 afpc2SyyyC/oV/TOMSMHV3mP7RrVOdPJd45Hlwz5/RxNqWTgVZOQAZwDaXemrOKteBfm GRKmSKjm7DqH/YLbV3ImXyRJAdN455y/VjfPJo/yc6XQUDr1zUl3N9+R9lT/oG5u+rNi gkAw== X-Gm-Message-State: AOJu0YzGpyifGKxCo/3lJzXwUyeWQH9J6shbzgsx52u+SisypmrdGxer gmO+045OBRPCSIuK2s0Bcg20r8nLAgdYgXn5O1q25HaTAZBRMB9sVOmooa21zZFJYVWuFMltQIu kIs4= X-Gm-Gg: ASbGnctxDY1caaGZw+MRyBuT2FDQoOWeMHUkQNj9li6d9u6V8P0qm29+ugiRr9KvFUp yTFNmvO2+G4USysbntPz6uw0FEfgmKk3jenV2+c8E100hXQ/HXRhvTpF1ask8HFX8YBen90PPUn KL3f1OFlVAHSSuDGLnJkeZepc6k319LaVZYXQNADzCuqR+FNyGFAD/cKCshY1uh7J17+0Ur/846 WqH8UGiUSKaLm1Kw5YHaAbYzJ2PLHNphLJoLLVyqRADjlWw+x9u3XsNeO7HtH+2eCej4gdkswsp egaElAro65sYXiLugyoYi0exuEDZ7LnMP2iPJTolUyeqjCijAQ== X-Google-Smtp-Source: AGHT+IFiiCld9lsovlNLZiyZG15O1UKwLEyIwPDJ6UpC/n/pGYRSzHptckgGrB9jfZF2kgKFBnwzhw== X-Received: by 2002:a05:620a:1917:b0:7a9:b914:279c with SMTP id af79cd13be357-7b5143dff90mr487051385a.0.1732285784859; Fri, 22 Nov 2024 06:29:44 -0800 (PST) Received: from ip-10-114-89-186.evoforge.org (ec2-52-70-167-183.compute-1.amazonaws.com. [52.70.167.183]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7b513f9063csm91144885a.8.2024.11.22.06.29.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 06:29:44 -0800 (PST) From: Greg Hogan Date: Fri, 22 Nov 2024 14:29:39 +0000 Message-ID: <7daac6d4cf5c0934236b37b39a112971a0ee0610.1732284490.git.code@greghogan.com> X-Mailer: git-send-email 2.46.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: none client-ip=2607:f8b0:4864:20::72b; envelope-from=code@greghogan.com; helo=mail-qk1-x72b.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Scanner: mx11.migadu.com X-Migadu-Spam-Score: 0.57 X-Spam-Score: 0.57 X-Migadu-Queue-Id: BEF5A46610 X-TUID: lpC5RU73D4zb Commit eee95b5a879b7096dffd533f24107cf8926b621e changed package rewriting to ignore hidden packages. This patch permits the previous use by adding an option to rewrite hidden packages. * guix/packages.scm (package-input-rewriting/spec)[rewrite]: When P is hidden, return it as-is unless #:replace-hidden? has been enabled. * tests/packages.scm ("package-input-rewriting/spec, replace hidden package"): New test. * doc/guix.texi (Defining Package Variants): Update. Change-Id: I0a7988cac70e0c6b88b0fe6e27c1036fa723e030 --- doc/guix.texi | 5 +++-- guix/packages.scm | 9 ++++++--- tests/packages.scm | 15 +++++++++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/doc/guix.texi b/doc/guix.texi index 1c39628ffa..e22bb693d7 100644 --- a/doc/guix.texi +++ b/doc/guix.texi @@ -8619,7 +8619,8 @@ Defining Package Variants The following variant of @code{package-input-rewriting} can match packages to be replaced by name rather than by identity. -@deffn {Procedure} package-input-rewriting/spec @var{replacements} [#:deep? #t] +@deffn {Procedure} package-input-rewriting/spec @var{replacements} @ + [#:deep? #t] [#:replace-hidden? #t] Return a procedure that, given a package, applies the given @var{replacements} to all the package graph, including implicit inputs unless @var{deep?} is false. @@ -8628,7 +8629,7 @@ Defining Package Variants package specification such as @code{"gcc"} or @code{"guile@@2"}, and each procedure takes a matching package and returns a replacement for that package. Matching packages that have the @code{hidden?} property -set are not replaced. +set are not replaced unless @var{replace-hidden?} is set to true. @end deffn The example above could be rewritten this way: diff --git a/guix/packages.scm b/guix/packages.scm index f373136d22..dbb8597488 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -1611,14 +1611,16 @@ (define* (package-input-rewriting replacements (package-mapping rewrite cut? #:deep? deep?)) -(define* (package-input-rewriting/spec replacements #:key (deep? #t)) +(define* (package-input-rewriting/spec replacements + #:key (deep? #t) (replace-hidden? #f)) "Return a procedure that, given a package, applies the given REPLACEMENTS to all the package graph, including implicit inputs unless DEEP? is false. REPLACEMENTS is a list of spec/procedures pair; each spec is a package specification such as \"gcc\" or \"guile@2\", and each procedure takes a matching package and returns a replacement for that package. Matching -packages that have the 'hidden?' property set are not replaced." +packages that have the 'hidden?' property set are not replaced unless +REPLACE-HIDDEN? is set to true." (define table (fold (lambda (replacement table) (match replacement @@ -1647,7 +1649,8 @@ (define* (package-input-rewriting/spec replacements #:key (deep? #t)) (define (rewrite p) (if (or (assq-ref (package-properties p) replacement-property) - (hidden-package? p)) + (and (not replace-hidden?) + (hidden-package? p))) p (match (find-replacement p) (#f p) diff --git a/tests/packages.scm b/tests/packages.scm index a623628447..7c28e75c45 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -1628,6 +1628,21 @@ (define compressors '(("gzip" . "gz") (match (delete-duplicates pythons eq?) ((p) (eq? p python))))) +(test-assert "package-input-rewriting/spec, replace hidden package" + ;; Rewrite hidden packages when requested. + (let* ((python (hidden-package python)) + (p0 (dummy-package "chbouib" + (build-system trivial-build-system) + (inputs (list python)))) + (rewrite (package-input-rewriting/spec + `(("python" . ,(const sed))) + #:replace-hidden? #t)) + (p1 (rewrite p0))) + (match (package-inputs p1) + ((("python" python)) + (and (string=? (package-full-name python) + (package-full-name sed))))))) + (test-equal "package-input-rewriting/spec, graft" (derivation-file-name (package-derivation %store sed)) base-commit: ba3a03151e6971bdfa9a86af5179055601042ff8 -- 2.46.0