[PATCH] etc: gitconfig: Run etc/teams.scm from correct environment.

  • Done
  • quality assurance status badge
Details
2 participants
  • Clément Lassieur
  • Maxim Cournoyer
Owner
unassigned
Submitted by
Clément Lassieur
Severity
normal
Merged with

Debbugs page

C
C
Clément Lassieur wrote on 18 Oct 2023 05:05
(address . guix-patches@gnu.org)(name . Clément Lassieur)(address . clement@lassieur.org)
d5abdf65dfd8d835e3a7ae9aa5c419bca0f55db6.1697630719.git.clement@lassieur.org
* etc/git/gitconfig: Prepend "guix shell -D guix --pure ./pre-inst-env" to the
etc/teams.scm script so that any user that have git:send-email installed can
use it in the Guix checkout without changing their environment.
---
etc/git/gitconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/etc/git/gitconfig b/etc/git/gitconfig
index 907ad0180454..757360220155 100644
--- a/etc/git/gitconfig
+++ b/etc/git/gitconfig
@@ -14,5 +14,5 @@
[sendemail]
to = guix-patches@gnu.org
- headerCmd = etc/teams.scm cc-members-header-cmd
+ headerCmd = guix shell -D guix --pure -- ./pre-inst-env etc/teams.scm cc-members-header-cmd
thread = no

base-commit: 5498835bb38c0de57f284f0fa6b1178ecdcaf678
prerequisite-patch-id: d95e49e4fc059972fc5a7b2c92816df2228a0af1
prerequisite-patch-id: a0dca8c3175d6ce71c77e220c4ac98b6e97cef56
--
2.41.0
M
M
Maxim Cournoyer wrote on 18 Oct 2023 10:54
(name . Clément Lassieur)(address . clement@lassieur.org)(address . 66605@debbugs.gnu.org)
874jinu88f.fsf@gmail.com
Hi,

Clément Lassieur <clement@lassieur.org> writes:

Toggle quote (4 lines)
> * etc/git/gitconfig: Prepend "guix shell -D guix --pure ./pre-inst-env" to the
> etc/teams.scm script so that any user that have git:send-email installed can
> use it in the Guix checkout without changing their environment.

I'm not sure I understand; why does etc/teams.scm cc-members-header-cmd
fail in an environment where git:send-email is available?

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 18 Oct 2023 10:54
control message for bug #66605
(address . control@debbugs.gnu.org)
87wmvjstni.fsf@gmail.com
tags 66605 + moreinfo
quit
C
C
Clément Lassieur wrote on 18 Oct 2023 13:52
Re: [bug#66605] [PATCH] etc: gitconfig: Run etc/teams.scm from correct environment.
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 66605@debbugs.gnu.org)
87cyxbk618.fsf@lassieur.org
Hi Maxim,

Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (7 lines)
>> * etc/git/gitconfig: Prepend "guix shell -D guix --pure ./pre-inst-env" to the
>> etc/teams.scm script so that any user that have git:send-email installed can
>> use it in the Guix checkout without changing their environment.
>
> I'm not sure I understand; why does etc/teams.scm cc-members-header-cmd
> fail in an environment where git:send-email is available?

Because it requires (git) and (guix ui). So you need ./pre-inst-env for
(guix ui), plus guile, guile-git and guile-gcrypt. The minimal setup
would be:

`guix shell guile guile-git guile-gcrypt git git:send-email --pure -- ./pre-inst-env git send-email`

or

`guix shell guile guile-git guile-gcrypt -- ./pre-inst-env git send-email`

with an impure environment containing git and git:send-email.

But it could be shortened as

`guix shell git:send-email -D guix --pure -- ./pre-inst-env git send-email`

However, in this case `guix shell git:send-email` is necessary even with
impure environments containing git and git:send-email because `-D guix`
pulls git without pulling git:send-email.

Thanks,
Clément
C
C
Clément Lassieur wrote on 18 Oct 2023 14:50
[PATCH v2] etc: gitconfig: Run etc/teams.scm from correct environment.
(address . 66605@debbugs.gnu.org)(name . Clément Lassieur)(address . clement@lassieur.org)
d409fe3f12ae15b9f663a81221f5bbf254c995ee.1697665843.git.clement@lassieur.org
* etc/git/gitconfig: Prepend "guix repl" to the etc/teams.scm script so that
any user that has git:send-email installed can use it in the Guix checkout
without changing their environment. (teams.scm uses (git) and (guix ui).)
---
etc/git/gitconfig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

