Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor system package scripts #33873

Closed
mkoeppe opened this issue May 20, 2022 · 17 comments
Closed

Refactor system package scripts #33873

mkoeppe opened this issue May 20, 2022 · 17 comments

Comments

@mkoeppe
Copy link
Contributor

mkoeppe commented May 20, 2022

We extend the scripts sage-get-system-packages and sage-print-system-package-command:

  • When system=auto, they now invoke sage-guess-package-system.

  • sage-print-system-package-command gets a new option --spkg; then it invokes sage-get-system-packages.

This simplifies some uses.

CC: @dimpase

Component: scripts

Author: Matthias Koeppe

Branch/Commit: d75da7e

Reviewer: Dima Pasechnik

Issue created by migration from https://trac.sagemath.org/ticket/33873

@mkoeppe mkoeppe added this to the sage-9.7 milestone May 20, 2022
@mkoeppe
Copy link
Contributor Author

mkoeppe commented May 20, 2022

@mkoeppe
Copy link
Contributor Author

mkoeppe commented May 24, 2022

Author: Matthias Koeppe

@mkoeppe
Copy link
Contributor Author

mkoeppe commented May 24, 2022

Commit: d75da7e

@mkoeppe
Copy link
Contributor Author

mkoeppe commented May 24, 2022

New commits:

ab5a4f1build/bin/sage-get-system-packages: If system=auto, use sage-guess-package-system
798f4d3build/bin/sage-print-system-package-command: If system=auto, use sage-guess-package-system
ef249ccbuild/bin/sage-print-system-package-command: New option --spkg
d75da7etox.ini: Simplify using new options of sage-print-system-package-command

@mkoeppe

This comment has been minimized.

@dimpase
Copy link
Member

dimpase commented Jul 6, 2022

comment:6

how can one test that?

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 6, 2022

comment:7

For example, on a Linux machine using tox -e local-sudo-standard -- config.status

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 6, 2022

comment:8

#33819 also makes (limited) use of it

@dimpase
Copy link
Member

dimpase commented Jul 6, 2022

comment:9

Replying to @mkoeppe:

For example, on a Linux machine using tox -e local-sudo-standard -- config.status

how about something without sudo?

@dimpase
Copy link
Member

dimpase commented Jul 6, 2022

comment:10

I tried local-standard instead, it worked.

@dimpase
Copy link
Member

dimpase commented Jul 6, 2022

Reviewer: Dima Pasechnik

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 6, 2022

comment:11

Thanks!

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 6, 2022

comment:12

Replying to @dimpase:

I tried local-standard instead, it worked.

I think this does not actually invoke the package scripts at all, but you can do tox -e local-root-standard and wait for the error from not being root

@dimpase
Copy link
Member

dimpase commented Jul 7, 2022

comment:13

why is sudo/root needed at all for these tests? Is it meant to allow a system-wide installation of (parts of) Sage?

@dimpase
Copy link
Member

dimpase commented Jul 7, 2022

comment:14

Replying to @mkoeppe:

Replying to @dimpase:

I tried local-standard instead, it worked.

I think this does not actually invoke the package scripts at all, but you can do tox -e local-root-standard and wait for the error from not being root

the error is coming very soon:

$ tox -e local-root-standard -- config.status
local-root-standard create: /home/scratch/scratch2/dimpase/sage/sagetrac-mirror/.tox/local-root-standard
local-root-standard run-test-pre: PYTHONHASHSEED='263570377'
local-root-standard run-test: commands[0] | bash -c 'if [ ! -d /home/scratch/scratch2/dimpase/sage/sagetrac-mirror/.tox/local-root-standard/Library/Caches ]; then mkdir -p /home/scratch/scratch2/dimpase/sage/sagetrac-mirror/.tox/Caches && mkdir -p /home/scratch/scratch2/dimpase/sage/sagetrac-mirror/.tox/local-root-standard/Library && ln -sf /home/scratch/scratch2/dimpase/sage/sagetrac-mirror/.tox/Caches /home/scratch/scratch2/dimpase/sage/sagetrac-mirror/.tox/local-root-standard/Library/; fi'
local-root-standard run-test: commands[1] | bash -c 'case "" in 1|y*|Y*);; *) eval $(build/bin/sage-print-system-package-command auto  update) ;; esac'
local-root-standard run-test: commands[2] | bash -c 'case "" in 1|y*|Y*);; *) export PATH="build/bin:$PATH" && eval $(sage-print-system-package-command auto  --yes --no-install-recommends --spkg install $(sage-package list --has-file=spkg-configure.m4 :standard:) _bootstrap    ) || [ "$IGNORE_MISSING_SYSTEM_PACKAGES" = yes ] && echo "(ignoring errors)" ;; esac'
Error: This command has to be run with superuser privileges (under the root user on most systems).
ERROR: InvocationError for command /usr/local/bin/bash -c 'case "" in 1|y*|Y*);; *) export PATH="build/bin:$PATH" && eval $(sage-print-system-package-command auto  --yes --no-install-recommends --spkg install $(sage-package list --has-file=spkg-configure.m4 :standard:) _bootstrap    ) || [ "$IGNORE_MISSING_SYSTEM_PACKAGES" = yes ] && echo "(ignoring errors)" ;; esac' (exited with code 1)
...
Error: This command has to be run with superuser privileges (under the root user on most systems).

@mkoeppe
Copy link
Contributor Author

mkoeppe commented Jul 7, 2022

comment:15

Replying to @dimpase:

why is sudo/root needed at all for these tests? Is it meant to allow a system-wide installation of (parts of) Sage?

These tox environments are primarily for use on containers to install system packages. It's not intended to be user-facing.

One use is in .github/workflows/ci-wsl.yml

@vbraun
Copy link
Member

vbraun commented Jul 9, 2022

Changed branch from u/mkoeppe/refactor_system_package_scripts to d75da7e

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants