Homebrew / brew

🍺 The missing package manager for macOS (or Linux)
https://brew.sh
BSD 2-Clause "Simplified" License
40.87k stars 9.59k forks source link

error / audit errors after `brew update` #367

Closed adamv closed 8 years ago

adamv commented 8 years ago

When doing a brew update I got a warning about :perl being unsupported. Running a brew audit gives me:

$ brew audit
Error: Failed to import: /Users/adamv/source/homebrew/Library/Taps/homebrew/homebrew-core/Formula/asciinema2gif.rb
Unsupported special dependency :perl
Error: cannot load such file -- language/node
Please report this bug:
    https://git.io/brew-troubleshooting
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
/Users/adamv/source/homebrew/Library/Taps/homebrew/homebrew-core/Formula/autocode.rb:1:in `load_formula'
/Users/adamv/source/homebrew/Library/Homebrew/formulary.rb:21:in `module_eval'
/Users/adamv/source/homebrew/Library/Homebrew/formulary.rb:21:in `load_formula'
/Users/adamv/source/homebrew/Library/Homebrew/formulary.rb:38:in `load_formula_from_path'
/Users/adamv/source/homebrew/Library/Homebrew/formulary.rb:87:in `load_file'
/Users/adamv/source/homebrew/Library/Homebrew/formulary.rb:78:in `klass'
/Users/adamv/source/homebrew/Library/Homebrew/formulary.rb:74:in `get_formula'
/Users/adamv/source/homebrew/Library/Homebrew/formulary.rb:211:in `factory'
/Users/adamv/source/homebrew/Library/Homebrew/formula.rb:1112:in `block in each'
/Users/adamv/source/homebrew/Library/Homebrew/formula.rb:1110:in `each'
/Users/adamv/source/homebrew/Library/Homebrew/formula.rb:1110:in `each'
/Users/adamv/source/homebrew/Library/Homebrew/cmd/audit.rb:70:in `audit'
/Users/adamv/source/homebrew/Library/brew.rb:81:in `<main>'
MikeMcQuaid commented 8 years ago

@adamv Long time no see, you well? Can we see your brew config and brew doctor? Ta!

adamv commented 8 years ago

Doing well, thanks. Hope everything is good with you all. Sorry I only drop by when I have a problem!

brew doctor is:

Warning: Your Homebrew is not installed to /usr/local
You can install Homebrew anywhere you want, but some brews may only build
correctly if you install in /usr/local. Sorry!

brew config is:

$ brew config
HOMEBREW_VERSION: 0.9.9
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: c3c233dd809f9c358ba8aa5268b64c335202bc56
Last commit: 8 weeks ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 405f79e67ab8854a1b4e0bb6404032a61521084f
Core tap last commit: 6 hours ago
HOMEBREW_PREFIX: /Users/adamv/hb
HOMEBREW_REPOSITORY: /Users/adamv/source/homebrew
HOMEBREW_CELLAR: /Users/adamv/source/homebrew/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: 8-core 64-bit haswell
OS X: 10.11.5-x86_64
Xcode: N/A
CLT: 7.3.1.0.1.1461711523
Clang: 7.3 build 703
X11: N/A
System Ruby: 2.0.0-p648
Perl: /usr/bin/perl
Python: /Users/adamv/hb/bin/python => /Users/adamv/source/homebrew/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/bin/python2.7
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: 1.8.0_74
adamv commented 8 years ago

Off-topic, but if any maintainers are in the Issaquah / greater-Seattle area, do hit me up and we'll grab a bite/pint.

UniqMartin commented 8 years ago
ORIGIN: https://github.com/Homebrew/brew.git
HEAD: c3c233dd809f9c358ba8aa5268b64c335202bc56
Last commit: 8 weeks ago

This is the problem. For whatever reason you Homebrew repository (the one with the package manager inside) is stuck in the past, while the core formulae repository has advanced as usual. This is problematic because recent changes to formulae use features added to the package manager.

I suspect you have HOMEBREW_DEVELOPER set in your environment and checked out the main repository to a non-master branch. Under these conditions, brew update will update the master branch, but afterwards will restore your working directory to the previous state (original branch and local modifications, if any). This should fix your problem:

cd $(brew --repository)
git checkout master
adamv commented 8 years ago

That was it, thanks Martin.

MikeMcQuaid commented 8 years ago

I suspect you have HOMEBREW_DEVELOPER set in your environment and checked out the main repository to a non-master branch. Under these conditions, brew update will update the master branch, but afterwards will restore your working directory to the previous state (original branch and local modifications, if any). This should fix your problem:

Worth adding this to brew doctor or brew config, @UniqMartin?

UniqMartin commented 8 years ago

Worth adding this to brew doctor or brew config, @UniqMartin?

You mean a doctor check whether any of the tap repositories and the package manager repository has a non-master branch checked out (or non-upstream branch using the same logic we use in update.sh)? I think the least we could do would be to append something to the SHA1-lines in brew config if the two main repositories that are listed there aren't on the master branch …

MikeMcQuaid commented 8 years ago

You mean a doctor check whether any of the tap repositories and the package manager repository has a non-master branch checked out (or non-upstream branch using the same logic we use in update.sh)?

That could work. I was thinking of flagging HOMEBREW_DEVELOPER.

I think the least we could do would be to append something to the SHA1-lines in brew config if the two main repositories that are listed there aren't on the master branch …

Yeh, git symbolic-ref --short should get you a branch name from that SHA; that'd be useful.

UniqMartin commented 8 years ago

That could work. I was thinking of flagging HOMEBREW_DEVELOPER.

I figure this could be annoying if it was part of brew doctor. I'd never get a zero exit status again, nor any of our more prolific contributors that we want to encourage to use HOMEBREW_DEVELOPER, too, if I remember some recent discussion correctly. (Well, technically I already get a nonzero exit status, because I'm not using /usr/local for my Homebrew installation.)

Yeh, git symbolic-ref --short should get you a branch name from that SHA; that'd be useful.

I'll put this on my list and see to it when things are a little calmer, if nobody beats me to it.