Toggle diff (17 lines)
diff --git a/etc/git/gitconfig b/etc/git/gitconfig
index 907ad0180454..abcd494d62e8 100644
--- a/etc/git/gitconfig
+++ b/etc/git/gitconfig
@@ -14,5 +14,5 @@
[sendemail]
to = guix-patches@gnu.org
- headerCmd = etc/teams.scm cc-members-header-cmd
+ headerCmd = guix repl etc/teams.scm cc-members-header-cmd
thread = no

base-commit: 5498835bb38c0de57f284f0fa6b1178ecdcaf678
prerequisite-patch-id: d95e49e4fc059972fc5a7b2c92816df2228a0af1
prerequisite-patch-id: a0dca8c3175d6ce71c77e220c4ac98b6e97cef56
--
2.41.0
M
M
Maxim Cournoyer wrote on 18 Oct 2023 18:39
(name . Clément Lassieur)(address . clement@lassieur.org)(address . 66605@debbugs.gnu.org)
87lebzqtki.fsf@gmail.com
Hi,

Clément Lassieur <clement@lassieur.org> writes:

Toggle quote (18 lines)
> * etc/git/gitconfig: Prepend "guix repl" to the etc/teams.scm script so that
> any user that has git:send-email installed can use it in the Guix checkout
> without changing their environment. (teams.scm uses (git) and (guix ui).)
> ---
> etc/git/gitconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/etc/git/gitconfig b/etc/git/gitconfig
> index 907ad0180454..abcd494d62e8 100644
> --- a/etc/git/gitconfig
> +++ b/etc/git/gitconfig
> @@ -14,5 +14,5 @@
>
> [sendemail]
> to = guix-patches@gnu.org
> - headerCmd = etc/teams.scm cc-members-header-cmd
> + headerCmd = guix repl etc/teams.scm cc-members-header-cmd

I had noticed as well that since Guix depends on 'git', we now have to
include git:send-email to the profile to be able to use it, like:

'guix shell -D guix git:send-email'.

I think on foreign distributions, you also need to use mumi or git
send-email in ./pre-inst-env, which is what your patch solves, I
believe. This is not needed on a Guix System because the guix-daemon
used by it adds the Guix modules to the GUILE_LOAD_PATH.

--
Thanks,
Maxim
M
M
Maxim Cournoyer wrote on 18 Oct 2023 18:44
control message for bug #66605
(address . control@debbugs.gnu.org)
87edhrqtc3.fsf@gmail.com
forcemerge 66605 66616
quit
M
M
Maxim Cournoyer wrote on 18 Oct 2023 18:44
(address . control@debbugs.gnu.org)
87cyxbqtbm.fsf@gmail.com
forcemerge 66605 66617
quit
M
M
Maxim Cournoyer wrote on 18 Oct 2023 18:47
Re: [bug#66605] [PATCH v2] etc: gitconfig: Run etc/teams.scm from correct environment.
(name . Clément Lassieur)(address . clement@lassieur.org)(address . 66605@debbugs.gnu.org)
878r7zqt7r.fsf@gmail.com
Hello,

Clément Lassieur <clement@lassieur.org> writes:

Toggle quote (18 lines)
> * etc/git/gitconfig: Prepend "guix repl" to the etc/teams.scm script so that
> any user that has git:send-email installed can use it in the Guix checkout
> without changing their environment. (teams.scm uses (git) and (guix ui).)
> ---
> etc/git/gitconfig | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/etc/git/gitconfig b/etc/git/gitconfig
> index 907ad0180454..abcd494d62e8 100644
> --- a/etc/git/gitconfig
> +++ b/etc/git/gitconfig
> @@ -14,5 +14,5 @@
>
> [sendemail]
> to = guix-patches@gnu.org
> - headerCmd = etc/teams.scm cc-members-header-cmd
> + headerCmd = guix repl etc/teams.scm cc-members-header-cmd

Even nicer could be using 'guix repl' in the teams.scm script shebang.
This way even for those using it outside of 'git send-email', it'd
always work.

--
Thanks,
Maxim
C
C
Clément Lassieur wrote on 19 Oct 2023 03:05
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 66605@debbugs.gnu.org)
d6e1a604-f9e5-490d-ba5c-e1e65228c120@app.fastmail.com
Toggle quote (4 lines)
> Even nicer could be using 'guix repl' in the teams.scm script shebang.
> This way even for those using it outside of 'git send-email', it'd
> always work.

