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
Test do fix for HEAD versions. #536
Conversation
@@ -166,6 +166,10 @@ def initialize(name, path, spec) | |||
validate_attributes! | |||
@build = active_spec.build | |||
@pin = FormulaPin.new(self) | |||
|
|||
if head && head_pkg_version = latest_head_pkg_version |
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.
do you mean ==
?
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, this checks whether latest_head_pkg_version
is nil
or not i.e. there is at least one HEAD
installed. I use head_pkg_version
in the following line.
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.
OK, in that case you should probably do the assignment on its own line.
As I explained in the above comment, this is an incorrect fix. What you really need to do is to update commit inside diff --git a/Library/Homebrew/extend/ARGV.rb b/Library/Homebrew/extend/ARGV.rb
index beee470..2da6141 100644
--- a/Library/Homebrew/extend/ARGV.rb
+++ b/Library/Homebrew/extend/ARGV.rb
@@ -32,6 +32,10 @@ module HomebrewArgvExtension
resolved_spec = spec(nil) || tab.spec
f.set_active_spec(resolved_spec) if f.send(resolved_spec)
f.build = tab
+ if f.head? && tab.tabfile
+ k = Keg.new(tab.tabfile.parent)
+ f.version.update_commit(k.version.version.commit)
+ end
end
f
else
diff --git a/Library/Homebrew/formulary.rb b/Library/Homebrew/formulary.rb
index 4254437..20f115f 100644
--- a/Library/Homebrew/formulary.rb
+++ b/Library/Homebrew/formulary.rb
@@ -246,6 +246,7 @@ class Formulary
end
end
f.build = tab
+ f.version.update_commit(keg.version.version.commit) if f.head?
f
end
diff --git a/Library/Homebrew/postinstall.rb b/Library/Homebrew/postinstall.rb
index 14e5781..0b6d8f6 100644
--- a/Library/Homebrew/postinstall.rb
+++ b/Library/Homebrew/postinstall.rb
@@ -11,7 +11,7 @@ begin
trap("INT", old_trap)
- formula = ARGV.formulae.first
+ formula = ARGV.resolved_formulae.first
formula.extend(Debrew::Formula) if ARGV.debug?
formula.run_post_install
rescue Exception => e
diff --git a/Library/Homebrew/test.rb b/Library/Homebrew/test.rb
index 796ce09..ffffa18 100644
--- a/Library/Homebrew/test.rb
+++ b/Library/Homebrew/test.rb
@@ -19,7 +19,7 @@ begin
trap("INT", old_trap)
- formula = ARGV.formulae.first
+ formula = ARGV.resolved_formulae.first
formula.extend(Homebrew::Assertions)
formula.extend(Debrew::Formula) if ARGV.debug?
|
Agreed. |
d53f37f
to
de197fb
Compare
When I try to build emacs with --HEAD, the build fails with:
I do not know much about homebrew internals, but by looking at this commit it seems ARGV.rb does a bit more before calling |
@mariusk I think you need to |
I could have sworn I did it already, but now that I tested and rebuilt emacs it seems to work. Thanks, my bad! |
However, if updating doesn't resolve this build failure, I suspect this is another manifestation of the bug that is about to be fixed in PR #644. |
Yes, indeed. Now that #644 is merged, this should be fixed after a $ brew install emacs --without-librsvg --devel
[…]
🍵 /opt/brewery/dummy/Cellar/emacs/25.1-rc1: 4,038 files, 97.6M, built in 3 minutes 6 seconds
$ brew reinstall emacs --HEAD
Error: undefined method `commit' for #<Version:0x007fd3e32c5538 @version="25.1-rc1">
Please report this bug:
https://git.io/brew-troubleshooting
/opt/brewery/dummy/Library/Homebrew/formulary.rb:249:in `from_keg'
/opt/brewery/dummy/Library/Homebrew/formulary.rb:225:in `from_rack'
/opt/brewery/dummy/Library/Homebrew/extend/ARGV.rb:43:in `block in resolved_formulae'
/opt/brewery/dummy/Library/Homebrew/extend/ARGV.rb:27:in `map'
/opt/brewery/dummy/Library/Homebrew/extend/ARGV.rb:27:in `resolved_formulae'
/opt/brewery/dummy/Library/Homebrew/cmd/reinstall.rb:11:in `reinstall'
/opt/brewery/dummy/Library/Homebrew/brew.rb:87:in `<main>' |
brew tests
with your changes locally?Fixes #535