414 Commits

Author SHA1 Message Date
Shaun Jackman
133ee7966d shell: Use .profile unless .bash_profile exists 2020-05-13 09:30:02 -07:00
Mike McQuaid
84a110744a
utils/fork: check for inner exception command.
If it's not present then `ErrorDuringExecution` and `BuildError` don't
work correctly so better to fall back to a default `RuntimeError`.
2020-05-12 10:26:09 +01:00
Mike McQuaid
6123cdb767
Improve Homebrew Portable Ruby messaging
As-of https://github.com/Homebrew/homebrew-portable-ruby/pull/100 we've
removed ARM builds for Portable Ruby due to months of breakage.
Similarly, when we last bumped Portable Ruby the ARM build was much
delayed but, despite Homebrew/brew being completely unusable to anyone
using it on ARM in that case, no-one complained or filed issues.

Instead of attempting to maintain and update a Portable Ruby on niche
(Homebrew) platforms like ARM (or, in past/future PPC) improve the
messaging to provide users with a workaround.

Now we allow only a major/minor version match it should be pretty
doable for those users to install e.g. a prebuilt Ruby binary from a PPA
or built it from source if needed using `ruby-build` and `rbenv`.

The messaging could be improved further but we're somewhat limited by
`ruby.sh` and `vendor-install.sh` being separate. I'm tempted to combine
them (or at least have `vendor-install.sh` not be so generic as to not
be able to give Ruby-specific advice).
2020-05-02 13:53:45 +01:00
Eric Knibbe
fa1ce146e4 ruby.sh: allow running on older ruby versions 2020-04-22 17:36:00 -04:00
EricFromCanada
0acfb4b819 Add line break and indent to subcommand descriptions 2020-04-19 11:50:28 -04:00
Jonathan Chang
286488f753 github: add sponsors GraphQL API 2020-04-17 17:16:54 +10:00
Jonathan Chang
951cf09d4b pr-pull: eliminate another curl call
We're setting the basename, so no need to make a curl call to figure out
what it ought to be. This should speed up bottle pulls even more.
2020-04-14 13:41:35 +10:00
Bo Anderson
a6d3e3c47c utils/github: form encode workflow branch 2020-04-13 21:22:01 +01:00
Jonathan Chang
c1ba9975b8 pr-pull: fetch artifacts with no-resume strategy 2020-04-13 19:59:22 +10:00
Mike McQuaid
73df5891ef
Merge pull request #7283 from claui/fix-make-tmpfile
Ensure TMPDIR is set for Xcode’s `make`
2020-04-11 13:11:30 +01:00
Claudia
29538c89cd
Set TMPDIR for Xcode’s make
This fixes an issue where at least in Xcode 11.0, `make` uses
`/var/tmp` as a fallback for temporary files unless `TMPDIR` is set:

```
$ strings "$(xcrun -f make)" | grep -B 3 fopen
TMPDIR
/var/tmp/
GmXXXXXX
fopen (temporary file)
```

Given that Homebrew filtered `TMPDIR`, and the `/var/tmp` directory may
not be writable for non-root users, this would cause Homebrew’s
build environment to error out:

```
$ brew ruby -e 'puts ENV["TMPDIR"]; puts `: | make -f -`'
```

```
Ignoring bigdecimal-2.0.0 because its extensions are not built. Try: gem pristine bigdecimal --version 2.0.0
[…]
Ignoring zlib-1.1.0 because its extensions are not built. Try: gem pristine zlib --version 1.1.0
make: *** fopen (temporary file): Permission denied.  Stop.
```

In practice, this would break `brew audit`, `brew style`, and other
commands, which would run `make` to build native gem extensions.

This commit sets `TMPDIR` to `${HOMEBREW_TEMP}` in the gem environment, which
mirrors the behaviour we already have in other places.
We choose `HOMEBREW_TEMP` because that’s user-controlled but also falls
back to `/tmp` in case `TMPDIR` is not set in the user’s environment.

Thanks to Bo Anderson for helping find the bug.

CC: Bo Anderson <mail@boanderson.me>
2020-04-11 08:01:05 +02:00
Mike McQuaid
3381cbf5c7
Use Homebrew::EnvConfig. 2020-04-07 09:58:26 +01:00
Bo Anderson
846166c62f utils/gems: prioritise Homebrew's chosen Ruby 2020-04-05 15:38:10 +01:00
Dawid Dziurla
e1ce5c852d
github: return output if JSON parsing is not desired 2020-04-01 13:23:54 +02:00
Jonathan Chang
39040fba8b utils/github: properly use token scopes 2020-03-31 22:11:06 +11:00
Jonathan Chang
5b1d0786a4 utils/github: add fetch_artifact API 2020-03-30 22:18:19 +11:00
Vítor Galvão
2e8aa3eb97 Use long --disable instead of short -q in curl 2020-03-29 20:04:37 +01:00
Bo Anderson
119b3fe69a utils/shebang: add rewrite_shebang 2020-03-27 13:04:39 +00:00
Jonathan Chang
7c752e487f pr-publish: wording fixes 2020-03-24 12:31:58 +11:00
Jonathan Chang
4bb66c12e8 utils/github: add repository_dispatch API 2020-03-22 13:24:07 +11:00
Markus Reiter
50b61fa7f2 Retry curl requests 3 times by default. 2020-03-20 18:40:43 +01:00
Mike McQuaid
1e265247ca
rubocop: apply autofixes. 2020-03-13 21:16:18 +00:00
Mike McQuaid
8f98b2bcc4
analytics: tweak behaviour.
- Use separate method for `not_this_run?` so we can still set the
  analytics message as seen when set.
