From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id CNgMHWmLR2NVMAEAbAwnHQ (envelope-from ) for ; Thu, 13 Oct 2022 05:52:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id QLAfHWmLR2M+0AAA9RJhRA (envelope-from ) for ; Thu, 13 Oct 2022 05:52:09 +0200 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 2F1F5116E6 for ; Thu, 13 Oct 2022 05:52:08 +0200 (CEST) Received: from localhost ([::1]:46890 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oipGR-0007VM-Ca for larch@yhetil.org; Wed, 12 Oct 2022 23:52:07 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:49596) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oipGN-0007VD-1D for guix-patches@gnu.org; Wed, 12 Oct 2022 23:52:03 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59718) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oipGM-0006KL-Nf for guix-patches@gnu.org; Wed, 12 Oct 2022 23:52:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oipGM-000511-G4 for guix-patches@gnu.org; Wed, 12 Oct 2022 23:52:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#57963] Almost plain SXML serializer Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 13 Oct 2022 03:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57963 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Liliana Marie Prikler , Taiju HIGASHI Cc: ludo@gnu.org, 57963@debbugs.gnu.org Received: via spool by 57963-submit@debbugs.gnu.org id=B57963.166563310819260 (code B ref 57963); Thu, 13 Oct 2022 03:52:02 +0000 Received: (at 57963) by debbugs.gnu.org; 13 Oct 2022 03:51:48 +0000 Received: from localhost ([127.0.0.1]:58796 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oipG7-00050Y-Pk for submit@debbugs.gnu.org; Wed, 12 Oct 2022 23:51:48 -0400 Received: from relay10.mail.gandi.net ([217.70.178.230]:34685) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oipG5-00050M-VL for 57963@debbugs.gnu.org; Wed, 12 Oct 2022 23:51:46 -0400 Received: (Authenticated sender: andrew@trop.in) by mail.gandi.net (Postfix) with ESMTPSA id E17DD240003; Thu, 13 Oct 2022 03:51:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop.in; s=gm1; t=1665633099; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=PzjHwD2j3Y89APng2Fm+6yXLEpQi6u/JGCEG03pY9bM=; b=hhTAJZAaKgzxPD8VrAezny75zBjhH7+QukUTTxE/LbTRsm3c2sghxI8D4iaKA+BUqYKFKh xYdujZD0Jnix7ZFScbVqWxqZhs+tcOTZHA5Ce2co8czrlNE+SL+72Ks9ujiNCGnzeuuMko dXU3f4Wu+QsQ6/YXQxqTCzCM5t8QJBdyjQC9hWFxOM/Y8aLQZjHhxaONVMQh0xbCkEvCOO jaqD5pqam49j5TANVVPrNazUHr2cAiCS7Yn9MJ5CsemO6fBWG8N62trWMKEMl0E+QQhR4N C/Lzm3lAbs+pZyHlHXoKlih5/8mU4UagEO+mTpzVXvTp3Uy1EGTsdB+muiSZrQ== From: Andrew Tropin In-Reply-To: <4e239948c075c47041a4ac1087b25de65a9172b3.camel@gmail.com> References: <20221002131535.9972-1-higashi@taiju.info> <20221002131535.9972-2-higashi@taiju.info> <87zge4chb5.fsf@trop.in> <87edvfkob8.fsf@taiju.info> <7a7ba84518d2f6afa387e1e2649bc249acd74750.camel@gmail.com> <87pmexmsei.fsf@trop.in> <87a661i7zm.fsf@taiju.info> <874jw9mbxc.fsf@trop.in> <4e239948c075c47041a4ac1087b25de65a9172b3.camel@gmail.com> Date: Thu, 13 Oct 2022 07:51:35 +0400 Message-ID: <875ygoe5yw.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" 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" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1665633128; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:resent-cc:resent-from:resent-sender: resent-message-id:in-reply-to:in-reply-to:references:references: list-id:list-help:list-unsubscribe:list-subscribe:list-post: dkim-signature; bh=PzjHwD2j3Y89APng2Fm+6yXLEpQi6u/JGCEG03pY9bM=; b=GQwJX4svb4BP0Mth4+hXgRKNgUBlH15foasFt6wNlZukQm9kIIDmP2RDv5HoyZQS9oO/xa /QkFG+YkCNEo/X2O4WmoW48jv/DT3MylpwXf51O9sRWLKDDcwFgel+O9M4foYfDUhIDA8+ OkFzUCkIbqkQWVAvViqYC4ikOHYN4i56X0Adl/572oWAEAD238gZZW96WzEbcX3noPsuRF Qv2c4Qx46Y2HOjV/puF88Z98iFtA9p8ycakhyX+zCx+1uAabLw6uF31/+qatSFwzBNj7Z6 nxNipJu5m489rSa8FourV/UB7zlnSLLilQPEC3v5bLmXQRc/U2mtIxBfgwjH1g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1665633128; a=rsa-sha256; cv=none; b=R5V8gL7kNYeKdmBK/+DNrivp5m6hlhk9YEFvXnvV3kyo4KGHa7fSK5ynd/H7iW7T6Z6Kbs 3kMaIR+4j5yci0L7Bu9dFwoZeBNynJr7C1Fwrd1cweFwYwgPB6J79PzqUhc7RhWRyiRfDw p5j5c10HuZykB7JGVRS3kjU3l+ue2OVmaMFXrwLKkWRw8JOcDGM84nm1nvtLui+PfIXln/ EKUX9JxXFCk5y1Ks2AzTciI/FlHs3c3GHMSEd9+CTu+uKpt2yuRJXAtue8gx4ESwFTQqrC HjK0pn3TPEKOOozmT8gDH0nSL6WU3xVY9sJKSVon8BQlWUW+iYHWei8tukPPGw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=hhTAJZAa; dmarc=none; 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" X-Migadu-Spam-Score: 1.90 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop.in header.s=gm1 header.b=hhTAJZAa; dmarc=none; 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" X-Migadu-Queue-Id: 2F1F5116E6 X-Spam-Score: 1.90 X-Migadu-Scanner: scn1.migadu.com X-TUID: cnOScNZXK0dK --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 2022-10-12 20:23, Liliana Marie Prikler wrote: > Am Mittwoch, dem 12.10.2022 um 17:03 +0400 schrieb Andrew Tropin: >> On 2022-10-12 20:42, Taiju HIGASHI wrote: >>=20 >> > Andrew Tropin writes: >> >=20 >> > > On 2022-10-11 06:21, Liliana Marie Prikler wrote: >> > >=20 >> > > > Am Dienstag, dem 11.10.2022 um 12:54 +0900 schrieb Taiju >> > > > HIGASHI: >> > > > > We can specify invalid value such as (list "foo" '(foo bar) >> > > > > 123). >> > > > It will be sanitized before that. >> > > >=20 >> > > > > > Also, making multi-type fields is debatable, but isn't >> > > > > > great IMO. >> > > > >=20 >> > > > > I see. If we had to choose one or the other, I would prefer >> > > > > the >> > > > > string-type field. >> > > > Prefer sexp-type. >> > > >=20 >> > >=20 >> > > Current (v5) extra-config has a list type.=C2=A0 This list can conta= in >> > > strings >> > > and nested lists, string elements are for raw XML, and list >> > > elements are for SXML. >> > >=20 >> > > This is done I guess to support following use case: >> > >=20 >> > > (list "Already existing XML copied from existing .xml file, >> > > which >> > > we don't want to rewrite to SXML." >> > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 '((tag (@ (attr1 "value1") >> > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 (attr2 "value2")) >> > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (nested "Part of the configuration defined with >> > > SXML") >> > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (empty))) >> > > =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 "Maybe some other part o= f raw XML> > > tag>") >> > >=20 >> > > This way we can combine SXML with already existing raw XML. >> > >=20 >> > > Am I right? >> >=20 >> > You're right.=C2=A0 The current implementation allows XML string and >> > SXML >> > list in the list.=C2=A0 Also, it can mix those. >> >=20 >>=20 >> Ok, that means we can cover this use case, but at the same time have >> more functionality, clarity and consistency. >>=20 >> We can make extra-config to be SXML only (with G-exps support), this >> way we will achieve not only the same functionality, but will get >> more advanced features like referencing files/directiories in the >> /gnu/store or generating parts of configuration using full-fledged >> scheme (the simpliest example is just reading the content of the >> existing file-like object or using format to generate "raw XML" and >> insert it in arbitrary place of SXML tree). >>=20 >> --8<---------------cut here---------------start------------->8--- >> (list #~"Already existing XML copied from existing .xml file, >> which >> we don't want to rewrite to SXML." >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 `((tag (@ (attr1 "value1") >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 (attr2 "value2")) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= (nested "Part of the configuration defined with SXML") >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= ,#~(format #f "=C2=A0=C2=A0=C2=A0 ~a" >> #$variable) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= (fontdirs >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0 (dirs ,(file-append font-iosevka "/share/fonts"))) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= (empty))) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #~(call-with-input-file #$(local-file "ol= d.xml") get-string- >> all) >> =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 #~"Maybe some other part of = raw XML> tag>") >> --8<---------------cut here---------------end--------------->8--- >>=20 >> Liliana, Ludo what do you think? > I think the mockup implementation is a little unclear.=20 The file generated from definition above should look like: =2D-8<---------------cut here---------------start------------->8--- Already existing XML copied from existing .xml file, which we don't wa= nt to rewrite to SXML. Text node variable value here /gnu/store/w2wvg2229lj3qba0r44pmd786mkllvjl-font-iosevka-15.2.0/share= /fonts Maybe some other part of raw XML =2D-8<---------------cut here---------------end--------------->8--- Hope it helps, let me know if you want me to rephrase or clarify something. > Do you mean that G-Expressions should imply a string that is to be > parsed? Because note that gexp->sexp exists and you could likewise > #~(sxml->xml #$some- file-in-the-store) imho. Not sure what you mean. Can you elaborate, please? =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmNHi0cACgkQIgjSCVjB 3rBGJQ/+ItF65K+KBzlbNOK7obqzx4lPDPAYySYvwWW/lOyDpseiCSpM2dly+bAc LuxoIB7Fa5/00hkCla+zobJurKekvLPEcvf6aDaYJMAXcvtkoWXFnWta3ikh+zYD VImbcPUCIIeJ03JvpL8+KMKWq2GNeVvUiUCyzhhJTqB5na5eZ6p9EKUiHFExIcKe mXA4je1XjZ/1DcEEIemrOfce1p2/h3uoJ7Oft+qgyUgNUXDkHZFhV7T7q0Y9/qkt J883T9L+XLbkTVYMbtUnddK4rq0jTFUaZBnqMQxgh4vQewU7NswuaNM0Qyjjk3+W 1GIunVqaHqapOMKSp5KA5SeatyxfqpXL32//fh1J5aoXLpUmOOozuN75V+PcirWp xkJEgmH/q6t3ZiXy5OH6yuR2S2vBJtCF5EzrF2+oJV4cu3yiC8xsef+Q35kRXriv KSGX8z/M/C/6qBMLjNpwdmgAAs7vycl3ToD0l8yV/vSgNwOCRhsAL1M7NjtIOwIP L+WSYKSoaeNWyI2NPHdc5wE+73Tyry8Sp8/z9tBcyIkbusWiabEQSFSX4Vn40ndY xP/2ZY42l/N4Ifge6oSE5FfdQWsd28X2Iqbz88Vci8uZRtui4SBl/rmWB+zoWLxD QoEgagpk4Ka2QEYuRXxNU3CMYBE0kL8QutY1RRGwguLwKbSB9AA= =f3Pk -----END PGP SIGNATURE----- --=-=-=--