Commit Graph
128 Commits
Author SHA1 Message Date
Jack Nagel 576b5c66dc Pathname: removed unused method alias 2013-10-14 22:05:30 -05:00
Mike McQuaid f4d29a0494 Pathname: add cp_path_sub method.
This method allows copying a file to a new location by performing a
substitution on the pathname.
2013-10-10 16:46:47 +01:00
Mike McQuaid 8db4a6c18d InstallRenamed: don't overwrite etc files; rename.
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.
2013-10-10 16:46:47 +01:00
Jack Nagel b4ba775003 Use MacOS.locate to find otool
Fixes #23111.
2013-10-07 21:32:18 -05:00
Misty De Meo 52af93123a Only track C++ stdlibs for C++ code
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.
2013-10-06 19:26:06 -07:00
Jack Nagel 2178b33dde Allow partial installation of resources 2013-09-17 21:29:54 -05:00
Jack Nagel e2554ccbe9 Open files in binary mode where appropriate 2013-09-16 12:50:31 -05:00
Adam Vandenberg b37bbbfc31 Implement Resources
Closes #20212.
2013-09-11 22:05:26 -07:00
Adam Vandenberg cbdc8dc58b pathname: remove unused return values
Return value was used only by one test, rewrote test to know expected value.
2013-08-13 20:41:08 -07:00
Jack Nagel f2689d502d Improve checksum perf by providing an output buffer 2013-08-13 15:40:48 -05:00
Jack Nagel 99976efeed Make usage of ObserverPathnameExtension more obvious
Remove use of globals.

Closes #21795.
2013-08-10 19:02:00 -05:00
Jack Nagel 3cf3749e6e Pathname#write: don't check ARGV.force?
Closes #21390.
2013-07-22 21:26:42 -05:00
Phil Smith da774ad4d9 typo
Closes #21385.

Signed-off-by: Adam Vandenberg <flangy@gmail.com>
2013-07-22 11:24:40 -07:00
Jack Nagel 411d064725 Handle NULs in link targets in Pathname#resolved_path_exists?
Fixes #19475.
Fixes #21184.
2013-07-13 16:56:43 -05:00
Jack Nagel 64ae87bb92 Don't use install_p directly 2013-07-06 11:29:33 -05:00
Jack Nagel 7a9ed17fbb Splatted parameter is always an array 2013-06-20 16:22:55 -05:00
Adam Vandenberg f7fbbe79f4 Remove adamv-alt references.
Closes #20364.
2013-06-09 07:32:06 -07:00
Adam Vandenberg ebc38db960 Sniff for non-tarred gzips
Don't try to untar non-tarred gzips.
2013-06-08 15:37:32 -07:00
Desmond Brand fc565bee26 Overwrite broken symlinks with --overwrite
Closes #19480.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2013-05-09 09:21:34 -05:00
Jack Nagel e51d0e4d0c Only remove DS_Store on ENOTEMPTY 2013-04-27 15:21:05 -05:00
Jack Nagel 9d1a86cda1 Avoid calling to_s on the same Pathname multiple times 2013-04-20 13:50:42 -05:00
Jack Nagel 4a0d57283e Performance fix for Pathname#prepend_prefix
See 05a456c231dc6da7cb0f7c70cb21feaf9a0d803c; same story.
2013-04-14 22:38:18 -05:00
Jack Nagel 05a456c231 Performance fix for Pathname#chop_basename
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+.
2013-04-14 21:56:04 -05:00
Jack Nagel bd15c06992 Recognize 7z files by magic bytes, not filename 2013-04-03 23:30:32 -05:00
Jack Nagel d52032f748 Adjust BOTTLE_EXTNAME_RX for :snow_leopard_32 2013-03-09 17:38:49 -06:00
Jack Nagel 18ff8a67fb Fix Regexp encoding under 1.9/2.0 2013-02-10 15:26:07 -06:00
Mike McQuaid 1da2d5dd92 Remove MD5 support.
Closes #17317.
2013-01-30 22:36:12 -08:00
Mike McQuaid 3318b08a2e Don't use underscores in (new) bottle filenames.
Closes #14270
2013-01-29 17:14:09 -08:00
Mike McQuaid e9eac42daa Cleanup old bottle syntax. 2013-01-29 17:14:00 -08:00
Shaun Jackman 47bde804c5 pathname.rb: Pass -s to du instead of -d0
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.html

Closes #16516.

Signed-off-by: Charlie Sharpsteen <source@sharpsteen.net>
2012-12-11 09:32:16 -08:00
Jack Nagel a5a530573a Rewrite plists when installing from a bottle 2012-11-25 15:11:57 -06:00
Mike McQuaid a1cdf9f64d Overwrite plists. 2012-11-25 20:53:04 +00:00
Adam Vandenberg 1184584bc2 Try to remove a single .DS_Store when uninstalling
Closes #12976.
Closes #15975.
2012-11-14 15:10:08 -08:00
Adam Vandenberg 3cfe157b06 Don't error out if metafiles are linked
Closes #16008.
2012-11-12 20:56:05 -08:00
Adam Vandenberg e7f2e449e7 Teach Pathname how to scan for metafiles 2012-11-11 10:45:58 -08:00
Sijawusz Pur Rahnama 38f121bd68 Add support for 7zip archives
Closes #15723.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-10-29 14:57:23 -05:00
Adam Vandenberg b40e5323ca Pathname: add exec and jar helpers
Closes #13318.
2012-10-27 19:28:42 -07:00
Misty De Meo f52ebe5fc7 brew ln --force is now brew ln --overwrite
* Renames --force to --overwrite, freeing up brew ln --force for #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
Misty De Meo f899878220 Don't count mkpath in ObserverPathnameExtension
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.
2012-10-04 21:37:37 -05:00
Jack Nagel 71dbaaae1b Improve text_executable heuristic
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>
2012-09-27 17:26:26 -05:00
Max Howell 0ed5daf86d Produce good error messages for bad tarballs 2012-08-29 12:41:33 -04:00
Jack Nagel 4affbabfb7 Replace version strings with Version objects 2012-08-18 11:12:08 -05:00
Jack Nagel acd2866bbc Move version detection to Version class
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 11:12:07 -05:00
Max Howell b96bd9ac3b Don't fail if ENOENT 2012-08-13 10:14:59 -04:00
Brandon Black 8aa4f9dd3b Fix issues with writable? detection in brew doctor
Closes #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 :/
2012-08-06 22:02:38 -04:00
Misty De Meo 305495f70a Synchronize Keg#link and #unlink counts
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.
2012-07-29 10:28:41 -03:00
Misty De Meo bf051054b6 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 #11811.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-07-09 12:01:09 -05:00
Jack Nagel a76bce6898 Decouple pathname from bottles
Pathname is one of the basic building block classes in Homebrew, and as
such it is preferrable that `require`ing it does not drag in other
Homebrew code; thus avoiding circular dependency situations. Its
dependency on bottles.rb gave it an implicit dependency on formula.rb,
among other things.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-05 20:32:55 -05:00
Jack Nagel 0c18ffd7fa Refactor checksumming
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-04 22:47:33 -05:00
Jack Nagel dc7b620754 Improve Pathname#text_executable? regexp
file(1) does not allow leading whitespace on shebang lines, and there
appears to be no restrictions on what characters follow '#!', either.

While at it, fix an erroneous shebang test.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-06-15 20:06:36 -05:00