3989 Commits

Author SHA1 Message Date
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
Xu Cheng
1f2ca73ac1 bottle: ensure to restore relocation on text files 2016-01-26 15:50:17 +08:00
Mike McQuaid
ca8bb1a33c update-bash: release to non-developers.
Allow people to run this command (so we can ask people to test it)
without having to set `HOMEBREW_DEVELOPER`.

Closes Homebrew/homebrew#48260.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-25 16:33:52 +00:00
Baptiste Fontaine
e1875b7a43 audit: avoid false positive pkgshare problems 2016-01-25 17:19:51 +01:00
Baptiste Fontaine
e0c7b38aa7 audit: warn once about deprecated *Formula classes
GithubGistFormula inherits from ScriptFileFormula so a problem is added
for each one instead of the first only.
2016-01-25 01:26:24 +01:00
Xu Cheng
e3687a5ba2 update-bash: use array for QUIET_ARGS
Per @UniqMartin's advice, avoid disabling shellcheck rules.

Closes Homebrew/homebrew#48286.

Signed-off-by: Xu Cheng <xucheng@me.com>
2016-01-21 21:14:55 +08:00
Xu Cheng
e9096b0701 update-bash: explicitly tag local variables 2016-01-21 21:14:55 +08:00
Xu Cheng
eb54a6b5d5 update-bash: handle option flags like -vd
Per @UniqMartin's advice, the original code will fail to handle flags
like `-vd`, because once a case is handled, no other cases are evaluate.
2016-01-21 21:14:55 +08:00
Xu Cheng
58e0249609 update-bash: don't stash for --simulate-from-current-branch
When invoking --simulate-from-current-branch, we shouldn't do any file
manipulation.
2016-01-21 21:14:55 +08:00
Xu Cheng
f7c276a0be update-bash: fix revision variable setting
* only set HOMEBREW_UPDATE_BEFORE inside pull instead of fetch.
* fix HOMEBREW_UPDATE_BEFORE/AFTER variable settings. They should be set
  to INITIAL_REVISION and CURRENT_REVISION correspondingly.
* avoid unnecessary duplicated shellout.
* remove unused variable.
2016-01-21 21:14:55 +08:00
Xu Cheng
2f52ca9ded update-bash: kill all of subprocess on interrupt when fetching 2016-01-21 21:14:55 +08:00
Xu Cheng
2d84fc56fe update-bash: improve reset_on_interrupt
* make sure exit after reset.
* more wide guardian range. We should trap reset_on_interrupt as soon as
  we are about to change any files.
* check INITIAL_BRANCH against UPSTREAM_BRANCH
2016-01-21 21:14:55 +08:00
Xu Cheng
fafe8f0f53 update: implement rename_taps_dir_if_necessary in bash
rename_taps_dir_if_necessary must be performed before actual update.
Otherwise, it will report that `HOMEBREW_UPDAET_BEFORE<REPO_VAR>` is
unset.
2016-01-21 21:14:55 +08:00
Xu Cheng
ca59d6fbee update: improve repo_var
* use HOMEBREW_REPOSITORY instead of HOMEBREW_PREFIX
* better performance:
  * update-bash: avoid shellout
  * update-report: use strip_prefix and tr
* more robust:
  * explicitly handle the case when repo is HOMEBREW_REPOSITORY to avoid
    to handle the trailing backslash.
  * handle both lower case and upper case when stripping non alpha and
    digital characters.
2016-01-21 21:14:55 +08:00
Xu Cheng
9cd2658073 update-bash: avoid shellout for stripping prefix 2016-01-21 21:14:55 +08:00
Xu Cheng
83e1373376 update-bash: use odie and chdir from bin/brew 2016-01-21 21:14:55 +08:00
Xu Cheng
bc78f81032 update-bash: always use [[ 2016-01-21 21:14:55 +08:00
Xu Cheng
826f65cc2f update-report: skip non git tap 2016-01-21 21:14:55 +08:00
Xu Cheng
bb5cf70a02 update-bash: fix incorrect argument parsing 2016-01-21 21:14:55 +08:00
Martin Afanasjew
5786f36b62 tests: add --only=<test>[/<method>] flag
Simplify running a single test (or even a single method from a single
test), which is useful when developing or debugging a test. Instead of
`brew test TEST=test_diagnostic.rb TESTOPTS=--name=test_check_DYLD_vars`
it is now possible to run `brew tests --only=diagnostic/check_DYLD_vars`
to get the same effect. Similarly, `brew tests --only=diagnostic` maps
to `brew test TEST=test_diagnostic.rb`.

Closes Homebrew/homebrew#48279.

Signed-off-by: Martin Afanasjew <martin@afanasjew.de>
2016-01-21 05:42:06 +01:00
Martin Afanasjew
0d1e72f55f tests: allow passing --seed <number>
This parameter is printed by every `brew tests` run and feeding it back
into the test suite allows to get an identical run. Make it easier to
do that by accepting the argument as it is printed during `brew tests`.

This requires a slight adjustment to named-argument passing as the
number that follows `--seed` is also seen as a named argument, but we
usually only want to pass `TEST=<something>` and `TESTOPTS=<something>`.
2016-01-21 05:42:06 +01:00
Baptiste Fontaine
5775d3b326 command: support .sh commands
Closes Homebrew/homebrew#48192.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-01-20 22:27:13 +01:00
Baptiste Fontaine
c1e673e19a commands: support .sh commands 2016-01-20 22:27:13 +01:00
Baptiste Fontaine
f9fd251605 tap-readme: fix for Ruby 1.8
Closes Homebrew/homebrew#48281.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-01-20 20:15:34 +01:00
Baptiste Fontaine
861910b85f sh: flush stdout before executing the shell
Closes Homebrew/homebrew#48268.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-01-20 11:37:42 +01:00
Mike McQuaid
84a85b97ff Revert "formula_installed: tweak source build behaviour."
This reverts commit 5dd200c6b40f4fa9cc3a70cbc9ca2885e4626943.

Closes Homebrew/homebrew#47889.
2016-01-19 10:16:59 +00:00
Baptiste Fontaine
44a264376b tests: rm the coverage cache before each run
Closes Homebrew/homebrew#48209.

Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
2016-01-19 00:28:41 +01:00
Tommy Sparber
d675fa0b5a Search also in Caskroom/versions Tap
Extending the current search functionallity to search in
https://github.com/caskroom/homebrew-versions

Closes Homebrew/homebrew#47954.

Signed-off-by: Mike McQuaid <mike@mikemcquaid.com>
2016-01-17 21:53:20 +00:00