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

Fix brew formula update #14403

Merged
merged 1 commit into from Jan 6, 2017
Merged

Fix brew formula update #14403

merged 1 commit into from Jan 6, 2017

Conversation

@paulrouget
Copy link
Contributor

paulrouget commented Nov 29, 2016

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 Reviewable

@highfive
Copy link

highfive commented Nov 29, 2016

Heads up! This PR modifies the following files:

  • @aneeshusa: etc/ci/upload_nightly.sh, etc/ci/update_brew.sh, etc/ci/buildbot_steps.yml
Copy link
Member

aneeshusa left a comment

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 update_brew.sh script.

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.

@aneeshusa

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.

@aneeshusa

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.

@aneeshusa

aneeshusa Dec 7, 2016

Member

style nit: put the then on the same line

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.

@aneeshusa

aneeshusa Dec 7, 2016

Member

Can you add a comment about what this regex is doing?

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.

@aneeshusa

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.

@aneeshusa

aneeshusa Dec 7, 2016

Member

Please rename the TOKEN to be less generic, something like HOMEBREW_PUSH_TOKEN.

@paulrouget paulrouget force-pushed the paulrouget:fixBrew branch from 86dd153 to 1b6c193 Dec 13, 2016
bors-servo added a commit to servo/saltfs that referenced this pull request Dec 29, 2016
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 -->
Copy link
Member

aneeshusa left a comment

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.

@aneeshusa

aneeshusa Dec 29, 2016

Member

nit: Double-quote "${1}"

This comment has been minimized.

@paulrouget

paulrouget Jan 5, 2017

Author Contributor

Not sure how to properly do that. \" doesn't work for some reason.

This comment has been minimized.

@aneeshusa

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.

@paulrouget

paulrouget Jan 5, 2017

Author Contributor

oh right. It works.

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.

@aneeshusa

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.

@paulrouget

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.

@aneeshusa

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.

@aneeshusa

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.

@aneeshusa

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.

@paulrouget

paulrouget Jan 5, 2017

Author Contributor

ok

@paulrouget paulrouget force-pushed the paulrouget:fixBrew branch from 1b6c193 to e1654d9 Jan 5, 2017
@paulrouget
Copy link
Contributor Author

paulrouget commented Jan 5, 2017

Comments addressed.

@aneeshusa
Copy link
Member

aneeshusa commented Jan 5, 2017

LGTM, thanks for fixing this! @bors-servo r+

@bors-servo
Copy link
Contributor

bors-servo commented Jan 5, 2017

📌 Commit e1654d9 has been approved by aneeshusa

@bors-servo
Copy link
Contributor

bors-servo commented Jan 5, 2017

Testing commit e1654d9 with merge 7519fc8...

bors-servo added a commit that referenced this pull request Jan 5, 2017
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
Copy link
Contributor

bors-servo commented Jan 5, 2017

💔 Test failed - linux-rel-css

@paulrouget
Copy link
Contributor Author

paulrouget commented Jan 6, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Jan 6, 2017

Testing commit e1654d9 with merge 207f9a5...

bors-servo added a commit that referenced this pull request Jan 6, 2017
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 bors-servo merged commit e1654d9 into servo:master Jan 6, 2017
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
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.

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