unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: "Ludovic Courtès" <ludo@gnu.org>
To: 43578@debbugs.gnu.org
Cc: "Ludovic Courtès" <ludo@gnu.org>
Subject: [bug#43578] [PATCH 3/4] packages: 'package-mapping' correctly recurses into 'replacement'.
Date: Wed, 23 Sep 2020 18:23:17 +0200	[thread overview]
Message-ID: <20200923162318.2800-3-ludo@gnu.org> (raw)
In-Reply-To: <20200923162318.2800-1-ludo@gnu.org>

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





  parent reply	other threads:[~2020-09-23 16:28 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-23 16:12 [bug#43578] [PATCH 0/4] Rewriting implicit inputs with 'package-input-rewriting' & co Ludovic Courtès
2020-09-23 16:23 ` [bug#43578] [PATCH 1/4] packages: 'package-mapping' can recurse on implicit inputs Ludovic Courtès
2020-09-23 16:23   ` [bug#43578] [PATCH 2/4] packages: 'package-input-rewriting/spec' can rewrite implicit dependencies Ludovic Courtès
2020-09-23 16:23   ` Ludovic Courtès [this message]
2020-09-23 16:23   ` [bug#43578] [PATCH 4/4] packages: 'package-input-rewriting' has a #:deep? parameter Ludovic Courtès
2020-09-23 17:17 ` [bug#43578] [PATCH 0/4] Rewriting implicit inputs with 'package-input-rewriting' & co zimoun
2020-09-23 20:51   ` Ludovic Courtès
2020-09-24  6:28     ` Efraim Flashner
2020-09-25 22:38 ` zimoun
2020-09-26 13:53   ` Ludovic Courtès
2020-09-26 16:04     ` zimoun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200923162318.2800-3-ludo@gnu.org \
    --to=ludo@gnu.org \
    --cc=43578@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).