67 Commits

Author SHA1 Message Date
Jack Nagel
e3068f631a Prune LinkedKegs relative to correct path
Fixes Homebrew/homebrew#16948.
2013-01-08 11:03:13 -06:00
Mike McQuaid
faf51f254d Make generic caveats for launchd plist files. 2012-11-25 23:05:52 +00:00
Jack Nagel
7f9c03c1ff Link Frameworks into top-level Frameworks directory 2012-11-06 12:32:09 -06:00
Jack Nagel
2f542f657e Combine duplicated postfix conditionals 2012-11-06 12:32:09 -06:00
Jack Nagel
f8183d9510 Hoist top-level directory list into a constant 2012-11-06 12:32:09 -06:00
Misty De Meo
447f78c0d2 brew ln --force is now brew ln --overwrite
* Renames --force to --overwrite, freeing up brew ln --force for Homebrew/homebrew#13349
* Changes --dry-run to preview linking by default, rather than
  overwriting. An overwrite dry-run can be simulated via both
  --dry-run --overwrite
* Adds some basic Keg tests
2012-10-20 21:00:46 -05:00
Jack Nagel
ca45225fad Flatten share_mkpaths
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-10-15 18:03:07 -05:00
Misty De Meo
0f2fe4a61b Keg#unlink: use ObserverPathnameExtension
#link was using the extension but #unlink wasn't, so the counting
criteria were potentially different and `brew unlink` was ignoring
--verbose.
2012-10-04 21:37:37 -05:00
Misty De Meo
a1f6f590d2 Keg#unlink: check file comes from the right keg
For real this time.

This makes sure that files won't be unlinked if they resolve into 
other kegs. For example: if fish and fishfish are both installed, 
with fishfish linked and fish unlinked, `brew unlink fish` would 
unlink some files that resolve into fishfish's keg.
2012-10-04 21:37:36 -05: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
31b61cb013 keg: add method to return the corresponding Version 2012-08-18 11:12:10 -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
Max Howell
da692fadc6 Don't chmod -R 0777 before uninstalling
If the user owns the parent directory we have the rights to rmtree. At least I believe so.

Fixes Homebrew/homebrew#13714.
2012-08-06 18:49:14 -04:00
Misty De Meo
70d7c0c122 Revert 66a4ea1c80fa36fe348b3d5ad6d2f6c61cf21c05
Refusing to unlink files from another keg introduced issues when
files changed between formula versions; for instance, this
introduced issues when upgrading from gtk+ 2.24.10 to 2.24.11.

See Homebrew/homebrew#12778.
2012-07-24 09:52:12 -05:00
Misty De Meo
17953f2b83 Keg#unlink: check destination before unlinking
Rather than skip unlinking if there's no linked keg record, check to
see whether the destination's realpath is the same as the source file
in the keg being unlinked.
2012-07-22 10:58:19 -05:00
Misty De Meo
ba2d17b8d1 Keg#unlink: Don't try to unlink if keg is unlinked 2012-07-20 12:03:31 -05:00
Misty De Meo
14c8c7c9ce Fix brew link --dry-run
The last make_relative_symlink was missing the mode argument, which
caused spurious linking under certain circumstances.
2012-07-11 22:32:15 -05:00
Misty De Meo
743b5e6feb link: add --force and --dry-run options
`brew link` can now be made to delete any conflicting files using
the --force argument. It also has a --dry-run option, similar to
git clean -n, which will list any files which would be deleted
without touching the filesystem.

Closes Homebrew/homebrew#11811.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-07-09 12:01:09 -05:00
Misty De Meo
44ccd122c2 Keg#unlink: skip find for non-extant files
In 1.8, Pathname.find would work (and do nothing) if the
source path didn't exist. In 1.9 this throws an exception
instead, so check whether the file exists before trying.
2012-07-06 10:32:56 -05:00
Christian Höltje
7b24382d14 zsh: support site specific files
This fixes the `site-scripts` and `site-functions` directories
so that zsh points to the HOMEBREW_PREFIX version of these files
instead of the Cellar version.

This means you can drop files in these directories and the files
will persist when you upgrade zsh. Otherwise they disappear when
you upgrade zsh.

Closes Homebrew/homebrew#11955.

[jn: mkpath everything under share/zsh]

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-05-02 23:43:30 -05:00
Jack Nagel
07e24dda76 mkpath all directories under lib/python*
The python formula explicity creates lib/python2.7/site-packages.
However, that path may already exist as a symlink if something that
installs python bindings is installed before python itself. The result
is that some random keg will end up hosting the site-packages directory
instead of the top-level directory.

Fix this by explicitly creating directories under lib/python* during
linking.

Fixes Homebrew/homebrew#11882.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-04-26 20:35:09 -05:00
Max Howell
1e55c1f580 Fix brew unlink
Whoops.
2012-03-25 13:09:30 +01:00
Max Howell
69672ca965 Speed-up brew-unlink under certain conditions
This massively speeds up upgrades for certain formula, ie. formula with lots of files that aren't in the directories we link. I found upgrading android took ages before the un-tar step and it was indeed for this reason.
2012-03-25 11:07:30 +01:00
Misty De Meo
de234ebb5a Don't try to link info/dir with HOMEBREW_KEEP_INFO
Some formulae have local info/dir files from before 9610ff2, and
attempting to link their info/dir over PREFIX/share/info/dir caused
linking to fail.
2012-03-20 17:00:38 -05:00
Misty De Meo
bc7469c819 Fix inappropriate linking of info files
share/info files were always being linked if they existed, regardless of
whether the user had HOMEBREW_KEEP_INFO set. This primarily affects
users with software built before
9610ff2e9e06931693f49d4377ee26c0e664c547.

