2916 Commits

Author SHA1 Message Date
Andrew Janke
a74e872409 brew fetch: only include sha256 in output
Closes Homebrew/homebrew#50067.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-03-14 19:39:15 +08:00
Baptiste Fontaine
236a18debe audit: fix crash when HOMEBREW_NO_GITHUB_API is set
Running brew audit --strict --online on a formula with a GitHub
homepage/url would crash if HOMEBREW_NO_GITHUB_API is set because
GitHub.repository returns `nil` and the audit code assumes it always
returns a hash.

Closes Homebrew/homebrew#50054.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-03-14 19:39:15 +08:00
Andrew Janke
23ee1ee499 brew pull: fix encoding of brew info --json output
Fixes Homebrew/homebrew#49757
Closes Homebrew/homebrew#49775

Closes Homebrew/homebrew#49947.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-03-13 14:32:05 +08:00
Andrew Janke
f63b4359d7 brew pull: enable blocking bintray publish by setting content-type
Looks like the bintray publish_wait_for_secs was being ignored because the
content type wasn't being set, so it defaulted to x-www-form-urlencoded
instead of application/json.

Changes the  timeout to 0 to preserve current non-blocking behavior, which
we want in case multiple formulae are being updated.

Closes Homebrew/homebrew#49951.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-03-11 13:32:54 +08:00
Mike McQuaid
2c3a7e8c75 Fix brew update user agent.
This needs to be `Homebrew $HOMEBREW_VERSION` so we can be adequately
filtered.

Closes Homebrew/homebrew#49961.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-03-11 13:32:54 +08:00
Xu Cheng
0f6def90b7 update: shallow fetch for git_init_if_necessary
Users shouldn't need to fetch all of git history.

Closes Homebrew/homebrew#49903.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-03-09 19:47:26 +08:00
Xu Cheng
865b788e96 Revert "update: checkout branch unconditionally"
This reverts commit 0525c9eeea27eff1a6de05e7a01ec268ae07437b.
Which breaks `brew update --rebase`.
2016-03-09 17:38:46 +08:00
Mike McQuaid
041c8502c5 Set HOMEBREW_API_TOKEN from Git when available.
As requested in Homebrew/homebrew#46578. Falls back to existing functionality.

Closes Homebrew/homebrew#46578.

Closes Homebrew/homebrew#49846.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-03-08 20:52:11 +08:00
Xu Cheng
3a4f2c1aea update: checkout branch unconditionally 2016-03-08 20:36:19 +08:00
Xu Cheng
cad2a5620f update: passing --force to git fetch
Per document:
> -f, --force
>    When git fetch is used with <rbranch>:<lbranch> refspec, it refuses
>    to update the local branch <lbranch> unless the remote branch
>    <rbranch> it fetches is a descendant of <lbranch>. This option
>    overrides that check.
2016-03-08 20:36:19 +08:00
Xu Cheng
6f9f3faef3 test-bot: fix wrong tap argument check 2016-03-07 20:00:35 +08:00
Xu Cheng
5b63890198 test-bot: check if current repo is a tap
If it's not a tap, we test formula on CoreTap. This can happen
if we run test on a fork, e.g. Linuxbrew or future Homebrew/brew.

Closes Homebrew/homebrew#49844.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-03-07 19:43:46 +08:00
Xu Cheng
1e487edd21 tap various commands: use tap name method.
Instead of hard coded `Homebrew/homebrew`
2016-03-07 19:43:46 +08:00
Xu Cheng
28f3dae8cd rename CoreFormulaRepository to CoreTap
Core tap will be separated from core code in the near future.
It makes sense to rename it to CoreTap.
2016-03-07 19:43:46 +08:00
Tim D. Smith
b4edf23a36 test-bot: make bottle stats visible by default
Closes Homebrew/homebrew#49620.
2016-02-28 09:51:14 -08:00
Xu Cheng
eb6f970b90 tap: support --quieter flag
Closes Homebrew/homebrew#49551.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-26 18:42:36 +08:00
Xu Cheng
b52af53e71 various: use Tap abstraction
formula_rename and tap_migrations are now handled inside Tap.

Closes Homebrew/homebrew#49549.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-26 17:00:17 +08:00
Xu Cheng
2496bdf280 remove update-ruby
Closes Homebrew/homebrew#49523.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-25 23:05:39 +08:00
Xu Cheng
9a4987533a update-report: fix new_full_name in report 2016-02-25 17:27:50 +08:00
Xu Cheng
239c860863 update-report: refactoring
* Better variable/class name. `update-report` isn't response to actual
  update.