- Clarify when analytics message is printed that we haven't sent any
  analytics yet.
2020-02-22 17:13:51 +00:00
Mike McQuaid
02cc419a23
utils/bottles: delegate methods. 2020-02-19 11:54:42 +00:00
Mike McQuaid
f31e01c3ad
test: set Git name and email.
Extract the code from `bottle.rb` into `utils/git.rb` and ensure it's
run before we run tests.

Should resolve issues like in
https://github.com/Homebrew/homebrew-core/pull/50328
2020-02-17 19:40:44 +00:00
Mike McQuaid
bbe300ab2a
Merge pull request #6983 from GauthamGoli/argv-cleanup-9
ARGV: Replace ARGV.verbose? with Homebrew.args.verbose?
2020-02-02 15:41:47 +01:00
Gautham Goli
acde828a45 ARGV: Replace ARGV.verbose? with Homebrew.args.verbose? 2020-02-02 14:00:04 +01:00
Mike McQuaid
8471421c86
utils/ruby.sh: fix macOS portable Ruby detection.
Avoid unconditionally installing due to a variable name change.
2020-02-01 19:10:17 +01:00
Mike McQuaid
0b09c07862
ruby.sh: fix whitespace and tweak required ruby version check. 2020-02-01 12:49:35 +01:00
Emre Erhan
cad7f98527
Clean up variable names
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
2020-01-31 15:17:32 -08:00
emreerhan
a1102f253c Remove checks to variable that is not set anywhere 2020-01-30 15:48:41 -08:00
emreerhan
027cc68534 Add condition to check if ruby version is < 2.7 2020-01-30 15:01:26 -08:00
Mike McQuaid
8ad50cd4dc
utils/github: refactor and update logic.
- better handle `HOMEBREW_GITHUB_API_USERNAME` and
  `HOMEBREW_GITHUB_API_PASSWORD` from `brew gist-logs`
- only user personal access tokens from the macOS keychain (fixes #6862)
- general refactoring and cleanup around the above
2020-01-09 16:13:44 +00:00
Mike McQuaid
682ac2a3b8
utils/gems: hardcode bundler version.
This should avoid issues like those described in:
https://discourse.brew.sh/t/bump-pr-formula-bundler-version/6520/3
2020-01-01 15:47:06 +00:00
Mike McQuaid
5dd8ead51a
Rename Formula#installed? to Formula#latest_version_installed?
This naming has always been a bit weird and confusing so let's change
it and provide a `compat` fallback for later deprecation.
2019-12-03 11:42:42 +00:00
Maxim Belkin
2735663dc3
GitHub Actions: get username if we don't have it 2019-11-25 16:43:29 -06:00
Mike McQuaid
6d6d2c0bbf
utils/analytics: fix refactoring rename.
Fixes a bug from #6639.
2019-11-22 10:39:16 +00:00
Mike McQuaid
3a9f585ebb
Move more code to utils/analytics. 2019-11-22 09:10:29 +00:00
Mike McQuaid
28635a7fe4
Merge pull request #6723 from maxim-belkin/gh-actions/no-fork-prs
bump-formula-pr: enable same-repo (no-fork) Pull Requests
2019-11-22 09:06:48 +00:00
Maxim Belkin
c7f065b8da
utils/github.rb: use parallel assignments rather than indices
Co-Authored-By: Mike McQuaid <mike@mikemcquaid.com>
2019-11-21 11:13:10 -06:00
Maxim Belkin
845f65b945
Factor out some code into functions 2019-11-21 11:13:10 -06:00
Alexander Bayandin
b7b5a60f86 utils/inreplace: do not allow to use empty list of files 2019-11-21 16:49:06 +00:00
Dawid Dziurla
f90612ccf0
bump-formula-pr: make it usable on linux
This commit makes it possible to use `bump-formula-pr` on linux to
contribute to `homebrew-core` as easily as it is on macOS, but with some
additional steps made before actual bumping of the formula.

Differences in the process (before bumping):
- add `homebrew-core` remote named `homebrew`
- fetch `homebrew/master`
- check if formula exists in `homebrew-core`
- switch to `homebrew/master` ref
2019-11-15 13:22:31 +01:00
Mike McQuaid
3609101728
utils/gems: fix finding bundler.
Need to specify the executable name not variable here.
2019-11-01 17:04:27 +00:00
Mike McQuaid
77531166d6
Use bundler from Ruby 2.6
Now Ruby comes with its own bundler let's favour using it when we can
over requiring a system one be installed.

This avoids needing to have anything in `~/.gem` again.

I am somewhat optimistic this may help with #6579 but it's useful
by itself.
2019-10-30 13:49:17 +00:00
Markus Reiter
d37831219d Use temp file for calculating hash. 2019-10-29 19:50:07 +01:00
Markus Reiter
7a5e4d1269 Remove User::automation_access?. 2019-10-22 07:38:35 +02:00
Markus Reiter
0a175c4feb
Merge pull request #6625 from reitermarkus/rubocop-namespace
Fix RuboCop namespace.
2019-10-22 01:46:05 +02:00
Markus Reiter
f099d44021 Add GitHub::create_check_run function. 2019-10-21 20:12:31 +02:00
Markus Reiter
6c03cc0040 Fix RuboCop namespace. 2019-10-21 20:09:56 +02:00