sassc icon indicating copy to clipboard operation
sassc copied to clipboard

`--version` is broken

Open chdiza opened this issue 5 years ago • 4 comments

Actual behavior:

$ sassc --version
sassc: na
libsass: na
sass2scss: 1.1.1
sass: 3.5

Expected: the first two each say 3.6.1.

chdiza avatar Jun 23 '19 18:06 chdiza

Whoops, forgot to mention that this is on macOS 10.14.5.

chdiza avatar Jun 23 '19 18:06 chdiza

Hi @chdiza. I do not have macOS handy, but I took a look at the source code of homebrew formula for SassC: https://github.com/Homebrew/homebrew-core/blob/master/Formula/sassc.rb; it seems like the value of version was never assigned. Was this the case with older formulas as well?

Still untested, but it seems like there are two ways to fix it:

Solution 1; write a VERSION file at build time & DRY

diff --git a/Formula/sassc.rb b/Formula/sassc.rb
index 764238e776..6c2c58200e 100644
--- a/Formula/sassc.rb
+++ b/Formula/sassc.rb
@@ -1,8 +1,9 @@
 class Sassc < Formula
   desc "Wrapper around libsass that helps to create command-line apps"
   homepage "https://github.com/sass/sassc"
+  version "3.6.1"
   url "https://github.com/sass/sassc.git",
-      :tag      => "3.6.1",
+      :tag      => version,
       :revision => "46748216ba0b60545e814c07846ca10c9fefc5b6"
   head "https://github.com/sass/sassc.git"

@@ -20,6 +21,7 @@ class Sassc < Formula
   depends_on "libsass"

   def install
+    system "echo #{version} > VERSION"
     system "autoreconf", "-fvi"
     system "./configure", "--prefix=#{prefix}", "--disable-silent-rules",
                           "--disable-dependency-tracking"

Solution 2; add git as dependency

diff --git a/Formula/sassc.rb b/Formula/sassc.rb
index 764238e776..6ed77c1a32 100644
--- a/Formula/sassc.rb
+++ b/Formula/sassc.rb
@@ -13,6 +13,7 @@ class Sassc < Formula
     sha256 "e54c8d0ddc93a8212c9c39f9e8c853a6b19ae1fc2ba3bee650785215441aa60e" => :sierra
   end

+  depends_on "git" => :build
   depends_on "autoconf" => :build
   depends_on "automake" => :build
   depends_on "libtool" => :build

Could you try these solutions and send pull request to https://github.com/Homebrew/homebrew-core? Thanks!

am11 avatar Jun 24 '19 07:06 am11

It's not a Homebrew problem; it happens even if I build sassc outside of Homebrew. (Also, I'm not using the official Homebrew formula anyway, though this problem does occur even with the official Homebrew formula.)

I'm using the github releases, not cloning the repo.

If it's really as simple as placing a file called "VERSION" in the tarball, then shouldn't that be part of the sassc repo, or at least included with the offical release tarball? It seems odd that that'd be the user's job.

Solution 2; add git as dependency

It's really weird to add that as a dep just to get the version. I can't think of another package like this.

it seems like the value of version was never assigned

The value of "version" in Homebrew is normally inferred from the name of the source tarball. In my custom formula that version is indeed in the name of the tarball, so Homebrew knows what the version is. That's not the problem.

chdiza avatar Jun 24 '19 14:06 chdiza

The value of "version" in Homebrew is normally inferred from the name of the source tarball. In my custom formula that version is indeed in the name of the tarball, so Homebrew knows what the version is. That's not the problem.

Sorry I wasn't clear, I was referring to the value of version in SassC' config (version.sh), that does not get the valid version in case git is not in PATH as well as VERSION file does not exist.

I agree that VERSION file should be in tarball for the tagged releases. Currently we do not publish release artifacts from TravisCI script, which will be necessary in this case.

am11 avatar Jun 24 '19 17:06 am11