Skip to content

Use Salt for mach bootstrap - #14974

Merged
bors-servo merged 5 commits into
servo:masterfrom
aneeshusa:add-mach-bootstrap
Jan 20, 2017
Merged

bors-servo merged 5 commits into
servo:masterfrom
aneeshusa:add-mach-bootstrap

Conversation

@aneeshusa

@aneeshusa aneeshusa commented Jan 12, 2017 •

Copy link
Copy Markdown
Contributor

This is currently WIP, but allows Salt for mach bootstrap. Not looking for review yet, just posting for visibility. You can run ./mach bootstrap and Salt will run, letting you know what changes it would make for bootstrapping (doesn't actually run yet though).

Currently, this reads from saltfs using gitfs, meaning it always tracks the master branch. (Note that this is blocked on servo/saltfs#577 landing; in the meantime, I've included a small workaround in this PR to pull from my updated saltfs branch, which will need to be removed.) In the future, the relevant Salt code may be merged in tree as part of Docker support for TC, and the bootstrapper should be updated to read from in tree.

Also, our Windows machines have not been Salted, so the existing Windows bootstrappers are retained.

TODO:

  • Hook into existing bootstrapping code less hackily
  • Actually bootstrap instead of always using test=True mode (includes sudo)
  • Default to interactive mode (test first, then ask), with a force flag
  • Don't require running from the repository root directory
  • Make it easy to add support for other distros

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #__ (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because they should be verified manually

This change is Reviewable

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @wafflespeanut: python/requirements.txt, python/servo/bootstrapper/bootstrap.py, python/servo/bootstrapper/salt_config/minion, python/servo/bootstrapper/salt.py

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 12, 2017
@aneeshusa
aneeshusa force-pushed the add-mach-bootstrap branch 5 times, most recently from 1626266 to 0e0f9d7 Compare January 12, 2017 19:11
@aneeshusa

Copy link
Copy Markdown
Contributor Author

This should work on Ubuntu Trusty now.

@Wafflespeanut @frewsxcv Python question: So far it seems necessary to use --system-site-packages when creating the virtualenv to allow Salt to work properly (see the commit message for details). Does this seem OK to you or should I make a separate virtualenv for Salt?

@aneeshusa aneeshusa added the S-awaiting-answer Someone asked a question that requires an answer. label Jan 12, 2017
`mach` can't do any bootstrapping for Android, so the flag is useless.
@aneeshusa
aneeshusa force-pushed the add-mach-bootstrap branch 2 times, most recently from 84429a2 to 6b00847 Compare January 14, 2017 05:16
@aneeshusa aneeshusa changed the title WIP: Use Salt for mach bootstrap Use Salt for mach bootstrap Jan 14, 2017
@aneeshusa

Copy link
Copy Markdown
Contributor Author

I've finished the remaining items on this, including a cleanup/overhaul of the existing bootstrapping. This is ready for review.

cc @UK992 since you wrote the original Windows bootstrapping, can you check that mach bootstrap still works on Windows?

@aneeshusa aneeshusa added the S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. label Jan 14, 2017
@aneeshusa

Copy link
Copy Markdown
Contributor Author

Note this is still blocked on servo/saltfs#577 landing, however.

Comment thread python/servo/bootstrap.py Outdated
proceed = raw_input(
'Proposed changes are above, proceed with bootstrap? [y/N]: '
)
if proceed not in ['y', 'yes', 'Y', 'Yes', 'YES']:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if proceed.lower() not in ['y', 'yes']? 😄

@ghost

ghost commented Jan 14, 2017

Copy link
Copy Markdown

This is great! 😄

Does this seem OK to you or should I make a separate virtualenv for Salt?

This should be fine, since pip install -I is going to reinstall our local requirements which will shadow the globally available libraries anyway.

@aneeshusa

Copy link
Copy Markdown
Contributor Author

Also, I think this should work on macOS (using Homebrew) - if someone could check that I'll enable the Salt bootstrapper for macOS as well (instead of just Ubuntu 14.04).

@UK992

UK992 commented Jan 15, 2017 •

Copy link
Copy Markdown
Contributor

Since both gnu and msvc use same python, detection should be relied on host_triple.
For msvc, maybe could --force flag delete msvc-dependencies folder and reinstall all packages?
Also salt should be excluded in requirements.txt for Windows, because it's failed to create virtualenv.

@UK992

UK992 commented Jan 15, 2017

Copy link
Copy Markdown
Contributor

Also set() on WINDOWS_GNU packages list should be removed, because it fails to execute command.

@aneeshusa
aneeshusa force-pushed the add-mach-bootstrap branch 3 times, most recently from 0263adf to 966a2c4 Compare January 15, 2017 18:28
@aneeshusa

Copy link
Copy Markdown
Contributor Author

@UK992

  • I haven't changed the GNU/MSVC detection from the original. I'm not sure exactly how to use host_triple, can you show me how I should use it here?
  • We shouldn't never need to delete the msvc-dependencies folder, since each package version is installed in its folder and never changed, so IMO a --force flag is unnecessary. If we do want that behavior it's different from what --force does for the other two, so I think we would need two flags at that point.
  • Addressed your other two comments.

@UK992

UK992 commented Jan 15, 2017

Copy link
Copy Markdown
Contributor

GNU/MSVC detection was broken for some time. Using host_triple:

if "windows-gnu" in host_triple():
    bootstrapper = windows_gnu
elif "windows-msvc" in host_triple():
    bootstrapper = windows_msvc

Extracting these functions helps avoid circular dependencies,
and make them easier to find/reuse.
Use the `desc` parameter instead to make the error messages
customized for the actual download.

Also use new-style format strings.
- Default to interactive mode and remove the `--interactive` flag
- Use `--force` to skip interactivity
- Change MSVC dependency storage organization on disk: put each version
  into its own folder and directly refer to the versioned folders,
  providing immutability and making the installation list redundant
- Reuse `host_triple()` function to fix broken bootstrapper dispatching
- Simplify code:
  - Remove or inline many unused and redudant functions and variables
  - Prefer plain functions to classes
  - Consolidate into fewer files, remove unnecessary bootstrapper/ dir
- Improve Python style
- Sort dependency list
@aneeshusa

Copy link
Copy Markdown
Contributor Author

@UK992 OK thanks, I updated that. Can you give it a try and also run ./mach build on MSVC after bootstrapping? I want to ensure the reorganizing of msvc-dependencies didn't break the build_env function.

@UK992

UK992 commented Jan 15, 2017

Copy link
Copy Markdown
Contributor

@aneeshusa building works perfectly on MSVC.

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.
@aneeshusa

Copy link
Copy Markdown
Contributor Author

servo/saltfs#577 merged and I've updated this, so this is no longer blocked.

@aneeshusa aneeshusa removed S-awaiting-answer Someone asked a question that requires an answer. S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. labels Jan 17, 2017
@jdm

jdm commented Jan 19, 2017

Copy link
Copy Markdown
Member

@metajack Review ping!

@metajack

Copy link
Copy Markdown
Collaborator

@bors-servo r+

Looks good to me.

@bors-servo

Copy link
Copy Markdown
Contributor

📌 Commit b4f5086 has been approved by metajack

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jan 20, 2017
@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Testing commit b4f5086 with merge 1f76aa6...

bors-servo pushed a commit that referenced this pull request Jan 20, 2017
Use Salt for mach bootstrap

<!-- Please describe your changes on the following line: -->

This is currently WIP, but allows Salt for `mach bootstrap`. Not looking for review yet, just posting for visibility. You can run `./mach bootstrap` and Salt will run, letting you know what changes it would make for bootstrapping (doesn't actually run yet though).

Currently, this reads from saltfs using gitfs, meaning it always tracks the master branch. (Note that this is blocked on servo/saltfs#577 landing; in the meantime, I've included a small workaround in this PR to pull from my updated saltfs branch, which will need to be removed.) In the future, the relevant Salt code may be merged in tree as part of Docker support for TC, and the bootstrapper should be updated to read from in tree.

Also, our Windows machines have not been Salted, so the existing Windows bootstrappers are retained.

TODO:
- [x] Hook into existing bootstrapping code less hackily
- [x] Actually bootstrap instead of always using `test=True` mode (includes sudo)
- [x] Default to interactive mode (test first, then ask), with a force flag
- [x] Don't require running from the repository root directory
- [x] Make it easy to add support for other distros

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [ ] `./mach build -d` does not report any errors
- [x] `./mach test-tidy` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [x] These changes do not require tests because they should be verified manually

<!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. -->

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/14974)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

@bors-servo
bors-servo merged commit b4f5086 into servo:master Jan 20, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jan 20, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants