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

tox.ini: Add environments local-sudo-ubuntu-standard, etc. #30923

Closed
mkoeppe opened this issue Nov 15, 2020 · 39 comments
Closed

tox.ini: Add environments local-sudo-ubuntu-standard, etc. #30923

mkoeppe opened this issue Nov 15, 2020 · 39 comments

Comments

@mkoeppe
Copy link
Member

mkoeppe commented Nov 15, 2020

These environments would just run sudo apt-get ... etc. to install (but not remove!) packages, for use at the user's own risk.

To test (on an Ubuntu system):

    tox -e local-sudo-ubuntu-bionic-standard

or

    tox -e local-sudo-standard

CC: @tobiasdiez @dimpase

Component: porting

Author: Matthias Koeppe

Branch: ff34897

Reviewer: Tobias Diez, Dima Pasechnik

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

@mkoeppe mkoeppe added this to the sage-9.3 milestone Nov 15, 2020
@mkoeppe
Copy link
Member Author

mkoeppe commented Nov 15, 2020

Author: Matthias Koeppe

@tobiasdiez
Copy link
Contributor

comment:2

Is it possible to put the sudo outside? I.e. sudo tox -r local-ubuntu-standard?

@mkoeppe
Copy link
Member Author

mkoeppe commented Nov 16, 2020

comment:3

But we would only want to do the package installation as root, not the Sage build

@mkoeppe
Copy link
Member Author

mkoeppe commented Nov 16, 2020

@mkoeppe
Copy link
Member Author

mkoeppe commented Nov 16, 2020

Commit: 30e624a

@mkoeppe
Copy link
Member Author

mkoeppe commented Nov 16, 2020

comment:5

Here's a first approximation.


New commits:

30e624atox.ini: Add local-sudo

@mkoeppe

This comment has been minimized.

@tobiasdiez
Copy link
Contributor

comment:7

I think you forgot the confirmation -y after install: tobiasdiez@942149e

Moreover, I was wondering if one should also read the debian-bootstrap.txt files.

Finally, there are problems that some of the packages are not found. First, one should probably add sudo add-apt-repository ppa:deadsnakes/ppa since otherwise libpython3.7-dev is not found on ubuntu 20.04. Second, texlive-generic-extra doesn't exist on ubuntu 20.04.
https://github.com/tobiasdiez/sage/runs/1404001507?check_suite_focus=true

Other than that, looks good to me! Thanks a lot.

@mkoeppe
Copy link
Member Author

mkoeppe commented Nov 16, 2020

comment:8

Yes, I'll add bootstrap

I don't think we have libpython3.7-dev listed in the debian.txt files any more.

But yes, handling IGNORE_MISSING_SYSTEM_PACKAGES needs to be done.

For deadsnakes, there's #30217. This would not be the default, but a mix-in flavor.

@tobiasdiez
Copy link
Contributor

comment:9

On a second thought, do you really thing it's the job of tox to install system packages? I would feel more comfortable to put the code into a shell script that you can run as build/install_system_packages ubuntu-2004, say. (Having such a script might be a good idea anyway).

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 16, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

75ecd11tox.ini (local-sudo): Also use ...-bootstrap.txt

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 16, 2020

Changed commit from 30e624a to 75ecd11

@tobiasdiez
Copy link
Contributor

comment:11

Replying to @mkoeppe:

But yes, handling IGNORE_MISSING_SYSTEM_PACKAGES needs to be done.

and/or change texlive-generic-extra that exist on modern ubuntu systems as well.

@tobiasdiez
Copy link
Contributor

comment:12

Replying to @sagetrac-git:

Branch pushed to git repo; I updated commit sha1. New commits:

75ecd11tox.ini (local-sudo): Also use ...-bootstrap.txt

Don't forget to change local-sudo-standard/maximal as well.

@mkoeppe
Copy link
Member Author

mkoeppe commented Nov 16, 2020

comment:13

Replying to @tobiasdiez:

On a second thought, do you really thing it's the job of tox to install system packages? I would feel more comfortable to put the code into a shell script that you can run as build/install_system_packages ubuntu-2004, say. (Having such a script might be a good idea anyway).

It's working well with tox, in particular the environment factors give a nice compact way of expressing different configurations.

And I definitely do not want to add user-facing scripts to Sage that promises to install all necessary system packages. We deliberately only offer system package advice (at the end of ./configure). Already now users complain if that advice is not entirely accurate -- so we definitely do not want to make stronger promises! We simply do not have enough developers who could keep it up to date.

But there is a lot of room for refactoring what is in tox.ini into various helper scripts. I have described some possible directions in #30865 -- help is very welcome there.

@mkoeppe
Copy link
Member Author

mkoeppe commented Nov 16, 2020

comment:14

Replying to @tobiasdiez:

Replying to @sagetrac-git:

Branch pushed to git repo; I updated commit sha1. New commits:

75ecd11 tox.ini (local-sudo): Also use ...-bootstrap.txt

Don't forget to change local-sudo-standard/maximal as well.

No, that line is also executed for these environments - by the magic of tox's factor conditions.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 16, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

0dc79ebbuild/bin/sage-print-system-package-command: Handle --no-install-recommends, --yes for systems for which write-dockerfile.sh knows these flags
050dcb8tox.ini (local-sudo): Use --yes --no-install-recommends

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 16, 2020

