Commit Graph
35 Commits
Author SHA1 Message Date
Adam Vandenberg 4b014a4ed1 Consolidate sudo checks.
Closes #20318.
2013-06-08 20:44:56 -07:00
Jack Nagel 19863c92fd upgrade: fix expansion of options for top-level formula objects
Fixes #20045.
2013-05-24 10:33:08 -05:00
Jack Nagel 5e422741f6 upgrade: fix typo 2013-05-18 22:11:19 -05:00
Jack Nagel 13208d7c1a upgrade: use a method rather than a boolean flag 2013-05-18 22:09:15 -05:00
Jack Nagel 1a2f1cacf3 upgrade: tighten installed precondition 2013-05-18 22:09:15 -05:00
Simon Sigurdhsson 85eb73ced7 brew-pin: prevent selected formulae from upgrade.
* Added `pin` et. al. to manpage.
* Added `brew pin` to `brew.1` * Added `brew unpin` to `brew.1`
* Added `brew list --pinned` to `brew.1`
* Added information about frozen formulae to `brew upgrade` in `brew.1`
* Added `pin` et.al. to completion scripts.
* Unpin formulae when uninstalling them
* Unpin and re-pin formulae when upgrading (avoids stale symlink)

References #18386.
Closes #18515.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-03-30 19:50:47 +00:00
Jack Nagel 7e8d110910 upgrade: use standard Tab accessor
Yes, the formula object does refer to a version that has not yet been
installed, but we were not looking into Formula#prefix, but #linked_keg,
which is version agnostic (since the original patch was committed, we
Tab#for_formula learned to look into #opt_prefix as well). The rest of
the logic is already embedded in the Tab accessors.
2013-01-26 12:14:51 -06:00
Jack Nagel 569231f14d upgrade: offload dependency expansion to FormulaInstaller
Now that FormulaInstaller does dependency expansion the _right_ way,
avoid duplicating the logic in upgrade. Instead, offload it to the
installer, which will generate an exception in check_install_sanity that
we can safely ignore when formulae in the outdated list are upgraded as
part of the dependency tree of another outdated formula.
2013-01-26 12:14:49 -06:00
Jack Nagel 0551dedf79 FormulaInstaller: don't install bottle if options were passed 2013-01-26 12:14:46 -06:00
Jack Nagel f76a8bdd1f FormulaInstaller: make tab an attr, but never a parameter 2013-01-26 12:14:46 -06:00
Matt Di Pasquale e1c62c3546 brew upgrade: improve exit codes.
exit 1 if formulae given but none outdated

Closes #17199.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-01-21 19:55:09 +00:00
Jack Nagel 30a08f5cc7 Don't attempt installation multiple times
When a dependency of a formula specified on the command-line is also
specified, *after* the dependent formula, installation proceeds as part
of the dependent's dependency tree and then is attempted again because
the user asked for it explicitly. This results in the installer raising
a CannotInstallFormulaError because it has already been installed.

For example:

  $ brew install graphviz pkg-config
  ==> Installing graphviz dependency: pkg-config
  ...
  ==> Installing graphviz
  ...
  Error: pkg-config-0.27.1 already installed

We already have a mechanism for dealing with this, but it does not kick
in early enough. Move the installation attempt check into
FormulaInstaller#check_install_sanity and catch the exception in the
appropriate places.

Fixes #16957.
2013-01-10 16:46:54 -06:00
Charlie Sharpsteen 78e7cc32e8 upgrade.rb: Generate Tab from Keg not Formula
Two issues were preventing `brew upgrade` from functioning properly:

  - `Tab.for_formula` was used to recover options from prior installs. The
    problem is that during an upgrade `for_formula` will be directed to a
    non-existant install of the newer version and thus returns a forged tab
    claiming no options were invoked.

  - The assignment to `installer.install_bottle` requires parenthesis in order
    to function properly.
2012-12-18 15:12:10 -08:00
Jack Nagel 9526817341 Don't lie about upgrading up-to-date formulae
Usually, the "foo-version already installed" error is printed by
FormulaInstaller. However, if an up-to-date formula that has outdated
deps is passed on the command line, we proceed to upgrade the deps and
then print a message saying that the formulae given on the command line
is already installed.

Catch this earlier, when the outdated list is being populated, print an
appropriate message, and skip the up-to-date formula.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 19:33:39 -05:00
Jack Nagel 07d6ace2f2 upgrade: filter ARGV when expanding deps
This serves the same purpose as similar code in FormulaInstaller, but we
duplicate it because we do the dependency expansion in an ad-hoc fashion
here.

Fixes #11863.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 19:33:39 -05:00
Jack Nagel ec5770b590 Add ARGV.ignore_deps?
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 19:33:39 -05:00
Jack Nagel c7cd378c6e outdated: use new version comparison machinery 2012-08-18 11:12:10 -05:00
Charlie Sharpsteen b9d370084e brew-upgrade: Respect --ignore-dependencies flag
Passing `--ignore-dependencies` to `brew upgrade` will now have the desired
effect.
2012-06-25 09:20:18 -08:00
Nicolas Despres 1c74a94276 Honor build options and bottles when upgrading
Fixes #11552.
Closes #11777.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-05-05 12:24:56 -05:00
Mike McQuaid 34c970b103 Add ofail command and fix bottle command output. 2012-04-30 21:38:08 +08:00
Mike McQuaid 48a82e5f02 Exit with bad exit code on command failures. 2012-03-29 18:44:37 +11:00
Jack Nagel f8fefcc51e Pass the tab to FormulaInstaller
Callers of FormulaInstaller now usually unlink the existing keg prior to
running the installer. However, Tab.for_formula uses the LinkedKeg
record to obtain the tab.

Since we need the tab to persist install options across upgrades, we
must start creating the Tab object before unlinking the old keg and
passing it to the FormulaInstaller.

Fixes #11086.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-03-23 13:05:08 -05:00
Mike McQuaid 9728610ca0 Remove bad exit status; need to fix another way. 2012-03-10 08:18:42 +13:00
Mike McQuaid 2e63ae9f71 Add better Unix exit codes.
Closes #10809.
2012-03-09 19:16:33 +13:00
Max Howell 8b04a82181 Allow dependencies to still install
Oops bug.
2012-03-07 13:48:04 +00:00
Max Howell a633812f95 Don't allow sudo brew upgrade if not sensible 2012-03-07 12:50:15 +00:00
Max Howell 9bb8f4760d Don't abort upgrade if one formula won't build
Also, unlink previous keg before installing to prevent issues when existing installed brews cause build problems for the newer installed brew.

If the build fails the active keg is relinked before aborting.

Fixes #10341.
2012-03-07 12:34:40 +00:00
Jack Nagel fbb583719b upgrade: unlink relative to the correct keg
Calling Keg#unlink on "#{f.rack}/#{f.version}" will perform the unlink
relative to the _new_ keg, rather than the keg we are upgrading from.
Fix this by resolving the linked_keg entry and unlinking relative to it.

Fixes #10296.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-20 15:14:31 -06:00
Charlie Sharpsteen 5b4d59d143 brew-upgrade: Fix installation of dependencies
Fixes #7528.
Closes #7572.
2011-09-16 09:02:02 -07:00
Charlie Sharpsteen 00cd16f866 Return Formula objects from outdated_brews
Previously, `outdated_brews` returned a list of lists---each containing three
components of a Formula object:

  - f.rack
  - f.name
  - f.version

Frequently more information is required which necessitates back-casting from
`name` to a Formula object---simpy returning formula objects removes this step.
2011-09-16 08:55:38 -07:00
Charlie Sharpsteen 06fbecbeae Centralize definition of rack in formula.rb
`rack` is a commonly used alias for `formula.prefix.parent`---so common that it
gets defined and used quite a bit. This patch makes `rack` an official method
of the `Formula` class.
2011-09-16 08:55:38 -07:00
Max Howell e02e7f853e Handle brew upgrade ARGV errors properly
Fixes #7304.
2011-09-02 12:12:30 +01:00
Charlie Sharpsteen 99918c08f5 Leopard: Eliminate moar Array.count from brew upgrade 2011-08-25 18:02:36 -07:00
Charlie Sharpsteen 8cb7090723 Leopard: Fix undefined method count for Array
Leopard runs Ruby 1.8.6 while Snow Leopard runs 1.8.7 and `Array.count` was not
introduced until 1.8.7.

Using `Array.length` instead.
2011-08-24 17:45:19 -07:00
Max Howell 81f1fb38a9 brew upgrade
Consequence: you can no longer install when something is already installed, you must upgrade it. This doesn't apply if the formula in question was unlinked. You can still --force installs though.

Rationale: the old way of installing over the top would leave symlinks to multiple versions in /usr/local if the old version had a file the newer version didn't. The new upgrade command handles everything properly.
2011-08-24 22:30:43 +01:00