378 Commits

Author SHA1 Message Date
Mike McQuaid
842d6ce8bd keg: add ALL_TOP_LEVEL_DIRECTORIES constant.
This is used in diagnostic (and will be used in other places later)
rather than hard-coding other directories later.
2016-09-15 09:20:39 +01:00
Dominyk Tiller
2aa32ea191
keg: make guile's site-dir persistent
Things that install Guile scheme objects should be doing so in
HOMEBREW_PREFIX/share/guile/site, which should be persistent rather
than a symlink to any formulae's Cellar, not even guile's necessarily as
f061d864d9
managed to expose.

I believe guile isn't actually configured correctly to expect
this directory, but since absolutely nobody has complained to
date as far as I can find & `gnutls` seems to be the only formula
using it this way the temptation is to leave it misconfigured
& use this directory for site schemes.

I don't really know the deeper issues around messing with Guile's
configuration so going for a minimal fix seems the safest option.
2016-09-12 03:24:53 +01:00
Xu Cheng
a8566c9848 various: eliminate the usage of any? (#638)
`any?` is not the opposite of `empty?`. Besides the case that
`[false, nil].any?` will return false, `any?`(O(n)) has much worse
performance than `empty?`(O(1)).
2016-08-05 22:01:32 +08:00
Xu Cheng
1eaa95b805
Keg#link: run optlink first
This prevents a link conflict during `brew upgrade` causing opt link
stuck to old version. At this point, users will have to run `brew switch`
to fix it.

Closes #533.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-07-17 02:16:18 +08:00
Luca Favatella
c6022104f9 bottle: delete .pyo files as with .pyc (#382)
This should make more bottles relocatable e.g. ansible.

.pyo files are bytecode as .pyc files but optimized -
[ref](https://www.python.org/dev/peps/pep-0488/)

Ref https://github.com/Homebrew/homebrew-core/pull/2125#issuecomment-226987124
2016-06-21 01:22:58 +02:00
Paolo G. Giarrusso
2f20a42292 Synchronize counts for link and unlink (#242)
Closes #239.
2016-05-15 12:07:58 +01:00
Dominyk Tiller
7faae5adf2 keg: mkpath on lua shares
Closes Homebrew/homebrew#48134.
2016-01-19 12:54:00 +00:00
Xu Cheng
885022a5e3 add Keg#empty_installation?
Avoid using `FormulaAuditor` in `FormulaInstaller`.

Closes Homebrew/homebrew#47887.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-01-09 20:28:15 +08:00
Rakesh
e4f2a1e0ef pathname: store file count and disk usage.
especially for directory instances of `Pathname` class and all
instances of `Keg` class.
2015-12-30 08:11:23 +00:00
Xu Cheng
d108bf0a55 move more deprecated methods to compat folder 2015-11-17 18:52:00 +08:00
Xu Cheng
8cf3402870 keg: mkpath for share/postgresql 2015-11-07 02:26:33 +08:00
Alex Dunn
d435f3ac41 keg.rb: guard against nonexistent site-lisp subdir
Fixes Homebrew/homebrew#45596.
2015-11-01 18:04:42 -08:00
Alex Dunn
168a2687f8 stricter audit for Emacs Lisp installs
Require that the subdirectory in site-lisp match the formula name
exactly.  This lets us provide better information in the caveats and
will make it easier for helper methods to write to the correct
location (as in in Homebrew/homebrew-emacs#13).
2015-11-01 17:34:28 -08:00
Martin Afanasjew
fdd3469fca linkapps: stop linking .app bundles from 'bin/'
`Keg#app_installed?` only checks the formula prefix and `libexec/` for
.app bundles to determine if a formula provides any. This is used by
`Caveats#app_caveats` to generate an appropriate message. The same list
should be used by `brew linkapps` for consistency.

Reduce likelihood of future inconsistencies by creating `Keg#apps` and
using it in place of the duplicate code.

Closes Homebrew/homebrew#45173.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-10-20 18:25:28 +08:00
M Jordan Stanway
a7df9c53eb keg: add java to SHARE_PATHS
Add `java` to `SHARE_PATHS` so that `HOMEBREW_PREFIX/share/java` is a folder with symlinks in it, rather than a symlink to a folder for a specific formula.

This way we avoid conflicts if multiple formulas put `jar` files in the
standard location `HOMEBREW_PREFIX/share/java`.

See also:
[pull request 44420](https://github.com/Homebrew/homebrew/pull/44420)

Closes Homebrew/homebrew#44456.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-10-08 16:23:40 +08:00
Xu Cheng
9581ab64e3 Keg#unlink: prune directory for dry_run as well 2015-09-06 15:31:09 +08:00
Ethan Piekarski
eff3d21350 Added --dry-run to unlink
Closes Homebrew/homebrew#43561.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-09-06 15:25:36 +08:00
Xu Cheng
451c69d9bd keg: mkpath for mecab 2015-08-27 20:19:00 +08:00
Xu Cheng
27d7244f8c keg: mkpath for lib/gio 2015-08-23 21:43:04 +08:00
Xu Cheng
b6c64ae46a also lock oldname when applied 2015-08-20 15:47:41 +08:00
Vlad Shablinsky
d3037f7044 update opt for renamed formula
After the formula gets renamed oldname opt is created and
it points to the linked keg. However if we then upgrade newname
oldname opt still points to the same keg it pointed before upgrade.
The commit fixes this behaviour thus that oldname opt links at the
same keg opt point.
2015-08-17 01:53:58 +08:00
Tim D. Smith
88e8e6cf60 Don't try to link symlinks over their targets
If we have lib/python3.4/site-packages, which is a symlink to
HOMEBREW_PREFIX/lib/python3.4/site-packages, link will be confused. This
only appears after unlinking and relinking because this symlink is
created in post_install, which runs after the first link.

Fixes Homebrew/linuxbrew#502.

Closes Homebrew/homebrew#42891.
2015-08-15 20:24:20 -07:00
Tim D. Smith
3a535ed36b make path instead of symlink for lib/R
Moves us towards being able to support formulae that install R bindings,
like nonpareil in homebrew-science.

Some discussion in Homebrew/homebrew-science#2559.

Closes Homebrew/homebrew#42539.
2015-08-15 00:14:38 -07:00
BrewTestBot
13d544e11e Core files style updates.
Closes Homebrew/homebrew#42354.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-08-03 13:22:35 +01:00
Alex Dunn
81eedecc5a Automatic caveats for emacs lisp files
- The name of the subdirectory under site-lisp may not be exactly the
  same as the name of the package

- `(normal-top-level-add-subdirs-to-load-path)` adds every subdirectory
  of `default-directory` to the load-path, so users don't have to update
  their load-path for every package they install.

Closes Homebrew/homebrew#42309.
2015-08-01 14:48:54 -07:00
Mike McQuaid
b9cdfe21fc keg_relocate: relocate all text files.
Work out what's text and what's not using `file`. Also, rename
`keg_fix_install_names` to `keg_relocate` because that's a more
accurate description of what it does now.

Closes Homebrew/homebrew#41663.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-07-18 19:52:56 -07:00
Xu Cheng
3f601e0e7f keg: mkpath for fish related directories
Fixes Homebrew/homebrew#41742.

Closes Homebrew/homebrew#41849.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-07-18 16:48:41 +08:00
Johannes Wienke
de43ac7503 Add support for fish shell completions
* Library/Homebrew/caveats.rb: add caveats comparable to other shells
* Library/Homebrew/formula.rb: define completion directory along the
  conventions explained in the fish documentation for
  $fish_complete_path
* Library/Homebrew/keg.rb: add fish shell to check function for
  installed completions

Closes Homebrew/homebrew#39828.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2015-06-02 10:09:10 +01:00
Xu Cheng
c14794baa8 keg: add rack method 2015-05-27 13:53:41 +08:00
Ben Morgan
1795599d88 keg: explicitly create cmake dir under lib
Packages supporting CMake may install configuration files for use
with CMake's find_package command. A recommended location for these
is `<prefix>/lib/cmake` which is not unique across packages. This
may cause issues for Formula using this location when their Keg
is linked.

As with pkg-config, explicitly create the `lib/cmake` folder when
linking a Keg that has installed folders/files to this location.

Also add testcase.

Closes Homebrew/homebrew#38005.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-03-29 22:01:21 +08:00
Jack Nagel
0a41cbcd9c Always create real directories under lib/ruby
Fixes Homebrew/homebrew#37685.
Closes Homebrew/homebrew#37704.
2015-03-15 23:23:14 -04:00
Jack Nagel
dd90030213 Fix "possible reference to past scope" warnings on 2.2 2014-12-26 11:58:09 -05:00
Baptiste Fontaine
278b77e6c5 Quote path in conflict error rm command
Fixes Homebrew/homebrew#35143.
Closes Homebrew/homebrew#35239.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2014-12-24 12:16:16 -05:00
Tim D. Smith
daabf4f5dc keg: add python_pth_files_installed? helper 2014-11-02 10:33:34 -08:00
Jack Nagel
044393641e Less code in begin block 2014-10-20 17:07:54 -05:00
Jack Nagel
55e0f40d02 Handle broken symlinks in resolve_any_conflicts
Fixes Homebrew/homebrew#33328.
2014-10-20 17:07:54 -05:00
Jack Nagel
05ba3f0e34 Return early from resolve_any_conflicts for non-symlinks 2014-10-20 17:07:53 -05:00
Jack Nagel
4fd78c9690 Provide more information about link errors
References Homebrew/homebrew#32046.
2014-09-09 14:26:36 -05:00
Jack Nagel
3451c2d67f Handle nonexistent files when constructing ConflictError
Closes Homebrew/homebrew#31051.
2014-07-30 16:29:10 -05:00
Jack Nagel
8076f3340a Fix typo 2014-07-12 20:15:57 -05:00
Jack Nagel
1eafe3bc35 Handle conflicts where links point at symlinks
Fixes Homebrew/homebrew#30664.
2014-07-12 19:56:58 -05:00
Jack Nagel
7b26c885bd Always link symlinks directly 2014-07-12 19:56:58 -05:00
Jack Nagel
84372e570e Use a regular conditional instead of next unless ... 2014-07-04 19:40:18 -05:00
Jack Nagel
810b5838b2 Simpler "use the correct symlink" checks
When determining whether to remove a symlink during unlinking, we check
three things:

  (a) Is the destination a symlink?
  (b) Does the destination exist?
  (c) Does the destination resolve to the source path?

However, since we know that the source path exists, (b) is guaranteed if
(a) and (c) are true. Thus checking (b) is unnecessary.

Similarly, when creating a new symlink during linking, we first check to
see if the link already exists by checking the same three criteria.
Again, checking (b) is unnecessary here.

See also the expanded test coverage in b52b579b.

Addendum: although we know that the source path exists during unlinking,
it doesn't matter. If the source path does not exist, then we still know
we have a broken symlink pointing into the keg we are unlinking, and
removing that symlink is still safe.
2014-07-04 17:46:52 -05:00
Jack Nagel
07e00061a7 Pass relative paths into link exceptions 2014-07-02 10:48:18 -05:00
Jack Nagel
c2228c0d0f Remove default argument from make_relative_symlink
All callers of this method now pass a mode object.
2014-06-30 22:14:18 -05:00
Jack Nagel
4ea3997d9c Pass the mode through the optlink method 2014-06-30 22:14:09 -05:00
Jack Nagel
548d66be59 Simplify optlink method
delete/unlink on a directory is the same operation as rmdir.
2014-06-30 22:14:07 -05:00
Jack Nagel
d792b64655 Add methods for manipulating the opt record 2014-06-30 20:31:13 -05:00
Jack Nagel
0744ed9410 Store the opt record so we don't have to keep reconstructing it 2014-06-30 20:30:50 -05:00