245 Commits

Author SHA1 Message Date
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
Max Howell
1deb3a1fea Don't resolve conflcts for pre-existing symlinks in HOMEBREW_PREFIX
Eg /usr/local/lib/juice/foo points somewhere else where the user has modules that he wants juice to use.

Basically don't error out for stuff that isn't ours.
2009-12-17 19:17:50 +00:00
Adam Vandenberg
bc378d091b Compare against HOMEBREW_CELLAR using real paths.
The code in Keg.self.for path uses "path = path.parent.realpath" to walk
up subfolders looking for a Keg.

Because 'realpath' is in there, and the path is checked against
HOMEBREW_CELLAR, which  may be a symlink, we need to do realpath-to-realpath
comparisons in Keg. Otherwise, we will hit equivalent but symlinked folders,
not see that they are the same, and walk all the way up to / and then
error out.
2009-11-12 12:47:17 -08:00
Max Howell
3570214d20 Allow multiple formula to symlink the same directory
During the link step, if the destination symlink already exists, unlink it, and create a directory instead, then relink the original contents. Then continue linking the formula in question.

Fixes Homebrew/homebrew#62
2009-10-23 19:22:07 +01:00
Max Howell
a8d6a695bc mkpath for all directories under lib/perl5
Don't symlink, as multiple formula will install to this directory.
2009-09-17 22:01:27 +01:00
Max Howell
0543bbcccc Fixes Homebrew/homebrew#32 -- Create directory, don't symlink perl5/site_perl 2009-09-03 23:17:02 +01:00
Max Howell
4d63b87e0a Change license to BSD
I confirmed this change with all relevant contributors first.
2009-08-31 16:09:17 +01:00
Max Howell
65cb8ea09f brew unlink command
Closes Homebrew/homebrew#8
2009-08-29 21:07:26 +01:00
Max Howell
5b6deb8845 Don't symlink directories into bin 2009-08-24 01:04:54 +01:00
Adeel Ahmad Khan
1c55642645 Link binaries in sbin as well as bin.
Signed-off-by: Max Howell <max@methylblue.com>
2009-08-12 23:55:57 +08:00
Max Howell
f724f5ed52 Ensure ENV is pristine for each installation
Because we modified the ENV global each install this propagated to consecutive
formulae. So exec a new brew process each install. This is the safest way
although Ruby exceptions don't propagate to the parent process so I worry
about it somewhat.
2009-08-10 18:11:23 +01:00
Max Howell
760c083c0c Refactor
Large refactor to Formula, mostly improving reliability and error handling but
also layout and readability.

General improvements so testing can be more complete.

Patches are automatically downloaded and applied for Formula that return a
list of urls from Formula::patches.

Split out the brew command logic to facilitate testing.

Facility from Adam Vandenberg to allow selective cleaning of files, added
because Python doesn't work when stripped.
2009-08-10 18:11:17 +01:00
Max Howell
e39f2ad229 FIX chmod correctly for *both* 32bit and 64bit binaries 2009-07-31 14:03:58 +01:00
Max Howell
9b19f194cc Refactor $foo into HOMEBREW_FOO
CONSTANTS are the far saner choice for these important parameters.

Split env up so I can redefine the CONSTANTS in unittest.rb.
2009-07-31 04:59:02 +01:00
Max Howell
7f3e8bc36a Recognise 64 bit binaries too 2009-07-31 01:19:11 +01:00
Max Howell
6d64eb28d5 Don't allow Keg.new for empty kegs
Kegs have to exist to be created.
2009-07-31 01:18:03 +01:00
Max Howell
90c7029144 Fix brew rm 2009-07-29 01:00:26 +01:00
Max Howell
fb5aefd4a0 Refactor--object orientate where sensible 2009-07-24 23:57:54 +01:00