In order to allow kegs built with the same version but differing formula
revisions to coexist, we must encode the revision as part of the keg's
name. This is necessary to actually perform an upgrade, as we cannot
upgrade a keg in-place, and temporarily moving it pending the result of
the upgrade is error-prone and potentially slow.
To accomplish this, we introduce a new Formula#pkg_version method that
concatenates the active_spec version with the formula revision. An
exception is made for a formula that has no revision: the tag is
omitted. This preserves compatibility with existing installations.
Still in alpha state.
Handles defaults and merging changes with new versions.
Enable by setting the HOMEBREW_GIT_ETC environment variable.
ClosesHomebrew/homebrew#15751.
ClosesHomebrew/homebrew#17713.
If the `src` in the Cellar of a formula is a symlink to another dir
in the same Cellar (for example `Frameworks/QtGui.framework` is a
symlink to `lib/QtGui.framework`), then we should make a symlink
directly instead of possibly creating an empty dir.
This is needed because Ruby's `find` does not follow symlinks (newer
versions can, but we have to support 10.8 for a long time).
Currently this probably only occurs for Qt, where we put symlinks
into the Cellar/Frameworks and the frameworks linking code is a bit
special to create a directory to "merge" together different versions
of the same framework from different formulae. See `python` and
`python3`; both install `Python.framework` and only one can be the
`Current` but the other should still be put into
`Python.framework/Versions`. Therefore `Python.framework` has to
be a dir and no symlink.
Gnome desktop support has a lot of folders in share that should be created
directly in share, rather than shared.
Add these folders to keg, and don't link any icon cache files into share.
ClosesHomebrew/homebrew#20340.
For example python and python3 both provide a
`Python.framework` and OS X Frameworks are made to
deal with this by putting them into `Versions` and
linking the default one as `Current`. However, brew
did not respect this and cleaned out stuff making
neither of the two versions work because `Current`
is replaced by an empty directory.
This commit fixes that. However, still one of the
two `Python.frameworks` has to remove it's
`Current` and `Headers` links, because brew cannot
decide alone which one is the "default" and allowed
to set the `Current` link.
A similar situation might apply to Qt 4 vs. 5..
New `depends_on :python` Dependency.
New `depends_on :python3` Dependency.
To avoid having multiple formulae with endings -py2 and -py3,
we will handle support for different pythons (2.x vs. 3.x)
in the same formula.
Further brewed vs. external python will be transparently supported.
The formula also gets a new object `python`, which is false if
no Python is available or the user has disabled it. Otherwise
it is defined and provides several support methods:
python.site_packages # the site-packages in the formula's Cellar
python.global_site_packages
python.binary # the full path to the python binary
python.prefix
python.version
python.version.major
python.version.minor
python.xy # => e.g. "python2.7"
python.incdir # includes of python
python.libdir # the python dylib library
python.pkg_config_path # used internally by brew
python.from_osx?
python.framework?
python.universal?
python.pypy?
python.standard_caveats # Text to set PYTHONPATH for python.from_osx?
python.if3then3 # => "" for 2.x and to "3" for 3.x.
Further, to avoid code duplication, `python` takes an optional
block that is run twice if the formula defines depends_on
:python AND :python3.
python do
system python, 'setup.py', "--prefix=#{prefix}"
end
Read more in the Homebrew wiki.
FormulaInstaller now attempts to take a lock on a "foo.brewing" file for
the formula and all of its dependencies before attempting installation.
The lock is an advisory lock implemented using flock(), and as such it
only locks out other processes that attempt to take the lock. It also
means that it is never necessary to manually remove the lock file,
because the lock is not enforced by I/O.
The uninstall, link, and unlink commands all learn to respect this lock
as well, so that the installation cannot be corrupted by a concurrent
Homebrew process, and keg operations cannot occur simultaneously.
* 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
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.
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.
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.
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.
`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.
ClosesHomebrew/homebrew#11811.
Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
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.
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.
ClosesHomebrew/homebrew#11955.
[jn: mkpath everything under share/zsh]
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
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.
FixesHomebrew/homebrew#11882.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>