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
cpuinfo (new formula) #171405
cpuinfo (new formula) #171405
Conversation
@@ -0,0 +1,39 @@ | |||
class Cpuinfo < Formula |
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.
Given that the CLI tool is named cpu-info
, and that there is already a cask named cpuinfo
, it might be better to name this cpu-info
.
However, Debian calls it cpuinfo
and so do other distros, so I'm genuinely unsure.
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.
to me, cpuinfo
sounds better than cpu-info
.
Formula/c/cpuinfo.rb
Outdated
# TODO: test other arch-specific "dump" binaries, if present | ||
# gpu-dump, auxv-dump, cpuid-dump, cpuinfo-dump |
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.
let's maybe remove it
# TODO: test other arch-specific "dump" binaries, if present | |
# gpu-dump, auxv-dump, cpuid-dump, cpuinfo-dump |
class Cpuinfo < Formula | ||
desc "CPU INFOrmation library and associated command-line tools" | ||
homepage "https://github.com/pytorch/cpuinfo" | ||
url "https://github.com/pytorch/cpuinfo/archive/3c8b1533ac03dd6531ab6e7b9245d488f13a82a5.tar.gz" |
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.
we need a tagged 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.
They don't exist 🤷♂️. Debian simply names the package versions gitYYYYMMDD.${GITHASH}
. https://packages.debian.org/search?keywords=cpuinfo
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.
For what it's worth, @SMillerDev and @chenrui333, I see several other formulae where the "releases" are simply date-plus-Git-hash slugs.
the only catch is we need a tagged release. (as we only ship stable releases at best efforts)
Is this requirement a recently-added one?
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.
No, it's not a new requirement. luajit
is a one-off exception, but there should not be any others. I'll do a review when I have time to confirm this.
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.
@p-linnane, if I simply git grep -P -C5 'version "20\d\d' Formula/
, I find numerous other formulae in which the version identifiers used by Homebrew are simply dates and/or Git hashes, with no sign of a clear versioning or tagging strategy that originates in the upstream projects.
Here is an example that appears nearly identical to this one:
homebrew-core/Formula/j/jsmin.rb
Lines 4 to 11 in 262db06
url "https://github.com/douglascrockford/JSMin/archive/430bfe68dc0823d8c0f92c08d426e517cbc8de5e.tar.gz" | |
version "2019-10-30" | |
sha256 "24e3ad04979ace5d734e38b843f62f0dc832f94f5ba48642da31b4a33ccec9ac" | |
license "JSON" | |
# The GitHub repository doesn't contain any tags, so we have to check the | |
# date in the comment at the top of the `jsmin.c` file. | |
livecheck do |
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 just ran that, and looked through the results. jsmin
is the only one that matches what you are talking about here. All other results are us having to clarify the string we want to use as the version, because it can't be parsed from the filename. Additionally, it appears jsmin
is the way it is because the repo has no tags, but the website states a release date, so that's what's being used.
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.
jsmin is the only one that matches what you are talking about here. All other results are us having to clarify the string we want to use as the version, because it can't be parsed from the filename.
How about, say, https://github.com/Homebrew/homebrew-core/blob/master/Formula/i/ipbt.rb#L3-L7?
The "release" is simply a tarball with a date and a Git hash embedded in it. The homepage simply mentions it as:
A Unix source archive of IPBT is available here:
… without otherwise describing any strategy or approach to versioning.
I guess what I'd like to clarify here is: what is a minimum threshold for what counts as "versions that come from upstream"?
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.
That falls into the category I mentioned. It is a deliberate release, with the date being the version identifier as far as we are concerned. The point is that upstream for ipbt
is distributing this version, so it's what we are using. Arbitrary commits are not enough.
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 regex you want is probably something more like
git grep -P -C5 'url "https://github.com/[^/]*/[^/]*/archive/[0-9a-f]*\.tar\.gz"' -- Formula/
This produces a number of results, but most of the matches belong to resource
s (which don't need version tags). There are three formulae url
s that match (i.e. the match doesn't belong to a resource
): luajit
, jsmin
and solid
.
Of those, solid
and luajit
used to provide tags/versioned download URLs (see the repo Git log for details). jsmin
was likely added before we adopted the policy1 of only packaging software where upstream has version tags.
If you really want this in Homebrew/core, ask upstream if they're willing to tag their releases. Otherwise, you can host this formula in your own tap.
Footnotes
the only catch is we need a tagged release. (as we only ship stable releases at best efforts) |
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.
So far this does not meet the requirements for inclusion: https://docs.brew.sh/Acceptable-Formulae#stable-versions
Adds the 'cpu-info', 'cache-info', and 'isa-info' command-line tools from https://github.com/pytorch/cpuinfo, and the associated dynamic library and headers.
@SMillerDev wrote:
As I show in #171405 (comment), there are many counter-examples to this, where there are previously accepted formulae in I definitely do completely understand the desire to use and rely on coherent upstream versioning wherever possible, though 😅. And thank you @chenrui333 for pinging pytorch/cpuinfo#84 (comment). Since there are numerous other free-software distributions which manage to stably package https://github.com/pytorch/cpuinfo, what would you think of piggybacking on the specific versions that they package? My preference would be to pick the versions packaged by Debian, as a very well-organized and relied-upon Linux distribution. |
Please see my response to the comment in question, because this is not an accurate statement. |
Also: new formulae have a higher bar to reach than existing, widely used formulae. |
Adds the
cpu-info
,cache-info
, andisa-info
command-line tools from https://github.com/pytorch/cpuinfo, and the associated dynamic library and headers.HOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source cpuinfo
brew test cpuinfo
brew audit --strict <formula>
(after doingHOMEBREW_NO_INSTALL_FROM_API=1 brew install --build-from-source <formula>
)? If this is a new formula, does it passbrew audit --new <formula>
?