Homebrew inferring the wrong project version


(Luc Perkins) #1

I’m writing a Homebrew formula for the CoreDNS project, and for some reason Homebrew is incorrectly inferring that the latest version of the project is 64 even though there’s only one version of the project (1.3.1). I’m a bit stumped as to why that’s happening.

For reference, here is the troublesome formula PR:

And here is the GitHub repo that the formula builds from:

The formula builds successfully in a local context but with a warning: Warning: coredns 64 is available and more recent than version 1.3.1.. When I try to run brew test coredns I get Error: Testing requires the latest version of coredns. And when I run brew upgrade coredns (which shouldn’t work given that there’s only one version) it attempts to install version 64.

I just can’t seem to figure out why Homebrew is inferring this version. Any help would be greatly appreciated!

Here’s the formula for reference:

class Coredns < Formula
  desc "Plugin-driven DNS and service discovery"
  homepage "https://coredns.io"
  url "https://github.com/coredns/coredns.git",
    :tag => "v1.3.1",
    :revision => "6b56a9c92130d50cee9bd92aaee500dbccff395f"
  head "https://github.com/coredns/coredns.git"

  depends_on "dep" => :build
  depends_on "go" => :build

  def install
    ENV["GOPATH"] = buildpath
    dir = buildpath/"src/github.com/coredns/coredns"
    dir.install buildpath.children

    cd dir do
      system "make", "godeps", "all"
      bin.install "coredns"
      prefix.install_metafiles
    end
  end

  test do
    system bin/"coredns", "-dns.port=1053"
  end
end

(Steve Peters) #2

What does brew info coredns say?


(Luc Perkins) #3

@scpeters

coredns: stable 64
CoreDNS is a DNS server that chains plugins
https://coredns.io
/usr/local/Cellar/coredns/1.3.1 (64B)
  Built from source
From: https://github.com/Homebrew/homebrew-core/blob/master/Formula/coredns.rb

It’s also trying to infer the project description from the repo as well (as you can see, the description in the brew info output doesn’t match the description in my formula). If there’s a way to take the “magic” out of the build process, please let me know!


(Steve Peters) #4

I think somehow it’s inferring the version 64 from this prior commit:

If you squash some commits in this branch, I think it may fix this error.


(Luc Perkins) #5

I’ve now squashed the commits (as you can see in the PR) and cleared out my Homebrew cache. But I’m still having the same issue. From what I can gather, this is an issue only in my home environment, and doesn’t seem to be reproduced in the Homebrew CI process. Oh well. I think I’m just going to fight head-to-head with CI until I can get it worked out.