Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upPart of #13551 - Create packages under release/debug directories as appropriate #13845
Conversation
|
I've only skimmed the description so far, but thanks for the PR, and extra thanks for going above and beyond! Cleaning up the path manipulations in the OS X builders has been on my TODO list for a long time :) |
|
r? @aneeshusa Highfive is slacking off it seems. |
|
Oh huh, thanks @KiChjang - I thought my original message assigned successfully. |
|
Looks good overall. I'll take a closer look at the path manipulation changes once they're split up. It looks like you're going to earn a lot of bonus points on this PR! |
| @@ -25,9 +25,20 @@ upload() { | |||
| s3cmd cp "${package_upload_path}" "${nightly_upload_dir}/servo-latest.${3}" | |||
| } | |||
|
|
|||
| package_path() { | |||
This comment has been minimized.
This comment has been minimized.
aneeshusa
Oct 28, 2016
Member
We only are packaging + uploading release builds for nightlies (at least right now), so no need to support debug builds at the moment.
|
|
||
| main() { | ||
| if [[ "${#}" != 1 ]]; then | ||
| if (( "${#}" != 1 )); then |
This comment has been minimized.
This comment has been minimized.
| @@ -153,14 +153,14 @@ def package(self, release=False, dev=False, android=None, debug=False, debugger= | |||
| return e.returncode | |||
| elif is_macosx(): | |||
|
|
|||
| dir_to_build = '/'.join(binary_path.split('/')[:-1]) | |||
| dir_to_build = path.dirname(binary_path) | |||
This comment has been minimized.
This comment has been minimized.
aneeshusa
Oct 28, 2016
Member
Please split out all of the hacking string processing -> os.path function changes into a separate commit.
| dir_to_dmg = '/'.join(binary_path.split('/')[:-2]) + '/dmg' | ||
| dir_to_app = dir_to_dmg + '/Servo.app' | ||
| dir_to_resources = dir_to_app + '/Contents/Resources/' | ||
| dir_to_dmg = path.join(path.dirname(binary_path), 'dmg') |
This comment has been minimized.
This comment has been minimized.
| dir_to_resources = dir_to_app + '/Contents/Resources/' | ||
| dir_to_dmg = path.join(path.dirname(binary_path), 'dmg') | ||
| dir_to_app = path.join(dir_to_dmg, 'Servo.app') | ||
| dir_to_resources = path.join(dir_to_app, 'Contents/Resources/') |
This comment has been minimized.
This comment has been minimized.
| time = now.replace(microsecond=0).isoformat() | ||
| time = time.replace(':', '-') | ||
| dmg_path += time + "-servo-tech-demo.dmg" | ||
| dmg_path = path.join(dir_to_build, time + "-servo-tech-demo.dmg") |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Oct 28, 2016
Member
If it fits the line limit, I'd prefer string formatting for the second arg:
'{}-servo-tech-demo.dmg'.format(time)
| @@ -318,7 +317,7 @@ def package(self, release=False, dev=False, android=None, debug=False, debugger= | |||
| print("Creating tarball") | |||
| time = datetime.utcnow().replace(microsecond=0).isoformat() | |||
| time = time.replace(':', "-") | |||
| tar_path = path.join(self.get_target_dir(), time + '-servo-tech-demo.tar.gz') | |||
| tar_path = path.join(os.path.dirname(binary_path), time + '-servo-tech-demo.tar.gz') | |||
This comment has been minimized.
This comment has been minimized.
3bec7c1
to
0942ae4
0942ae4
to
3520247
|
I really liked the path cleanups you had previously - sorry if I wasn't clear but I still want them in this PR, just as a separate commit to avoid this directory change from getting lost. Also, for the brew package it looks like the upload script has the new location but the packaging code hasn't been changed (although I seem to remember it being there before). |
| @@ -25,9 +25,8 @@ upload() { | |||
| s3cmd cp "${package_upload_path}" "${nightly_upload_dir}/servo-latest.${3}" | |||
| } | |||
|
|
|||
|
|
|||
This comment has been minimized.
This comment has been minimized.
aneeshusa
Oct 30, 2016
Member
Keep this line to avoid diff noise and fit with the double newline between functions style.
This comment has been minimized.
This comment has been minimized.
leikahing
Nov 9, 2016
Author
Contributor
This is resolved in the next commit (haven't done any squashing yet in order to separate out my fixes and improvements).
| @@ -158,7 +158,7 @@ def package(self, release=False, dev=False, android=None, debug=False, debugger= | |||
| now = datetime.utcnow() | |||
|
|
|||
| print("Creating Servo.app") | |||
| dir_to_dmg = '/'.join(binary_path.split('/')[:-2]) + '/dmg' | |||
| dir_to_dmg = '/'.join(dir_to_build) + '/dmg' | |||
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
leikahing
Oct 30, 2016
Author
Contributor
Yes, I have a second commit incoming that does all the path tidying - just testing it all to make sure it works again as a blob (and because servo currently isn't building on my Mac for some reason).
|
@aneeshusa - I committed all my path changes again - sorry for the confusion. I had to redo my commits to make them separate and since I have to build on two different machines, I committed to my fork before re-adding all my path modifications back in (now with more cleanups). I re-tested everything on Linux/macos with all these changes - everything looks good on my end. Please re-review when you can. |
|
|
7b01cbd
to
bc1283a
|
Review ping @aneeshusa. |
| dir_to_build = '/'.join(binary_path.split('/')[:-1]) | ||
| dir_to_root = '/'.join(binary_path.split('/')[:-3]) | ||
| dir_to_build = path.dirname(binary_path) | ||
| dir_to_root = os.sep.join(binary_path.split(os.sep)[:-3]) |
This comment has been minimized.
This comment has been minimized.
| os.makedirs(dir_to_app + '/Contents/MacOS/') | ||
| shutil.copy2(dir_to_build + '/servo', dir_to_app + '/Contents/MacOS/') | ||
| shutil.copytree(path.join(dir_to_root, 'resources'), dir_to_resources) | ||
| shutil.copytree(browserhtml_path, dir_to_resources + path.split(browserhtml_path)[1]) |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Nov 15, 2016
Member
The + can be replaced by a path.join, and you can use path.basename instead of splitting and indexing.
|
|
||
| content_dir = path.join(dir_to_app, 'Contents', 'MacOS') | ||
| os.makedirs(content_dir) | ||
| shutil.copy2(path.join(dir_to_build, 'servo'), content_dir) |
This comment has been minimized.
This comment has been minimized.
|
|
||
| print("Finding dylibs and relinking") | ||
| copy_dependencies(dir_to_app + '/Contents/MacOS/servo', dir_to_app + '/Contents/MacOS/') | ||
| copy_dependencies(path.join(dir_to_app, 'Contents', 'MacOS', 'servo'), content_dir) |
This comment has been minimized.
This comment has been minimized.
| with open(template_path) as template_file: | ||
| template = mako.template.Template(template_file.read()) | ||
| with open(credits_path, "w") as credits_file: | ||
| credits_file.write(template.render(version=version)) | ||
| delete(template_path) | ||
|
|
||
| print("Writing run-servo") | ||
| bhtml_path = path.join('${0%/*}/../Resources', browserhtml_path.split('/')[-1], 'out', 'index.html') | ||
| runservo = os.open(dir_to_app + '/Contents/MacOS/run-servo', os.O_WRONLY | os.O_CREAT, int("0755", 8)) | ||
| bhtml_path = path.join('${0%/*}/../Resources', browserhtml_path.split(os.sep)[-1], 'out', 'index.html') |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
aneeshusa
Nov 15, 2016
Member
Also, see if you can get rid of the explicit /s in the first path.join in favor of multiple args.
| bhtml_path = path.join('${0%/*}/../Resources', browserhtml_path.split('/')[-1], 'out', 'index.html') | ||
| runservo = os.open(dir_to_app + '/Contents/MacOS/run-servo', os.O_WRONLY | os.O_CREAT, int("0755", 8)) | ||
| bhtml_path = path.join('${0%/*}/../Resources', browserhtml_path.split(os.sep)[-1], 'out', 'index.html') | ||
| runservo = os.open(path.join(dir_to_app, 'Contents', 'MacOS', 'run-servo'), |
This comment has been minimized.
This comment has been minimized.
bc1283a
to
eef6001
eef6001
to
f03cf09
|
@aneeshusa Thanks again for feedback - I've cleaned up the code, squashed my commits into the 'feature change' commit and an enhancement commit, and changed my commit messages to conform to servo standards. |
|
Review ping @aneeshusa |
|
Sorry about the delay. You've got all the rights bits in terms of code and commit messages, but they need to be shuffled around a bit to match.
|
f03cf09
to
800a181
|
@aneeshusa Sorry for how long it's taken to get this PR in. I've reordered my commits so that the path manipulation cleanups are the first commit. I imagine your statement here:
Was for the other direction (some changes in the path-manipulation change belonged in the 'change release packaging' commit), so the path manipulation commit now changes the |
|
Looks great! One last style nit. |
| bhtml_path = path.join('${0%/*}/../Resources', browserhtml_path.split('/')[-1], 'out', 'index.html') | ||
| runservo = os.open(dir_to_app + '/Contents/MacOS/run-servo', os.O_WRONLY | os.O_CREAT, int("0755", 8)) | ||
| bhtml_path = path.join('${0%/*}', '..', 'Resources', path.basename(browserhtml_path), 'out', 'index.html') | ||
| runservo = os.open(path.join(content_dir, 'run-servo'), |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Dec 9, 2016
Member
nit: use block indentation:
runservo = os.open(
path.join(...),
os.O_WRONLY...,
int("0755", 8)
)
Path manipulation has been changed from using '/' to using os.path functions for packaging code for macOS and Linux targets.
This commit updates the 'mach package' command to generate output under the target/release and target/debug directories when run on macOS and Linux. etc/ci/upload_nightly.sh has also been updated to upload packages from the release/debug directories.
800a181
to
6a7fb6c
|
Everything looks good to me, thanks again for the PR and cleaning up all that path code! @bors-servo r+ |
|
|
…aneeshusa Part of #13551 - Create packages under release/debug directories as appropriate r? @aneeshusa This change implements fixes for #13551 for Linux and MacOS targets. `/python/servo/package_commands.py` was modified so that: - On MacOS, it creates all intermediate packaging directories like `dmg`, `brew`, and `brew-tmp` under `target/(release|debug)`, rather than in `target` directly. - On MacOS, all packaging artifacts (`.dmg`, brew `.tar.gz`) are packaged under `target/(release|debug)`, rather than in `target` directly. - On Linux, the resulting `tar.gz` Servo package is placed under `target/(release|debug)`, rather than in `target`. - Also did some extra cleanup around path parsing in the MacOS packaging code, to use `os.path` methods rather than straight `'/'` parsing with `split` and `join` where it was applicable. `/etc/ci/upload_nightly.sh` was modified to: - Look for artifacts in `target/release` for `mac`, `macbrew`, and `linux` platforms, rather than just `target/`. --- <!-- 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 - [x] These changes fix #13551 - [x] These changes do not require tests because it is based on CI and packaging tools. They were manually tested for correctness. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> …lease/debug as specified or detected. Modify macos packaging to create all packages under release/debug directory. Updated etc/ci/upload_nightly.sh to support uploading from either release/debug directory, depending on what was built <!-- 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/13845) <!-- Reviewable:end -->
|
|
leikahing commentedOct 20, 2016
•
edited
r? @aneeshusa
This change implements fixes for #13551 for Linux and MacOS targets.
/python/servo/package_commands.pywas modified so that:dmg,brew, andbrew-tmpundertarget/(release|debug), rather than intargetdirectly..dmg, brew.tar.gz) are packaged undertarget/(release|debug), rather than intargetdirectly.tar.gzServo package is placed undertarget/(release|debug), rather than intarget.os.pathmethods rather than straight'/'parsing withsplitandjoinwhere it was applicable./etc/ci/upload_nightly.shwas modified to:target/releaseformac,macbrew, andlinuxplatforms, rather than justtarget/../mach build -ddoes not report any errors./mach test-tidydoes not report any errors…lease/debug as specified or detected. Modify macos packaging to create all packages under release/debug directory. Updated etc/ci/upload_nightly.sh to support uploading from either release/debug directory, depending on what was built
This change is