tox.ini (local): Add environment variables to skip system package installs and other steps, add mechanism for a local interactive shell
mkoeppe opened this issue · 31 comments
(from #31064)
We add the following to the local-... environments:
- an environment variable that can be passed to tox to skip system package installs, directly reusing a previously set up system
SKIP_SYSTEM_PKG_INSTALL=yes tox -e local-homebrew-macos-standard -- config.status
SKIP_SYSTEM_PKG_INSTALL=yes tox -e local-homebrew-macos-standard -- config.status
This can save time and also give developers more control for experiments with system packages.
- a target that gives an interactive shell in the tox environment:
tox -e local-homebrew-macos-standard -- bash
tox -e local-direct -- bash
SKIP_SYSTEM_PKG_INSTALL=yes SKIP_BOOTSTRAP=1 SKIP_CONFIGURE=1 tox -e local-homebrew-macos-standard -- bash
Depends on #30944
CC: @tobiasdiez @kliem @dimpase
Component: porting
Author: Matthias Koeppe
Branch/Commit: 2d84b5a
Reviewer: Tobias Diez
Issue created by migration from https://trac.sagemath.org/ticket/31216
Description changed:
---
+++
@@ -6,6 +6,9 @@
This can save time and also give developers more control for experiments with system packages.
-- a target or environment variable to give an interactive shell.
+- a target give an interactive shell:
-
+```
+tox -e local-homebrew-macos-standard -- bash
+tox -e local-direct -- bash
+```Last 10 new commits:
e5fe752 | Merge tag '9.3.beta4' into t/30940/src_bin_sage_list_packages__make_it_work_if_sage_root_is_not_available |
78ff9d5 | src/sage/misc/package.py: Add one more # optional - build |
a44042f | Merge branch 't/30940/src_bin_sage_list_packages__make_it_work_if_sage_root_is_not_available' into t/29124/script-packages-prereq-toolchain-bootstrap |
64bde5f | Merge tag '9.3.beta5' into t/30940/src_bin_sage_list_packages__make_it_work_if_sage_root_is_not_available |
e9a7572 | src/sage/misc/package.py: Improve source formatting |
c7bcda9 | Merge branch 't/30940/src_bin_sage_list_packages__make_it_work_if_sage_root_is_not_available' into t/29124/script-packages-prereq-toolchain-bootstrap |
9988c5f | ci-cygwin*.yml: Adjust to new script packages _bootstrap, _prereq |
ab19133 | Merge branch 't/29124/script-packages-prereq-toolchain-bootstrap' into t/30944/tox__improve_local_sudo_ubuntu_standard |
c6ad06e | Merge branch 't/30944/tox__improve_local_sudo_ubuntu_standard' into t/31216/tox_ini__local___add_environment_variables_to_skip_system_package_installs__mechanism_for_a_local_interactive_shell |
13f58fc | tox.ini (local): Run an interactive shell if posargs are bash |
Description changed:
---
+++
@@ -6,7 +6,7 @@
This can save time and also give developers more control for experiments with system packages.
-- a target give an interactive shell:
+- a target that gives an interactive shell in the tox environment:
```
tox -e local-homebrew-macos-standard -- bashBranch pushed to git repo; I updated commit sha1. New commits:
ace4ef6 | tox.ini (local): Add option SKIP_SYSTEM_PKG_INSTALL=1 |
Author: Matthias Koeppe
Description changed:
---
+++
@@ -4,6 +4,9 @@
- an environment variable that can be passed to tox to skip system package installs, directly reusing a previously set up system
+```
+SKIP_SYSTEM_PKG_INSTALL=yes tox -e local-homebrew-macos-standard -- config.status
+```
This can save time and also give developers more control for experiments with system packages.
- a target that gives an interactive shell in the tox environment:
@@ -12,3 +15,4 @@
tox -e local-homebrew-macos-standard -- bash
tox -e local-direct -- bash
```
+On a first glance this looks good. Thanks! Could you please also add documentation for these tox commands / switches. Also I was wondering if one could add a tox -e local-homebrew-macos-standard -- install-system-packages that only installs the system packages?
Branch pushed to git repo; I updated commit sha1. New commits:
ddc4f0b | tox.ini (local): Handle environment variables SKIP_BOOTSTRAP, SKIP_CONFIGURE |
Description changed:
---
+++
@@ -5,6 +5,7 @@
- an environment variable that can be passed to tox to skip system package installs, directly reusing a previously set up system
```
+SKIP_SYSTEM_PKG_INSTALL=yes tox -e local-homebrew-macos-standard -- config.status
SKIP_SYSTEM_PKG_INSTALL=yes tox -e local-homebrew-macos-standard -- config.status
```
This can save time and also give developers more control for experiments with system packages.
@@ -14,5 +15,6 @@
```
tox -e local-homebrew-macos-standard -- bash
tox -e local-direct -- bash
+SKIP_SYSTEM_PKG_INSTALL=yes SKIP_BOOTSTRAP=1 SKIP_CONFIGURE=1 tox -e local-homebrew-macos-standard -- bash
```
Replying to @tobiasdiez:
Could you please also add documentation for these tox commands / switches.
Done
Also I was wondering if one could add a
tox -e local-homebrew-macos-standard -- install-system-packagesthat only installs the system packages?
I have instead added more SKIP_... options.
Replying to @mkoeppe:
I have instead added more
SKIP_...options.
Thanks! Would it also make sense to add one to skip make? (I remember you once told me how to do this, I think, it was via config.status or something - but maybe the version using skip is closer in spirit anyway).
I'll review this once #30944 is merged in develop.
Replying to @tobiasdiez:
Would it also make sense to add one to skip
make?
You can just pass a make target that does nothing - such as Makefile
local-sudo-standard run-test: commands[1] | bash -c 'case "" in 1|y*|Y*);; *) eval
$(build/bin/sage-print-system-package-command $ (build/bin/sage-guess-package-system) --sudo update) ;;'/usr/bin/bash: -c: line 1: syntax error: unexpected end of file
I think there is a "esac" missing at the end of these two lines:
+ local-{root,sudo}: bash -c 'case "{env:SKIP_SYSTEM_PKG_INSTALL:}" in 1|y*|Y*);; *) eval $(build/bin/sage-print-system-package-command {env:SYSTEM} {env:__SUDO:} update) ;;'
+ local-{root,sudo}: bash -c 'case "{env:SKIP_SYSTEM_PKG_INSTALL:}" in 1|y*|Y*);; *) PACKAGES=$(build/bin/sage-get-system-packages {env:SYSTEM} $(PATH=build/bin:$PATH build/bin/sage-package list {env:SAGE_PACKAGE_LIST_ARGS}) _bootstrap); eval $(build/bin/sage-print-system-package-command {env:SYSTEM} {env:__SUDO:} --yes --no-install-recommends install $PACKAGES) || [ "$IGNORE_MISSING_SYSTEM_PACKAGES" = yes ] && echo "(ignoring errors)" ;;'
Replying to @mkoeppe:
Replying to @tobiasdiez:
Would it also make sense to add one to skip
make?You can just pass a make target that does nothing - such as
Makefile
tox -e local-sudo-standard Makefile with SKIP_BOOTSTRAP: yes and SKIP_CONFIGURE: yes still runs bootstrap and base-toolchain in the make command, which then fails since configure was not called before.
Ah, of course. Make that configure.ac instead of Makefile...
That worked, thanks! Apart from the missing "esac" mentioned above, this looks good to me.
Branch pushed to git repo; I updated commit sha1. New commits:
2d84b5a | tox.ini: Add missing esac |
Is the prefix [mkoeppe@sage sage]$ really needed / what's its purpose?
sagemath/sagetrac-mirror@u/mkoeppe/tox__improve_local_sudo_ubuntu_standard...u/mkoeppe/tox_ini__local___add_environment_variables_to_skip_system_package_installs__mechanism_for_a_local_interactive_shell#diff-c13a55474e037a35696cfba4768b81295c0383f1940052c5fcbef0737387f165R610
Otherwise the changes look good to me.
Replying to @tobiasdiez:
Is the prefix
[mkoeppe@sage sage]$really needed / what's its purpose?
It's a typical shell prompt on posix systems. The second sage indicates the current directory. This is consistent with other parts of the Sage developer guide, for example https://doc.sagemath.org/html/en/developer/doctesting.html
Thanks, then it looks good to me!
Thanks!
Reviewer: Tobias Diez