This also fixes a bug in Keg#link_dir, in which a file would always be
linked if no argument was passed.
2012-03-20 14:33:46 -05:00
Misty De Meo
f8861daeb9 Skip linking info/dir
The regexp that handles skipping info files was only skipping
info/*.info files, but several formula would create info/dir files as
well. Since these conflicted with each other, Homebrew would error out
during the linking step.
2012-03-20 11:46:10 -05:00
Max Howell
88118b51b2 Don't error if exact link already exists
If the link already exists exactly (well almost exactly) as we are about to correct it, then it's okay. Otherwise we error out. This is a safe choice, and really, the correct choice too.

This will prevent the tickets like Homebrew/homebrew#11050 from occurring.
2012-03-19 12:24:13 +00:00
Jack Nagel
5b1957f13a keg: don't skip linking based on relative pathname
ed1a674c ("keg: allow selective linking at the file level") had a
regression which caused the link step to skip files with the same name
as a directory in the user's CWD.

Keg#link_dir yields a relative pathname, so assumptions cannot be made
about the nature of that pathname in the block.

Instead, introduce ":skip_dir" and ":skip_file" to replace the existing
":skip" directive. This way, we won't skip things marked ":skip_dir"
when linking a file, and vice-versa.

Fixes Homebrew/homebrew#10860.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-03-11 10:18:12 -05:00
Jack Nagel
d6851033f9 Fix gdk-pixbuf module installation
When other packages install gdk-pixbuf modules, they get installed into
the gdk-pixbuf keg. To avoid this, we explicitly create the top level
lib directories for gdk-pixbuf and hack the pkgconfig file to point at
the top-level directories instead of the keg.

This results in other packages installing modules into the top-level
directory and as such they are "lost" and treated as unbrewed files, but
that is still better than losing them during upgrades of gdk-pixbuf
itself.

If we had a post-link hook, we could keep everything confined to its own
keg, linked into the top-level modules directory, and then run

    gdk-pixbuf-query-loaders --update-cache

ourselves. In the abscence of that, I think this is the best compromise.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-03-08 20:40:26 -06:00
Jack Nagel
01994c7be1 keg: allow selective linking at the file level
Some parts of a keg's tree are not subject to the cleaner, and sometimes
we still want to remove things in directories marked skip_clean; this
allows us that freedom.

If 'lib' is marked skip_clean, we still want to avoid linking the
charset.alias file into the top of the tree. The same needs to be done
for the locale.alias file in share/locale.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-03-04 23:56:22 -06:00
Max Howell
11953cbcb9 Remove empty directories during uninstall
About time we did this right?
2012-02-29 01:23:49 +00:00
Jack Nagel
8567570d97 keg: make locale directory regexp a constant
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-01 22:52:14 -06:00
Nicolas Despres
d0be4d692b keg: handle the info directory file properly
If HOMEBREW_KEEP_INFO environment variable is set:
 - Do not symlink the info directory file (aka 'share/info/dir')
   otherwise it gets overwritten by next installed brew.
 - Install an entry in the directory for each linked info file when the
   brew is linked.
 - Uninstall the entry when the brew is unlinked.

Closes Homebrew/homebrew#9700.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-01 22:52:14 -06:00
Jack Nagel
36085bd34d keg: mkpath directories in share/locale
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-02-01 14:17:33 -06:00
Jack Nagel
a86f524156 mkpath directories under lib/ocaml
Ocaml packages that need to install here will cause the site-lib
directory to be created, and the symlink in the ocaml keg will work as
intended. This is necessary for the ocaml bottle to work properly.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-01-30 00:04:33 -06:00
Jack Nagel
97fa28248d Force creation of locale-specific man directories
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-01-04 20:50:19 -06:00
Jack Nagel
07b7dd7a7a Add a helper to determine if a keg is linked
'keg.linked?' will return true if there is an entry for 'keg' in
LinkedKegs.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-01-03 19:50:19 -06:00
Max Howell
13918ff6d9 Record which keg is linked
Will be useful for a variety of reasons, but for now, I'm just using it to ensure install won't install again if something is already installed (use brew upgrade instead).

But means that brew switch and that can work properly etc.
2011-08-24 22:30:44 +01:00
Adam Vandenberg
9995f9a651 keg - use proper inheritance style 2011-03-15 21:48:24 -07:00
Adam Vandenberg
b02d25bccd Add ruby lib to folders handled specially by keg.link 2011-03-13 12:19:27 -07:00
Max Howell
521f1ec959 A install name fix step during install
We currently only fix relative paths, but we should expand this more.
2011-03-12 11:55:04 -08:00
Max Howell
768910283a Refactor the brew command into one file per command
The code was sucking. To the extent that maintenance was hard. It's a lot
easier to work with code that is sensibly split at sensible boundaries. So
now it is more like that.

But the refactor is minimal. Because we don't want you to have more merge
hell than absolutely necessary.

If you merge you will need to pay attention to brew.h.rb (as it is deleted)
and bin/brew (as command logic is gone). It will be painful, but you will just
have to help git out by moving any changes around manually.

Note compatibility.rb. It ensures that any function renames or removals don't
break anything. We're pretty serious about backwards compatibility. And that's
because we encourage you to hack around with the innards. And we couldn't do
that if we would then just make stuff disappear behind your back.
2011-03-12 11:55:02 -08:00
Michael Dippery
e0c23d670d More .DS_Store ignoring
* Don't link .DS_Store files
* Don't list .DS_Store files in `brew info`

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2010-11-05 19:44:56 -07:00
Adam Vandenberg
4e6d7a4de9 Man sections only run through 8 2010-08-21 11:25:14 -07:00
Adam Vandenberg
04c0342d96 comment link step 2010-08-21 10:51:43 -07:00
Adam Vandenberg
612af6b4fe Make "lib/node" a real folder.
Treat the "lib/node" folder like Python, Perl, etc.
Create it as a real folder in HOMEBREW_PREFIX, so that
package managers (npm) have a stable place to drop libs.
2010-08-07 21:10:41 -07:00
Patrick Walton
6fbf125970 Create explicit folders for more language libs. 2010-06-23 11:31:52 -07:00
Adam Vandenberg
48c7e2fb0b Don't symlink lib/python2.6
Like pkgconfig, perl5 & php, we don't want any one formula to "own" the
lib/python2.6 path.

Fixes Homebrew/homebrew#1218.
2010-06-01 18:09:44 -07:00
Adam Vandenberg
fb9f4bbccc Don't link_dir if the target doesn't exist.
Fixes Homebrew/homebrew#1115 for Ruby 1.9, thanks to assaf.
2010-04-04 13:46:41 -07:00
Adam Vandenberg
a9b19f0255 Move license block to separate LICENSE file. 2010-03-01 11:41:24 -08:00