"brew upgrade" should remember install options #5250

Closed
minusfive opened this Issue Apr 17, 2011 · 12 comments

Projects

None yet

7 participants

When I installed coreutils I set the "default names" option ( brew install coreutils --default-names ). However, when I ran brew upgrade it didn't remember this so it screwed up my setup. I had to uninstall + reinstall the formula with the proper settings.

It's hard to keep track which settings you used for each formula upon install, and on which formulas you used them. I feel this is something Homebrew should somehow remember.

Contributor

I have thought of the same. That whenever you install something, the "install" line is kept stored, so when e.g. you upgrade, they stay the same.

Thank you for creating the feature request :)

Contributor
Sharpie commented Apr 17, 2011

One thing to note is that Homebrew currently doesn't really "remember" anything. It writes no metadata files, maintains no package databases. All of its intelligence on what is installed/not installed is basically derived from the output of the ls command (there is a little more to it than that, but not much). Dependency resolution is computed solely from the class definitions in the formula files.

I agree that this functionality is sorely needed, but it could be difficult to implement as Homebrew derives much of it's simplicity and elegance from pathologically avoiding the maintenance of persistant data.

Contributor
Sharpie commented Apr 17, 2011

One place to look for inspiration on this front may be the Nix package manager. Nix takes a "pure functional programming" approach to package management, so it has to be careful about how it handles state and side effects.

It looks like their approach to options and build flags involves hashing them into the install prefix.

@adamv adamv was assigned Jun 9, 2011
Contributor
adamv commented Jun 9, 2011

One thought here is to write out a "homebrewed" file to the Cellar, so for instance:

/usr/local/Cellar/glib/
/usr/local/Cellar/glib/homebrewed - "--universal"
/usr/local/Cellar/glib/2.2.20/ - actual install files

So then `brew install glib` or `brew install -u glib` would read in the homebrewed file and try to use those options.

Except having things in the Cellar above the version folders kind of messes things up.
We could write this into the Cache: ~/Library/Caches/Homebrew/InstallInfo

But it's not really cached data like the downloads, ie, it shouldn't be deletable at will.

Looking like Homebrew might need some non-Cellar, non-Cache folder to store persistent data in.

~/Library/Application Data/Homebrew is a logical choice, but now we're adding folders and complexity.
Contributor
adamv commented Jun 20, 2011

New thought is that the "which_versions" method from the which command can be used to determine which version is currently installed and linked, so the metadata file can go in each version's prefix.

When the version # in the formula changes, we essentially use brew which internally to find the previous version, and from there, the metadata file.

Contributor

I've been through a world of pain since I updated MySQL last time... It got re-build without --D_WITH_LOCALFILE because brew didn't "remember" I needed it, and I spent hours trying to figure out why MySQL was rejecting my statements.

I am a big fan of this feature request...

Another place for inspiration could be Bundler and the Gemfile/Gemfile.lock.

Maybe instead of trying to force Homebrew to handle all the persistent-data-intelligence, we could offload some of it to the user! Have the user maintain a ~/.brewfile with a plain list of formulas + settings they want on their system, and then you could run "brew install brewfile" which would go through the list and install everything you need on a machine. This would make setting up new machines way easier as well!

Then, when you run "brew upgrade" the first thing it would do is read tue brewfile and install whatever needs to be upgraded, with the appropriate settings.

Stupid idea?

Contributor

I would love what @minusfive suggests.

It could be inspired on what Bundler does in the Gemfile, indeed... So we could specify a specific version, a minimum version, and that kind of things... To ensure we are up to date, and don't get upgrades on stuff we do NOT want to upgrade (incompatible changes, etc...)

Contributor

+1 on this. I specially like @adamv's first suggestion, adding a homebrewed file to the top level folder for each formulae.

Contributor
Sharpie commented Sep 23, 2011

Proposed fix in pull request #7784.

@Sharpie Sharpie closed this in 7148211 Nov 13, 2011
Contributor
Sharpie commented Nov 13, 2011

Installation options now persist when upgrading. To do a clean install without re-using any old flags, brew uninstall <formula> && brew install <formula>.

@wrigleyster wrigleyster added a commit to wrigleyster/homebrew that referenced this issue Nov 17, 2011
@Sharpie @wrigleyster Sharpie + wrigleyster metadata: Use options from previous installs
FormulaInstaller now loads the install recipt of a previous install and appends
the `used_options` to ARGV before forking to build. This means `brew upgrade`
will "remember" which options were invoked for the last install and re-use
them.

Fixes #5250.
aa54ca9
@etehtsea etehtsea pushed a commit to etehtsea/homebrew that referenced this issue Dec 24, 2011
@Sharpie Sharpie metadata: Use options from previous installs
FormulaInstaller now loads the install recipt of a previous install and appends
the `used_options` to ARGV before forking to build. This means `brew upgrade`
will "remember" which options were invoked for the last install and re-use
them.

Fixes #5250.
f9155c2
@etehtsea etehtsea pushed a commit to etehtsea/homebrew that referenced this issue Dec 27, 2011
@Sharpie Sharpie metadata: Use options from previous installs
FormulaInstaller now loads the install recipt of a previous install and appends
the `used_options` to ARGV before forking to build. This means `brew upgrade`
will "remember" which options were invoked for the last install and re-use
them.

Fixes #5250.
1d587ff
cnf commented Jun 25, 2012

brew missing does not take this into consideration.

@snakeyroc3 snakeyroc3 pushed a commit to snakeyroc3/homebrew that referenced this issue Dec 17, 2012
@Sharpie Sharpie metadata: Use options from previous installs
FormulaInstaller now loads the install recipt of a previous install and appends
the `used_options` to ARGV before forking to build. This means `brew upgrade`
will "remember" which options were invoked for the last install and re-use
them.

Fixes #5250.
d0ca7bb
This was referenced Nov 9, 2013
@xu-cheng xu-cheng 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.