1421 Commits

Author SHA1 Message Date
Carlo Cabrera
faa58e6576
utils/github/api: avoid loading gh
This is causing errors in third-party taps after
Homebrew/homebrew-test-bot#934.

Fixes Homebrew/discussions#4546.
2023-05-31 23:43:24 +08:00
Carlo Cabrera
ff45c2822f
utils/github/api: fix nil implicit conversion error
Fixes

    Error: no implicit conversion of nil into String

https://github.com/Homebrew/homebrew-test-bot/actions/runs/5113802196/jobs/9193401244#step:11:11
2023-05-30 01:03:33 +08:00
Bjorn Neergaard
fc63aca46a utils/github/api: refactor keychain code to use system_command 2023-05-26 09:54:28 -06:00
Bjorn Neergaard
d634296109 utils/github/api: discover credentials stored by the GitHub CLI 2023-05-26 09:54:25 -06:00
Markus Reiter
e9bfcb9296
Merge pull request #15225 from reitermarkus/audit-os-arch
Add `--os=all` and `--arch=all` options for `brew audit`.
2023-05-19 15:03:32 +02:00
Markus Reiter
e7a9727f56
Simplify curl_download. 2023-05-19 14:39:46 +02:00
Markus Reiter
9885fbc129
Fix failing test. 2023-05-19 14:07:06 +02:00
Carlo Cabrera
6ac868a035
Merge pull request #15440 from carlocab/download-artifact-refactor
Refactor GitHub artifact downloads out of `dev-cmd/pr-pull`
2023-05-18 21:27:36 +08:00
Kevin
946478aed4
Merge pull request #15396 from apainintheneck/custom-service-name
Custom service name
2023-05-17 22:09:31 -07:00
Carlo Cabrera
4c0912d95c
utils/github/artifacts: minor improvements 2023-05-17 23:54:45 +08:00
Carlo Cabrera
d7870bb24d
Move artifact download code to separate file
This will help avoid mutually-recursive `require`s.
2023-05-17 23:48:58 +08:00
Markus Reiter
486c3765ce
Add --os=all and --arch=all options. 2023-05-17 15:26:46 +02:00
Carlo Cabrera
9260bd97e8
GitHubArtifactDownloadStrategy: fix initialize signature 2023-05-17 21:11:16 +08:00
Carlo Cabrera
d372eb86ca
utils/github: remove unnecessary chdir call
The only existing caller already has the requested directory as the
workign directory, so this is currently not needed.
2023-05-17 21:11:15 +08:00
Carlo Cabrera
05337cbb79
Refactor GitHub artifact downloads out of dev-cmd/pr-pull
I plan to use these in `test-bot` to download built bottles from
previous CI runs.
2023-05-17 21:11:15 +08:00
apainintheneck
1111706378 service: add custom service name DSL
The main thing is that this DSL allows us to provide an
interface that can be serialized to the JSON API.

Changes:
- Homebrew::Service
  - Adds `#service_name` and `#plist_name` methods
    - Each is now included in the `#serialize` method as well
  - Eval block on instantiation
    - Before we lazy evaluated this but the cost is not significant
      and it complicated the code a bunch. This only gets called
      during install, when evaluating caveats and in the `brew service`
      command. It skips this evaluation if the service block isn't there.
  - Add `#command?` helper to avoid `#command.blank?` and `#command.present?`
- Formula
  - `#service` now returns a service whenever it's called. This call is
    hidden behind a call to `#service?` most of the time anyway so this
    should be fine.
  - `#plist_name` and `#service_name` now call the methods of the same name
    on the service class. This should have already been in the service object
    to begin with and keeping these methods here helps preserve backwards
    compatibility with people who were overwriting these methods before.
- Caveats
  - Prefer `service#command?`
  - Add helpers for checking on service commands
    - This duplicates some of the work in `brew services`. Maybe we should
      merge that repo in at some point.
  - Check for installed service at `#plist_name` or `#service_name`. I think
    this should be used instead of `Keg#plist_installed?` which checked for any plist file.
    We should think about deprecating `#plist_installed?` in the future.
  - Stop using `ps aux | grep #{formula.plist_name}` to check for service files
    because it was inaccurate (it always returns true on my machine) because the grep
    process is started before the ps process.
  - Note: The behavior is the same as it was before. This means that caveats
    only show up for custom service files on install or if they're already installed.
    Otherwise it won't show up in `brew info`. This is because it has to check
    first if the service file has been installed.
- Utils::Service
  - Add utils for evaluating if a service is installed and running. This duplicates
    some of the work already found in `brew services`. We should seriously consider
    merging `brew services` with the main brew repo in the future since it's already
    tightly coupled to the code in the main repo.
- Formulary.load_formula_from_api
  - Be more explicit about which types can be deserialized into run params since
    it is now possible for run params to be nil.
- Update and add tests
2023-05-13 14:53:01 -07:00
Markus Reiter
4c3e8255cf
Compare Tag using standardized_arch. 2023-05-13 22:19:35 +02:00
Carlo Cabrera
0376c6c5c1
utils/github: use Pulls API to check open pull requests on CI
We currently use the search API to check for duplicate pull requests,
but this is not very reliable. Our `autobump.yml` workflow routinely
opens duplicate pull requests [1] because the search API often returns
incorrect results.

