From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id yKw+FeziUmE0cAAAgWs5BA (envelope-from ) for ; Tue, 28 Sep 2021 11:39:56 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 6HDwEOziUmH3QwAAB5/wlQ (envelope-from ) for ; Tue, 28 Sep 2021 09:39:56 +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 6051735869 for ; Tue, 28 Sep 2021 11:39:55 +0200 (CEST) Received: from localhost ([::1]:36398 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mV9ac-0000jI-I8 for larch@yhetil.org; Tue, 28 Sep 2021 05:39:54 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47966) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mV9Ws-0003ho-Np for bug-guix@gnu.org; Tue, 28 Sep 2021 05:36:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:60555) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mV9Ws-0007J9-4x for bug-guix@gnu.org; Tue, 28 Sep 2021 05:36:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mV9Ws-00077Z-1X for bug-guix@gnu.org; Tue, 28 Sep 2021 05:36:02 -0400 X-Loop: help-debbugs@gnu.org Subject: bug#50856: Unbound variables in Guix Home Resent-From: Andrew Tropin Original-Sender: "Debbugs-submit" Resent-CC: bug-guix@gnu.org Resent-Date: Tue, 28 Sep 2021 09:36:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50856 X-GNU-PR-Package: guix X-GNU-PR-Keywords: To: go.wigust@gmail.com, 50856@debbugs.gnu.org X-Debbugs-Original-To: Oleg Pykhalov , bug-guix Received: via spool by submit@debbugs.gnu.org id=B.163282174927355 (code B ref -1); Tue, 28 Sep 2021 09:36:01 +0000 Received: (at submit) by debbugs.gnu.org; 28 Sep 2021 09:35:49 +0000 Received: from localhost ([127.0.0.1]:43868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mV9Wf-000778-4D for submit@debbugs.gnu.org; Tue, 28 Sep 2021 05:35:49 -0400 Received: from lists.gnu.org ([209.51.188.17]:59822) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mV9Wd-000771-JQ for submit@debbugs.gnu.org; Tue, 28 Sep 2021 05:35:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47920) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mV9Wd-0003Js-9T for bug-guix@gnu.org; Tue, 28 Sep 2021 05:35:47 -0400 Received: from mail-lf1-x130.google.com ([2a00:1450:4864:20::130]:47082) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mV9WZ-000738-M7 for bug-guix@gnu.org; Tue, 28 Sep 2021 05:35:46 -0400 Received: by mail-lf1-x130.google.com with SMTP id z24so90941194lfu.13 for ; Tue, 28 Sep 2021 02:35:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=trop-in.20210112.gappssmtp.com; s=20210112; h=from:to:subject:in-reply-to:references:date:message-id:mime-version; bh=3VrhpRrgqvZI0LUX4CPrbnoXl786oxgt6KqhbwBT4E0=; b=uJZEe20wIwp6h+u709MpfKgeLb/2AlRS7i5TIX0mM7EVZORI+xmgxXhqJycOezV9VE e+cl1tgZ7eIozFfffiAUgcjgweHy64ULboYe+qgEoE/+QYmQUtAiZvfoFUZFe6JxXqF9 uHdNaEYVZ+9TrobY6hjhkUSZOfdhXWXygz3d9MXbbE/x0oIJLlYTlyzEhKByckHXNOpS cwRR+wWz1qh4k0ZdfaJsM73KpWagOZLW5qsiXdz9V57YMaFS4pS8e2Lfze7ORtrT9yc4 1JOR/O0XsyeuOJdqI07cgAaK3Ccw9Oqdphxn0wELZlV5uds+Rqs8hc2tYBWAzXOe6G7a 0FAw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:in-reply-to:references:date :message-id:mime-version; bh=3VrhpRrgqvZI0LUX4CPrbnoXl786oxgt6KqhbwBT4E0=; b=gszDDmkXCgN+SCJcms927X3oXJh+KVqx5Skt7pyr9fVHJgmfCVGLLtOCjVF+qTjNwX l8w5FBYE0cFRGiUCgXV3xHZDYyfnpwIuvOt07tJ4XKIKxTBtQ/KtV6LtIkpffYv59UoG 6TjtigO9Ojc56frLErLhszuSZDhQsi7L9niCUFiJMcKdj7qlqFCSjpdfSZG32uPNjRt3 uvQwnLErpCdhuVKOcrvqWKR2vrXEW8CY4lMT+T0/JFbIROEWtJzsIZ8lhNkvBp1REsmo 6r722s4OfmdQ5Fvv+OWrBjy/7GrwpyP6epxbfSv2pnSa5B+K6OxWIJc4H11YFoHH/K/f aJBg== X-Gm-Message-State: AOAM533CMVCcWsT+ZcmujRd3qIwLBRdm4D+9LZYfWoepnbkTklWonG8g bSauGkGvsSlcIrt9ZcOBhcIFkg== X-Google-Smtp-Source: ABdhPJzbtXoC7DEwoIiQ+jWIhkLkIl5zJxnOW4Gh9T5vN3Jze/49js9wSRUUn6hSDMqXr/WdOg92EQ== X-Received: by 2002:a2e:5019:: with SMTP id e25mr4734342ljb.63.1632821741590; Tue, 28 Sep 2021 02:35:41 -0700 (PDT) Received: from localhost (109-252-93-92.nat.spd-mgts.ru. [109.252.93.92]) by smtp.gmail.com with ESMTPSA id t4sm2049418lfp.250.2021.09.28.02.35.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Sep 2021 02:35:40 -0700 (PDT) From: Andrew Tropin In-Reply-To: <87k0j14t56.fsf@gmail.com> References: <87k0j14t56.fsf@gmail.com> Date: Tue, 28 Sep 2021 12:35:37 +0300 Message-ID: <87a6jxghzq.fsf@trop.in> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="==-=-="; micalg=pgp-sha512; protocol="application/pgp-signature" Received-SPF: none client-ip=2a00:1450:4864:20::130; envelope-from=andrew@trop.in; helo=mail-lf1-x130.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-guix@gnu.org List-Id: Bug reports for GNU Guix List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guix-bounces+larch=yhetil.org@gnu.org Sender: "bug-Guix" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1632821995; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to: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=3VrhpRrgqvZI0LUX4CPrbnoXl786oxgt6KqhbwBT4E0=; b=M+hWMzFnJwvw7G9Dz5KuKPneiZL6iNP9gGNPTKvH9fS4ZKewbxwJ3t4hKDgLu5iNf44oWH 5nOG7jIkis8NY+p2P5yviDpoJvWlYARRHPUN7wS1Od6SHKutUwVUrSTxo6ioWo4CCJeHdS FRJkoN/VfTYxpEpnXqD2qznAqXF95G/d3+f6evhP4vGHAa+/KbYeiRe4gQxHvUzYaM3ccu xvXLmYdj/rfVZsTBuou29+2veXmOslgZacmr55DYa9AL/m84aUV91Q0/pRckWuPmcu4Cgy /1wEDuCwMBcYMkP7gnzMK9z6Nvi9vG2j0+dvJVt6vAABXE0Dwm6piVuIobBHnQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1632821995; a=rsa-sha256; cv=none; b=WcbLuhmLpq3X43vWcJEMfmnpPoJJl8dYSAuvNsR8T23El7oau/Wwjv8ZYVE3YU1rTc4hIj p/5jJ3X8ZA+T2+/fDAC+mPCaX1i9EXH3KNVXze19LnehKmn2eRrrwqw/Y5hZZFW4bn7w2v cOIpvxTwu+/YCu+dyHSkQTkH2NUFwyALsYOvIoLN3aRaZegiguwxqhwhI9ja2Ujq3sa4eU X/hkFuMDUu7TtnUmL7nbcZ3SoKovp0iR+n0mLbBPK9Unf3hrnEd9m14bnH9mqdx/24pBq9 CAt5biwYFHMhkoqzffWTO7NC4Vl+D9xN82wLohCbgC42WWrnpfttzPNDnqeslA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop-in.20210112.gappssmtp.com header.s=20210112 header.b=uJZEe20w; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Spam-Score: -3.49 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=trop-in.20210112.gappssmtp.com header.s=20210112 header.b=uJZEe20w; dmarc=none; spf=pass (aspmx1.migadu.com: domain of bug-guix-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=bug-guix-bounces@gnu.org X-Migadu-Queue-Id: 6051735869 X-Spam-Score: -3.49 X-Migadu-Scanner: scn0.migadu.com X-TUID: o8svExX/9DdF --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain On 2021-09-28 00:15, Oleg Pykhalov wrote: > Hi Guix, > > We have unbound variables in some Guix Home files: > --8<---------------cut here---------------start------------->8--- > gnu/home-services/configuration.scm:56:6: warning: possibly unbound variable `formatted-message' > gnu/home-services/configuration.scm:57:7: warning: possibly unbound variable `G_' > gnu/home-services/xdg.scm:309:43: warning: possibly unbound variable `maybe-list' > gnu/home-services/xdg.scm:330:13: warning: possibly unbound variable `list->human-readable-list' > guix/scripts/home/import.scm:210:18: warning: possibly unbound variable `package-version' > guix/scripts/home/import.scm:210:35: warning: possibly unbound variable `find-packages-by-name' > guix/scripts/home/import.scm:222:23: warning: possibly unbound variable `cut' > guix/scripts/home/import.scm:222:27: warning: possibly unbound variable `version>?' > guix/scripts/home/import.scm:222:45: warning: possibly unbound variable `<>' > guix/scripts/home/import.scm:225:16: warning: possibly unbound variable `version-unique-prefix' > --8<---------------cut here---------------end--------------->8--- > > maybe-list and list->human-readable-list come from > gnu/home-services-utils.scm in rde project. > > Oleg. My bad) Here it is: --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-home-services-Add-missing-imports-and-function-defin.patch Content-Transfer-Encoding: quoted-printable From=20634e6cbb7153ea02fb2ace6d39dae4055ed0c73c Mon Sep 17 00:00:00 2001 From: Andrew Tropin Date: Tue, 28 Sep 2021 12:30:55 +0300 Subject: [PATCH] home-services: Add missing imports and function definition. * gnu/home-services/configuration.scm: Add missing imports. * gnu/home-services/utils.scm (list->human-readable-list): Add new function. * gnu/home-services/configuration.scm: Add missing imports. * gnu/home-services/xdg.scm: Fix ensure-list function. * guix/scripts/home/import.scm: Add missing imports. =2D-- gnu/home-services/configuration.scm | 2 ++ gnu/home-services/utils.scm | 30 ++++++++++++++++++++++++++++- gnu/home-services/xdg.scm | 12 +++++++----- guix/scripts/home/import.scm | 4 ++++ 4 files changed, 42 insertions(+), 6 deletions(-) diff --git a/gnu/home-services/configuration.scm b/gnu/home-services/config= uration.scm index 3698006c37..e8f4bc77ec 100644 =2D-- a/gnu/home-services/configuration.scm +++ b/gnu/home-services/configuration.scm @@ -23,6 +23,8 @@ #:use-module (srfi srfi-1) #:use-module (ice-9 curried-definitions) #:use-module (ice-9 match) + #:use-module (guix i18n) + #:use-module (guix diagnostics) =20 #:export (filter-configuration-fields =20 diff --git a/gnu/home-services/utils.scm b/gnu/home-services/utils.scm index 3e490a0515..f13133a7ae 100644 =2D-- a/gnu/home-services/utils.scm +++ b/gnu/home-services/utils.scm @@ -24,7 +24,8 @@ =20 #:export (maybe-object->string object->snake-case-string =2D object->camel-case-string)) + object->camel-case-string + list->human-readable-list)) =20 (define (maybe-object->string object) "Like @code{object->string} but don't do anyting if OBJECT already is @@ -75,3 +76,30 @@ STYLE can be three `@code{lower}', `@code{upper}', defau= lts to (cons (first splitted-string) (map string-capitalize (cdr splitted-string)))))))))) + +(define* (list->human-readable-list lst + #:key + (cumulative? #f) + (proc identity)) + "Turn a list LST into a sequence of terms readable by humans. +If CUMULATIVE? is @code{#t}, use ``and'', otherwise use ``or'' before +the last term. + +PROC is a procedure to apply to each of the elements of a list before +turning them into a single human readable string. + +@example +(list->human-readable-list '(1 4 9) #:cumulative? #t #:proc sqrt) +@result{} \"1, 2, and 3\" +@end example + +yields:" + (let* ((word (if cumulative? "and " "or ")) + (init (append (drop-right lst 1)))) + (format #f "~a" (string-append + (string-join + (map (compose maybe-object->string proc) init) + ", " 'suffix) + word + (maybe-object->string (proc (last lst))))))) + diff --git a/gnu/home-services/xdg.scm b/gnu/home-services/xdg.scm index 457ce999a1..94275f3b65 100644 =2D-- a/gnu/home-services/xdg.scm +++ b/gnu/home-services/xdg.scm @@ -287,9 +287,9 @@ The value of an XDG MIME entry must be a list, string o= r symbol, was given ~a") =20 @example (merge-duplicates '((key1 . value1) =2D (key2 . value2) =2D (key1 . value3) =2D (key1 . value4)) '()) + (key2 . value2) + (key1 . value3) + (key1 . value4)) '()) =20 @result{} ((key1 . (value4 value3 value1)) (key2 . value2)) @end example" @@ -299,14 +299,16 @@ The value of an XDG MIME entry must be a list, string= or symbol, was given ~a") (tail (cdr alist)) (key (first head)) (value (cdr head)) =2D (duplicate? (assoc key acc))) + (duplicate? (assoc key acc)) + (ensure-list (lambda (x) + (if (list? x) x (list x))))) (if duplicate? ;; XXX: This will change the order of things, ;; though, it shouldn't be a problem for XDG MIME. (merge-duplicates tail (alist-cons key =2D (cons value (maybe-list (cdr duplicate?))) + (cons value (ensure-list (cdr duplicate?))) (alist-delete key acc))) (merge-duplicates tail (cons head acc))))))) =20 diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm index 39f45dbeac..79fb23a2fd 100644 =2D-- a/guix/scripts/home/import.scm +++ b/guix/scripts/home/import.scm @@ -20,9 +20,13 @@ (define-module (guix scripts home import) #:use-module (guix profiles) #:use-module (guix ui) + #:use-module (guix utils) + #:use-module (guix packages) + #:use-module (gnu packages) #:use-module (ice-9 match) #:use-module (ice-9 pretty-print) #:use-module (srfi srfi-1) + #:use-module (srfi srfi-26) #:export (import-manifest)) =20 ;;; Commentary: =2D-=20 2.33.0 --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEEKEGaxlA4dEDH6S/6IgjSCVjB3rAFAmFS4ekACgkQIgjSCVjB 3rBXAA/8Cv+g8uxRqGDGX5JkGxb06l0d8edrlETzUGHTwzyIeWDL2Lpw7oLV9CFD P361VQt7+oc/WQe/8lx/6xtj3NwxR7UzMOr2NEczr+Xtwjyzymo/NKCB63mBbDqF H4oaOgNT0woTxcAZnClvY/QgzsQUIBNto3x17m78g8SXn4TUQ6Kv9sdXfStyGVwR WFI10Qe6i0YVgvAchm3HbjM9hBgzC35owCTKt7+bxssHbdrFIZubMssMY/GNMPAm GCa1BulUHLLUg4/2aepqUbXZqFUqF3jAgJn2vIVPmAAtJa+pM7lVe0x4ctp/Dj/E Vjon8GEhFdgQIhGZMe2kFK96nZm5eNp71ftgiSENwvb13s0pCT26H0PEYalFonSM bw8FUVeH/AwVj3Mkw/tMQga4pQDpluC6ShOwMRL/W+0DTmSJeYikpdYmD6IQk/8G RzvLDisLKFNrHfBesvlk0YVTBzIxh5fw9zlOMdUXYUwqbavxfhik1K4PH+qqSsoy yb525ikvMOFh9kF5J44+2IvdolaeFqCuqFgO9sC8tpRuGgEHh7CpL3Kix1STOpjs pwXQZIxBsxzWBBLmhpuaXTdjr6OVCp9G3A3DE6ZSIIvWnQ9+lRJrepzId0ES8XgF mpHtkB1v2iqhdO+9Fkj71ZIeH8+8rqn/71rcCxAuv8yzGrY5l4s= =6XzT -----END PGP SIGNATURE----- --==-=-=--