-
-
Notifications
You must be signed in to change notification settings - Fork 13k
step: Fixed missing versions in homebrew binaries. #36997
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
Conversation
3fd7987
to
bca6902
Compare
Thanks for the feedback and guidance @javian! Let me know if the changes check out. |
Formula/step.rb
Outdated
@@ -3,6 +3,7 @@ class Step < Formula | |||
homepage "https://smallstep.com" | |||
url "https://github.com/smallstep/cli/archive/v0.8.5.tar.gz" | |||
sha256 "b809c4638ffd6d0c3e1bff66d87d9fbea186783735544492c34f35fe1e9f9d79" | |||
head "https://github.com/smallstep/cli.git" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dopey: I'm curious what your reasoning for adding a head url is. Unless it makes sense to do so to improve software quality, we avoid adding heads to formula. If you plan to use it for improving software quality, e.g., in nightly testing to test for installation regressions and issues caused by build dependencies, then I'm all for adding it. However, unless there is a compelling reason that users might want/need head installations, I would prefer that it is removed. In the future we'll be adding very prominent warnings to HEAD installs saying that they are totally unsupported and you're on your own if something breaks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually grabbed that from another Formula because I thought it might be useful. Should have looked up what it was doing. Removed.
In the same vein I saw another formula using this url definition (https://github.com/Homebrew/homebrew-core/blob/master/Formula/goofys.rb#L6-L8) and was wondering if it wouldn't be nicer to switch to that over the tarball. Any drawbacks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I actually grabbed that from another Formula because I thought it might be useful. Should have looked up what it was doing. Removed.
I like to add add nightly tests to my projects that build using brew install --HEAD <my-package>
to ensure that upstream dependencies, or changes to homebrew didn't break the install procedure for the package in question. I support and encourage this approach, because then the package authors/maintainers catch potential breakage of their package when installed via Homebrew. This way, when they mint a new release, they will have been testing the homebrew installation all along.
However, I discourage adding in simply because "some user may want this". If users want development software, they should be comfortable enough with git to grab it for themselves. The exception to this, in my mind, is tooling stuff. I like knowing if stuff, e.g., in nightly GFortran, might break my projects so that I can update them ahead of the next major compiler release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense for that use case, and definitely not one I had in mind when I added it. Thanks for the explanation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the same vein I saw another formula using this url definition (/Formula/goofys.rb@
master
#L6-L8) and was wondering if it wouldn't be nicer to switch to that over the tarball. Any drawbacks?
The way you have it now is probably more canonical. I don't recall whether or not brew
will do a shallow clone using the tag and hash version scheme. If it doesn't, then grabbing a whole git repo will be slower and more time consuming than just the tarball, and it will take up more disk space. Unless there is a compelling reason to switch, let's leave the version & download as is.
bca6902
to
068221d
Compare
Formula/step.rb
Outdated
@@ -21,7 +21,7 @@ class Step < Formula | |||
|
|||
def install | |||
ENV["GOPATH"] = buildpath | |||
contents = Dir["{*,.git,.gitignore}"] | |||
contents = Dir.glob("*", File::FNM_DOTMATCH) - %w[. ..] | |||
(buildpath/"src/github.com/smallstep/cli").install contents |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dopey How hard would it be to push this complexity to the build system? i.e., just be able to run system "make", "build"
from the default top level build directory? If it's not too difficult, would upstream be amenable to this? I guess it's possible that this could break other package managers, so I understand if that isn't feasible.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The project uses dep
to vendor dependencies, and as far as I can tell dep
requires that a package be under $GOPATH/src
. I'm not super well acquainted with this stuff, but based on some searching it seems that the other workaround (other than copying the whole project into $GOPATH/src
- what we're currently doing) would be to do some symlink magic - which I think would be more confusing. Dependency mgmt is scheduled to become a first class citizen in golang soon, so once we replace dep
the $GOPATH/src
requirement might go away.
Like I said, I'm not super confident with this stuff. If there are examples of other Formulas that use dep
and are able to build directly in the buildpath
I'd be happy to take their lead.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be the common pattern
def install
ENV["GOPATH"] = buildpath
(buildpath/"src/github.com/ssh-vault/ssh-vault").install buildpath.children
so if you grep for buildpath.children
there will be multiple examples from what I can tell.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the tip! Updated. Lemme know if that's better / easier to understand.
068221d
to
5b83ef8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
@dopey are we good to merge?
@zbeekman Good from my end. |
Actually, hold on labeling this ready for merge please. Just doing some further testing to make sure the versions made it. |
@dopey ok, we'll hold off. Let us know when you've finished testing |
@zbeekman It seems that the github release tarball doesn't actually contain a
then the repo is cloned and has the necessary Is there a work-around that I just don't know of? I could try to |
In my projects I try to encode version information in release assets using the E.g., in a file I have named
Then
if I have
in my The project I use this for has logic that checks if we're in a git working directory and uses I would recommend taking this approach (using export substitution for versioning when not in an active git repository) however, if the transition/implementation proves too burdensome, I think we can consider switching your URL/Versioning scheme to using git tags and SHAs. |
I meant to leave this link in my previous comment: info on |
Thanks for the info! I'll give this a shot tomorrow. We currently use a similar method to the one you described, but w/out the fallback onto a |
Hey @zbeekman I've plugged away at this for a few hours and I feel a bit silly, but I may need a bit more guidance.
but only on gnu Additionally, I searched for ways to have only the tag written to the I also looked through your repos on github and, while I found a few examples with If you wouldn't mind linking me to your code, assuming it doesn't overcomplicate our build pipeline, I'd be happy to implement it. Otherwise it may be easier to stick with cloning the repo and getting the version from |
I assumed, perhaps mistakenly, that you could use regex functionality in golang, or provided by the build system to grab the tag out of the Short of this, I would just rely on bash (or throw in the towel and go to the git based formula versioning). To do it with bash you can do something like: #!/usr/bin/env bash
read -r firstline < .VERSION
last_half="${firstline##*tag: }"
version_string="${last_half%%[,)]*}"
echo "$version_string"
I've never tried this, and from reading the man page, I'm under the impression that smudge may not work for TL;DR: If you want to switch to the tag based versioning scheme I'm ok with it. However, I think having your build system or tool use a golang regex library to parse the version file is more elegant, and short of that you can do it in plain old Bash 3, as I show above. The world is your oyster, and I'm content with whichever of these approaches you decide to take. |
5b83ef8
to
375a1a7
Compare
Apologies for the radio silence. It took a bit of time to update the build process with the .VERSION/.gitattributes stuffs (thanks @zbeekman for the tips) and then we found that zsh completion wasn't working. Had to bump the versions for the modified build process in both |
@dopey it looks like you may not have updated the SHA256 hashes. Can you please investigate (and try a local build)? |
Other than the SHA256 miss-matches everything else looks good to me. |
Looks good but build failure needs to be fixed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fix bad sha256
Formula/step.rb
Outdated
url "https://github.com/smallstep/cli/archive/v0.8.5.tar.gz" | ||
sha256 "b809c4638ffd6d0c3e1bff66d87d9fbea186783735544492c34f35fe1e9f9d79" | ||
url "https://github.com/smallstep/cli/archive/v0.8.6.tar.gz" | ||
sha256 "1aad35a78f8b7cfa59ced27131f547174344acf9333cad1d87731cb7b133ec41" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sha256 "1aad35a78f8b7cfa59ced27131f547174344acf9333cad1d87731cb7b133ec41" | |
sha256 "8eb5099550d510b24ba1e5a53ccd4141e545286274c6abceb712be702d428820" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just fixed. It's really strange because I tested that formula before I pushed. It's as though the sha changed from underneath me. It's actually not the first time we've seen that happen with a recently built release. dodgy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If someone yanked a tag, and force pushed a new one with the same name that will happen. The preferred thing to do is to just warn users off a bad tag with big red letters and push a new tag that increments at least the patch or tweak level.
Copy entire contents of directories - was leaving behind .git files. Fix zsh completions.
375a1a7
to
269e29e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks for your patience and continued hard work, @dopey
Contributor resolved issues identified in this review
gah, the commit message is malformed, but I think that will get updated automagically, if not I'll fix it. |
Thanks for your contribution to Homebrew! 🎉 🥇 Without awesome contributors like you, it would be impossible to maintain Homebrew to the high level of quality users have come to expect. Thank you!!!! |
brew install --build-from-source <formula>
, where<formula>
is the name of the formula you're submitting?brew test <formula>
, where<formula>
is the name of the formula you're submitting?brew audit --strict <formula>
(after doingbrew install <formula>
)?