I can't find a nice solution to do that. And I think people who run teams.scm directly will expect a guile crash and make sure to get the correct environment, so it's not really a problem at that point.

This is not the case for people who run `git send-email`. Those people don't expect a guile crash.

So if you have a clean solution that works in a shebang (without the file being detected as a shell script by most editors), please show it :-)
Attachment: file
M
M
Maxim Cournoyer wrote on 20 Oct 2023 20:39
[PATCH v3] teams: Adjust shebang to use 'guix repl'.
(address . 66605@debbugs.gnu.org)
299e89a115bf711529aca404d133c2a741249fb6.1697859573.git.maxim.cournoyer@gmail.com
This ensures the correct Guix dependencies are always available for the
script.

* etc/teams.scm.in: Rename to...
* etc/teams.scm: ... this. Adjust shebang.
* .gitignore: No longer ignore it.
* configure.ac: Do not process it with AC_CONFIG_FILES.

Change-Id: I7a01750c6c5f0696b6c36b1e6caa9389d9e6822c
---
.gitignore | 1 -
configure.ac | 1 -
etc/{teams.scm.in => teams.scm} | 8 ++++++--
3 files changed, 6 insertions(+), 4 deletions(-)
rename etc/{teams.scm.in => teams.scm} (99%)
mode change 100644 => 100755

Toggle diff (50 lines)
diff --git a/.gitignore b/.gitignore
index 543dc1c655..0f74b5da3d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,7 +68,6 @@
/doc/version.texi
/doc/version-*.texi
/etc/committer.scm
-/etc/teams.scm
/etc/gnu-store.mount
/etc/guix-daemon.cil
/etc/guix-daemon.conf
diff --git a/configure.ac b/configure.ac
index d817f620cf..ecbd596a34 100644
--- a/configure.ac
+++ b/configure.ac
@@ -281,7 +281,6 @@ AC_CONFIG_FILES([Makefile
guix/config.scm])
AC_CONFIG_FILES([etc/committer.scm], [chmod +x etc/committer.scm])
-AC_CONFIG_FILES([etc/teams.scm], [chmod +x etc/teams.scm])
AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
[chmod +x pre-inst-env])
diff --git a/etc/teams.scm.in b/etc/teams.scm
old mode 100644
new mode 100755
similarity index 99%
rename from etc/teams.scm.in
rename to etc/teams.scm
index 55242caad1..98bbfd9e57
--- a/etc/teams.scm.in
+++ b/etc/teams.scm
@@ -1,5 +1,9 @@
-#!@GUILE@ \
---no-auto-compile -s
+#!/bin/sh
+# Extra care is taken here to ensure this script can run in most environments,
+# since it is invoked by 'git send-email'.
+pre_inst_env_maybe=
+command -v guix || pre_inst_env_maybe=./pre-inst-env
+exec $pre_inst_env_maybe guix repl -- "$0" "$@"
!#
;;; GNU Guix --- Functional package management for GNU

base-commit: d2111894c48b2ebd7e7be683c07241bbd8a91919
prerequisite-patch-id: b8372a944dab5ec4df332a27705ff18e6a0e679c
--
2.41.0
M
M
Maxim Cournoyer wrote on 22 Oct 2023 13:07
[PATCH v5] teams: Adjust shebang to use 'guix repl'.
(address . 66605@debbugs.gnu.org)
7ab82f90b104c99781b759d3799ae0553ab256f9.1698005256.git.maxim.cournoyer@gmail.com
This ensures the correct Guix dependencies are always available for the
script.

