574 Commits

Author SHA1 Message Date
Jack Nagel
ea4188ecda FormulaInstaller: skip build-time deps for bottles 2013-01-26 12:14:44 -06:00
Jack Nagel
43d9f480af FormulaInstaller: factor out dependency installation 2013-01-26 12:14:44 -06:00
Jack Nagel
8b346d7a6d FormulaInstaller: factor out requirement checking 2013-01-26 12:14:44 -06:00
Jack Nagel
70ff06c827 Refactor option handling internals
Currently we handle options in several ways, and it is hard to remember
what code needs an option string ("--foo"), what needs only the name
("foo") and what needs an Option object.

Now that Option objects can act as strings and be converted to JSON, we
can start using them instead of passing around strings between Formula
objects, Tab objects, and ARGV-style arrays.

The Options class is a special collection that can be queried for the
inclusion of options in any form: '--foo', 'foo', or Option.new("foo").
2013-01-26 11:37:01 -06:00
Jack Nagel
d8a83073ff Clean up Tab creation 2013-01-26 11:37:00 -06:00
Randy Thiemann
766bc13cfb Allow hiding Homebrew emoji with an env var.
Closes Homebrew/homebrew#17085.
Closes Homebrew/homebrew#17086.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-01-19 23:13:01 +00:00
Jack Nagel
870f095c69 Restore keg-only caveats
Fixes Homebrew/homebrew#16989.
2013-01-14 14:57:42 -06:00
Jack Nagel
8f88850cdb Only mark install as attempted if it was actually attempted
Commit 30a08f5cc707 ("Don't attempt installation multiple times") was
correct in raising FormulaInstallationAlreadyAttemptedError early enough
to prevent the other exceptions in #check_install_sanity from being
raised, but it should not have moved the point at which formulae are
added to the attempted set. Doing so prevents the installer from being
instantiated multiple times on the same formula, even if installation
was never attempted.

Put it back where it belongs.
2013-01-13 15:46:46 -06:00
Samuel John
bc3c07d197 Give a fresh 🍺 after hard work of brew install
- Name of the brewed formula in "Summary" heading.
- At the beginning of the summary line a 🍺  is given out
  (but only on Lion or above). This acts as a nice
  visual marker for the end of a brew-ing process.
- When brewing a dependency, the name is highlighted in green.
- `oh1` is bold, too (like ohai).

Closes Homebrew/homebrew#16020.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-01-11 11:16:11 +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
Mike McQuaid
755a2fbe52 Add caveats class and use in brew info.
Probably a better approach than reverted e721c7.

Fixes Homebrew/homebrew#16604.
2013-01-02 09:28:15 +00:00
Mike McQuaid
da0c0ae97a Cleanup FormulaInstaller caveats. 2013-01-02 09:28:15 +00:00
Mike McQuaid
f25e7de43b Add --homebrew-developer flag 2013-01-01 16:39:06 +00:00
Jack Nagel
68d1dfe5d7 Revert "Add launchctl_instructions method"
This code makes assumptions about the existence of prefix which are
valid in the context of the installer, but not necessarily in the
context of `brew info`, thus `brew info` on an outdated formula errors
out.

This reverts commit e5b53dd64b769b67805d1054d906f7083939d905.
2012-12-16 19:56:15 -06:00
Lorenzo Manacorda
d23366ae9a Add launchctl_instructions method
Closes Homebrew/homebrew#16604.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2012-12-16 23:31:30 +00:00
Mike McQuaid
9342a42386 Fix startup plist instructions.
Closes Homebrew/homebrew#16369.
2012-12-03 17:09:51 +00:00
Mike McQuaid
c4fb2b73e2 Support installing bottles from local files. 2012-12-01 12:45:23 +00:00
Mike McQuaid
faf51f254d Make generic caveats for launchd plist files. 2012-11-25 23:05:52 +00:00
Jack Nagel
340769443c Rewrite plists when installing from a bottle 2012-11-25 15:11:57 -06:00
Mike McQuaid
c3f96851b2 Don't warn users about bad packaging. 2012-11-25 20:51:41 +00:00
Mike McQuaid
c6a8dd247e Remove m4 macro warning.
Fixes Homebrew/homebrew#15956.
2012-11-12 20:17:57 +00:00
Stefan
49ef6267f5 Remove plist file exists check
Closes Homebrew/homebrew#15958.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2012-11-11 18:02:22 -08:00
Jack Nagel
efcd926d1b Work around Readline clash
Only limited debugging functionality is available to things that involve
the Readline formula, but it is better than crashing outright.

c.f. Homebrew/homebrew#15776.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-11-11 18:49:32 -06:00
Jack Nagel
e1da727a4e FormulaInstaller: disambiguate show_header usage
show_header should default to false (we don't want to display it in the
case of installing a single formula without dependencies), but it only
worked this way by accident.

The assignment "show_header = true" creates a local variable named
show_header, and in the case where needed_deps is empty and this
assignment is not actually executed, the latter usage evaluates the
local variable instead of calling the method.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-10-24 22:59:24 -05:00
Jason A. Donenfeld
9601b753fd Add .sh to list of valid library extenions.
As discussed with mistym, it's not only compiled code that goes in
/usr/lib, but any types of libraries. As such, .pm was added to the
valid extensions list a while back. Unfortunately, .sh was not added,
even though configuration includes and platform function library shell
files are often put in /usr/lib as shellscript libraries. This patch
adds .sh to the list of valid library extensions.

Closes Homebrew/homebrew#14993.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2012-09-30 10:54:29 -07:00
Max Howell
a217b03952 Clean up and improve build-error output and logs
All logs are now stored from each command executed in Formula.install.

Error output is truncated to five lines in an attempt to not overwhelm the user and to encourage users to read the error output and report the bug properly. Maybe we can get that figure up from 70% to 90%.
2012-09-25 11:31:56 -04:00
Max Howell
12d17155cf If we delete stuff in the clean step, make fuss
/cc @jwheare
2012-09-18 16:27:34 -04:00
Max Howell
523f50862b Install plists in FormulaInstaller, not build.rb
Build rb should only build!
2012-09-13 17:00:02 -04:00
Jack Nagel
e909b54c96 Tighten post-install checks
- Avoid ENOTDIR by ensuring that the directories we are checking are
   actually directories.
 - DRY up the check_PATH method; paths are already available via the
   global ORIGINAL_PATHS.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-09-11 00:45:45 -05:00
Max Howell
5790f4b523 Display skip-clean warning only before clean
Not anytime the formula loads.
2012-08-29 15:43:28 -04:00
Max Howell
336c4d1b05 If installed but not linked, say so
Rationale: if ack is unlinked but installed, typing ack does nothing, but then user tries to install and it says it is already installed. What gives? The user thinks.

Formula ending up unlinked can happen due to failures during the link phase and we recommend unlinking formula for conflicts. So common enough to justify this amendment.
2012-08-29 12:41:35 -04:00
Max Howell
20ce16a3ff Much better CTRL-C handling
Let's not show weird error messages when user interrupts during various stages of brew initialization.

Tested by doing `for x in $(brew search); do brew install $x; done` and pressing CTRL-C at random short intervals.
2012-08-29 12:41:35 -04:00
Max Howell
57df15afd0 Use opt paths in keg-only messages 2012-08-29 12:41:34 -04:00
Max Howell
f02d81ecbf Create active symlinks for installed formula
Similar to the LinkedKegs record, we write a symlink for installed kegs to PREFIX/opt.

Unlike the linked-keg record, unlinking doesn't remove the link, only uninstalling, and keg-only formula have a record too.

The reason for this addition is so that formula that depend on keg-only formula can build against the opt directory and not the cellar keg. Thus surviving upgrades.

To enforce this fix_install_names and built were adapted to use the opt path.

