26 Commits

Author SHA1 Message Date
Michael Cho
f5c11fa342
Check host libstdc++ for brew gcc dependency
For most formulae, the bottles need a minimum libstdc++ rather than a
minimum GCC version. This is particularly important when building on
Ubuntu where the default compiler version is older than libstdc++.

So, checking the host libstdc++ version is a more accurate way to
determine whether brew GCC is needed at runtime. This can be improved in
the future to check symbol versions (e.g. GLIBCXX, CXXABI, GLIBC) which
can allow some bottles to be installed even with older glibc/libstdc++.
2025-09-12 14:15:56 -04:00
Douglas Eichelberger
fb6c51da07
Enable strict typing in SystemCommand 2025-09-02 10:26:40 -07:00
Rylan Polster
267afac198
Remove more monkey-patching in extend/os 2025-06-21 21:34:20 -04:00
Mike McQuaid
9ac306e464
Remove alias generic_* definitions in favour of using super
This is the pattern we've been adopting for a while and it's a bit
cleaner. Let's remove all of the existing usage of the existing pattern
to avoid confusion when adopting the new one.
2025-06-16 08:10:08 +00:00
Mike McQuaid
2b4324af9b
Update Linux GCC code.
Update both the variables that dictate this and the documents that
explain our GCC/glibc policies.

These should ease a future migration to a newer GCC version.
2025-04-03 12:47:21 +01:00
Issy Long
45978435e7
rubocop: Use Sorbet/StrictSigil as it's better than comments
- Previously I thought that comments were fine to discourage people from
  wasting their time trying to bump things that used `undef` that Sorbet
  didn't support. But RuboCop is better at this since it'll complain if
  the comments are unnecessary.

- Suggested in https://github.com/Homebrew/brew/pull/18018#issuecomment-2283369501.

- I've gone for a mixture of `rubocop:disable` for the files that can't
  be `typed: strict` (use of undef, required before everything else, etc)
  and `rubocop:todo` for everything else that should be tried to make
  strictly typed. There's no functional difference between the two as
  `rubocop:todo` is `rubocop:disable` with a different name.

- And I entirely disabled the cop for the docs/ directory since
  `typed: strict` isn't going to gain us anything for some Markdown
  linting config files.

- This means that now it's easier to track what needs to be done rather
  than relying on checklists of files in our big Sorbet issue:

```shell
$ git grep 'typed: true # rubocop:todo Sorbet/StrictSigil' | wc -l
    268
```

- And this is confirmed working for new files:

```shell
$ git status
On branch use-rubocop-for-sorbet-strict-sigils
Untracked files:
  (use "git add <file>..." to include in what will be committed)
        Library/Homebrew/bad.rb
        Library/Homebrew/good.rb

nothing added to commit but untracked files present (use "git add" to track)

$ brew style
Offenses:

bad.rb:1:1: C: Sorbet/StrictSigil: Sorbet sigil should be at least strict got true.
^^^^^^^^^^^^^

1340 files inspected, 1 offense detected
```
2024-08-12 15:24:27 +01:00
Michael Cho
bc2bb59726
extend/os/linux/system_config: show glibc/gcc version for API users 2023-08-26 22:19:32 -07:00
Maxim Belkin
c9b289fc3d Use 'wslview' instead of 'xdg-open' on Windows 2023-02-27 14:39:56 +00:00
Nanda H Krishna
d9d6a74257
brew style --fix 2023-02-06 13:48:18 -05:00
Sean Molenaar
84911edbed
system config: don't print WSL info on non-WSL systems
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2023-01-02 16:08:42 +01:00
Sean Molenaar
55c82749ad
SystemConfig: show WSL version if available on Linux 2022-12-30 20:48:24 +01:00
Bo Anderson
1201823095
extend/os/linux/system_config: support gcc 12 & keg-only glibc 2022-09-19 07:40:15 +01:00
Michka Popoff
0a292c7041
linux: use preferred_gcc instead of gcc 2021-02-09 21:48:48 +01:00
Markus Reiter
6e20d27582 Remove some unneeded requires. 2020-11-30 00:49:14 +01:00
Markus Reiter
61b79318ed Move include Kernel into .rbi files again and split up existing .rbi files. 2020-10-10 19:10:58 +02:00
Markus Reiter
24ae318a3d Move type annotations into files. 2020-10-10 14:59:39 +02:00
Maxim Belkin
40f1994eec system_config.rb: rename SYSTEM_RUBY_PATH to HOST_RUBY_PATH
Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2020-09-04 13:46:53 +00:00
Maxim Belkin
de736ffb7d system_config.rb: show system Ruby info on Linux 2020-09-03 19:25:58 +00:00
Markus Reiter
e2c9e6d3c2 Refactor and document SystemConfig. 2020-08-23 04:15:35 +02:00
Mike McQuaid
47769f98f1
os/linux: add, use OS::Linux.os_version
Similar to MacOS.version. A bit cleaner for us here but also plan on
using this in Homebrew/homebrew-bundle.
2019-09-13 16:48:13 +01:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Mike McQuaid
e03f07f302 Rubocop 0.53.0 automatic fixes. 2018-03-08 14:10:02 +00:00
Shaun Jackman
0575d7b610 config: Print host glibc version [Linux] 2017-12-07 10:37:19 -08:00
Shaun Jackman
06b9f1c50d config: Print the linked_version [Linux]
Otherwise when the keg was installed but out-of-date, it would display "N/A".
2017-12-02 09:27:39 -08:00
Shaun Jackman
0d5a53ba2c Add extend/os/linux/system_config.rb
Report the Linux kernel, OS, and gcc versions.
2017-03-16 17:59:26 -07:00