Changed commit from 75ecd11 to 050dcb8

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 16, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

c8fbe0btox.ini (local-sudo): Ignore errors when IGNORE_MISSING_SYSTEM_PACKAGES=yes

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 16, 2020

Changed commit from 050dcb8 to c8fbe0b

@mkoeppe

This comment has been minimized.

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 16, 2020

Branch pushed to git repo; I updated commit sha1. New commits:

ff34897tox.ini (local): Guess the package system if it is not provided as a factor

@sagetrac-git
Copy link
Mannequin

sagetrac-git mannequin commented Nov 16, 2020

Changed commit from c8fbe0b to ff34897

@mkoeppe

This comment has been minimized.

@tobiasdiez
Copy link
Contributor

comment:20

Replying to @mkoeppe:

Replying to @tobiasdiez:

On a second thought, do you really thing it's the job of tox to install system packages? I would feel more comfortable to put the code into a shell script that you can run as build/install_system_packages ubuntu-2004, say. (Having such a script might be a good idea anyway).

It's working well with tox, in particular the environment factors give a nice compact way of expressing different configurations.

Sure, but it feels a bit like you are using tox for something it wasn't designed. Normally, in a tox setting, "environment" refers to a virtual python env, but for sage it is the complete system env including the os and system packages. I have the feeling a more general-purpose framework like invoke would be a better solution to manage these things.

And I definitely do not want to add user-facing scripts to Sage that promises to install all necessary system packages.

I didn't meant it as a user-facing script, but only for developers (i.e don't ship it).

@tobiasdiez
Copy link
Contributor

comment:21

I've tested the current code in the wsl github workflow and it seems to work well: https://github.com/tobiasdiez/sage/actions/runs/365823571

@mkoeppe
Copy link
Member Author

mkoeppe commented Nov 16, 2020

comment:22

Sounds like a positive review?

@tobiasdiez
Copy link
Contributor

Reviewer: Tobias Diez, ...

@tobiasdiez
Copy link
Contributor

comment:23

Yes, in principle. But I cannot really judge the changes in the bash script.

@dimpase
Copy link
Member

dimpase commented Nov 17, 2020

comment:25

ok

@dimpase
Copy link
Member

dimpase commented Nov 17, 2020

Changed reviewer from Tobias Diez, ... to Tobias Diez, Dima Pasechnik

@mkoeppe
Copy link
Member Author

mkoeppe commented Nov 17, 2020

comment:26

Thanks!

@tobiasdiez
Copy link
Contributor

comment:27

Is it possible to call only the system package install code via tox (i.e. don't run rest of build and tests)?

That would be handy for #30371.

@mkoeppe
Copy link
Member Author

mkoeppe commented Nov 21, 2020

comment:28

Replying to @tobiasdiez:

Is it possible to call only the system package install code via tox (i.e. don't run rest of build and tests)?

Yes, you can pass make targets to tox, e.g., tox -e local-sudo-standard -- configure will only run bootstrap, or tox -e local-sudo-standard -- config.status will stop after running ./configure

@tobiasdiez
Copy link
Contributor

comment:29

Thanks! That kind of worked. I had to install sudo manually, since this is not installed by default on github actions and also not necessary.
It would be nice if you could try to make it work without sudo.

local-sudo-standard run-test: commands[2] | bash -c 'PACKAGES=`sed "s/#.*//;" build/pkgs/$(build/bin/sage-guess-package-system)*.txt`; $(build/bin/sage-print-system-package-command $(build/bin/sage-guess-package-system) --sudo --yes --no-install-recommends install $PACKAGES) || [ "$IGNORE_MISSING_SYSTEM_PACKAGES" = yes ] && echo "(ignoring errors)" '
/usr/bin/bash: sudo: command not found

ERROR: InvocationError for command /usr/bin/bash -c 'PACKAGES=`sed "s/#.*//;" build/pkgs/$(build/bin/sage-guess-package-system)*.txt`; $(build/bin/sage-print-system-package-command $(build/bin/sage-guess-package-system) --sudo --yes --no-install-recommends install $PACKAGES) || [ "$IGNORE_MISSING_SYSTEM_PACKAGES" = yes ] && echo "(ignoring errors)" ' (exited with code 1)

Edit: Moreover, DEBIAN_FRONTEND: noninteractive was/is missing. And it fails with

configure: error: You cannot build Sage as root, switch to an unprivileged user.  (If building in a container, use --enable-build-as-root.)

Finally, tox -e local-sudo-standard -- config.status doesn't stop after contigure and continues with make, see https://github.com/tobiasdiez/sage/runs/1438029552?check_suite_focus=true

Since using this tox command for ci was one of the motivations but doesn't really work at the moment without extra modifications, I'll set the ticket back to needs work.

@vbraun
Copy link
Member

vbraun commented Nov 22, 2020

@vbraun
Copy link
Member

vbraun commented Nov 22, 2020

comment:32

Can you make a separate ticket for that? Once a ticket is in positive review I'll only unmerge it for critical bugs, not things that would also be good to have.

@vbraun
Copy link
Member

vbraun commented Nov 22, 2020

Changed commit from ff34897 to none

@tobiasdiez
Copy link
Contributor

comment:33

Sure! It's now #30944. Sorry if I broke any (unwritten) laws; I wasn't sure about resetting it to "needs work".

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

4 participants