Add a Salt bootstrapper

The Salt bootstrapper invokes Salt during `./mach bootstrap`
to install Servo's build dependencies.
It uses salt-call pinned to the same version of Salt as used in saltfs.

Currently, the implementation uses gitfs and reads directly from
the master branch of the saltfs repo;
in the future this should be changed when the relevant Salt states
are moved in-tree as part of Dockerization for TaskCluster.

We have not Salted our Windows machines, so the existing Windows
bootstrappers are retained. Currently this is only tested on
Ubuntu Trusty.

Salt uses various system python libraries,
including `python-apt` on Debian-based OSes to interact with apt.
`python-apt` does not seem to be installable via a requirements.txt
file, and the versions available on PyPI are far behind the versions
installed on actual Ubuntu machines.
Additionally, adding `python-apt` as an unconditional python dependency
would add bloat for users of other OSes, and lead to more churn
as additional OSes are supported.
However, as `python-apt` is already installed via apt on these machines,
we can allow Salt to instead use the module by using
`--system-site-packages` for the python virtualenv.
We also add the `-I` flag to `pip install` to ensure we have a local,
untouched copy of any other python packages used.
However, because this prints system-level Python packages in scope,
it slightly breaks isolation, so it is important to always pin
all dependencies in the requirements files.
This commit is contained in:
Aneesh Agrawal 2017-01-11 16:43:54 -05:00
parent 60a1503b29
commit b4f5086305
4 changed files with 136 additions and 4 deletions

View file

@ -118,7 +118,11 @@ def _activate_virtualenv(topdir):
if not virtualenv:
sys.exit("Python virtualenv is not installed. Please install it prior to running mach.")
process = Popen([virtualenv, "-p", python, virtualenv_path], stdout=PIPE, stderr=PIPE)
process = Popen(
[virtualenv, "-p", python, "--system-site-packages", virtualenv_path],
stdout=PIPE,
stderr=PIPE
)
process.wait()
if process.returncode:
out, err = process.communicate()
@ -153,7 +157,7 @@ def _activate_virtualenv(topdir):
if not pip:
sys.exit("Python pip is either not installed or not found in virtualenv.")
process = Popen([pip, "install", "-q", "-U", "pip"], stdout=PIPE, stderr=PIPE)
process = Popen([pip, "install", "-q", "-I", "-U", "pip"], stdout=PIPE, stderr=PIPE)
process.wait()
if process.returncode:
out, err = process.communicate()
@ -175,7 +179,7 @@ def _activate_virtualenv(topdir):
if not pip:
sys.exit("Python pip is either not installed or not found in virtualenv.")
process = Popen([pip, "install", "-q", "-r", req_path], stdout=PIPE, stderr=PIPE)
process = Popen([pip, "install", "-q", "-I", "-r", req_path], stdout=PIPE, stderr=PIPE)
process.wait()
if process.returncode:
out, err = process.communicate()