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 upFix brew formula update #14403
Fix brew formula update #14403
Conversation
highfive
commented
Nov 29, 2016
|
Heads up! This PR modifies the following files:
|
|
Sorry about the delay, the approach looks reasonable. This will require a PR to saltfs to pass the homebrew token to this script instead of the |
| local -r package="${2}" | ||
| local -r extension="${3}" | ||
|
|
||
| local -r nightly_timestamp="$(date -u +"%Y-%m-%dT%H-%M-%SZ")" |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Dec 7, 2016
Member
The use of local will always cause this line to exit with a zero return code, masking any errors from the subshell invocation. Hence, it's best to first declare the variable(s) as local, then do the variable assignment (and then optionally mark those variables as readonly afterwards).
This comment has been minimized.
This comment has been minimized.
aneeshusa
Dec 7, 2016
Member
Also, I'd move the nightly_timestamp generation/assignment into main, and have main responsible for calling upload and update_brew as necessary.
| s3cmd cp "${package_upload_path}" \ | ||
| "${nightly_upload_dir}/servo-latest.${extension}" | ||
|
|
||
| if [[ "${platform}" == "macbrew" ]] |
This comment has been minimized.
This comment has been minimized.
| package_url="https://download.servo.org/nightly/macbrew/${nightly_filename}" | ||
| sha=$(shasum -a 256 ${package} | sed -e 's/ .*//') | ||
| version=$(echo "${nightly_timestamp}" | \ | ||
| sed -n 's/\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\).*/\1.\2.\3/p') |
This comment has been minimized.
This comment has been minimized.
| local package_url sha version script_dir tmp_dir | ||
|
|
||
| package_url="https://download.servo.org/nightly/macbrew/${nightly_filename}" | ||
| sha=$(shasum -a 256 ${package} | sed -e 's/ .*//') |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Dec 7, 2016
Member
Make sure to double-quote variables and command substitutions per the style guide.
| git commit -m "Version bump: ${version}" | ||
|
|
||
| git push -qf \ | ||
| "https://${TOKEN}@github.com/servo/homebrew-servo.git" master \ |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Dec 7, 2016
Member
Please rename the TOKEN to be less generic, something like HOMEBREW_PUSH_TOKEN.
update_brew doesn't exist anymore follow up servo/servo#14403 <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/saltfs/541) <!-- Reviewable:end -->
|
Just a few last nits. |
|
|
||
| nightly_filename="${2}-$(basename "${1}")" | ||
| package_url="https://download.servo.org/nightly/macbrew/${nightly_filename}" | ||
| sha="$(shasum -a 256 ${1} | sed -e 's/ .*//')" |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
paulrouget
Jan 5, 2017
Author
Contributor
Not sure how to properly do that. \" doesn't work for some reason.
This comment has been minimized.
This comment has been minimized.
aneeshusa
Jan 5, 2017
Member
$() creates a new quoting context, so you should be able to just do "$(shasum -a 256 "${1}" | sed ...)"
This comment has been minimized.
This comment has been minimized.
| sed -n 's/\([0-9]\{4\}\)-\([0-9]\{2\}\)-\([0-9]\{2\}\).*/\1.\2.\3/p')" | ||
|
|
||
| script_dir="${PWD}/$(dirname "${0}")" | ||
| tmp_dir="$(mktemp -d -t homebrew-servo)" |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Dec 29, 2016
Member
Add some uppercase Xs to the end of the template, i.e. homebrew-servo.XXXXXXXXX, so not the temporary directory used is randomized.
This comment has been minimized.
This comment has been minimized.
paulrouget
Jan 5, 2017
•
Author
Contributor
iirc, that's only true on Linux. mktemp on mack adds a postfix automatically.
This comment has been minimized.
This comment has been minimized.
aneeshusa
Jan 5, 2017
Member
Oh, I didn't know that, that's a nice feature. Still might be nice to have in case this gets blindly copy-pasted out of context later, but up to you if you want to change it.
| "https://${GITHUB_HOMEBREW_TOKEN}@github.com/servo/homebrew-servo.git" \ | ||
| master >/dev/null 2>&1 | ||
|
|
||
| rm -rf ${tmp_dir} |
This comment has been minimized.
This comment has been minimized.
aneeshusa
Dec 29, 2016
Member
Please double-quote "${tmp_dir}".
Also, we're still inside the directory at this point (it's the pwd), so I'm not sure how we're able to delete it...we should cd back to somewhere else (e.g. the "${script_dir}") first.
This comment has been minimized.
This comment has been minimized.
aneeshusa
Dec 29, 2016
Member
An alternative to using cd entirely is using the -C argument for the git invocations, e.g. git -C "${tmp_dir}" add ... and editing the path in the sed invocation to "${tmp_dir}/Formula/servo-bin.rb". This avoids cd completely, which I find nicer to reason about.
This comment has been minimized.
This comment has been minimized.
|
Comments addressed. |
|
LGTM, thanks for fixing this! @bors-servo r+ |
|
|
Fix brew formula update Fix servo/saltfs#535 I decided to merge update_brew within upload_nightly. I hope this will fix the brew formula upadte. <!-- 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/14403) <!-- Reviewable:end -->
|
|
|
@bors-servo: retry |
Fix brew formula update Fix servo/saltfs#535 I decided to merge update_brew within upload_nightly. I hope this will fix the brew formula upadte. <!-- 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/14403) <!-- Reviewable:end -->
|
|
paulrouget commentedNov 29, 2016
•
edited by larsbergstrom
Fix servo/saltfs#535
I decided to merge update_brew within upload_nightly.
I hope this will fix the brew formula upadte.
This change is