190 Commits

Author SHA1 Message Date
Misty De Meo
ecfb175cdc Fix :gzip_only extraction
gunzip can only extract files in-place, so just shelling out to
gunzip was actually leaving the uncompressed file in Homebrew's cache,
not in the temporary directory. (It also destroyed the original
compressed file.)
2013-06-27 12:24:58 -05:00
Jack Nagel
083b3c84d0 Add Utils::JSON to wrap the JSON implementation 2013-06-22 21:34:02 -05:00
Adam Vandenberg
aff66c3b86 Sniff for non-tarred gzips
Don't try to untar non-tarred gzips.
2013-06-08 15:37:32 -07:00
Mike McQuaid
95f9c6227a Use new download strategy for local bottles.
Fixes installation of e.g. ScriptFileFormula/denominator bottles.
2013-06-08 16:41:23 +01:00
Adam Vandenberg
d5c331c072 CurlDownloadStrategy no longer uses ? in downloaded filenames
Strip `?` and trailing characters from URL extensions and basenames.

This makes some install methods cleaner, and prevents staging of files
with `?` in the name, as that is a weird character.

Affects 2 formulae in core (though potentially externals will need to be fixed.)
2013-06-07 20:57:59 -07:00
Jack Nagel
a8f5527f74 CurlDownloadStrategy: use opt path for xz 2013-06-07 16:35:21 -05:00
Shaun Jackman
fa7291f21b CurlDownloadStrategy: use with_system_path to locate tar
Closes Homebrew/homebrew#20316.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-06-07 16:35:14 -05:00
Samuel John
623b21a7bd mercurial: Install python bindings properly
Also allow to build with --HEAD by making brew's
download strategy aware of a brewed but unlined hg.

Adapted the caveats so that the procedure to brew
hg --HEAD is clear.

Mention how to config hgk in the caveats.
2013-06-04 17:05:02 +02:00
Samuel John
c524895666 Python 2.x and 3.x support
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.
2013-06-03 17:29:43 +02:00
Jack Nagel
68b3e6f3fb Add required methods to AbstractDownloadStrategy
Fixes Homebrew/homebrew#20080.
2013-05-26 09:16:27 -05:00
Jack Nagel
65775e4318 CurlDownloadStrategy: remove "tarball_path" accessor
This information is already exposed as "cached_location", which is
common to all download strategies.
2013-05-16 15:26:25 -05:00
Adam Vandenberg
13c604035b Retry downloads if a server doesn't support byte ranges
If an incomplete download exists, and the HTTP server doesn't support
byte ranges, delete the incomplete download and retry once.

Tested with freeling, whose server does not support byte ranges.

Closes Homebrew/homebrew#19757.
2013-05-13 07:32:03 -07:00
Xiyue Deng
869642e635 Fix download strategy for SVN HEAD
After converting to Pathname to create paths, using '+=' will result in
path concatenation by '/', which result in weird path like
'gcc--svn/-HEAD'. This patch should fix this.