* etc/teams.scm.in: Rename to...
* etc/teams.scm: ... this. Adjust shebang.
* .gitignore: No longer ignore it.
* configure.ac: Do not process it with AC_CONFIG_FILES.

---

Changes in v5:
- Redirect command -v output to /dev/null

.gitignore | 1 -
configure.ac | 1 -
etc/{teams.scm.in => teams.scm} | 8 ++++++--
3 files changed, 6 insertions(+), 4 deletions(-)
rename etc/{teams.scm.in => teams.scm} (99%)
mode change 100644 => 100755

Toggle diff (49 lines)
diff --git a/.gitignore b/.gitignore
index 543dc1c655..0f74b5da3d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -68,7 +68,6 @@
/doc/version.texi
/doc/version-*.texi
/etc/committer.scm
-/etc/teams.scm
/etc/gnu-store.mount
/etc/guix-daemon.cil
/etc/guix-daemon.conf
diff --git a/configure.ac b/configure.ac
index d817f620cf..ecbd596a34 100644
--- a/configure.ac
+++ b/configure.ac
@@ -281,7 +281,6 @@ AC_CONFIG_FILES([Makefile
guix/config.scm])
AC_CONFIG_FILES([etc/committer.scm], [chmod +x etc/committer.scm])
-AC_CONFIG_FILES([etc/teams.scm], [chmod +x etc/teams.scm])
AC_CONFIG_FILES([test-env:build-aux/test-env.in], [chmod +x test-env])
AC_CONFIG_FILES([pre-inst-env:build-aux/pre-inst-env.in],
[chmod +x pre-inst-env])
diff --git a/etc/teams.scm.in b/etc/teams.scm
old mode 100644
new mode 100755
similarity index 99%
rename from etc/teams.scm.in
rename to etc/teams.scm
index 55242caad1..0b25955701
--- a/etc/teams.scm.in
+++ b/etc/teams.scm
@@ -1,5 +1,9 @@
-#!@GUILE@ \
---no-auto-compile -s
+#!/bin/sh
+# Extra care is taken here to ensure this script can run in most environments,
+# since it is invoked by 'git send-email'.
+pre_inst_env_maybe=
+command -v guix > /dev/null || pre_inst_env_maybe=./pre-inst-env
+exec $pre_inst_env_maybe guix repl -- "$0" "$@"
!#
;;; GNU Guix --- Functional package management for GNU

base-commit: faeebdc37e9137d62e11175e83988f77496a6641
--
2.41.0
C
C
Clément Lassieur wrote on 22 Oct 2023 13:23
(name . Maxim Cournoyer)(address . maxim.cournoyer@gmail.com)(address . 66605@debbugs.gnu.org)
87jzre9zjx.fsf@lassieur.org
Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:

Toggle quote (11 lines)
> This ensures the correct Guix dependencies are always available for the
> script.
>
> * etc/teams.scm.in: Rename to...
> * etc/teams.scm: ... this. Adjust shebang.
> * .gitignore: No longer ignore it.
> * configure.ac: Do not process it with AC_CONFIG_FILES.
>
> Fixes: https://issues.guix.gnu.org/66605
> ---

Sounds good to me! Of course, please commit it as your own.

Thank you very much,
Clément
M
M
Maxim Cournoyer wrote on 22 Oct 2023 17:39
(name . Clément Lassieur)(address . clement@lassieur.org)(address . 66605-done@debbugs.gnu.org)
87edhmb29i.fsf@gmail.com
Hi,

Clément Lassieur <clement@lassieur.org> writes:

Toggle quote (18 lines)
> Maxim Cournoyer <maxim.cournoyer@gmail.com> writes:
>
>> This ensures the correct Guix dependencies are always available for the
>> script.
>>
>> * etc/teams.scm.in: Rename to...
>> * etc/teams.scm: ... this. Adjust shebang.
>> * .gitignore: No longer ignore it.
>> * configure.ac: Do not process it with AC_CONFIG_FILES.
>>
>> Fixes: https://issues.guix.gnu.org/66605
>> ---
>
> Sounds good to me! Of course, please commit it as your own.
>
> Thank you very much,
> Clément

Done! Thanks for the report!

--
Thanks,
Maxim
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 66605@patchwise.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 66605
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch