Now that a URL, version, and the (for lack of a better term) "specs"
associated with said URL (e.g. the VCS revision, or a download strategy
hint) are neatly bundled up in a SoftwareSpec object, it doesn't make
sense to pass them individually to download strategy constructors. These
constructors now take only the formula name and a SoftwareSpec as
parameters.
This allows us to move mirror handling out out of Formula#fetch and into
the download strategies themselves. While doing so, we adjust the mirror
implementation a bit; mirrors now assume the same "specs" as their
owner's URL. They are still only useable by the CurlDownloadStrategy,
but this provides a basis for extending mirror support to other
strategies.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
'which' only returns a Pathname or nil, and doesn't care about anything
sent to stderr, so just silence it by default and combine the two
methods.
ClosesHomebrew/homebrew#12115.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
The --depth option is apparently more nuanced that I had originally
thought, and while it does not actually break repositories, repeatedly
using "--depth 1" can cause problems depending on the structure of the
history.
Luckily, we don't actually need it to prevent the entire repository from
being fetched as long as the fetch respec is set correctly, which we do
since 7718c939b06987ff8f1ecd599c8ace6f998ce180.
FixesHomebrew/homebrew#12024.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
git-clone's --single-branch is too new, and Xcode 4.3's stock git
doesn't have it. Since we don't require git from Homebrew, don't use it.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
The current series of fetch invocations in GitDownloadStrategy has the
unfortunate behavior of fetching full history even in shallow clones
that only need the history between the clone point and the remote HEAD.
It should be possible to determine if it is actually necessary to fetch
the full history, including all tags, and if it is not to avoid this
overhead.
FixesHomebrew/homebrew#11958, and several other recurring problems.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
GIT_DIR is convenient, but it does not work when both a formula and
subformula try to stage a git checkout, as git will use the main
formula's repository when staging the subformula.
Stop setting it, and restore the kludge to the git-multipush formula.
FixesHomebrew/homebrew#10893.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
We now read six bytes instead of four in order to detect xz compression;
this broke rar detection which used a string literal instead of a regexp
for comparison.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Some build scripts want to inspect the git history, e.g. to determine
version strings. Rather than copy the repository into the build tree,
just setting GIT_DIR is enough for things to "just work".
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Rationale: some software (e.g. GNU Coreutils, GnuTLS 3.x), have started
distributing _only_ xz-compressed tarballs. There is no system XZ
utility provided by OS X, but it is necessary so that we can continue to
provide formulae for this software.
If XZUtils isn't installed, we abort and prompt the user to `brew
install xz`.
The `xz` command itself doesn't do any untarring, so we write the
decompressed archive to stdout and pipe it to tar.
Git checkouts that do not specify a branch should always reset to the
remote's HEAD, as some remotes have HEAD set to 'unstable' or some other
non-master branch.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
There was an UnsafeSubversionDownloadStrategy in a single formula
before, but a) it broke against later changes to
SubversionDownloadStrategy, and b) wasn't available to other formula.
Signed-off-by: Adam Vandenberg <flangy@gmail.com>
:sha was used to prevent the "--depth" option to git clone, but was
never actually used to checkout the SHA.
ClosesHomebrew/homebrew#7859.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
Also adjust output text slightly for prettiness.
A possibly useful side effect here is safe_system has a defined Exception (subclassing RuntimeError) now.
When installing with --HEAD, cached repo clones do "git fetch origin"
followed by "git reset --hard". This will only reset the working tree
and index to the state of the local HEAD, but Homebrew will think it's
updated and install anyway. "git reset --hard origin/master" will
achieve the desired result.
Should fixHomebrew/homebrew#7613.
Signed-off-by: Jack Nagel <jacknagel@gmail.com>
`svn up` doesn't take url argument; compare `svn help up` to `svn help checkout`
Apparently `svn up` can ignore this argument (not documented), but providing this
argument could confuse code readers into believing that changing the url will
switch the branch. It doesn't; the argument is ignored.
This fix was relayed to me, but I've studied it further before posting.
It is related to the bug where --HEAD installs reuse the wrong cache.
Reading the former code, one might hope that providing a changed URL would
have `svn up` change branches. It doesn't; the url was ignored.
ClosesHomebrew/homebrew#7159.
Signed-off-by: Max Howell <max@methylblue.com>
Bottles now pour purely, without doing all the other unnecessary stuff that happened before the `brew upgrade` code shuffle.
Formula.pourable? removed since it was install-specific metadata and not related to the formula itself. Now all such logic is in the FormulaInstaller which is much cleaner.
I also changed the bottle cache location to the normal directory and added a .bottle pre-extension. Thus you can see everything in one directory without messing about.
All Apache Formulae should be updated to use the closer.vgi script
to specify downloads rather than a random mirror that could be out
of date or compromised. Apache's closer.cgi does periodic health
checks.
The base URL for the mirror system is
http://www.apache.org/dyn/closer.cgi?path=#{filepath}
e.g.:
http://www.apache.org/dyn/closer.cgi?path=/couchdb/1.0.3/apache-couchdb-1.0.3.tar.gz
Note: The addition of the "Actually downloading..." message is sub-optimal
as the message should probably be emitted in _fetch() rather than fetch(),
but I didn't want to change the way Homebrew works today, so I'm leaving
this for mxcl & team to sort out or adopt :)