Closes Homebrew/homebrew#19233.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2013-04-16 16:17:48 -05:00
Jack Nagel
1426b92a82 Only dup and shift when specs hash is populated 2013-04-16 14:18:23 -05:00
Jack Nagel
49682e854d Avoid expensive Pathname concatenation 2013-04-15 15:00:57 -05:00
Jack Nagel
841c8bedca Clean up remaining DownloadStrategy initializers 2013-04-15 15:00:57 -05:00
Jack Nagel
6ed441bd71 SubversionDownloadStrategy: *really* fix pathname concatenation 2013-04-08 23:07:21 -05:00
Jack Nagel
b681ed4200 SubversionDownloadStrategy: fix pathname concatenation
Fixes Homebrew/homebrew#19066.
2013-04-08 19:18:19 -05:00
Jack Nagel
8cf0f34aa7 Download strategies require a usable name
We should handle this case in some predictable way, but until we do,
let's raise a more appropriate exception. It would also be good to get
rid of the duplication here.
2013-04-07 20:59:50 -05:00
Jack Nagel
2288f63197 Tests for AbstractDownloadStrategy 2013-04-07 20:59:50 -05:00
Jack Nagel
9db0e68eb6 Unify indentation of access modifiers
These are class method calls, not some special keyword, and should be
indented as such (also all standard Ruby indenters do this).
2013-04-07 20:59:49 -05:00
Jack Nagel
0d45c3c0f2 Suppress uninitialized instance variable warnings 2013-03-28 17:37:29 -05:00
Mike McQuaid
9837bbda55 Add with_system_path to run using system PATHs.
Needed for Linux compatibility.
2013-03-11 18:26:25 +00:00
Jack Nagel
528072f7d7 GitDownloadStrategy: force checkouts
Local changes to the cached repository should not cause fetch or install
to error out.
2013-02-17 15:54:22 -06:00
Jack Nagel
6d1c6dcdea GitDownloadStrategy: reset after checkout during updates
Otherwise, if the local branch is behind the remote branch, or has
diverged, we will stage the wrong revision.
2013-02-17 15:53:35 -06:00
Jack Nagel
145647fc45 GitDownloadStrategy: factor out checkout args 2013-02-17 15:43:16 -06:00
Jack Nagel
612745352d GitDownloadStrategy: generalize has_tag? to has_ref? 2013-02-17 15:41:24 -06:00
Jack Nagel
2ef79d1387 GitDownloadStrategy: default to remote HEAD during checkout 2013-02-14 17:29:59 -06:00
Jack Nagel
166e262312 GitDownloadStrategy: quiet reset in non-verbose mode 2013-02-14 17:29:59 -06:00
Jack Nagel
5f5d6ace5f GitDownloadStrategy: only fetch from remote when necessary
When we are building from a tag, and that tag is already present in the
cached repository, we don't to hit the network; everything we need
already exists.
2013-02-14 17:29:58 -06:00
Jack Nagel
02ad6442e7 GitDownloadStrategy: extract checkout from #stage 2013-02-14 17:29:58 -06:00
Jack Nagel
8b27989d11 GitDownloadStrategy: split up submodule update and checkout 2013-02-14 17:29:58 -06:00
Jack Nagel
e186d9a136 GitDownloadStrategy: split #fetch into several methods 2013-02-14 17:29:58 -06:00
Jack Nagel
248891fde1 Avoid nil in URL specs 2013-02-11 20:52:07 -06:00
Jack Nagel
e22af69149 Catch JSON decoding errors in Apache download strategy
c.f. Homebrew/homebrew#17772.
2013-02-11 17:14:26 -06:00
Jack Nagel
7b8f4b3d19 kill dead code 2013-02-10 20:32:18 -06:00
Jack Nagel
8e2b8c1419 CurlDownloadStrategy: remove pointless type introspection 2013-02-10 20:10:15 -06:00
Jack Nagel
ef6d01fc8f download_strategy: move requires out of method
This can cause subtle issues when an exception is marshaled between the
build process and the main Homebrew process, as the marshaled exception
may contain URI objects even when the main Homebrew process has not
loaded the URI library.

Closes Homebrew/homebrew#17642.
2013-02-07 12:45:37 -06:00
Jack Nagel
f9670f5dda download_strategy: fix typo 2013-02-02 16:21:25 -06:00
Simon Sigurdhsson
af3bfab9db Make CurlDownloadStrategy resume aborted downloads
* `CurlDownloadStrategy#_fetch` (and the same methods in its
  subclasses) now fetches the file to a temporary path, and
  `CurlDownloadStrategy#fetch` moves it to the correct location.
* `Homebrew#cleanup` cleans the temporary files `CurlDownloadStrategy`
  creates if they're left in the cache.

Closes Homebrew/homebrew#13953.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2013-02-02 14:05:40 -08:00
Mike McQuaid
161b89ddf0 Add SourceForge bottle mirror selection.
Use ENV['HOMEBREW_SOURCEFORGE_MIRROR'].

Closes Homebrew/homebrew#15642.
Closes Homebrew/homebrew#17368.
2013-01-30 21:29:19 -08:00
Mike McQuaid
1107171f83 Cleanup old bottle syntax. 2013-01-29 17:14:00 -08:00
Jack Nagel
0a9f5c6867 CurlApacheMirrorDownloadStrategy: fetch mirrors in JSON format
Closes Homebrew/homebrew#16457.
2013-01-23 18:01:06 -06:00
Mike McQuaid
c4fb2b73e2 Support installing bottles from local files. 2012-12-01 12:45:23 +00:00
Mike McQuaid
c3313d084c Copy rather than move e.g. war files. 2012-11-25 23:03:29 +00: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
Jack Nagel
39ec66614b Test coverage for DownloadStrategyDetector
While at it, make it use class methods instead; no reason to instantiate
an object for this.

Eventually there should be some functional tests for the individual
strategies as well.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-10-15 17:45:48 -05:00
Jack Nagel
bab29bab72 GitDownloadStrategy: avoid unnecessary checkout
By default, git checks out the fetched ref after cloning the repo, but
this is unnecessary as we explicitly check out the desired ref during
staging. This also silences some unnecessarily confusing output.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-10-15 15:29:23 -05:00
Jack Nagel
799c164cd9 GitDownloadStrategy: silence checkout actions in non-verbose mode
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-10-15 15:29:23 -05:00
Jack Nagel
a0e575e5b6 GitDownloadStrategy: silence status check
"git status -s" is used to detect if the repository was corrupted during
an interrupted clone, but it can leak output to the terminal, so use
quiet_system.

Signed-off-by: Jack Nagel <jacknagel@gmail.com>
2012-10-15 15:29:23 -05:00