We can make this more reliable by using the Pulls API instead.
Unfortunately, querying the Pulls API is very slow (~10s vs less than a
second for the search API), so let's limit its usage to calls made
inside CI, which should help @BrewTestBot avoid opening duplicate PRs.
(Most recent dupes were authored by @BrewTestBot.)

[1] https://github.com/Homebrew/homebrew-core/pulls?q=is%3Apr+author%3ABrewTestBot+is%3Aunmerged+in%3Acomments+Duplicate
2023-05-10 13:08:32 +08:00
Markus Reiter
f7168bf234
Merge pull request #15336 from reitermarkus/version-head-null
Merge `HeadVersion` and `NullVersion` into `Version`.
2023-05-10 01:01:21 +02:00
Markus Reiter
4b787fdee2
Retry curl_headers on 400 codes. 2023-05-09 07:40:15 +02:00
Markus Reiter
e493d0cb04
Rescue ErrorDuringExecution instead of changing curl_headers return type. 2023-05-09 07:25:00 +02:00
Markus Reiter
8274920217
Rename OS::Mac::Version to MacOSVersion. 2023-05-09 05:08:38 +02:00
Sam Ford
16f3a05e45
Strategy#page_headers: Update for #curl_headers
`#curl_headers` was recently introduced into `Strategy#page_headers`
but only the call was modified and the method wasn't updated to
correctly work with the new return value, so all `HeaderMatch` checks
immediately started failing with an error.

This commit includes changes that return `#page_headers` to a working
state. I've removed the `result.assert_success!` call because it
prevents a few checks from being retried with `GET` (`firefox-cn`,
`krisp`, `prepros`).
2023-05-08 23:08:05 -04:00
Markus Reiter
353818f508
Rename curl_head to curl_headers. 2023-05-06 03:41:35 +02:00
Markus Reiter
545a332fef
Use curl_head and curl_output for Livecheck strategies. 2023-05-06 03:40:09 +02:00
William Woodruff
ea6423094b
pypi: normalize name in pypi_info
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-27 10:14:17 -06:00
Douglas Eichelberger
1df469b348 Enable strict typing 2023-04-26 09:27:00 -07:00
Douglas Eichelberger
65a4d9f627 Fix visibility modifiers 2023-04-26 09:16:55 -07:00
Douglas Eichelberger
a69fc11459 Hoist public method 2023-04-26 09:16:55 -07:00
Douglas Eichelberger
7229d03133 Switch from module_function to eigenclass 2023-04-26 09:16:55 -07:00
Douglas Eichelberger
8f97dea167 Remove other activesupport use 2023-04-26 09:16:55 -07:00
Douglas Eichelberger
03ee70b1ae Remove kernel/reporting extension 2023-04-26 09:16:55 -07:00
Douglas Eichelberger
08af78a2a5 brew style --fix 2023-04-25 09:26:24 -07:00
Mike McQuaid
c343e545c0
Merge pull request #15307 from woodruffw-forks/die-pipgrip
utils/pypi: replace `pipgrip` with `pip`'s built in dependency resolution
2023-04-25 09:36:23 +01:00
Douglas Eichelberger
24cf6076e8 brew style --fix 2023-04-24 20:42:39 -07:00
William Woodruff
62df91f09c
pypi: document normalization
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-24 20:52:35 -06:00
William Woodruff
1f671862d5
pypi: brew style --fix
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-24 20:29:05 -06:00
William Woodruff
12613ea2b0
pypi: unused arg
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-24 20:27:31 -06:00
William Woodruff
57af1abb6c
pypi: namespacing
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-24 20:12:09 -06:00
William Woodruff
ce8834e43e
[WIP] pypi: more name normalization
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-24 20:11:24 -06:00
William Woodruff
6e798a7ab8
[WIP] pypi: hackety hack
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-24 17:56:33 -06:00
William Woodruff
92225e9ec0
[WIP] pypi: filter_map sadness
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-24 17:55:18 -06:00
William Woodruff
727a88d025
[WIP] pypi: hackety hack
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-24 17:53:09 -06:00
William Woodruff
48a604e31c
[WIP] pypi: hackety hack
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-24 17:33:17 -06:00
William Woodruff
0316b9659f
[WIP] pypi: hackety hack
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-24 17:28:53 -06:00
William Woodruff
953c24a7c4
[WIP] pypi: fix python executable
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-24 17:23:22 -06:00
William Woodruff
ab7af6355d
[WIP] pypi: cut out pipgrip
Signed-off-by: William Woodruff <william@yossarian.net>
2023-04-24 17:05:51 -06:00
Bo Anderson
5b3cf28bbc
utils/gems: don't silently install gems during tests 2023-04-24 17:05:38 +01:00
Bo Anderson
e6c188affe
utils/gems: run bundle clean when install not required 2023-04-24 15:51:12 +01:00
Douglas Eichelberger
df5c5842cc Fix tests 2023-04-17 11:30:12 -07:00