Skip to content
This repository has been archived by the owner on Jul 4, 2023. It is now read-only.

"brew upgrade" forgets build options #11171

Closed
aabdnn opened this issue Mar 23, 2012 · 8 comments
Closed

"brew upgrade" forgets build options #11171

aabdnn opened this issue Mar 23, 2012 · 8 comments
Labels

Comments

@aabdnn
Copy link
Contributor

aabdnn commented Mar 23, 2012

$ 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
Copy link
Contributor

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

@aabdnn
Copy link
Contributor Author

aabdnn commented Mar 24, 2012

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
Copy link
Contributor

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.

@aabdnn
Copy link
Contributor Author

aabdnn commented Mar 24, 2012

$ 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
Copy link
Contributor

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?)

@aabdnn
Copy link
Contributor Author

aabdnn commented Mar 24, 2012

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 added a commit to camillol/homebrew that referenced this issue Mar 24, 2012
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 Homebrew#11171
@camillol
Copy link
Contributor

@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
Copy link
Contributor

adamv commented Aug 9, 2012

This should be addressed by the work in #13923.

@adamv adamv closed this as completed Aug 9, 2012
@Homebrew Homebrew locked and limited conversation to collaborators Feb 16, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants