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
bottles: translate foo@1.2 to fooAT1.2 #832
Conversation
Oh, come on 😆. |
@@ -57,6 +57,7 @@ def resolve_version(bottle_file) | |||
class Bintray | |||
def self.package(formula_name) | |||
formula_name.to_s.tr("+", "x") | |||
formula_name.to_s.sub!(/(.)@(\d)/, "\\1AT\\2") # Handle foo@1.2 style formulae. |
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 isn't doing what it is supposed to do:
$ brew irb
==> Interactive Homebrew Shell
Example commands available with: brew irb --examples
irb(main):001:0> Utils::Bottles::Bintray.package("gcc")
=> nil
irb(main):002:0> Utils::Bottles::Bintray.package("gcc@6.2")
=> "gccAT6.2"
irb(main):003:0> Utils::Bottles::Bintray.package("crf++")
=> nil
You'll need to either append a sub
(without bang) to the tr
or introduce a local variable:
formula_name.to_s.tr("+", "x").sub(/(.)@(\d)/, "\\1AT\\2")
# or
package_name = formula_name.to_s.dup
package_name.tr!("+", "x")
package_name.sub!(/(.)@(\d)/, "\\1AT\\2")
package_name
# or
package_name = formula_name.to_s.tr("+", "x")
package_name.sub!(/(.)@(\d)/, "\\1AT\\2")
package_name
(I'm favoring the 1st variant, that can be split across multiple lines to improve readability, if that's desired.)
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. I did actually test this a bit, but I managed to confuse myself by doing:
fname = Formula["wget"].name
fname.to_s.sub!(/(.)@(\d)/, "\\1AT\\2")
=> nil
fname
=> "wget"
I managed to miss the fname
part wouldn't be automatically triggered.
What is the actual error message? Could it be that an
If you felt like addressing this, it should be fairly straightforward to add some unit tests for the methods in |
It's not, I checked the website:
I do occasionally follow up on curious errors 😉.
I'll take a peek, but I'm not convinced coverage isn't a little broken. This PR failed coverage tests & all I was doing there is tweaking existing lines from |
Thanks! I didn't doubt you did, just wanted to gently nudge you to share your findings with us (error messages you saw, relevant resources you found, …). From the listed characters, would you consider
The change in coverage makes sense here. You added a line to a method that wasn't covered, so the number of relevant lines increased, but the number of covered lines did not, hence the (very small) drop in coverage.
This is a different case as far as I can tell. The latest Travis job for the PR failed very early before it could run the test suite and generate the coverage report. The Travis job that was supposed to run after the merge is still pending. Or am I overlooking something? |
I guess I don't have a strong objection as long as you don't mind the inconsistency of it being
There was a |
|
FWIW, the colon is weird. If the file names for bottles in HOMEBREW_CACHE are going to have this colon, they get presented by the Finder as having a slash in place of the colon. I think that looks unacceptably weird in a filename on a Mac. If the file names of bottles in the cache don't have the colon---if that's just what they're called on Bintray's servers---that seems fine. |
{"openssl@1.1":{"formula":{"pkg_version":"1.1.0","path":"Library/Taps/homebrew/homebrew-core/Formula/openssl@1.1.rb"},"bottle":{"root_url":"https://homebrew.bintray.com/bottles","prefix":"/usr/local","cellar":"/usr/local/Cellar","rebuild":0,"tags":{"el_capitan":{"filename":"openssl@1.1-1.1.0.el_capitan.bottle.tar.gz","sha256":"1c387846400ee0d03713c935f1ce14f558dfa48c0d18b9146cb52246828637c4"}}},"bintray":{"package":"openssl:1.1","repository":"bottles"}}} |
👍 to this PR. Would be good (if we haven't already) to specifically audit (or actually block) formulae now with |
I'm having a slow day. Can you clarify this as well? 🙈. I think you're saying you want formulae audited to make sure people are using |
@DomT4 Yeh, make sure they are using valid name formats in both the class name, formula name and filename. |
@DomT4 I guess better late than never: Thanks for adding some tests and for giving some thought to my suggestions and eventually incorporating some of them. Much appreciated! ❤️ |
brew tests
with your changes locally?Guess who hates special characters? Bintray hates special characters! Need to do the translation here as well so things like
openssl@1.1
don't cause Bintray to reject our upload.Follow up to #812.