If an etc file exists on installation instead of overwriting it (or
requiring all the manual checks in formula) simply copy it with the
extension `.default` appended.
After a formula is built, scan all mach-o files for dynamic links
to see if any of them point to a C++ stdlib (libc++ or libstdc++).
If one of them is linked, record that information in the formula's tab.
This replaces the old behaviour where all files were assumed to be C++
code, and stdlibs were always tracked regardless of whether they were
actually linked against.
This also modifies the way that tabs are written - now tabs are written
with the stdlib field null, and values are only written if an stdlib
is detected.
This is an internal method, but is called a bunch of times in
performance-critical codepaths, and is ultra slow because the constant
is interpoplated into the Regexp each time the method is called.
Alas, this has been fixed in Ruby 1.9+.
The option `du -s` is equivalent to `du -d0`. The former is a POSIX standard
(IEEE Std 1003.1-2008), whereas the latter is a BSD extension.
From the BSD man page:
`-s Display an entry for each specified file. (Equivalent to -d 0)`
From SUSv4:
`-s Instead of the default output, report only the total sum for each of the specified files.`
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/du.htmlClosesHomebrew/homebrew#16516.
Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
* 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
mkpathed directories aren't really "linked" or "unlinked" per se,
and link/unlink handle directories differently. It's easier just to
ignore them, which finally synchronizes link/unlink counts.
Previously we detected this by reading the first line of the file.
However, "first line" is meaningless when dealing with binary files, but
IO#readline will happily keep reading until it finds a newline
character, which can result in some unnecessarily large buffers.
Aside from the performance issue, this causes an additional problem
under Ruby 1.9: trying to match the binary string against a pattern will
raise ArgumentError (unless the binary string just happens to also be
valid UTF-8, heh).
Fix both issues: only read the first 1024 bytes, as no sane shebang will
ever be that long, and use a plain read(), which returns an ASCII
encoded string even on 1.9.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
ClosesHomebrew/homebrew#13689.
Signed-off-by: Max Howell <mxcl@me.com>
There are subtle distinctions between writable? and writable_real? we don't
understand precisely why we need this, but it fixes the bugs :/
Keg#link would sometimes count a linked file when doing mkpath, even if
the target directory already exists; #unlink would never count it. This
meant that "brew ln" and "brew unlink" counts for the same keg could be
out of sync with each other.