Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default_prefix: set macOS default prefix on Linux if simulating it #11605

Merged
merged 1 commit into from Jun 27, 2021

Conversation

dawidd6
Copy link
Member

@dawidd6 dawidd6 commented Jun 26, 2021

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

This should fix the doctor complaining on Linux in homebrew-core:

Warning: Your Homebrew's prefix is not /usr/local.
Some of Homebrew's bottles (binary packages) can only be used with the default
prefix (/usr/local).
You will encounter build failures with some formulae.
Please create pull requests instead of asking for help on Homebrew's GitHub,
Twitter or any other official channels. You are responsible for resolving
any issues you experience while you are running this
unsupported configuration.

Above snippet taken from (somewhat companion) PR: Homebrew/homebrew-core#80082

The DEFAULT_PREFIX should not be set to the macOS one when setting HOMEBREW_FORCE_HOMEBREW_ON_LINUX.
Since we have stricter env var (HOMEBREW_SIMULATE_MACOS_ON_LINUX), then use it rather than the former.

Also, doctor was right complaining about this issue of course, because now every bottle built for Linux in homebrew-core has the prefix set to the macOS one and I gotta rebuild those formulae after this PR is merged.
Example of latest Linux bottle JSON with wrong prefix:

{
  "pkg-config": {
    "formula": {
      "name": "pkg-config",
      "pkg_version": "0.29.2_3",
      "path": "Library/Taps/homebrew/homebrew-core/Formula/pkg-config.rb",
      "tap_git_path": "Formula/pkg-config.rb",
      "tap_git_revision": "a7d01ae87028dd276476059772dd4a4db2aa6a63",
      "tap_git_remote": "https://github.com/Homebrew/homebrew-core",
      "desc": "Manage compile and link flags for libraries",
      "license": "GPL-2.0-or-later",
      "homepage": "https://freedesktop.org/wiki/Software/pkg-config/"
    },
    "bottle": {
      "root_url": "https://ghcr.io/v2/homebrew/core",
      "prefix": "/usr/local",
      "cellar": "any_skip_relocation",
      "rebuild": 0,
      "date": "2021-06-26",
      "tags": {
        "x86_64_linux": {
          "filename": "pkg-config-0.29.2_3.x86_64_linux.bottle.tar.gz",
          "local_filename": "pkg-config--0.29.2_3.x86_64_linux.bottle.tar.gz",
          "sha256": "3d9b8bf9b7b4bd08086be1104e3e18afb1c437dfaca03e6e7df8f2710b9c1c1a",
          "formulae_brew_sh_path": "formula",
          "tab": {
            "homebrew_version": "3.2.0-59-g196ec61",
            "changed_files": [
            ],
            "source_modified_time": 1490029698,
            "compiler": "gcc-5",
            "runtime_dependencies": [
            ],
            "arch": "x86_64",
            "built_on": {
              "os": "Linux",
              "os_version": "Ubuntu 16.04.7 LTS",
              "cpu_family": "broadwell",
              "glibc_version": "2.23",
              "oldest_cpu_family": "core2"
            }
          }
        }
      }
    }
  }
}

Note that we might need to swap those two env vars set in homebrew-core publishing workflow, but I'm not sure if the change in this PR will somehow negatively influence the publishing process. Talking about this line:
https://github.com/Homebrew/homebrew-core/blob/e80285c224946e333261436a9baa18a6faf26103/.github/workflows/publish-commit-bottles.yml#L14

@dawidd6 dawidd6 added the critical Critical change which should be shipped as soon as possible. label Jun 26, 2021
@BrewTestBot
Copy link
Member

Review period skipped due to critical label.

@dawidd6
Copy link
Member Author

dawidd6 commented Jun 27, 2021

If set, running Homebrew on Linux will use URLs for macOS. This is useful when merging pull requests for macOS while on Linux.

From the manpage about HOMEBREW_FORCE_HOMEBREW_ON_LINUX. Nothing about paths.

@dawidd6 dawidd6 requested a review from iMichka June 27, 2021 07:50
@iMichka
Copy link
Member

iMichka commented Jun 27, 2021

I'm ok with the change. I'll let your merge it when you have time to do the follow up tests in homebrew-core

@dawidd6 dawidd6 merged commit aa14e48 into Homebrew:master Jun 27, 2021
@dawidd6 dawidd6 deleted the simulate-force-linux-prefix branch June 27, 2021 15:42
@MikeMcQuaid
Copy link
Member

Makes sense, thanks @dawidd6!

@github-actions github-actions bot added the outdated PR was locked due to age label Jul 29, 2021
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 29, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
critical Critical change which should be shipped as soon as possible. outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants