Skip to content
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

Source build can fail when pour_bottle? do is unsatisfied #3251

Closed
4 tasks done
ilovezfs opened this issue Oct 1, 2017 · 13 comments
Closed
4 tasks done

Source build can fail when pour_bottle? do is unsatisfied #3251

ilovezfs opened this issue Oct 1, 2017 · 13 comments

Comments

@ilovezfs
Copy link
Contributor

ilovezfs commented Oct 1, 2017

  • Confirmed this is a problem with running a brew command and not brew installing or the post-install behaviour of one or more formulae? If it's a formulae-specific problem please file this issue at the relevant tap e.g. for Homebrew/homebrew-core https://github.com/Homebrew/homebrew-core/issues/new
  • Ran brew update and retried your prior step?
  • Ran brew doctor, fixed all issues and retried your prior step?
  • Ran brew config and brew doctor and included their output with your issue?

To help us debug your issue please explain:

  • What you were trying to do (and why)

Test source builds work when pour_bottle? do is unsatisfied.

  • What happened (include command output)

It attempts a source build but fails.

iMac-TMP:homebrew-core joe$ brew install ./python3-3.6.2.el_capitan.bottle.2.tar.gz 
Warning: Building python3 from source:
  The bottle needs the Apple Command Line Tools to be installed.
  You can install them, if desired, with:
    xcode-select --install

==> Downloading https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
Already downloaded: /Users/joe/Library/Caches/Homebrew/python3-3.6.2.tar.xz
Error: inreplace failed
setup.py:
  expected replacement of "@@HOMEBREW_PREFIX@@/ssl" with #<Pathname:/usr/local/opt/openssl>
iMac-TMP:homebrew-core joe$
  • What you expected to happen
    A successful source build (correct) or at least a successful bottle pour (less correct).

  • Step-by-step reproduction instructions (by running brew commands)

iMac-TMP:homebrew-core joe$ git diff -- Formula/python3.rb 
diff --git a/Formula/python3.rb b/Formula/python3.rb
index f1a0995..1bc6def 100644
--- a/Formula/python3.rb
+++ b/Formula/python3.rb
@@ -69,7 +69,7 @@ class Python3 < Formula
       You can install them, if desired, with:
         xcode-select --install
     EOS
-    satisfy { MacOS::CLT.installed? }
+    satisfy { false }
   end
 
   def install
iMac-TMP:homebrew-core joe$ brew install --build-bottle python3
==> Downloading https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
Already downloaded: /Users/joe/Library/Caches/Homebrew/python3-3.6.2.tar.xz
==> ./configure --prefix=/usr/local/Cellar/python3/3.6.2 --enable-ipv6 --datarootdir=/usr/local/Cellar/python3/3.6.2/share --datadir=/usr/local/Cellar/python3/3.6.2/share --enable-framework=/usr/local/Cel
==> make
==> make install PYTHONAPPSDIR=/usr/local/Cellar/python3/3.6.2
==> make frameworkinstallextras PYTHONAPPSDIR=/usr/local/Cellar/python3/3.6.2/share/python3
==> Downloading https://files.pythonhosted.org/packages/a4/c8/9a7a47f683d54d83f648d37c3e180317f80dc126a304c45dc6663246233a/setuptools-36.5.0.zip
Already downloaded: /Users/joe/Library/Caches/Homebrew/python3--setuptools-36.5.0.zip
==> Downloading https://files.pythonhosted.org/packages/11/b6/abcb525026a4be042b486df43905d6893fb04f05aac21c32c638e939e447/pip-9.0.1.tar.gz
Already downloaded: /Users/joe/Library/Caches/Homebrew/python3--pip-9.0.1.tar.gz
==> Downloading https://files.pythonhosted.org/packages/fa/b4/f9886517624a4dcb81a1d766f68034344b7565db69f13d52697222daeb72/wheel-0.30.0.tar.gz
Already downloaded: /Users/joe/Library/Caches/Homebrew/python3--wheel-0.30.0.tar.gz
==> Not running post_install as we're building a bottle
You can run it manually using `brew postinstall python3`
==> Caveats
Pip, setuptools, and wheel have been installed. To update them
  pip3 install --upgrade pip setuptools wheel

You can install Python packages with
  pip3 install <package>

They will install into the site-package directory
  /usr/local/lib/python3.6/site-packages

See: https://docs.brew.sh/Homebrew-and-Python.html
==> Summary
🍺  /usr/local/Cellar/python3/3.6.2: 7,539 files, 104.7MB, built in 1 minute 24 seconds
iMac-TMP:homebrew-core joe$ brew bottle python3
==> Determining python3 bottle rebuild...
==> Bottling python3-3.6.2.el_capitan.bottle.2.tar.gz...
==> Detecting if python3-3.6.2.el_capitan.bottle.2.tar.gz is relocatable...
./python3-3.6.2.el_capitan.bottle.2.tar.gz
  bottle do
    rebuild 2
    sha256 "279e5d11424c8f5e7cac4bbd9fe04417811d7cc95ade5eb907864e4d5e6ed377" => :el_capitan
  end
iMac-TMP:homebrew-core joe$ brew uninstall python3
Uninstalling /usr/local/Cellar/python3/3.6.2... (3,000 files, 47.9MB)
iMac-TMP:homebrew-core joe$ brew install ./python3-3.6.2.el_capitan.bottle.2.tar.gz 
Warning: Building python3 from source:
  The bottle needs the Apple Command Line Tools to be installed.
  You can install them, if desired, with:
    xcode-select --install

==> Downloading https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
Already downloaded: /Users/joe/Library/Caches/Homebrew/python3-3.6.2.tar.xz
Error: inreplace failed
setup.py:
  expected replacement of "@@HOMEBREW_PREFIX@@/ssl" with #<Pathname:/usr/local/opt/openssl>
iMac-TMP:homebrew-core joe$
iMac-TMP:homebrew-core joe$ brew config
HOMEBREW_VERSION: 1.3.4-45-gd62d496
ORIGIN: https://github.com/Homebrew/brew
HEAD: d62d496e36f6f38c6eba5a2d8a9216d62fc3a3fc
Last commit: 3 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 8236736ba57a96aed68a3cde64b915cc4c0810b0
Core tap last commit: 58 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local/Homebrew
HOMEBREW_CELLAR: /usr/local/Cellar
HOMEBREW_BOTTLE_DOMAIN: https://homebrew.bintray.com
CPU: octa-core 64-bit skylake
Homebrew Ruby: 2.3.3 => /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/bin/ruby
Clang: 8.0 build 800
Git: 2.10.1 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Perl: /usr/bin/perl
Python: /usr/bin/python
Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
Java: 1.8.0_121, 1.7.0_154-zulu-7.20.0.3
macOS: 10.11.6-x86_64
Xcode: 8.2.1
CLT: 8.2.0.0.1.1480973914
X11: 2.7.11 => /opt/X11
iMac-TMP:homebrew-core joe$ 
@ilovezfs
Copy link
Contributor Author

ilovezfs commented Oct 1, 2017

This is a regression caused by #3176 and is not resolved by #3250.

CC @sjackman @MikeMcQuaid

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Oct 1, 2017

@sjackman In general, we probably never want brew install ./foobottle to fall back to a source build, so getting that to be a hard failure may be part of a fix here.

@sjackman
Copy link
Member

sjackman commented Oct 1, 2017

The change in behaviour was before PR #3176, back in 008eaac of PR #3105. Prior to PR #3105, installing a local bottle always poured the bottle, and it did not check the status of pour_bottle? or compatible_cellar?. Pouring a bottle that is known not to be compatible with the system ought to be avoided. I'm okay with falling back to a source build in this case, using the formula stored inside the bottle, so long as the user is warned, which they are.

@sjackman
Copy link
Member

sjackman commented Oct 1, 2017

The old behaviour of always pouring the local bottle, even when it's incompatible, can be retained by using

brew install --force-bottle ./bottle.tar.gz

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Oct 1, 2017

@sjackman you get a successful source build if #3176 is reverted.

@sjackman
Copy link
Member

sjackman commented Oct 1, 2017

This line of code in the formula stored in .brew/python3.rb

      s.gsub! "/usr/local/ssl", Formula["openssl"].opt_prefix

is being changed to

      s.gsub! "@@HOMEBREW_PREFIX@@/ssl", Formula["openssl"].opt_prefix

by the bottle relocation. The file .brew/FORMULA.rb should be exempted from relocation. I can open a PR tomorrow to fix that.

@sjackman
Copy link
Member

sjackman commented Oct 1, 2017

Untested patch below. Something along the lines of…

commit fbfe9046fe93eacfb39c35d5a50a2e2bee8612ce
Author: Shaun Jackman <sjackman@gmail.com>
Date:   Sun Oct 1 09:52:29 2017 -0700

    replace_text_in_files: Exempt .brew/FORMULA.rb

diff --git a/Library/Homebrew/keg_relocate.rb b/Library/Homebrew/keg_relocate.rb
index 085748632..7a86e364b 100644
--- a/Library/Homebrew/keg_relocate.rb
+++ b/Library/Homebrew/keg_relocate.rb
@@ -58,6 +58,7 @@ class Keg
 
   def replace_text_in_files(relocation, files: nil)
     files ||= text_files | libtool_files
+    files -= ["#{to_path}/.brew/#{name}.rb"]
 
     changed_files = []
     files.map(&path.method(:join)).group_by { |f| f.stat.ino }.each_value do |first, *rest|

@MikeMcQuaid
Copy link
Member

Untested patch below. Something along the lines of…

Seems reasonable but may want to expand it to be beyond just replace_text_in_files so it's never returned from e.g. text_files etc. instead/too.

@sjackman
Copy link
Member

sjackman commented Oct 2, 2017

I've opened PR #3257 to address this issue.

@sjackman
Copy link
Member

sjackman commented Oct 2, 2017

Good suggestion. Thanks, Mike.

@sjackman
Copy link
Member

sjackman commented Oct 2, 2017

Is MacOS::CLT.installed? true or false on Jenkins?

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Oct 2, 2017

true

@ilovezfs
Copy link
Contributor Author

ilovezfs commented Oct 2, 2017

Closed via #3257.

@ilovezfs ilovezfs closed this as completed Oct 2, 2017
@Homebrew Homebrew locked and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants