From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms11 with LMTPS id GAKkGqh3a19DFwAA0tVLHw (envelope-from ) for ; Wed, 23 Sep 2020 16:28:24 +0000 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id cCEhFqh3a18TbAAAbx9fmQ (envelope-from ) for ; Wed, 23 Sep 2020 16:28:24 +0000 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 02B549404D3 for ; Wed, 23 Sep 2020 16:28:24 +0000 (UTC) Received: from localhost ([::1]:35798 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL7d0-0007Br-Te for larch@yhetil.org; Wed, 23 Sep 2020 12:28:22 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51630) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kL7Yq-000258-BU for guix-patches@gnu.org; Wed, 23 Sep 2020 12:24:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:54315) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kL7Yq-0000OB-25 for guix-patches@gnu.org; Wed, 23 Sep 2020 12:24:04 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kL7Yp-0001ZF-VQ for guix-patches@gnu.org; Wed, 23 Sep 2020 12:24:03 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43578] [PATCH 3/4] packages: 'package-mapping' correctly recurses into 'replacement'. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 23 Sep 2020 16:24:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43578 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 43578@debbugs.gnu.org Cc: Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 43578-submit@debbugs.gnu.org id=B43578.16008782175949 (code B ref 43578); Wed, 23 Sep 2020 16:24:03 +0000 Received: (at 43578) by debbugs.gnu.org; 23 Sep 2020 16:23:37 +0000 Received: from localhost ([127.0.0.1]:37624 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kL7YP-0001Xo-D2 for submit@debbugs.gnu.org; Wed, 23 Sep 2020 12:23:37 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44666) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kL7YM-0001Wx-MV for 43578@debbugs.gnu.org; Wed, 23 Sep 2020 12:23:35 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:47178) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kL7YF-0000Jw-Vw; Wed, 23 Sep 2020 12:23:28 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=52578 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1kL7YF-0002gP-1w; Wed, 23 Sep 2020 12:23:27 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Date: Wed, 23 Sep 2020 18:23:17 +0200 Message-Id: <20200923162318.2800-3-ludo@gnu.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200923162318.2800-1-ludo@gnu.org> References: <20200923162318.2800-1-ludo@gnu.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-Spam-Score: -3.3 (---) 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" X-Scanner: scn0 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of guix-patches-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=guix-patches-bounces@gnu.org X-Spam-Score: 3.99 X-TUID: hMav6kV0UAdd Previously, something like: guix build glib --with-graft=glibc=glibc@2.29 would produce a result showing that rewriting rules were not applied to libx11@1.6.A (a replacement). * guix/packages.scm (package-mapping): Call REPLACE instead of PROC to 'replacement'. * tests/packages.scm ("package-input-rewriting/spec, graft"): New test. --- guix/packages.scm | 2 +- tests/packages.scm | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/guix/packages.scm b/guix/packages.scm index f696945e30..0d0d7492b6 100644 --- a/guix/packages.scm +++ b/guix/packages.scm @@ -1037,7 +1037,7 @@ applied to implicit inputs as well." (inputs (map rewrite (package-inputs p))) (native-inputs (map rewrite (package-native-inputs p))) (propagated-inputs (map rewrite (package-propagated-inputs p))) - (replacement (and=> (package-replacement p) proc)) + (replacement (and=> (package-replacement p) replace)) (properties `((,mapping-property . #t) ,@(package-properties p)))))))) diff --git a/tests/packages.scm b/tests/packages.scm index 6fa4ad2f1b..e31dea6f72 100644 --- a/tests/packages.scm +++ b/tests/packages.scm @@ -1364,6 +1364,33 @@ (match (delete-duplicates pythons eq?) ((p) (eq? p (rewrite python)))))) +(test-equal "package-input-rewriting/spec, graft" + (derivation-file-name (package-derivation %store sed)) + + ;; Make sure replacements are rewritten. + (let* ((dep0 (dummy-package "dep" + (version "1") + (build-system trivial-build-system) + (inputs `(("coreutils" ,coreutils))))) + (dep1 (dummy-package "dep" + (version "0") + (build-system trivial-build-system) + (replacement dep0))) + (p0 (dummy-package "p" + (build-system trivial-build-system) + (inputs `(("dep" ,dep1))))) + (rewrite (package-input-rewriting/spec + `(("coreutils" . ,(const sed))))) + (p1 (rewrite p0))) + (match (package-inputs p1) + ((("dep" dep)) + (match (package-inputs (package-replacement dep)) + ((("coreutils" coreutils)) + ;; COREUTILS is not 'eq?' to SED, so the most reliable way to check + ;; for equality is to lower to a derivation. + (derivation-file-name + (package-derivation %store coreutils)))))))) + (test-equal "package-patched-vulnerabilities" '(("CVE-2015-1234") ("CVE-2016-1234" "CVE-2018-4567") -- 2.28.0