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

Add a --nightly | -n flag to mach run commands for linux #19947

Merged
merged 1 commit into from Mar 7, 2018

Conversation

@o0Ignition0o
Copy link
Contributor

o0Ignition0o commented Feb 4, 2018

First tries to download and extract a specific nightly version to run mach commands against.

I chose to split the Pull requests for each platform to avoid submitting a huge one, and to make sure I get the logic right.
I'm able to download / extract a nightly version, and I keep nightly versions in the target folder.
Windows and Mac OS support will be filed in separate PRs.
This is part of step two for #19505

The mentor on the issue is jdm


  • ./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 it is part of a ./mach command.

This change is Reviewable

@highfive
Copy link

highfive commented Feb 4, 2018

Thanks for the pull request, and welcome! The Servo team is excited to review your changes, and you should hear from @glennw (or someone else) soon.

@highfive
Copy link

highfive commented Feb 4, 2018

Heads up! This PR modifies the following files:

  • @wafflespeanut: python/servo/command_base.py, python/servo/post_build_commands.py
@o0Ignition0o o0Ignition0o changed the title [WIP] Add a --nightly | -n flag to mach commands [WIP] Add a --nightly | -n flag to mach run commands Feb 4, 2018
@o0Ignition0o o0Ignition0o force-pushed the o0Ignition0o:mach_run_nightly branch 6 times, most recently from d19f510 to e81328f Feb 4, 2018
@o0Ignition0o o0Ignition0o changed the title [WIP] Add a --nightly | -n flag to mach run commands Add a --nightly | -n flag to mach run commands for linux Feb 4, 2018
if is_windows():
print("The nightly flag is not supported on windows yet.")
sys.exit(1)
os_prefix = "windows-msvc"

This comment has been minimized.

@tigercosmos

tigercosmos Feb 5, 2018

Collaborator

why we change os_prefix after the program has exited?

This comment has been minimized.

@o0Ignition0o

o0Ignition0o Feb 5, 2018

Author Contributor

Good catch ! I was actually working on a multi platform solution, and then decided to split the merge requests. I'll remove it :)

@o0Ignition0o o0Ignition0o force-pushed the o0Ignition0o:mach_run_nightly branch from e81328f to e115b5a Feb 5, 2018
@bors-servo
Copy link
Contributor

bors-servo commented Feb 13, 2018

The latest upstream changes (presumably #19975) made this pull request unmergeable. Please resolve the merge conflicts.

@o0Ignition0o o0Ignition0o force-pushed the o0Ignition0o:mach_run_nightly branch from e115b5a to ed3911b Feb 25, 2018
@jdm
Copy link
Member

jdm commented Feb 25, 2018

r? @jdm

Sorry about the delay; let's get a more appropriate reviewer on this.

@highfive highfive assigned jdm and unassigned glennw Feb 25, 2018
@o0Ignition0o
Copy link
Contributor Author

o0Ignition0o commented Feb 26, 2018

Hi :)
No Problem, i've started working on the windows support since then. I'll put it in a separate PR :)

@o0Ignition0o o0Ignition0o force-pushed the o0Ignition0o:mach_run_nightly branch from ca0721a to ed3911b Feb 26, 2018
@o0Ignition0o
Copy link
Contributor Author

o0Ignition0o commented Feb 26, 2018

Build FAILED in 0:00:00

This looks weird, but I'm not really sure it's related to the changes I've made, any thoughts ?

@jdm
Copy link
Member

jdm commented Feb 26, 2018

You can ignore the taskcluster failure.

@o0Ignition0o
Copy link
Contributor Author

o0Ignition0o commented Feb 26, 2018

Ok thanks !
I guess it should be reviewable then :)

@o0Ignition0o
Copy link
Contributor Author

o0Ignition0o commented Mar 5, 2018

Hey there :) is anyone available for some suggestions or a code review ? I'm not at home but I'll ask on IRC as soon as I come home :)

@jdm
Copy link
Member

jdm commented Mar 5, 2018

Ugh, sorry for forgetting about this. I'll review it today.

Copy link
Member

jdm left a comment

This looks really great! Thanks!

env = self.build_env()
env["RUST_BACKTRACE"] = "1"

servo_cmd = [bin or self.get_binary_path(release, dev)] + params
servo_cmd = [bin or self.get_nightly_binary_path(
nightly.strip()) or self.get_binary_path(release, dev)] + params

This comment has been minimized.

@jdm

jdm Mar 5, 2018

Member

nit: let's join these lines, or split after the or instead.