Standard kegs also create an opt symlink so that caveats can now refer to the opt directory and thus provide steps that survive upgrades too.

Thus the choice of /opt. It is short, neat and the right choice: POSIX dictates that opt is for stand-alone prefixes of software.
2012-08-29 12:41:33 -04:00
Jack Nagel
d423519766 Don't download bottles when building from source
The recent fix that prevents "-v" from triggering source downloads
exposed a different bug that allowed the build script to download the
bottled package instead of the source package; fix the logic.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-28 18:00:27 -05:00
samueljohn
537de9c046 formula_installer: make "linking" more clear
When building software "linking step did not complete" sounds
like ld failed. Let's be clear about this.

Closes Homebrew/homebrew#14407.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2012-08-25 15:36:13 -07:00
Max Howell
4e7bb6c637 Better message if multiple kegs need linking 2012-08-21 12:09:05 -04: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
8a21bd52d5 Add ARGV.ignore_deps?
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 19:33:39 -05:00
Jack Nagel
a81da08732 Refer to the real keg when dying because the keg exists
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 11:26:00 -05:00
Jack Nagel
83cdc64b40 FormulaInstaller: filter ARGV when testing for installed deps
In FormulaInstaller#install, needed_deps is created without first
filtering ARGV for flags like --HEAD. In practice, this means that
sometimes needed_deps will contain dependencies that are actually
already installed; --HEAD causes Formula#installed_prefix to differ and
thus checking Formula#installed? will result in false negatives.

This can trigger weird bugs; for example, Homebrew/homebrew#10380, where the "Installing
foo" header is displayed even though no dependencies were previously
installed.

Fix this by filtering ARGV before testing for installed dependencies,
and do the same for requirements to maintain symmetry, and because some
requiremnts check Formula#installed? as well.

Fixes Homebrew/homebrew#10380.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-15 22:39:52 -05:00
Jack Nagel
140dc4c419 Don't print an empty line if all requirements are satisfied
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-14 23:30:15 -05:00
Jack Nagel
c38bc4fd67 Recursively expand requirements in FormulaInstaller
Currently FormulaInstaller "forgets" about the requirements of
dependencies, as dependencies are recursively expanded by the first
FormulaInstaller instance, and then ignored by subsequent instances to
prevent duplicate installation attempts. These requirements then have
their messages displayed, but the fatal check is skipped and thus no
exception is raised.

Now that we have Formula#recursive_requirements, we can mirror what we
are doing with dependencies and recursively expand requirements up
front.

While at it, fix a bug in determining Requirement equality that resulted
in unique requirements being eliminated from a formula's set of
recursive requirements.

Fixes Homebrew/homebrew#12290.
Fixes Homebrew/homebrew#14084.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-14 23:26:50 -05:00
Max Howell
88e79a9098 Uninstall keg if error during build & tab creation
Previously if error occurred in code around the logic you'd get a keg that is installed without a tab, which breaks brew.
2012-08-13 10:14:59 -04:00
Jack Nagel
a054dc5019 Add :when_xquartz_installed as a keg-only reason
Using :when_xquartz_installed will tell the keg-only machinery to activate
if XQuartz is installed.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-12 17:28:15 -05:00
Jack Nagel
c9f824b54a Make Set available globally
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-12 00:58:31 -05:00
Jack Nagel
c2725aa048 Simplify conditional
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-07 15:33:29 -05:00
Jack Nagel
1d295ff3bc Automatically append shell completion caveats
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-07 15:32:00 -05:00
Adam Vandenberg
8c8701f268 Allow multiple unsatisfied fatal requirements
Closes Homebrew/homebrew#13335.
2012-08-07 10:49:45 -07:00
Max Howell
97b841c1d5 Don't output Ruby warnings
We don't want bug reports about this crap, even though the user REALLY should listen to the warning message. What actually happens is they blame us instead.

This kind of warning in particular:

warning: Insecure world writable dir /usr/local/bin in PATH
2012-08-06 13:06:36 -04:00