From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id cIflMfkhfWEMmwAAgWs5BA (envelope-from ) for ; Sat, 30 Oct 2021 12:44:09 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 8NCTLfkhfWG6FgAAB5/wlQ (envelope-from ) for ; Sat, 30 Oct 2021 10:44:09 +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 95B7717426 for ; Sat, 30 Oct 2021 12:44:09 +0200 (CEST) Received: from localhost ([::1]:53144 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mglqK-00025c-KW for larch@yhetil.org; Sat, 30 Oct 2021 06:44:08 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52518) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mglqE-00025U-JH for guix-patches@gnu.org; Sat, 30 Oct 2021 06:44:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:45193) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mglqE-00023Q-Ay for guix-patches@gnu.org; Sat, 30 Oct 2021 06:44:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mglqE-0002dd-9E for guix-patches@gnu.org; Sat, 30 Oct 2021 06:44:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50873] [PATCH v3 8/8] guix home: import: Call =?UTF-8?Q?=E2=80=98local-file=E2=80=99?= with =?UTF-8?Q?=E2=80=98name=E2=80=99?= Resent-From: Xinglu Chen Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 30 Oct 2021 10:44:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 50873 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 50873@debbugs.gnu.org, Oleg Pykhalov , Andrew Tropin , Ludovic =?UTF-8?Q?Court=C3=A8s?= Received: via spool by 50873-submit@debbugs.gnu.org id=B50873.163559061210088 (code B ref 50873); Sat, 30 Oct 2021 10:44:02 +0000 Received: (at 50873) by debbugs.gnu.org; 30 Oct 2021 10:43:32 +0000 Received: from localhost ([127.0.0.1]:56739 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mglpk-0002ce-4d for submit@debbugs.gnu.org; Sat, 30 Oct 2021 06:43:32 -0400 Received: from h87-96-130-155.cust.a3fiber.se ([87.96.130.155]:59378 helo=mail.yoctocell.xyz) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mglp4-0002a4-4g for 50873@debbugs.gnu.org; Sat, 30 Oct 2021 06:42:50 -0400 From: Xinglu Chen DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=yoctocell.xyz; s=mail; t=1635590564; bh=UfY9+sc2B8doB9Z7PPiKrSE05DUz+hLQryKoFe2kmWc=; h=From:To:Subject:In-Reply-To:References:Date; b=lipI8QytGuzGQ5MvkifBXAi9tSO6TbR2UQETHykOfPV9AZoKCxBCgfdfoRgA42r7Y 6Pado9K6ZvIrc8fCf16na9btlmm/7KX5ABXviJpcbPf+t+rpqCOl3vXkrUluQh6pr/ RV09E/LYxN1qxGswFvvja0hv3ulR5naVVVxrWj60= In-Reply-To: References: Message-Id: <19dd061d4f7a3aab24ecb660df01e3c6613d4ae7.1635590221.git.public@yoctocell.xyz> Date: Sat, 30 Oct 2021 12:42:44 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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=1635590649; 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: 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:dkim-signature; bh=mTTv/kYzcdyjPmKdozAST/15ZX+PYa6sB8vP+sF370o=; b=dTjL0mU5fvzPuiGVK0JCAltdvKyob5NZzm2qdmp6Rmyfld7RzTbtsHD3mGg2rZrCfkLA66 ZY2Twgec4YoGAfl50NZrNSlo4JP3GAGl1Fwvv65Iv/2gEVAametzomK7Gk090xDWr9aRDO zc7QEXvkuQ1ZGGju/2ZFZ7iIM1aVmiKUMT0ljKObQNzL7DE8oEuprj7hQP+vXT27VQtUUL Sju342W9lPzERMkqTMmfXPYQjMc2C0W0DHddQiFinZJw4Eh4nEMVPZkf7sEktFZUKGfE21 DK31nfT+YZF1Seb8JYDGtBdZmUpygZa7rEA1xs/JaFrc2NmK2Cq4qyLsNy4+Nw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1635590649; a=rsa-sha256; cv=none; b=Wb31twxwCZ2O2V3w21aLeudZS1euTdj0Ur6DI3OpXFIIWtqGU0+YTX5JO1YeuF8OwRipjU KFzhD2GJ24EZUd2FzoGxhCBqDRc89kAzai8R1cvHeDGhYwNRJb7Gi0FBerWCGhctxHed0f jkGlqflLyczb0wWcAw7ICqGvoX6NNeT0Hhi4GeNmywIa5qoUStM/zp1a1FXCx2NLT3SsZ6 m0YhSWxRu4aHUKcT9P0vDuqc/QI3O9zZj2hirIIUDAlr/MRSgBwNGw+mGbBWUXywMFwFNp 9hmx/+Hf4AIiyUVm6QJguzGPRY6RRnQy1exR0utkicb1TuCwqa62TtVoV3fV1g== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=lipI8Qyt; dmarc=fail reason="SPF not aligned (relaxed)" header.from=yoctocell.xyz (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: 1.18 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=yoctocell.xyz header.s=mail header.b=lipI8Qyt; dmarc=fail reason="SPF not aligned (relaxed)" header.from=yoctocell.xyz (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: 95B7717426 X-Spam-Score: 1.18 X-Migadu-Scanner: scn0.migadu.com X-TUID: g0wsRCOAibsa Set the name of the file to just the basename of the file passed to =E2=80=98local-file=E2=80=99. * guix/scripts/home/import.scm (basename+remove-dots): New procedure. (generate-bash-configuration+modules): Use it. * tests/home-import.scm (match-home-environment-bash-service): Adjust accordingly. --- guix/scripts/home/import.scm | 20 ++++++++++++++++---- tests/home-import.scm | 3 ++- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/guix/scripts/home/import.scm b/guix/scripts/home/import.scm index 6e3ed065d5..a0022458f6 100644 --- a/guix/scripts/home/import.scm +++ b/guix/scripts/home/import.scm @@ -39,7 +39,16 @@ (define-module (guix scripts home import) ;;; ;;; Code: =20 - +(define (basename+remove-dots file-name) + "Remove the dot from the dotfile FILE-NAME; replace the other dots in +FILE-NAME with \"-\", and return the basename of it." + (string-map (match-lambda + (#\. #\-) + (c c)) + (let ((base (basename file-name))) + (if (string-prefix? "." base) + (string-drop base 1) + base)))) =20 (define (generate-bash-configuration+modules destination-directory) (define (destination-append path) @@ -52,15 +61,18 @@ (define (destination-append path) (home-bash-configuration ,@(if (file-exists? rc) `((bashrc - (list (local-file ,rc)))) + (list (local-file ,rc + ,(basename+remove-dots rc))))) '()) ,@(if (file-exists? profile) `((bash-profile - (list (local-file ,profile)))) + (list (local-file ,profile + ,(basename+remove-dots profile)= )))) '()) ,@(if (file-exists? logout) `((bash-logout - (list (local-file ,logout)))) + (list (local-file ,logout + ,(basename+remove-dots logout))= ))) '()))) (guix gexp) (gnu home services shells)))) diff --git a/tests/home-import.scm b/tests/home-import.scm index a4e71fa698..d2f5728e3c 100644 --- a/tests/home-import.scm +++ b/tests/home-import.scm @@ -156,7 +156,8 @@ (define-home-environment-matcher match-home-environment= -bash-service 'home-bash-service-type ('home-bash-configuration ('bashrc - ('list ('local-file "/tmp/guix-config/.bashrc")))))))))) + ('list ('local-file "/tmp/guix-config/.bashrc" + "bashrc")))))))))) =20 (test-assert "manifest->code: No services" (eval-test-with-home-environment --=20 2.33.0