sportngin / brew-gem

Install gems as homebrew formulas
MIT License
198 stars 22 forks source link

Unsure how to diagnose this one #55

Closed alanivey closed 5 years ago

alanivey commented 5 years ago

I installed Mojave on a fresh system, install Homebrew, installed brew-gem and ruby with brew (no system-level commands).

I'm trying to install aws-assume-role and it seems to get hung up on the keyring dependency. None of the files/directories in /usr/local/Cellar/, $HOME/Library/Logs/Homebrew/, or $HOME/Library/Caches/Homebrew/ for this particular gem existed prior:

$ brew gem install aws_assume_role --homebrew-ruby
==> Fetching aws_assume_role from gem source
Fetching: aws_assume_role-1.2.1.gem (100%)
Downloaded aws_assume_role-1.2.1
Warning: Cannot verify integrity of aws_assume_role-1.2.1.gem
A checksum was not provided for this resource
For your reference the SHA256 is: 56a07ac6468be291a80564645b8434c041f7e818d556cdeaa1b60fbf510725f9
==> /usr/local/bin/gem install /Users/alan/Library/Caches/Homebrew/aws_assume_role-1.2.1.gem --no-ri --no-rdoc --no-wrapper --no-user-install --install-dir /usr/local/Cellar/gem-aws_assume_role/1.2.1 --bindir
Last 15 lines from /Users/alan/Library/Logs/Homebrew/gem-aws_assume_role/01.gem:

    current directory: /usr/local/Cellar/gem-aws_assume_role/1.2.1/gems/keyring-0.4.1/ext
/usr/local/opt/ruby/bin/ruby mkrf_conf.rb
*osx: installing ruby-keychain

current directory: /usr/local/Cellar/gem-aws_assume_role/1.2.1/gems/keyring-0.4.1/ext
rake RUBYARCHDIR=/usr/local/Cellar/gem-aws_assume_role/1.2.1/extensions/x86_64-darwin-18/2.5.0/keyring-0.4.1 RUBYLIBDIR=/usr/local/Cellar/gem-aws_assume_role/1.2.1/extensions/x86_64-darwin-18/2.5.0/keyring-0.4.1
Ignoring ffi-1.9.25 because its extensions are not built.  Try: gem pristine ffi --version 1.9.25
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:241:in `bin_path': can't find gem rake (>= 0.a) (Gem::GemNotFoundException)
    from /usr/bin/rake:22:in `<main>'

rake failed, exit code 1

Gem files will remain installed in /usr/local/Cellar/gem-aws_assume_role/1.2.1/gems/keyring-0.4.1 for inspection.
Results logged to /usr/local/Cellar/gem-aws_assume_role/1.2.1/extensions/x86_64-darwin-18/2.5.0/keyring-0.4.1/gem_make.out

The /usr/local/Cellar/gem-aws_assume_role/ directory doesn't exist for further inspection. Contents of /Users/alan/Library/Logs/Homebrew/gem-aws_assume_role/ available here but I'm not sure provides much detail. How can I help troubleshoot or diagnose?

alanivey commented 5 years ago

If I run HOMEBREW_DEBUG=1 brew gem install aws_assume_role --homebrew-ruby and choose shell and run the command /usr/local/bin/gem install /Users/alan/Library/Caches/Homebrew/aws_assume_role-1.2.1.gem --no-ri --no-rdoc --no-wrapper --no-user-install --install-dir /usr/local/Cellar/gem-aws_assume_role/1.2.1 --bindir /usr/local/Cellar/gem-aws_assume_role/1.2.1/bin I get the same error as expected. Sure enough, the rake gem isn't listed:

bash-3.2$ gem list
Ignoring ffi-1.9.25 because its extensions are not built.  Try: gem pristine ffi --version 1.9.25

*** LOCAL GEMS ***

bigdecimal (1.2.8)
bindata (2.4.4)
corefoundation (0.2.0)
equatable (0.5.0)
ffi (1.9.25)
ffi-bit_masks (0.1.1)
gir_ffi (0.13.1)
gir_ffi-gnome_keyring (0.0.10)
indentation (0.1.1)
io-console (0.4.5)
json (1.8.3.1)
pastel (0.7.2)
psych (2.1.0.1)
rdoc (4.2.1)
ruby-keychain (0.3.2)
rubyzip (1.2.2)
slop (3.6.0)
smartcard (0.5.6)
tty-color (0.4.3)
yubioath (1.2.1)
zerg_support (0.1.6)
zip-zip (0.3)

If I exit the Homebrew debug shell:

$ /usr/local/bin/gem list

*** LOCAL GEMS ***

bigdecimal (default: 1.3.4)
bundler (default: 1.16.2)
cmath (default: 1.0.0)
csv (default: 1.0.0)
date (default: 1.0.0)
dbm (default: 1.0.0)
did_you_mean (1.2.0)
etc (default: 1.0.0)
fcntl (default: 1.0.0)
fiddle (default: 1.0.0)
fileutils (default: 1.0.2)
io-console (default: 0.4.6)
ipaddr (default: 1.2.0)
json (default: 2.1.0)
minitest (5.10.3)
net-telnet (0.1.1)
openssl (default: 2.1.2)
power_assert (1.1.1)
psych (default: 3.0.2)
rake (12.3.0)
rdoc (default: 6.0.1)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
stringio (default: 0.0.1)
strscan (default: 1.0.0)
test-unit (3.2.7)
webrick (default: 1.4.2)
xmlrpc (0.3.0)
zlib (default: 1.0.0)

$ /usr/bin/gem list

*** LOCAL GEMS ***

bigdecimal (1.2.8)
CFPropertyList (2.2.8)
did_you_mean (1.0.0)
io-console (0.4.5)
json (1.8.3.1)
libxml-ruby (2.9.0)
minitest (5.8.5)
net-telnet (0.1.1)
nokogiri (1.5.6)
power_assert (0.2.6)
psych (2.1.0.1)
rake (10.4.2)
rdoc (4.2.1)
sqlite3 (1.3.11)
test-unit (3.1.5)
alanivey commented 5 years ago

Within the debug shell, I can /usr/local/bin/gem install rake and then re-run the install command and it completes successfully. But there is nothing in /usr/local/Cellar/ when I quit. Not sure how to continue; any help appreciated, thanks.

alanivey commented 5 years ago

I think I sorted this out; in the debug brew shell, GEM_HOME and GEM_PATH are set to /usr/local/Cellar/gem-aws_assume_role/1.2.1 and rake isn't in there. So, I believe this to be a problem with the gem I'm trying to install not having rake as a dependency. I'll take it up with them.

I'll close, but here are my install steps for anyone else who may stumble upon this:

brew install brew-gem

BREW_GEM_TEMPDIR="$( mktemp -d 2>/dev/null || mktemp -d -t 'brew_gem_tempdir' )"

brew gem formula aws_assume_role | sed -e 's/\(cached_download\)/"rake", \1/' > "${BREW_GEM_TEMPDIR%/}/gem-aws_assume_role.rb"

HOMEBREW_NO_AUTO_UPDATE=1 brew install "${BREW_GEM_TEMPDIR%/}/gem-aws_assume_role.rb"

rm -r "${BREW_GEM_TEMPDIR:?}"

unset BREW_GEM_TEMPDIR