* Use abstraction offered by Reporter and ReproterHub class.
* Failure on one tap won't affect migration preformed by other taps.
* Simplify logic and prepare for core/formula separation.
2016-02-25 17:22:28 +08:00
Xu Cheng
95a6067702 update-report: refactoring ReporterHub
* Better variable/class name.
* Remove obsolete update_renamed, this is now handled inside each
  reporter.
* Remove obsolete formula file path to name computation, which is also
  handled by reporter.
* Hide low lever implementation detail to offer better abstraction.
  Use `add(reporter)` instead of `Hash#update` to add new report.
2016-02-25 17:22:28 +08:00
Xu Cheng
849e62c736 update-report: use tap inside Reporter
* Avoid tons of unnecessary file path manipulation. Use abstraction
offered by Tap class if possible.
* Handle formula rename/tap migration inside reporter in per tap basis.
* Avoid duplicated computation.
* Remove redundant/dead code.
2016-02-25 17:22:28 +08:00
Paul Phillips
6b6159a858 list: exclude .github from unbrewed
Recently added files polluting brew ls --unbrewed results.

Closes Homebrew/homebrew#49456.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-02-23 22:39:14 +01:00
Mike McQuaid
3505509bae update: better handle merge conflicts.
When there are merge conflicts we fail pretty hard. This is still
possible after this commit but at least we've given Git enough pointers
to make it less likely.

Closes Homebrew/homebrew#49299.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-22 09:00:35 +00:00
Xu Cheng
cfc5fed7ce update: fix fork bomb caused by brew update --help
Fixes Homebrew/homebrew#49334.

Closes Homebrew/homebrew#49343.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-19 17:28:37 +08:00
ilovezfs
8e6c3ab039 update: always checkout master.
This should help to prevent situations where a user accidentally ends up
"stranded" in a branch indefinitely.

Additionally, the stash is never popped automatically at the end of a
successful update, but the stash-pop message is printed if something is
stashed.

When an interrupt occurs, the original behavior is still in place
(switch back to the old branch and revision, and pop the stash), though
this could be changed as well.

This commit modifies the behavior of both `brew update` and
"update-bash.sh" in the manner described above.

The idea for this approach is from Mike McQuaid.

Issue Homebrew/homebrew#48812

Closes Homebrew/homebrew#48993.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-18 10:44:14 +00:00
Mike McQuaid
3ac1c7b653 update: use GitHub API to avoid unneeded fetches.
Check to see if `HEAD` is the same as what we have locally. If it is:
don't bother to `git fetch`.

Closes Homebrew/homebrew#47888.

