1285 Commits

Author SHA1 Message Date
Bo Anderson
c93bc7df45
utils/gems: fix bundler sometimes unnecessarily reinstalling 2023-06-06 23:32:52 +01:00
Mike McQuaid
286e175a31
Revert "PyPI: Handle non-pythonhosted formula URLs" 2023-06-05 17:21:56 +01:00
William Woodruff
0f40e224bd
utils/pypi: refactor instance variables
Signed-off-by: William Woodruff <william@yossarian.net>
2023-06-05 10:16:19 -04:00
William Woodruff
7067f72eb0
utils/pypi: fix sig
Signed-off-by: William Woodruff <william@yossarian.net>
2023-06-04 23:49:20 -04:00
William Woodruff
af6f728eb4
utils, test: rewrite PyPI::Package
This rewrites the `Package` class from the ground up
to better accomodate non-PyPI URLs.

The existing APIs are largely preserved, but with
clearer invariants around when they can or can't be used
(e.g., `#pypi_info`).

Signed-off-by: William Woodruff <william@yossarian.net>
2023-06-04 23:32:09 -04:00
William Woodruff
0b3a5d0f6c
utils/pypi: set default from_pypi
Signed-off-by: William Woodruff <william@yossarian.net>
2023-06-04 00:36:23 -04:00
William Woodruff
685693a8fe
utils/pypi: enforce non-pypi urls
Signed-off-by: William Woodruff <william@yossarian.net>
2023-06-04 00:27:34 -04:00
William Woodruff
f8d6dd4b94
utils/pypi: ensure Python
Signed-off-by: William Woodruff <william@yossarian.net>
2023-06-03 23:47:41 -04:00
William Woodruff
009ebff85c
utils/pypi: trim exception
Signed-off-by: William Woodruff <william@yossarian.net>
2023-06-03 23:17:59 -04:00
William Woodruff
d8b6bb2d4c
utils/pypi: more docs
Signed-off-by: William Woodruff <william@yossarian.net>
2023-06-03 23:15:44 -04:00
William Woodruff
43ba30e8a9
utils/pypi: style
Signed-off-by: William Woodruff <william@yossarian.net>
2023-06-03 23:13:26 -04:00
William Woodruff
f923b337b7
utils/pypi: support for non-pythonhosted urls
Signed-off-by: William Woodruff <william@yossarian.net>
2023-06-03 23:09:49 -04:00
Carlo Cabrera
f7d86ff9bc
Merge pull request #15398 from carlocab/pulls-api
utils/github: use Pulls API to check open pull requests on CI
2023-06-02 12:05:27 +08:00
Carlo Cabrera
fb73f074b6
utils/github: clarify comment
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-06-02 11:52:11 +08:00
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