58 Commits

Author SHA1 Message Date
Jack Nagel
ce1f598e98 Avoid realpath where it is not necessary
Symlinks in opt and LinkedKegs point directly at a keg in the cellar, so
only resolving one symlink should suffice, and make it clear what path
we are actually interested in.
2014-04-05 12:17:19 -05:00
Jack Nagel
a72061c59a Check existence of target keg instead of hiding exceptions 2014-03-24 11:00:55 -05:00
Jack Nagel
3b68723fa8 Make FormulaInstaller setup more readable 2014-03-13 15:59:54 -05:00
Jack Nagel
ce5e2aa65c Make debug an installer mode 2014-03-13 15:59:54 -05:00
Jack Nagel
4d02849d43 Make verbose an installer mode 2014-03-13 15:59:54 -05:00
Jack Nagel
60caf14ce2 Don't set installer options to their default
ignore_deps and show_header default to false.
2014-03-13 15:59:53 -05:00
Jack Nagel
a911dd5066 Make build_from_source an explicit installer mode 2014-03-10 14:56:02 -05:00
Jack Nagel
17032a600c Teach commands to work with revisions 2014-03-05 20:12:51 -06:00
Jack Nagel
1ab5943fb2 Let commands decide what mode the installer should use 2014-03-04 14:06:25 -06:00
Jack Nagel
4c0db19538 Extract installer setup to prelude method 2014-03-04 14:06:25 -06:00
Jack Nagel
de254f6cd6 Stop mutating build options in upgrade 2014-03-02 14:02:18 -06:00
Jack Nagel
c534b1907d Revert "Let commands decide what mode the installer should use"
I'd still like to make this change, but at least for now the initializer
requires ignore_deps to be set correctly.

This reverts commit 881a8855b944fa9bd7dfd598bb9197f79f7a13f0.
2014-03-02 09:01:50 -06:00
Jack Nagel
47f22d20af Fix typo 2014-03-02 00:30:09 -06:00
Jack Nagel
ffbe5bf22c Let commands decide what mode the installer should use 2014-03-02 00:21:13 -06:00
Jack Nagel
ea85812c58 Reduce the number of ways options can be passed to the installer 2014-03-02 00:03:08 -06:00
Drew Rodman
d63ef14794 Add DownloadError to catch a broader range of resource download errors.
Adding a broader exception class allows for errors raised in Resource.fetch
to be caught in upgrade and prevent the process from being killed when
a download fails. This should resolve issue 18364.

Fixes Homebrew/homebrew#18364.
Closes Homebrew/homebrew#26618.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2014-02-18 15:08:03 -05:00
Frizlab
5de3686cd2 upgrade: fix output when no packages to upgrade.
When upgrading, if the only package to upgrade is a
pinned package, the output looked like that:
	==> Upgrading 0 packages, with result:

	==> Not upgrading 1 pinned package:
	<<package_name & version>>

The blank line is not beautiful. This commit fixes
the output and replaces with:
	==> No packages to upgrade
	==> Not upgrading 1 pinned package:
	<<package_name & version>>

Closes Homebrew/homebrew#26157.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2014-01-26 18:04:20 +01:00
Nikolaus Wittenstein
f17289f708 upgrade.rb: Fix plural_s when number = 0
Currently Upgrade prints out:
"Upgrading 0 outdated package, with result:"

This change makes it print:
"Upgrading 0 outdated packages, with result:"
correctly pluralizing "packages".

Closes Homebrew/homebrew#22854.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-09-26 22:54:51 -07:00
Adam Coffman
753adbb0ce upgrade: put exit statements in both conditional branches
This check was only occurring in one branch of the conditional.
As a result, if you ran `brew upgrade` with no args and there were no packages to upgrade,
the nonsensical message

"==> Upgrading 0 outdated package, with result:"

would be printed.

Closes Homebrew/homebrew#21316.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-07-18 15:35:17 -05:00
Jack Nagel
9fb163d34c upgrade: don't rely on return value of 'onoe' 2013-07-15 23:47:04 -05:00
Jack Nagel
42cceeb4a0 upgrade: make condition clearer 2013-07-15 23:47:03 -05:00
Jack Nagel
b4419992ab upgrade: move require out of method body 2013-07-15 23:47:03 -05:00
Jack Nagel
1678a4a65d upgrade: remove redundant conditional
Since e1c62c35465eb6149688c745e4309438c08c410b, we exit early if the
outdated array is empty, so we no longer need to check this before
proceeding.
2013-07-15 23:47:02 -05:00
Adam Vandenberg
4c9ac19e87 Consolidate sudo checks.
Closes Homebrew/homebrew#20318.
2013-06-08 20:44:56 -07:00
Jack Nagel
5f38c19ba8 upgrade: fix expansion of options for top-level formula objects
Fixes Homebrew/homebrew#20045.
2013-05-24 10:33:08 -05:00
Jack Nagel
40dedcec70 upgrade: fix typo 2013-05-18 22:11:19 -05:00
Jack Nagel
a10cda77be upgrade: use a method rather than a boolean flag 2013-05-18 22:09:15 -05:00
Jack Nagel
26a076eef5 upgrade: tighten installed precondition 2013-05-18 22:09:15 -05:00
Simon Sigurdhsson
f8a88b5f28 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 Homebrew/homebrew#18386.
Closes Homebrew/homebrew#18515.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-03-30 19:50:47 +00:00
Jack Nagel
5ac4e4f071 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
82051a56ec 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
951872c4be FormulaInstaller: don't install bottle if options were passed 2013-01-26 12:14:46 -06:00
Jack Nagel
5822aa80cf FormulaInstaller: make tab an attr, but never a parameter 2013-01-26 12:14:46 -06:00
Matt Di Pasquale
e9158ca6dc brew upgrade: improve exit codes.
exit 1 if formulae given but none outdated

Closes Homebrew/homebrew#17199.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-01-21 19:55:09 +00:00
Jack Nagel
5c799ef8c8 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 Homebrew/homebrew#16957.
2013-01-10 16:46:54 -06:00
Charlie Sharpsteen
93dca5fb38 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
c6b3cd7cf4 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
93f7a0fa85 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 Homebrew/homebrew#11863.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 19:33:39 -05:00
Jack Nagel
8a21bd52d5 Add ARGV.ignore_deps?
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 19:33:39 -05:00
Jack Nagel
93baea7e47 outdated: use new version comparison machinery 2012-08-18 11:12:10 -05:00
Charlie Sharpsteen
f165e0cf5f 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
c2fdcf1a34 Honor build options and bottles when upgrading
Fixes Homebrew/homebrew#11552.
Closes Homebrew/homebrew#11777.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-05-05 12:24:56 -05:00
Mike McQuaid
fe969c21ad Add ofail command and fix bottle command output. 2012-04-30 21:38:08 +08:00
Mike McQuaid
0cbdeeaa3c Exit with bad exit code on command failures. 2012-03-29 18:44:37 +11:00
Jack Nagel
1bc6313694 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 Homebrew/homebrew#11086.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-03-23 13:05:08 -05:00
Mike McQuaid
cd13553d59 Remove bad exit status; need to fix another way. 2012-03-10 08:18:42 +13:00
Mike McQuaid
5f1a9098c9 Add better Unix exit codes.
Closes Homebrew/homebrew#10809.
2012-03-09 19:16:33 +13:00
Max Howell
8fd2778a95 Allow dependencies to still install
Oops bug.
2012-03-07 13:48:04 +00:00
Max Howell
6988a75b84 Don't allow sudo brew upgrade if not sensible 2012-03-07 12:50:15 +00:00
Max Howell
a13ff43886 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