From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp0 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id cJSlI3dLaGGuNgEAgWs5BA (envelope-from ) for ; Thu, 14 Oct 2021 17:23:35 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp0 with LMTPS id +ClVH3dLaGHRSQAA1q6Kng (envelope-from ) for ; Thu, 14 Oct 2021 15:23:35 +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 BFB40215C4 for ; Thu, 14 Oct 2021 17:23:34 +0200 (CEST) Received: from localhost ([::1]:33022 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mb2Zx-0001CK-QR for larch@yhetil.org; Thu, 14 Oct 2021 11:23:33 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47304) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mb2ZT-0001Ay-9c for guix-patches@gnu.org; Thu, 14 Oct 2021 11:23:04 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:53496) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mb2ZT-0004gt-1X for guix-patches@gnu.org; Thu, 14 Oct 2021 11:23:03 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mb2ZS-0003RY-Ul for guix-patches@gnu.org; Thu, 14 Oct 2021 11:23:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50967] [PATCH 13/14] home: services: configuration: Support file-like objects. Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 14 Oct 2021 15:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50967 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: To: Oleg Pykhalov , 50967@debbugs.gnu.org Cc: Oleg Pykhalov Received: via spool by 50967-submit@debbugs.gnu.org id=B50967.163422493313130 (code B ref 50967); Thu, 14 Oct 2021 15:23:02 +0000 Received: (at 50967) by debbugs.gnu.org; 14 Oct 2021 15:22:13 +0000 Received: from localhost ([127.0.0.1]:36805 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mb2Ye-0003Pg-6K for submit@debbugs.gnu.org; Thu, 14 Oct 2021 11:22:13 -0400 Received: from mail-lf1-f44.google.com ([209.85.167.44]:36789) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mauqc-0004He-Hr for 50967@debbugs.gnu.org; Thu, 14 Oct 2021 03:08:16 -0400 Received: by mail-lf1-f44.google.com with SMTP id g36so5830646lfv.3 for <50967@debbugs.gnu.org>; Thu, 14 Oct 2021 00:08:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version; bh=zPukjI1oCkDSp5RfhqS+TO0/VkYYzsh3wOqleEWnLFg=; b=UrfyovhqYnEt8XWQe1B+8TrJ5LTB3sD7BW7/fBhi9v9n8024ruIOSrS8ukEGv9yavt hszdUFhz/ooGhp9pHNS5pBB78cKhFNugAEBWlPv9wjbnP115rWb7LXjgCAqj61bHDOZp Ge7GbYwYyjx23wyPibpHvLREQELPa6MgkHHk1Z+8q7WcuGUROOofVbHToe3E+qD0uDv/ oXLt6UVDRDFE2du+VJFsIFbBILcjAbOUGelERpyEkCNeg8WDMt8VpoNftYhCMgyyylwi w3T3LdxE1t+CjMkKyAbpuVnXWAE2f2UDvpBqqPn+OVKtGsavWae7QMl4oDpM+JDhN1sJ VvVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version; bh=zPukjI1oCkDSp5RfhqS+TO0/VkYYzsh3wOqleEWnLFg=; b=WnKbHOddnlaXU0p5YKeBDBXQElJ6Cwn9uS1Fwmkw1GqGZz9U5ED8Lo7qNM56Lb+9+t moQJyk5me/J9JWLGH+E6kh5i449Btpafj07YSE1iF0ORUQOPgDBHGZ03QEZmwMgauQTK DLG4UBLCyayjT+lgYXI9mSKc2KJKcIxgTcpUCFKYybKNAhby8U+doAi2OZ3xUeX7zlO4 p1IPTz0LvaR7fY4uXVa7kIFr1rz/gO6tJSSnj5LCc5O0lRuUlwSeI4M24tCb4lureKw5 T+74cxwrKQNX/4HUYQ8lwOqMrv4G9Orq7nLcqW/TFbHvZgQ4YObC0aEAW+QbwtUWnk8l pgog== X-Gm-Message-State: AOAM531x+Vt4dP2O2bAvAa2hw3+fpv0ZqNHTz+fcjfpDd9Ur50cFfVfm 3xsjGeCWPnEGqgMD58xF3Ys= X-Google-Smtp-Source: ABdhPJxksdFPgcvWJrNhrEYXjPkeUGWP2XCV3o7eOkp0zPAYoIWQ6JZmEi2mtlRQTS4DkQq8Y3VYDg== X-Received: by 2002:a19:c78c:: with SMTP id x134mr3626042lff.97.1634195288484; Thu, 14 Oct 2021 00:08:08 -0700 (PDT) Received: from localhost (109-252-140-132.dynamic.spd-mgts.ru. [109.252.140.132]) by smtp.gmail.com with ESMTPSA id a17sm180162ljp.22.2021.10.14.00.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Oct 2021 00:08:07 -0700 (PDT) From: Andrew Tropin In-Reply-To: <20211002163834.29583-13-go.wigust@gmail.com> References: <20211002163834.29583-1-go.wigust@gmail.com> <20211002163834.29583-13-go.wigust@gmail.com> Date: Thu, 14 Oct 2021 10:08:03 +0300 Message-ID: <87lf2wt770.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" X-Mailman-Approved-At: Thu, 14 Oct 2021 11:22:09 -0400 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1634225015; 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=zPukjI1oCkDSp5RfhqS+TO0/VkYYzsh3wOqleEWnLFg=; b=LbENT8VTYwuXzGYgvbbZR1HemEX+1aQjMe9J3Fq3VHPO5fxwaJyELoDo6GCMHhElK2tmen CpkizM0GpzpqzcMaxz2T7A9WrI+vZXsuiG8ysCTJhXZdQid5uYa9aKoUWaxaK8m0ANvbAJ 5+7K0iW2rak82AhrlgHgeQyh11OJP9fqYoS2UejdsoigfbAcNQAMffDgA3XybOljywE3FH GG4RnX0oaXOQRMQ5vOxc7qxPZ7bb25YF2DEq7vT+nyzYYVNsRY8CfQRJzQ0Zy4cpovZzjZ rms/12urRuPUmUZ+9p3IIGVC3mvm+mfF52Bx+NIGEaiLQAGp5rMCBZZp8+umbw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1634225015; a=rsa-sha256; cv=none; b=PNpz1U+jzgY6M77inuJKOPyGXGiwrQSzOqCbLl0VqU0CZ6rUEq6Wq74c8Pb62Ke0YF6qpx sRq+vIxUhFZL3YrL4XZISCCkDunGTTP8aqJx8tvPGV+//SC5HGQIfN1TuajTyUNUcAjMdX /++i+DGeD1eDbmPOPN+9REPyahGrisb8yAo6dqUEfnqGC/9C2tXulSB7zDAwaTshbztQOt fLx/JhjYglABup78C9x2dxS2qzHdUc8bWxW3fQM5NcxGFyP3W0LSpfUS6yvWdF7SK67Llc 5HXdyQod+U6Cid9JK6VLZQyaDpHHha6g5RAOhIwUJ7EQikffpb15uGMlJWkcpw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Urfyovhq; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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-Migadu-Spam-Score: -0.91 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=Urfyovhq; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=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-Migadu-Queue-Id: BFB40215C4 X-Spam-Score: -0.91 X-Migadu-Scanner: scn0.migadu.com X-TUID: 3fkLfIVloQHn --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable On 2021-10-02 19:38, Oleg Pykhalov wrote: > * gnu/home/services/configuration.scm (interpose): Include content of fil= es. > (string-or-gexp?): Rename to 'file-or-string-or-gexp?' and check for file= -like > object. > (serialize-string-or-gexp): Rename to 'serialize-file-or-string-or-gexp'. > (text-config?): Call 'file-or-string-or-gexp?' intead of 'string-or-gexp?= '. > * guix/scripts/home/import.scm: > (generate-bash-module+configuration): Don't call slurp-file-gexp. > --- > gnu/home/services/configuration.scm | 14 ++++++++++---- > guix/scripts/home/import.scm | 8 +++----- > 2 files changed, 13 insertions(+), 9 deletions(-) > > diff --git a/gnu/home/services/configuration.scm b/gnu/home/services/conf= iguration.scm > index 5e7743e7d6..39db7a5693 100644 > --- a/gnu/home/services/configuration.scm > +++ b/gnu/home/services/configuration.scm > @@ -59,7 +59,12 @@ DELIMITER interposed LS. Support 'infix and 'suffix G= RAMMAR values." > (G_ "The GRAMMAR value must be 'infix or 'suffix, but ~a provided.= ") > grammar))) > (fold-right (lambda (e acc) > - (cons e > + (cons (if (file-like? e) > + #~(begin > + (use-modules (ice-9 rdelim)) > + (with-fluids ((%default-port-encoding "UTF= -8")) > + (with-input-from-file #$e read-string))) This transformation should not be a part of interpose function, interpose does know nothing about elements type and doesn't have to know. This addition is semantically incorrect and also contradictionary to docstring. It also breaks downstream channels. The version of change in master is different, it doesn't even check element type. I'm strongly against this change. If it necessary to make transformation of elements of the list it should be done outside of interpose. > + e) > (if (and (null? acc) (eq? grammar 'infix)) > acc > (cons delimiter acc)))) > @@ -79,11 +84,12 @@ the list result in @code{#t} when applying PRED? on t= hem." >=20=20 > (define alist? list?) >=20=20 > -(define (string-or-gexp? sg) (or (string? sg) (gexp? sg))) > -(define (serialize-string-or-gexp field-name val) "") > +(define (file-or-string-or-gexp? fsg) > + (or (string? fsg) (gexp? fsg) (file-like? fsg))) > +(define (serialize-file-or-string-or-gexp field-name val) "") >=20=20 > (define (text-config? config) > - (and (list? config) (every string-or-gexp? config))) > + (and (list? config) (every file-or-string-or-gexp? config))) > (define (serialize-text-config field-name val) > #~(string-append #$@(interpose val "\n" 'suffix))) >=20=20 > diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm > index c977ec3861..611f580e85 100644 > --- a/guix/scripts/home/import.scm > +++ b/guix/scripts/home/import.scm > @@ -46,17 +46,15 @@ > (home-bash-configuration > ,@(if (file-exists? rc) > `((bashrc > - (list (slurp-file-gexp (local-file ,rc))))) > + (list (local-file ,rc)))) > '()) > ,@(if (file-exists? profile) > `((bash-profile > - (list (slurp-file-gexp > - (local-file ,profile))))) > + (list (local-file ,profile)))) > '()) > ,@(if (file-exists? logout) > `((bash-logout > - (list (slurp-file-gexp > - (local-file ,logout))))) > + (list (local-file ,logout)))) > '())))))) =2D-=20 Best regards, Andrew Tropin --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFn11MACgkQIgjSCVjB 3rA3rA/+PmhNFEq+nSRe6Wi6emqP8ZZoCFFihnRtCzXAp3mMs+asZo5VL/JbMVWu Yvq45rsKBokEzzln6q2qemP4TJRSv+1NIjnNQXaRPCvh37iLyp7KRthc/bEs5nC9 pdoor2W1cYRmoJAN7G2JTcRtiluStmrfwKdOsZ7ULGzFQgVghAfQyb6JZ4oMEEdr gcS+ypoDLLVwLIDYQ1mxd87naAQFQYhWAS+KThEx7bh+HfoIRewnPSZHtjBlk0oM dZ+QIDN2t2OWztNR42meJjKF+p0QFiRO9FEfnV3v10XbjLxwFukvt5VilmPb0W2b jOrkGQfKWt/W0Q1Wfx5qiXz/lllcSOPZAeeZFexKO3zJZIbmsf9ygDBSWW3GgN1p 17SpkURXKTXld49/0tphEtzHhdmwOHZovk/gsFHWWxtvyG4rZ1V+vjhKcNzX8/tp EUuRY/Usb0Hs3yo4NaoS180jw2dE6ghou3mDJ3wGkCPMuPXYEMgZx0M+xHUmOeIo bai7hkjHjOv8jfwcCv5/XTTSN7ZsO8L9n2AADdYKxdPrSxtAsFAilPxkZ7qIPQ7r 256kURW7DncRtcvizL5INpee3igXycIjIh7YHVqvRzqJJbClz+a6ohMrC0U5pxJf BIDuRh4/Shqlmv2c9Z7VB5G7fYMbGEK/4Gn6f04ygK+bsX00RR8= =UjUv -----END PGP SIGNATURE----- --=-=-=--