Skip to content

services: default to canonical Linux service labels - #23837

Merged
MikeMcQuaid merged 1 commit into
mainfrom
services-canonical-linux-labels
Sep 6, 2026
Merged

services: default to canonical Linux service labels#23837
MikeMcQuaid merged 1 commit into
mainfrom
services-canonical-linux-labels

Conversation

@p-linnane

Copy link
Copy Markdown
Contributor

Phase two of moving the default Linux service label from homebrew.<formula> to sh.brew.<formula>, following #23792 and matching the macOS change in #23750. Generated systemd services and timers now use the canonical label for the unit filenames and the timer's Unit= target. Legacy homebrew.<formula> units stay discoverable and controllable, explicit name linux: labels and unrelated package-provided timer targets are unchanged, and macOS behavior is unchanged.

Migration is restart-only, as on macOS: start and run report a pending migration for a generated service loaded under the legacy label and point at brew services restart, which stops and disables the legacy units, removes their files and installs the canonical ones. Bundle keeps finding the legacy service file in existing kegs.

Two fixes found in review: systemd status discovery no longer lets an absent canonical unit mask a registered legacy unit that has stopped or failed, so brew services info keeps reporting its label, exit code and loaded file; and Keg#homebrew_created_file? now recognizes the sh.brew. prefix so canonical service files keep full-prefix relocation on /usr/local.


  • Have you followed our Contributing guidelines?
  • Have you checked for other open Pull Requests for the same change?
  • Have you explained what your changes do? Performance claims (e.g. "this is faster") must include brew benchmark results.
  • Have you explained why you'd like these changes included, not just what they do?
  • For bug fixes, have you given step-by-step brew commands to reproduce the bug?
  • Have you written new tests (excluding integration tests)? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) locally?

  • I did not use AI/LLM to create this PR, or I disclosed the tool/model below and reviewed its output; I did not attribute commits to AI and will answer maintainer questions and review comments myself without AI/LLM.

Claude Code (Fable 5.1) drafted the implementation and tests; I reviewed the diff, verified the new tests fail without the change and pass with it, and ran brew lgtm --online.


Signed-off-by: Patrick Linnane <patrick@linnane.io>
Copilot AI balanced review requested due to automatic review settings September 6, 2026 06:49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

馃煛 Changes recommended

Inactive legacy systemd units evade the real loaded-service probe, breaking restart-only migration.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

Moves generated Linux services to canonical sh.brew.* labels while retaining legacy compatibility.

Changes:

  • Defaults generated systemd services and timers to canonical labels.
  • Adds restart-driven legacy migration handling and status discovery fixes.
  • Updates relocation logic and regression coverage.
File summaries
File Description
Library/Homebrew/service.rb Changes the default systemd label.
Library/Homebrew/services/cli.rb Reports pending label migrations.
Library/Homebrew/services/formula_wrapper.rb Improves legacy status discovery.
Library/Homebrew/keg_relocate.rb Recognises canonical service files.
Library/Homebrew/test/service_spec.rb Updates generated timer expectations.
Library/Homebrew/test/services/cli_spec.rb Tests migration and legacy control.
Library/Homebrew/test/services/formula_wrapper_spec.rb Tests canonical paths and status.
Library/Homebrew/test/utils/service_spec.rb Tests compatible running labels.
Library/Homebrew/test/keg_spec.rb Tests canonical file recognition.
Library/Homebrew/test/formula_spec.rb Tests canonical formula helpers.
Library/Homebrew/test/formula_installer_spec.rb Tests canonical installed filenames.
Library/Homebrew/test/bundle/brew_services_spec.rb Tests legacy keg discovery.
Review details
  • Files reviewed: 12/12 changed files
  • Comments generated: 1
  • Review effort level: Balanced

馃挕 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.

Comment thread Library/Homebrew/services/cli.rb

@MikeMcQuaid MikeMcQuaid left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@MikeMcQuaid
MikeMcQuaid added this pull request to the merge queue Sep 6, 2026
Merged via the queue into main with commit 4cec090 Sep 6, 2026
53 checks passed
@MikeMcQuaid
MikeMcQuaid deleted the services-canonical-linux-labels branch September 6, 2026 11:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants