From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id yKrEKeANcmBWPgEAgWs5BA (envelope-from ) for ; Sat, 10 Apr 2021 22:43:12 +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 6MtgIuANcmBQBQAAB5/wlQ (envelope-from ) for ; Sat, 10 Apr 2021 20:43:12 +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 29E751E5CA for ; Sat, 10 Apr 2021 22:43:12 +0200 (CEST) Received: from localhost ([::1]:38548 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVKRj-0004oc-Bd for larch@yhetil.org; Sat, 10 Apr 2021 16:43:11 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39256) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lVKRa-0004oU-QN for guix-patches@gnu.org; Sat, 10 Apr 2021 16:43:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:41862) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lVKRa-0004nm-J5 for guix-patches@gnu.org; Sat, 10 Apr 2021 16:43:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lVKRa-0002Wd-E1 for guix-patches@gnu.org; Sat, 10 Apr 2021 16:43:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#43627] [PATCH core-updates v2 1/2] guix: Add an append-separator? field to the record. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 10 Apr 2021 20:43:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 43627 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Maxim Cournoyer Cc: 43627@debbugs.gnu.org, Leo Prikler Received: via spool by 43627-submit@debbugs.gnu.org id=B43627.16180873539672 (code B ref 43627); Sat, 10 Apr 2021 20:43:02 +0000 Received: (at 43627) by debbugs.gnu.org; 10 Apr 2021 20:42:33 +0000 Received: from localhost ([127.0.0.1]:53408 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVKR6-0002Vw-R2 for submit@debbugs.gnu.org; Sat, 10 Apr 2021 16:42:33 -0400 Received: from eggs.gnu.org ([209.51.188.92]:46192) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lVKR5-0002Vj-L6 for 43627@debbugs.gnu.org; Sat, 10 Apr 2021 16:42:32 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:50722) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lVKQx-0004PO-L7; Sat, 10 Apr 2021 16:42:24 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=42012 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lVKQw-00026S-Av; Sat, 10 Apr 2021 16:42:22 -0400 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <87blhtt6d6.fsf@gmail.com> <20210330155102.16610-1-maxim.cournoyer@gmail.com> X-URL: http://www.fdn.fr/~lcourtes/ X-Revolutionary-Date: 21 Germinal an 229 de la =?UTF-8?Q?R=C3=A9volution?= X-PGP-Key-ID: 0x090B11993D9AEBB5 X-PGP-Key: http://www.fdn.fr/~lcourtes/ludovic.asc X-PGP-Fingerprint: 3CE4 6455 8A84 FDC6 9DB4 0CFB 090B 1199 3D9A EBB5 X-OS: x86_64-pc-linux-gnu Date: Sat, 10 Apr 2021 22:42:18 +0200 In-Reply-To: <20210330155102.16610-1-maxim.cournoyer@gmail.com> (Maxim Cournoyer's message of "Tue, 30 Mar 2021 11:51:01 -0400") Message-ID: <87o8el27o5.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Content-Transfer-Encoding: 8bit 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=1618087392; 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: content-transfer-encoding:content-transfer-encoding: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; bh=sTzFktX16sfqmaT5/TGzrh7Ig//EHtGt89sl0x283PY=; b=VDBTXTMltlF7li106zxs1FvGipahsS1ROZHsr7K/wYyMV+OMpCTutKY7PkIT+7LrECpjIe tjvOMsh0lsFEHaD6wNINTdqqODM/ws/Sa0OlGxImBFije1GYnEQhm+dAneKj0ociRC+XCu AEodnh2KerpV2Oku5c12FIwbyU7BNpJ0h4H5JSRt+e2lyhI5qmcQlngzs5S/tx5knXx+QD zAOpyJSrC93WF8xGS+EJaNccRFJUnSBT3OoUYewYb+HmxdKHcL4ldN4FCrS3t3PKMQVADO xaHvLa5ZOLRzER/dZPVNslO3KOCXLJGAD/n88+oEz+itarVtsfxM4mQDWYSOcQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1618087392; a=rsa-sha256; cv=none; b=I9ZEL+nj6G/LOX0j3plQLjAqeKiUAt6D4hiy9QvRPbKpQ/sH1SnZiT048sqyWa2rhv7k+Z MZ0fuLD9c58WUebeTQzsguJbNUX4zdJzQyA5Alh+FraNIdCT+WzOSAaSutL+l52g4N3fOe ZPKFczE2Mt6fiB3KB70DXpelMFHeRGm6Hvs5bxvIXK7MSKi5jivSnu1R1AvmroZHRZvOFv sWVFYmWWsXozp/uSi9xuLGFw/m2xdVqmpCAmy8rlQtnIxOv5qj0nYtc4OGRUvfSYPDEVME /jI4movCRf14qNW+ybmhWztb84AAq8OqIm2VNJzZ0Vds/AS3Iizz/FeO4Ga5sQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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.44 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=pass (policy=none) header.from=gnu.org; 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: 29E751E5CA X-Spam-Score: -0.44 X-Migadu-Scanner: scn0.migadu.com X-TUID: Qs9WzYhkUiVa Hi, Maxim Cournoyer skribis: > This new field allows to specify in a search-path-specification that a > trailing separator should be added to the computed value of the environment > variable. A trailing separator sometimes has the meaning that the usual > builtin locations should be looked up as well as the ones explicitly > specified. > > One use case is to specify the Emacs library paths using EMACSLOADPATH. This > allows to not embed the Emacs version in its search path specification, which > has been shown to cause issues when upgrading a profile or when defining > variant Emacs packages of different versions. Got it now. :-) Leos patch series seems to be addressing the same issue: https://issues.guix.gnu.org/47661 Should we hold on until weve reviewed and acted upon #47661? Or does it have known uses apart from Emacs? > * guix/search-paths.scm (searh-path-specification): Add an APPEND-SEPARATOR? > field. > (search-path-specification->sexp): Adjust accordingly. > (sexp->search-path-specification): Likewise. > (evaluate-search-paths): Append a separator to the search path value when both > `separator' and `append-separator?' are #t. Document the new behavior. > * guix/scripts/environment.scm (create-environment): Adjust the logic used to > merge search-path values when creating an environment profile. > * guix/build/gnu-build-system.scm (set-paths): Adjust accordingly. Overall LGTM. Id suggest maybe replacing append-separator? by trailing-separator?, which I find a bit clearer. Could you add a test or two in tests/search-paths.scm, for the corner cases? > - ((env-var (files ...) separator type pattern) > + ((env-var (files ...) separator type pattern append-sep) > (set-path-environment-variable env-var files > input-directories > #:separator separator > #:type type > - #:pattern pattern))) > + #:pattern pattern > + #:append-separator? append-sep))) > search-paths) > > (when native-search-paths > ;; Search paths for native inputs, when cross building. > (for-each (match-lambda > - ((env-var (files ...) separator type pattern) > + ((env-var (files ...) separator type pattern append-sep) > (set-path-environment-variable env-var files Id fully spell out the variable name, like append-separator?, append?, trailing?, as per our coding style. > +++ b/guix/build/profiles.scm > @@ -1,5 +1,6 @@ > ;;; GNU Guix --- Functional package management for GNU > ;;; Copyright © 2015, 2017, 2018, 2019, 2020, 2021 Ludovic Court¨s > +;;; Copyright © 2020 Maxim Cournoyer > ;;; > ;;; This file is part of GNU Guix. > ;;; > @@ -20,6 +21,7 @@ > #:use-module (guix build union) > #:use-module (guix build utils) > #:use-module (guix search-paths) > + #:use-module (srfi srfi-1) > #:use-module (srfi srfi-26) > #:use-module (ice-9 ftw) > #:use-module (ice-9 match) > @@ -51,10 +53,13 @@ user-friendly name of the profile is, for instance ~/.guix-profile rather than > ((? string? separator) > (let ((items (string-tokenize* value separator))) > (cons search-path > - (string-join (map (lambda (str) > - (string-append replacement (crop str))) > - items) > - separator))))))))) > + (string-join > + (map (lambda (str) > + (string-append replacement (crop str))) > + ;; When APPEND-SEPARATOR? is #t, the trailing > + ;; separator causes an empty string item. Remove it. > + (remove string-null? items)) > + separator))))))))) If we remove the empty string, dont we lose the trailing separator? > +++ b/guix/build/utils.scm > @@ -573,7 +573,8 @@ for under the directories designated by FILES. For example: > #:key > (separator ":") > (type 'directory) > - pattern) > + pattern > + (append-separator? #f)) > "Look for each of FILES of the given TYPE (a symbol as returned by > 'stat:type') in INPUT-DIRS. Set ENV-VAR to a SEPARATOR-separated path > accordingly. Example: > @@ -590,11 +591,16 @@ denoting file names to look for under the directories designated by FILES: > (list docbook-xml docbook-xsl) > #:type 'regular > #:pattern \"^catalog\\\\.xml$\") > -" > + > +When both SEPARATOR and APPEND-SEPARATOR? are true, a separator is appended to > +the value of the environment variable." > (let* ((path (search-path-as-list files input-dirs > #:type type > #:pattern pattern)) > - (value (list->search-path-as-string path separator))) > + (value (list->search-path-as-string path separator)) > + (value (if append-separator? > + (string-append value separator) > + value))) Indentation is off. Thats it. Thanks and apologies for the delay! Ludo.