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.
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.
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.
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.
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.
FixesHomebrew/homebrew#10860.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
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>
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>
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.
ClosesHomebrew/homebrew#9700.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
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>
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.
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.
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.
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.
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.
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.
FixesHomebrew/homebrew#62
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.
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.