unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Mathieu Othacehe <othacehe@gnu.org>
To: guix-devel@gnu.org
Subject: Canonical-packages restoration.
Date: Tue, 09 Jun 2020 12:22:09 +0200	[thread overview]
Message-ID: <87zh9co7xq.fsf@gnu.org> (raw)


Hello,

With f30d84d32db0f4f6cb84e139868e1727a7dc0a51 and
dfc8ccbf5da96a67eb1cade499f0def21e7fdb02, I did remove most of the
"canonical-package" calls because they were breaking system
cross-compilation.

Now, I'd like to somehow restore them, using the new "let-system". My
idea is to define something like:

--8<---------------cut here---------------start------------->8---
(define (canonical-package* package)
  (let ((canonical
         (module-ref (resolve-interface '(gnu packages base))
                     'canonical-package)))
    (let-system (system target)
      (if target
          package
          (canonical package)))))
--8<---------------cut here---------------end--------------->8---

And then use for instance this way:

--8<---------------cut here---------------start------------->8---
diff --git a/gnu/system/locale.scm b/gnu/system/locale.scm
index 689d238d1a..fd50538e9a 100644
--- a/gnu/system/locale.scm
+++ b/gnu/system/locale.scm
@@ -106,7 +106,8 @@ of LIBC."
 
          ;; 'localedef' executes 'gzip' to access compressed locale sources.
          (setenv "PATH"
-                 (string-append #+gzip "/bin:" #+libc "/bin"))
+                 (string-append #+gzip "/bin:"
+                                #+(canonical-package* libc) "/bin"))
--8<---------------cut here---------------end--------------->8---

However, it seems that nesting a "let-system" inside "file-append" does
not work:

--8<---------------cut here---------------start------------->8---
(use-modules (guix))
(use-modules (gnu))

(run-with-store (open-connection)
  (mlet* %store-monad
      ((drv (lower-object
             (computed-file "computed"
                            #~(begin
                                (mkdir #$output)
                                (symlink #$(file-append
                                            (let-system (s t) glibc) "/bin")
                                         (string-append #$output "/ref"))))))
       (output -> (derivation->output-path drv)))
    (mbegin %store-monad
      (built-derivations (list drv))
      (return (format #t "~a~%" output)))))
--8<---------------cut here---------------end--------------->8---

and it prevents me from going further. Does this stuff make any sense?
If yes I can try to fix it, but I just want to be sure first :)

Thanks,

Mathieu


             reply	other threads:[~2020-06-09 10:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-09 10:22 Mathieu Othacehe [this message]
2020-06-09 11:18 ` Canonical-packages restoration Jan Nieuwenhuizen
2020-06-09 11:30   ` Mathieu Othacehe
2020-06-09 16:34 ` Ludovic Courtès
2020-06-10  9:35   ` Mathieu Othacehe
2020-06-10 15:24     ` Ludovic Courtès

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=87zh9co7xq.fsf@gnu.org \
    --to=othacehe@gnu.org \
    --cc=guix-devel@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).