Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

"brew upgrade" forgets build options #11171

Closed
arhbkb opened this Issue · 8 comments

4 participants

@arhbkb

$ brew -v
0.9

When I run "brew upgrade mtr", brew doesn't recognise that I had previously built mtr with "--no-gtk", and tries to install all kinds of dependencies.

@jacknagel
Owner

(a) Is the mtr keg still linked? and (b) post your brew --config, please.

@arhbkb

The mtr keg is still linked:

$ which mtr
/usr/local/sbin/mtr
~ $ brew --config
HOMEBREW_VERSION: 0.9
HEAD: 9b885f6
HOMEBREW_PREFIX: /usr/local
HOMEBREW_CELLAR: /usr/local/Cellar
CPU: dual-core 64-bit penryn
OS X: 10.7.3
Kernel Architecture: x86_64
Xcode: 4.3.1
GCC-4.0: build 5494
GCC-4.2: build 5666
LLVM: build 2336
Clang: 3.1 build 318
MacPorts or Fink? false
X11: /usr/X11
System Ruby: 1.8.7-249
/usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Which Perl: /usr/bin/perl
Which Python: /usr/bin/python
Which Ruby: /usr/bin/ruby => /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

@jacknagel
Owner

I just tried to reproduce this by faking an mtr 0.80 keg with an install receipt and it works as advertised.

Homebrew uses the symlink in Library/LinkedKegs to find the install receipt, so if that symlink is missing or broken it won't be able to find the install options.

I would try unlinking and relinking the mtr keg.

@arhbkb

$ brew unlink mtr
Unlinking /usr/local/Cellar/mtr/0.80... 2 links removed

$ brew link mtr
Linking /usr/local/Cellar/mtr/0.80... 2 symlinks created

$ brew upgrade mtr
==> Upgrading 10 outdated packages, with result:
jpeg 8d, libtiff 3.9.5, jasper 1.900.1, gdk-pixbuf 2.24.1, pixman 0.24.4, cairo 1.10.2, pango 1.28.4, atk 2.2.0, gtk+ 2.24.10, mtr
==> Upgrading jpeg
==> Downloading http://www.ijg.org/files/jpegsrc.v8d.tar.gz
^C

So it's still trying to install all these packages as dependencies of mtr.

@jacknagel
Owner

Hmm.

Upon closer inspection, this is a symptom of the larger problem of declaring dependencies conditionally (specifically, conditionally on the contents of ARGV).

There doesn't appear to be any problem retrieving the install options from the receipt. In fact, I think that even after the upgrade installs all of the gtk deps, the new install receipt would still say that --no-gtk was used.

When invoking brew upgrade mtr, gtk is added to the list of deps because --no-gtk is not in ARGV. The installed options are consulted just before we fork and exec the build script in FormulaInstaller#build.

Unfortunately there is not a quick fix for this, but there are several issues open pertaining to deps being declared conditionally and how we can avoid that, reworking install options, etc.

(As a side note, do people usually install mtr with --no-gtk? Should the default be changed?)

@arhbkb

Ok, so there's no way to use the "upgrade" command for this. I guess I'll just unlink, install the new version, link and clean up for now :(

@camillol camillol referenced this issue from a commit in camillol/homebrew
@camillol camillol handle conditional deps when doing brew upgrade
Many formulas add dependencies conditionally based on the presence
of some options in ARGV. These options are saved in the tab file,
but they are not present in ARGV when brew upgrade is called. As a
result, upgraded formulas are installed with the wrong dependencies.
This patch solves the problem by letting formulas see the expected
ARGV while upgrading. In the long term, it would be better to
remove all uses of ARGV from formulas in favor of some options-based
interface, but this bug does not have to wait until a new design is
finalized.

Fixes #11171
d8b741c
@camillol

@jacknagel what do you think of the solution I posted? (I'm pinging you because I'm not sure if people get notified when issues are referenced from other issues)

@adamv
Owner

This should be addressed by the work in #13923.

@adamv adamv closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.