99 Commits

Author SHA1 Message Date
Shaun Jackman
9a4567c2f9 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 Homebrew/homebrew#16516.

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

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-10-29 14:57:23 -05:00
Adam Vandenberg
73b3977ab4 Pathname: add exec and jar helpers
Closes Homebrew/homebrew#13318.
2012-10-27 19:28:42 -07:00
Misty De Meo
447f78c0d2 brew ln --force is now brew ln --overwrite
* 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
2012-10-20 21:00:46 -05:00
Misty De Meo
dbdf2c78c3 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
dd4302ae9b 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
05991dd846 Produce good error messages for bad tarballs 2012-08-29 12:41:33 -04:00
Jack Nagel
329f0a8490 Replace version strings with Version objects 2012-08-18 11:12:08 -05:00
Jack Nagel
5fe7fdf153 Move version detection to Version class
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-08-18 11:12:07 -05:00
Max Howell
28ee57aa3c Don't fail if ENOENT 2012-08-13 10:14:59 -04:00
Brandon Black
bcde6432f3 Fix issues with writable? detection in brew doctor
Closes Homebrew/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 :/
2012-08-06 22:02:38 -04:00
Misty De Meo
3822267d2c 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
743b5e6feb 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 Homebrew/homebrew#11811.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2012-07-09 12:01:09 -05:00
Jack Nagel
9a72fecf84 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
76b2eee777 Refactor checksumming
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-07-04 22:47:33 -05:00
Jack Nagel
7002359f7a 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
Jack Nagel
1cce85b1f1 Handle EOF in Pathname#text_executable?
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-06-03 22:34:28 -05:00
Jack Nagel
a786178382 Pathname: add Mach-O module
The MachO module contains methods for learning about Mach-O binaries,
and can be used where one might normally shell out to file(1).

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-05-30 22:32:48 -05:00
Adam Vandenberg
32ea2e3ad0 Don't unzip war files 2012-05-03 20:40:04 -07:00
Adam Vandenberg
428781723b Detect uncompressed tars
From a patch by @RuiPereira

Closes Homebrew/homebrew#12011.
2012-05-03 20:31:00 -07:00
Adam Vandenberg
3ad19e08b7 Extract detection of compression types
Separate out detecting compression types from uncompressing and staging.
2012-05-02 19:57:33 -07:00
Mike McQuaid
995186a72c Fix Ruby warnings.
Fixes Homebrew/homebrew#11966.
2012-05-01 20:45:17 +08:00
Mike McQuaid
ebe4e07fa3 Change versioned bottle syntax and fix issues.
Fixed Homebrew/homebrew#11562.
2012-04-24 18:53:45 +10:00
Mike McQuaid
11f382705c Add and correctly find erlang bottle.
Fixes Homebrew/homebrew#11780.
2012-04-24 18:53:33 +10:00
Mike McQuaid
d69620a55e Revert "Add and correctly find erlang bottle."
This reverts commit 146e253856eb3e27b6b7382734fd178c160c1beb.
2012-04-24 18:10:09 +10:00
Mike McQuaid
4138d30428 Revert "Change versioned bottle syntax and fix issues."
This reverts commit f80908bead8b620ebcc5cdde9de65e70598002b6.
2012-04-24 18:10:08 +10:00
Mike McQuaid
dcad1ae49f Add and correctly find erlang bottle. 2012-04-24 18:08:14 +10:00
Mike McQuaid
40370e05bd Change versioned bottle syntax and fix issues.
Fixed Homebrew/homebrew#11562.
2012-04-24 18:08:14 +10:00
Misty De Meo
90400eceb1 make_relative_symlink: give more specific advice 2012-04-09 10:09:19 -05:00
Adam Vandenberg
bfbfdf03eb Show target path when empty 2012-03-30 23:02:43 -07:00
Adam Vandenberg
a0cb4e7c11 install: warn when passed no files
Rationale: we warn when inreplace makes no changes; this is a similar
sort of warning. We expected some list (probably via Dir) to include
some files, but none were found.

Either the list was wrong, or the install can now be omitted.
2012-03-30 22:36:45 -07:00
Max Howell
abfce0f6b2 Don't double print ln message in verbose mode
Refs Homebrew/homebrew#11091.
2012-03-22 09:33:41 +00:00
Max Howell
c3370c48ce Better error when linking fails
Refs http://stackoverflow.com/questions/9762943

The system ln no longer outputs anything. Though the user can force its output with a --verbose of course. So in cases where it's not the usual of: not writable or existing file, we can ask the user to run with --verbose. I don't particularly like hiding its output, but it just confused the error IMO since it is creating a relative symlink the output was weird every time I've seen it in tickets.

I made a print wrapper so that the brew-link output doesn't get mucked up if an exception is thrown.
2012-03-19 00:28:38 +00:00
Max Howell
ee73c30aa5 Tap more than one formula from taps other than alt
Whoops.
2012-03-16 21:31:59 +00:00
Max Howell
4c02b2276b Taps can only have one directory of formula
Rationale: Let's not have duplicate-names. Insisting on only one directory lets the filesystem enforce this unique-naming criteria for us.

We special-case adamv/alt for now, until we remove it.
2012-03-16 21:06:17 +00:00
Max Howell
e6cb8cbee9 Pathname.atomic_write 2012-03-16 21:06:17 +00:00
Max Howell
765ae96180 Leave kegs keg-only if linking step fails
Rationale: well, it should always have been like this!

However now we are opening ourselves up to more-mixed installations of formula not maintained by us, it's important that
2012-03-16 21:06:16 +00:00
Max Howell
0c7e7ae437 brew tap and brew untap 2012-03-16 21:06:15 +00:00
Adam Vandenberg
5aa6aefa96 Allow multiple digits in GitHub version parts 2012-03-11 14:37:44 -07:00
Mike McQuaid
552dcdc703 Move most bottle stuff to a bottles.rb file. 2012-03-10 18:10:40 +13:00
Mike McQuaid
4a306f32f4 Support bottles for non-Lion OSX versions. 2012-03-10 18:09:35 +13:00
Max Howell
1b4b8a722e Pathname.stem knows about bottles 2012-03-06 20:28:06 +00:00
Max Howell
bb6816dc4a Convert to Pathname if not Pathname as we need it to be 2012-02-21 12:45:45 +00:00
Adam Vandenberg
847a2732ee Update return values of install and install_symlink
These now return an Array of all the target destinations.
Previously, if a single argument was passed a single non-
Array was returned.

This behavior has been changed so that an Array is always returned
even for a single argument.

Updated the test.

Hopefully this won't break any custom code out there.
2012-02-17 23:07:16 -08:00
Adam Vandenberg
9ee5e14e6d Pathname.install_symlink 2012-02-12 20:08:56 -08:00