unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Liliana Marie Prikler <liliana.prikler@gmail.com>
To: "Andrew Tropin" <andrew@trop.in>,
	guix-devel@gnu.org, "Oleg Pykhalov" <go.wigust@gmail.com>,
	"Ludovic Courtès" <ludo@gnu.org>
Cc: Xinglu Chen <public@yoctocell.xyz>, guix-maintainers@gnu.org
Subject: Re: Return back original implementation for text-config serialization
Date: Sun, 09 Jan 2022 12:19:03 +0100	[thread overview]
Message-ID: <ce10fa158fd6012dce6b32a834289543752c6904.camel@gmail.com> (raw)
In-Reply-To: <878rvp1deg.fsf@trop.in>

Hi Andrew,

Am Sonntag, dem 09.01.2022 um 12:12 +0300 schrieb Andrew Tropin:
> Before fee0bc serialization for text-config worked this way:
> --8<---------------cut here---------------start------------->8---
> `("string here"
>   ,#~"string valued gexp"
>   "source \"
>   ,(local-file "blabla.sh"))
> --8<---------------cut here---------------end--------------->8---
> 
> would yield something like:
> 
> --8<---------------cut here---------------start------------->8---
> string here
> string valued gexp
> source \
> /gnu/store/00fl96dj2aak4i1vqvdqzlhbmmskc7fx-blabla.sh
> --8<---------------cut here---------------end--------------->8---
> 
> [...]
> 
> The new text-config serialization implementation (after fee0bc
> commit) doesn't support gexps and tries to insert the literal content
> of the file in place where file-like object was used[.]
I agree that the old one looks nicer in this context, but wasn't the
new one introduced to solve the issue of (slurp-file-gexp) in the
importer?  Meaning whichever way we go, we need something that allows
us to insert literal file contents of another file at more or less G-
exp compile time.

Perhaps that issue could be solved, if instead the importer just reads
the file contents and declares it as a variable as in
(define %bashrc "
;; Original contents of bashrc
")
(define bashrc (plain-file %bashrc)).

WDYT?

> If we want to insert the file path to file-like object for new-style
> text-config internally we do something like
> 
> (mixed-text-file ...
>  "source \" "\n"
>  #~(read-everything-from-file
>     #$(computed-file "unecessary-file-name"
>        #~#$(local-file "blabla.sh"))))
> 
> when originally it was
> (mixed-text-file
>  "source \" "\n"
>  (local-file "blabla.sh"))
Is unnecessary-file-name ever created in this instance?  I think we
have something similar in other locations as well, where G-expressions
are merged -- public keys for substitutes spring to mind.  Perhaps all
it'd need to make use of new-style text configs is a better way of
quoting such things, e.g. a procedure which takes a file-like object
and produces a plain file with its name.

For the record, the use of (read-everything-from-file) in your example
-- a procedure which I'm unable to find in my local Guix checkout --
makes it somewhat difficult to come up with concrete solutions here, so
pardon me for being abstract.


Cheers


  reply	other threads:[~2022-01-09 11:19 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-09  9:12 Return back original implementation for text-config serialization Andrew Tropin
2022-01-09 11:19 ` Liliana Marie Prikler [this message]
2022-01-09 17:48   ` Andrew Tropin
2022-01-09 19:44     ` Liliana Marie Prikler
2022-01-10  9:49       ` Andrew Tropin
2022-01-10 20:12         ` Liliana Marie Prikler
2022-01-12 15:05           ` Andrew Tropin
2022-01-09 12:17 ` Maxime Devos
2022-01-09 12:19 ` Maxime Devos
2022-01-09 17:59   ` Andrew Tropin
2022-01-09 19:00     ` Maxime Devos
2022-01-18 14:26 ` Ludovic Courtès
2022-01-20 13:20   ` Andrew Tropin
2022-01-21  9:30     ` Maxime Devos
2022-01-26  8:34       ` Andrew Tropin
2022-01-27  5:04         ` Maxim Cournoyer
2022-01-28 15:48           ` Andrew Tropin
2022-02-05 11:09           ` Ludovic Courtès
2022-02-13 14:14             ` Andrew Tropin
2022-01-26  8:36       ` Andrew Tropin
2022-02-05 11:34         ` Maxime Devos
2022-02-13 14:09           ` Andrew Tropin
2022-01-24 15:37     ` Ludovic Courtès
2022-01-26  9:11       ` Andrew Tropin
2022-01-26  9:21         ` Andrew Tropin
2022-02-05 14:43     ` Xinglu Chen

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=ce10fa158fd6012dce6b32a834289543752c6904.camel@gmail.com \
    --to=liliana.prikler@gmail.com \
    --cc=andrew@trop.in \
    --cc=go.wigust@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=guix-maintainers@gnu.org \
    --cc=ludo@gnu.org \
    --cc=public@yoctocell.xyz \
    /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).