Closes Homebrew/homebrew#49219.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-18 10:43:10 +00:00
Xu Cheng
4e51c0b8ea add Tap#formula_file?
Return true if given path would present a Formula file in this Tap.
Accepts both absolute path and relative path (relative to this Tap's path)

It offer an abstraction such that caller would not need to worry about
low level file system in the tap.

It will be used in `brew pull` and `brew update`.

Closes Homebrew/homebrew#49191.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-16 14:23:39 +08:00
Mike McQuaid
775c4eedd7 Promote update-bash to the default updater.
Also, rename the existing updater to `update-ruby` to allow using as
a fallback. It will eventually be removed.

Closes Homebrew/homebrew#49109.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-15 08:54:03 +00:00
Dominyk Tiller
b389953f5b style: update rubocop to 0.37.2
Closes Homebrew/homebrew#49084.

Signed-off-by: Dominyk Tiller <dominyktiller@gmail.com>
2016-02-13 02:16:17 +00:00
Mike McQuaid
59f1c24b43 cmd/update-bash.sh: print message on fetch fail.
Closes Homebrew/homebrew#49107.
Closes Homebrew/homebrew#49105.
Closes Homebrew/homebrew#48267.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-02-12 13:17:25 +00:00
Mike McQuaid
9d6a1a693e update-bash: don't prompt for passwords.
We execute too many `git fetch` at once for this to be useful. Just let
them fail instead and make it up to users to setup username/password
caching or SSH agents.
2016-02-12 13:17:17 +00:00
Andrew Janke
0322d9bd82 pull --bump: add auto-detection of devel bumps
Closes Homebrew/homebrew#48472.

Signed-off-by: Andrew Janke <andrew@apjanke.net>
2016-02-12 07:33:51 -05:00
Mike McQuaid
b06c6c74f9 audit: roughly double notability requirements.
Closes Homebrew/homebrew#48706.
2016-02-11 20:32:22 +00:00
Xu Cheng
e5b6f79b22 bottle: do not follow symlink when setting mtime
Also set atime to mtime, which seems to be a more common practice.

Fixes Homebrew/homebrew#49007

Closes Homebrew/homebrew#49027.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-02-10 21:01:12 +08:00
Misty De Meo
7b81066038 Audit: Regexp.escape formula names
We allow certain special regex characters in formula names, and if
those aren't escaped when interpolating them into a regex, they'll be
interpreted as special regex characters.

This can cause regex compile errors on Ruby 1.8 (for example, with
"libxml++3", which has nested match characters), and more subtle
matching bugs in general.

Refs an issue surfaced in Homebrew/homebrew#48744.

Closes Homebrew/homebrew#49005.

Signed-off-by: Misty De Meo <mistydemeo@gmail.com>
2016-02-09 15:33:38 -08:00
Misty De Meo
1ed7108052 Array#count alias didn't always exist
Fixes mistydemeo/tigerbrew#408.
2016-02-06 14:20:56 -08:00
Dominyk Tiller
58cf0ec2b9 audit: add check for insecure hackage urls 2016-02-04 14:57:55 +00:00
Baptiste Fontaine
cdd990f9d7 audit: use start_with? to check the name in the desc 2016-02-03 14:04:31 +01:00
Martin Afanasjew
5b89c33cac pull: fix ambiguity issues for tap migrations
`Formula[name]` gets called with an unqualified name and thus will throw
`TapFormulaAmbiguityError` exceptions (silently ignored) if both the old
and the new tap are present and changes for the new tap are pulled
before the migrated formulae are removed from the old tap.

The result is an empty or incomplete `changed_formulae`, causing issues
with pulling the corresponding bottles and possibly other problems, too.
2016-02-03 00:36:48 +01:00
Dominyk Tiller
557f6e33a9 audit: check resource placement 2016-01-31 00:39:29 +00:00
Xu Cheng
47d1c2c4e6 update-bash: don't be quiet for git init
The output will help to show git is initialized in the first time.
Hence, offer a better UX.
2016-01-28 19:32:41 +08:00
Xu Cheng
0ec5fec801 update-bash: git related improvement
* Use git function instead of refreshing bash cache on `git` path.
* Better `which_git`:
  * Take user's setting of `HOMEBREW_GIT` and `GIT` env variable into
    account.
  * Always expand git path.
  * Only check Xcode installation for OS X.

Closes Homebrew/homebrew#48508.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-01-28 19:03:38 +08:00
Xu Cheng
d1b7c91787 update-bash: fix git_init_if_necessary
* Make sure `.git` directory be deleted at any error. So we won't have a
  stale setup.
* Run `git fetch` and `git reset` when initialize git in the first time.
  Otherwise, we will get error and merging problem afterwards.

Closes Homebrew/homebrew#48509.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-01-28 19:03:24 +08:00
Mike McQuaid
e07b5a98e0 update-bash: fully resolve Git's path in hash.
Otherwise Bash can cache a relative PATH and then get upset when it
changes directory and cannot find it any more.

Closes Homebrew/homebrew#48493.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-27 10:25:34 +00:00
Martin Afanasjew
da47ca9213 bin/brew: put commands into 'homebrew-' namespace
This should help to avoid collisions with external commands and other
shell functions in the future and is closer to what we do in Ruby, where
commands are namespaced by being methods of the `Homebrew` module.
2016-01-26 16:26:08 +01:00
Martin Afanasjew
aa8329b5a0 update-bash: stop handling command name argument 2016-01-26 16:26:07 +01:00
Martin Afanasjew
6106ac9035 update-bash: discourage direct use
Remove the executable bit from the file to make it clear it is not
supposed to be executed directly. This should make the shebang line and
the early check also unnecessary.
2016-01-26 16:26:07 +01:00
Mike McQuaid
21924396f0 update-report: don't duplicate "already updated".
This would be displayed more than once when verbose output was enabled.

Closes Homebrew/homebrew#48469.
2016-01-26 09:09:20 +00:00
Xu Cheng
9d216a53f8 bottle: clear tab cache
We cached the tab file content during formula loading.
Let's discard them, so we can read tab content after relocation
2016-01-26 15:52:45 +08:00