e.reason))
sys.exit(1)
except AttributeError as e:
print("Could not fetch a nightly version for date {} and platform {} ".format(

This comment has been minimized.

@jdm

jdm Mar 5, 2018

Member

nit: remove the extra space after {}

# (eg /foo/bar/baz.tar.gz extracts to /foo/bar/baz)
destination_file = path.join(
nightly_target_directory, file_to_download)
destination_folder = destination_file[:destination_file.index('.')]

This comment has been minimized.

@jdm

jdm Mar 5, 2018

Member

We can use os.path.splitext(destination_file)[0] instead.

This comment has been minimized.

@o0Ignition0o

o0Ignition0o Mar 6, 2018

Author Contributor

I didn't know about this method, pretty cool !

bors-servo added a commit that referenced this pull request Mar 6, 2018
Add a --nightly | -n flag to mach run commands for linux

First tries to download and extract a specific nightly version to run mach commands against.

<!-- Please describe your changes on the following line: -->
I chose to split the Pull requests for each platform to avoid submitting a huge one, and to make sure I get the logic right.
I'm able to download / extract a nightly version, and I keep nightly versions in the target folder.
Windows and Mac OS support will be filed in separate PRs.
This is part of step two for #19505

The mentor on the issue is jdm

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./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 it is part of a ./mach command.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/19947)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 6, 2018

💔 Test failed - mac-rel-wpt1

@jdm
Copy link
Member

jdm commented Mar 6, 2018

Error running mach:

    ['run', '-r', '-o', 'output.png']

The error occurred in the implementation of the invoked mach command.

This should never occur and is likely a bug in the implementation of that
command. Consider filing a bug for this issue.

If filing a bug, please include the full output of mach, including this error
message.

The details of the failure are as follows:

AttributeError: 'NoneType' object has no attribute 'strip'

  File "/Users/servo/buildbot/slave/mac-rel-wpt1/build/python/servo/post_build_commands.py", line 100, in run
    args = [bin or self.get_nightly_binary_path(nightly.strip()) or self.get_binary_path(release, dev)]
@o0Ignition0o
Copy link
Contributor Author

o0Ignition0o commented Mar 6, 2018

Ok I found two ways to handle this issue:
I can use an if / else construct to check if the string is empty or not.
I can change the command argument to default to "", but that would break the "command arguments consistency" eg :

@CommandArgument('--debugger', default=None, type=str, help='Name of debugger to use.') @CommandArgument('--headless', '-z', action='store_true', help='Launch in headless mode') @CommandArgument('--software', '-s', action='store_true', help='Launch with software rendering') @CommandArgument('--bin', default=None, help='Launch with specific binary') @CommandArgument('--nightly', '-n', default="", help='Specify a YYYY-MM-DD nightly build to run') @CommandArgument( 'params', nargs='...', help="Command-line arguments to be passed through to Servo") def run(self, params, release=False, dev=False, android=None, debug=False, debugger=None, headless=False, software=False, bin=None, nightly=""):

I think using "" as default would be more elegant, but I can understand that CommandArgument / public api consistency might be more important.
Which one would you rather have?

@o0Ignition0o o0Ignition0o force-pushed the o0Ignition0o:mach_run_nightly branch from bea6150 to 67a7a26 Mar 6, 2018
@o0Ignition0o
Copy link
Contributor Author

o0Ignition0o commented Mar 6, 2018

Ok I went for the empty default string, please let me know if you think the other approach is better :)

@jdm
Copy link
Member

jdm commented Mar 6, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Mar 6, 2018

Trying commit 67a7a26 with merge d4cfba5...

bors-servo added a commit that referenced this pull request Mar 6, 2018
Add a --nightly | -n flag to mach run commands for linux

First tries to download and extract a specific nightly version to run mach commands against.

<!-- Please describe your changes on the following line: -->
I chose to split the Pull requests for each platform to avoid submitting a huge one, and to make sure I get the logic right.
I'm able to download / extract a nightly version, and I keep nightly versions in the target folder.
Windows and Mac OS support will be filed in separate PRs.
This is part of step two for #19505

The mentor on the issue is jdm

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./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 it is part of a ./mach command.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/19947)
<!-- Reviewable:end -->
@Eijebong
Copy link
Member

Eijebong commented Mar 6, 2018

@bors-servo try

@jdm
Copy link
Member

jdm commented Mar 6, 2018

@o0Ignition0o Another option would be to strip the value inside get_nightly_binary_path once it has been checked for None.

@o0Ignition0o o0Ignition0o force-pushed the o0Ignition0o:mach_run_nightly branch from 67a7a26 to aa7b43b Mar 6, 2018
…version to run mach commands against. This currently only work on linux, but windows and mac os support will follow in subsequent PRs.
@o0Ignition0o o0Ignition0o force-pushed the o0Ignition0o:mach_run_nightly branch from aa7b43b to 10822ce Mar 6, 2018
@o0Ignition0o
Copy link
Contributor Author

o0Ignition0o commented Mar 6, 2018

It is indeed a better approach !

@jdm
Copy link
Member

jdm commented Mar 7, 2018

@bors-servo
Copy link
Contributor

bors-servo commented Mar 7, 2018

📌 Commit 10822ce has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented Mar 7, 2018

Testing commit 10822ce with merge 9eb4175...

bors-servo added a commit that referenced this pull request Mar 7, 2018
Add a --nightly | -n flag to mach run commands for linux

First tries to download and extract a specific nightly version to run mach commands against.

<!-- Please describe your changes on the following line: -->
I chose to split the Pull requests for each platform to avoid submitting a huge one, and to make sure I get the logic right.
I'm able to download / extract a nightly version, and I keep nightly versions in the target folder.
Windows and Mac OS support will be filed in separate PRs.
This is part of step two for #19505

The mentor on the issue is jdm

---
<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./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 it is part of a ./mach command.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/19947)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 7, 2018

@bors-servo bors-servo merged commit 10822ce into servo:master Mar 7, 2018
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
bors-servo added a commit that referenced this pull request Mar 16, 2018
Windows support for the --nightly | -n flag to mach run commands.

<!-- Please describe your changes on the following line: -->
Add windows support to the -n flag.
---
Followup to #19947 , this PR will add windows support to the -n flag.
 This is part of step two for #19505

<!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: -->
- [X] `./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).

The feature does not work just yet, I'm able to download and extract the archive, but it's not running the executable yet.
@tigercosmos might be a good reviewer on this one :)

<!-- Either: -->
- [ ] There are tests for these changes OR
- [X] These changes do not require tests because they're part of a ./mach command.

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/20122)
<!-- Reviewable:end -->
@o0Ignition0o o0Ignition0o deleted the o0Ignition0o:mach_run_nightly branch Dec 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

7 participants
You can’t perform that action at this time.