nickthecook/ops

Allow specifying version in brew dependency

nickthecook opened this issue · 2 comments

Looks like brew just uses git to pull packages and build them, and ops could check out a specific commit hash or branch:

https://stackoverflow.com/questions/39187812/homebrew-how-to-install-older-versions

dependencies:
  brew:
    - tflint@311029c24de3de608e78afe0ee4f2413ea7a792b # this is tflint release 0.18.0 in brew's formulae

Usage of @

Using the @ might be tricky, because there are actually some brew packages that have names with @ in them to denote versions, e.g.:

$ pwd
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
$ ls Formula/openssl*
Formula/openssl@1.1.rb

Option 1

ops could look for a package like this, and only try to use it as a git ref if a package with that name doesn't already exist in Homebrew. This might be too much trouble.

Option 2

Another option is to allow an expanded format of the depedency:

dependencies:
  brew:
    -
      name: tflint
      git_ref: 311029c24de3de608e78afe0ee4f2413ea7a792b
    - openssl@1.1

One brew dependency there is a hash, and one is a string. This also might be too much trouble.

Option 3

A third option is to use a character other than @. While ruby uses @, pip uses ==, and apt uses =. It might not be counterintuitive for developers to use =.

Will probably go with Option 3. Could use =, like pip, or /, because that seems more intuitive (a package has many versions).

Turns out it's very hard to implement this with Homebrew, compared to apt or pip.

apt is done now. apk will probably be next. pip can include this when it's added in #30.