From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id oIsqO5mMYWG27QAAgWs5BA (envelope-from ) for ; Sat, 09 Oct 2021 14:35:37 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id naKmNpmMYWHAJgAAbx9fmQ (envelope-from ) for ; Sat, 09 Oct 2021 12:35:37 +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 3FEC14AD0 for ; Sat, 9 Oct 2021 14:35:37 +0200 (CEST) Received: from localhost ([::1]:46744 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mZBZf-000596-Mu for larch@yhetil.org; Sat, 09 Oct 2021 08:35:35 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:51326) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mZBZ8-00058U-JD for guix-patches@gnu.org; Sat, 09 Oct 2021 08:35:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:40888) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mZBZ8-0006wo-0o for guix-patches@gnu.org; Sat, 09 Oct 2021 08:35:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1mZBZ7-0005zu-OE for guix-patches@gnu.org; Sat, 09 Oct 2021 08:35:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#50967] [PATCH 00/12] Move (gnu home-services XYZ) to (gnu services XYZ) Resent-From: Oleg Pykhalov Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Sat, 09 Oct 2021 12:35:01 +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: Ludovic =?UTF-8?Q?Court=C3=A8s?= Cc: Andrew Tropin , Xinglu Chen , 50967@debbugs.gnu.org, zimoun Received: via spool by 50967-submit@debbugs.gnu.org id=B50967.163378289823040 (code B ref 50967); Sat, 09 Oct 2021 12:35:01 +0000 Received: (at 50967) by debbugs.gnu.org; 9 Oct 2021 12:34:58 +0000 Received: from localhost ([127.0.0.1]:52434 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mZBYp-0005zI-GC for submit@debbugs.gnu.org; Sat, 09 Oct 2021 08:34:54 -0400 Received: from mail-lf1-f42.google.com ([209.85.167.42]:37496) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1mZBYl-0005z4-OU for 50967@debbugs.gnu.org; Sat, 09 Oct 2021 08:34:42 -0400 Received: by mail-lf1-f42.google.com with SMTP id z11so42152728lfj.4 for <50967@debbugs.gnu.org>; Sat, 09 Oct 2021 05:34:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version; bh=rAILKsOUN7rBr8kiPi7xY/fuAefouPX2FmGOHFyoiGI=; b=UHxmMikrSYIWjw5REyFJTh74+/yJJObUYtC0Vs9jGL+mL7+bXEykR2kxlyC706I3jv nUkQPt9B0pgIB6NnP6WVXVwx8vp6Ci0TjiHfmlF+7eCPgw8HeJgb7BIIkofAWpEozuQ6 x53MXLgGC+5EYDq241Xsu4Q1KNCoBCbaSQZ8E06gOWplDO+JF6mmRIjOEqknR8vIr+IQ s4hDoXctl9vxXl6V0k9abYks5Og3uILZye6oXTUkOvTIukhjMxEoekzMHetj8wjABqRo PKDZqFXoKPyBriTikCsBayhLpDgKi4aWgg90loKZh3xmmsy49b0bAjk+sKrXquJntwka O7XQ== 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:references:date:in-reply-to :message-id:user-agent:mime-version; bh=rAILKsOUN7rBr8kiPi7xY/fuAefouPX2FmGOHFyoiGI=; b=vL3xJvzWkzTf8f0P4J1juJoXD/NbTZyb01hKxD3hRbsbsHFX/3xM+XRsT6UIT1lylK MGeAwgAbMV5ATsZPqFqlL/Jj2rt17GZpaMg7Ni95/3exfHhXLLf1FB7wZZYkdek7vRTu TwLCLsYPm1SdF+h6OpoU919vb1OfxD8c3kTWsvT30QwUhzqz+mtVGJr4wpROsVm9e5nA QIuWoWFLWC8irq6bzCXAZD2ZwdhgD18W1gIUwW6WiIG08R5HmR2EhawvMsJajqGm6L9K HMxQnDZPchbf+AzBr1JAuUK9G5qhtj18b64eA9ZCzklKI1eWoRZWEA6Q0EkVuphGOfd+ yIPg== X-Gm-Message-State: AOAM531X9sW5pJbPF6LKFNa1YmbzYLV1xeEIsEkTARJdwj7vF3eVcy0Y 5fVXkHqVA7mJjGGSArJ1g+8= X-Google-Smtp-Source: ABdhPJwq5SSDlfK9kXFgn4NSCgD7diUwtr88YMgB9bZdZAGOIXJTJhpLts2vfcraMUfr1I6IfHfGrA== X-Received: by 2002:a2e:9e50:: with SMTP id g16mr3122923ljk.183.1633782873609; Sat, 09 Oct 2021 05:34:33 -0700 (PDT) Received: from guixsd ([88.201.161.72]) by smtp.gmail.com with ESMTPSA id h6sm201845lfc.72.2021.10.09.05.34.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 09 Oct 2021 05:34:32 -0700 (PDT) From: Oleg Pykhalov References: <87h7dwq4cb.fsf_-_@gnu.org> <20211004231331.5269-1-go.wigust@gmail.com> <20211004231331.5269-3-go.wigust@gmail.com> <878rz54xmy.fsf@gmail.com> <87o87z2kge.fsf_-_@gnu.org> Date: Sat, 09 Oct 2021 15:34:30 +0300 In-Reply-To: <87o87z2kge.fsf_-_@gnu.org> ("Ludovic =?UTF-8?Q?Court=C3=A8s?="'s message of "Sat, 09 Oct 2021 00:57:53 +0200") Message-ID: <87k0im74x5.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1633782937; 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=rAILKsOUN7rBr8kiPi7xY/fuAefouPX2FmGOHFyoiGI=; b=Y5NRQSo2NJl85Ism7JrkgzfA3Pk6UCOntiXm9cJyoP+UDEpEFoSOIjXjdbS1101uQQs+VO IjApUA64TfOCJMgtrtT/GKtCoLCAWgeM+BG2AHroWOOmJc6SBZNokuGmKMwyTbTGYpOkmq 1lJlkntnK0fyCJOffX5ZarrGJL25ErjZHP+taaWLBxKmJZxdCo2k0/ZNaOIu0GNfY0IXBz VKKAaYaby1coKBsFWsL5n8TFOUJ/mhMLbJHkbjBRIhSw2A+geaHzf58H+VbVQ/wqtqAxjg eUtmtk1eQZVGUfY3cdqMETQbxi86ExEsAh9lZIxndo4sVkzia+Q+JdMa6FCLsQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1633782937; a=rsa-sha256; cv=none; b=Ji2Bhu2fCnx4JeeiHw4znqCC7aCzBY34ClD1Akim+bbPzMQZFuVgZ983hlgjIxQB+3FAkO l9q5oMEqIgYoyms4IVs3l2STkv8wg+VkcRnjH9sscZ3MCDIz7Dnsc4m7gmZZt2uMBIfbGq A8mW644KuLmQKEqkaEf7fV5/x/IBOD4zgCvTNwH1Gm5hod988o+/AvYhW5KkdXT+B4qV3v k1xpWkvBVjcgJrdI8oET37JGS8EoAd8FUmrObbIn3+jHycFV8731qnUQHHa7hLlJuobUiL 76herXomN+w/rtFfVpZx6aRb2uFshH7LcpAiDOQpAg2ctVx2noSW+sdc9qRkhA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=UHxmMikr; 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: -2.31 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=UHxmMikr; 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: 3FEC14AD0 X-Spam-Score: -2.31 X-Migadu-Scanner: scn1.migadu.com X-TUID: fmYdeiLJbpEQ --==-=-= Content-Type: multipart/mixed; boundary="=-=-=" --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Ludovic Court=C3=A8s writes: >> From eec2ab5f514ec6e156244898f8a635baf323ab70 Mon Sep 17 00:00:00 2001 >> From: Oleg Pykhalov >> Date: Tue, 5 Oct 2021 02:10:25 +0300 >> Subject: [PATCH] scripts: home: Make sure profile directory exists. [=E2=80=A6] > Also, wouldn=E2=80=99t it be easier to set HOME to a new directory? > >> + guix home reconfigure "${test_directory}/home.scm" We probably should clean temporary $HOME directory with 'rm -rf' or delete each file with 'rm' and then invoke 'rmdir' inside a Bash's 'trap'. I fill worry about removing operations on $HOME directories. Alternative is not to remove $HOME by calling some command and just exit from a namespace, which will remove $HOME mounted as tmpfs after exiting a process running the guix-home.sh test. [=E2=80=A6] > Could you send an updated patch? Also returned Andrew's 'guix home search' tests. And 'home-bash-service-type' is replaced with 'simple-service' to not to block the guix-home.sh test from merging in master until completion of discussion about file-like objects. --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0001-scripts-home-Make-sure-profile-directory-exists.patch Content-Transfer-Encoding: quoted-printable Content-Description: scripts: home: Make sure profile directory exists. From=204b29f7f1592f4256c7cd628624d2225e2d427a9d Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Sat, 9 Oct 2021 14:52:10 +0300 Subject: [PATCH 1/2] scripts: home: Make sure profile directory exists. * guix/scripts/home.scm (process-action): Make sure profile directory exist= s. =2D-- guix/scripts/home.scm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm index a4d4aaa562..e6e35513fd 100644 =2D-- a/guix/scripts/home.scm +++ b/guix/scripts/home.scm @@ -2,6 +2,7 @@ ;;; Copyright =C2=A9 2021 Andrew Tropin ;;; Copyright =C2=A9 2021 Xinglu Chen ;;; Copyright =C2=A9 2021 Pierre Langlois +;;; Copyright =C2=A9 2021 Oleg Pykhalov ;;; ;;; This file is part of GNU Guix. ;;; @@ -189,6 +190,7 @@ ACTION must be one of the sub-commands that takes a hom= e environment declaration as an argument (a file name.) OPTS is the raw alist of options resulting from command-line parsing." (define (ensure-home-environment file-or-exp obj) + (ensure-profile-directory) (unless (home-environment? obj) (leave (G_ "'~a' does not return a home environment ~%") file-or-exp)) =2D-=20 2.33.0 --=-=-= Content-Type: text/x-patch; charset=utf-8 Content-Disposition: attachment; filename=0002-tests-Add-guix-home.sh.patch Content-Transfer-Encoding: quoted-printable Content-Description: tests: Add guix-home.sh. From=205cc0b064af3f4a6238722fbb451a98b499c8d6d2 Mon Sep 17 00:00:00 2001 From: Oleg Pykhalov Date: Sat, 9 Oct 2021 14:52:13 +0300 Subject: [PATCH 2/2] tests: Add guix-home.sh. * tests/guix-home.sh: New file. * Makefile.am (SH_TESTS): Add this. =2D-- Makefile.am | 1 + tests/guix-home.sh | 122 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+) create mode 100644 tests/guix-home.sh diff --git a/Makefile.am b/Makefile.am index bb0b5989d2..b341031ec9 100644 =2D-- a/Makefile.am +++ b/Makefile.am @@ -552,6 +552,7 @@ SH_TESTS =3D \ tests/guix-package-aliases.sh \ tests/guix-package-net.sh \ tests/guix-system.sh \ + tests/guix-home.sh \ tests/guix-archive.sh \ tests/guix-authenticate.sh \ tests/guix-environment.sh \ diff --git a/tests/guix-home.sh b/tests/guix-home.sh new file mode 100644 index 0000000000..f251304083 =2D-- /dev/null +++ b/tests/guix-home.sh @@ -0,0 +1,122 @@ + +# GNU Guix --- Functional package management for GNU +# Copyright =C2=A9 2021 Andrew Tropin +# Copyright =C2=A9 2021 Oleg Pykhalov +# +# This file is part of GNU Guix. +# +# GNU Guix is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or (at +# your option) any later version. +# +# GNU Guix is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Guix. If not, see . + +# +# Test the 'guix home' using the external store, if any. +# + +set -e + +guix home --version + +NIX_STORE_DIR=3D"$(guile -c '(use-modules (guix config))(display %storedir= )')" +localstatedir=3D"$(guile -c '(use-modules (guix config))(display %localsta= tedir)')" +GUIX_DAEMON_SOCKET=3D"$localstatedir/guix/daemon-socket/socket" +export NIX_STORE_DIR GUIX_DAEMON_SOCKET + +# Run tests only when a "real" daemon is available. +if ! guile -c '(use-modules (guix)) (exit (false-if-exception (open-connec= tion)))' +then + exit 77 +fi + +STORE_PARENT=3D"$(dirname "$NIX_STORE_DIR")" +export STORE_PARENT +if test "$STORE_PARENT" =3D "/"; then exit 77; fi + +run_guix_home_without_home() +{ + set -e + + # Save current directory (Guix source directory) for later mount + test_directory=3D"$(mktemp -d)" + trap 'umount $test_directory; rmdir $test_directory' EXIT + mount --bind "$PWD" "$test_directory" + + # Make $HOME directory empty to preserve user's files + mount --types tmpfs none "$HOME" + + # Mount Guix source directory in a clean environment + mkdir -p "$PWD" + mount --bind "$test_directory" "$PWD" + cd "$PWD" || exit 77 + + # + # Test 'guix home reconfigure'. + # + + cat > "home.scm" <<'EOF' +(use-modules (guix gexp) + (gnu home) + (gnu home-services) + (gnu services)) + +(home-environment + (services + (list + (simple-service 'test-config + home-files-service-type + (list `("config/test.conf" + ,(plain-file + "tmp-file.txt" + "the content of ~/.config/test.conf"))))))) +EOF + + guix home reconfigure "${test_directory}/home.scm" + test -d "${HOME}/.guix-home" + grep -q "the content of ~/.config/test.conf" "${HOME}/.config/test.con= f" + + # + # Test 'guix home describe'. + # + + configuration_file() + { + guix home describe \ + | grep 'configuration file:' \ + | cut -d : -f 2 \ + | xargs echo + } + test "$(cat "$(configuration_file)")" =3D=3D "$(cat home.scm)" + + canonical_file_name() + { + guix home describe \ + | grep 'canonical file name:' \ + | cut -d : -f 2 \ + | xargs echo + } + test "$(canonical_file_name)" =3D=3D "$(readlink "${HOME}/.guix-home")" + + # + # Test 'guix home search'. + # + + guix home search mcron | grep "^name: home-mcron" + guix home search job manager | grep "^name: home-mcron" +} +export -f run_guix_home_without_home + +if unshare -r true # Are user namespaces supported? +then + unshare --mount --map-root-user --fork sh -c "run_guix_home_without_ho= me" +else + exit 77 +fi =2D-=20 2.33.0 --=-=-= Content-Type: text/plain Oleg. --=-=-=-- --==-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQJIBAEBCgAyFiEEcjhxI46s62NFSFhXFn+OpQAa+pwFAmFhjFYUHGdvLndpZ3Vz dEBnbWFpbC5jb20ACgkQFn+OpQAa+px6xA/+IyBC69mIdZDVaSslhxm+CiIgNZFn KZAl89bVZz35rx4E8pULhB1RCXCMUeFipJhnjcWOcsGtO3g7LJgU/VBPAE+dx2YO QencgoqvduUctnYmnIUyoEVqxLtAwDO/qu+riOjZo+Nfwq47CjQU5UMbDxqYZfMb Q1iSB3eVPYcL5fVKfrYWtgKi0Ouzoj16Qo/orIPe3+PZFw5SYoTB4Nom8UGE450J kWU9ukPQ7giC7wSP6KrwJ7hCKJgcsmUFyB4Ffo1HNc6BviiFxQZY1/263mluDeoz C8dxAebgSCCtZDVePNOZK6E6AXRfXKI7kzvv1PoAC7M28DB3FzsnZjYXTGUq67pX IESqXcqww98ltgx5pZbhR/vZJyUcmPnLFSmD2v+vT3KuQwTf+U5QXaVYeN3fyNj5 LNUfneMeb6I5MInykseSqvkjtdYGH+mScQ0XoTEudBTz2L7nJ/CThvnoGcwe4c28 3tg0FMyqpHEbpsQYDpn1Xcjr+XK7WUf/O5OJMEAK9qRmGuNq6XW4DsBFSn4l+0Gc geDrmdPnf7fXSKBmHw7jMhnVIGkGJfPxw0/cp0I/as8GzHn55pZc8LyaahaRcY+b mT/FIsbe34ZYxlskkMWMs7uEyAcGxzf3lTrZ1VmLOFLgyqGxfViSZtEjOpHVIkdB aejEXR8OVMUj+KU= =Xz3D -----END PGP SIGNATURE----- --==-=-=--