🌐 AI搜索 & 代理 主页
Skip to content

Conversation

@TravisEz13
Copy link
Member

Backport of #26281 to release/v7.6

Triggered by @TravisEz13 on behalf of @app/copilot-swe-agent

Original CL Label: CL-BuildPackaging

/cc @PowerShell/powershell-maintainers

Impact

REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.

Tooling Impact

  • Required tooling change
  • Optional tooling change (include reasoning)

This backport changes the build dependencies from Ruby gems (fpm, dotenv, ffi, rexml) to native packaging tools (dpkg-deb for Debian-based systems, rpmbuild for RPM-based systems). Build agents and developers will no longer need Ruby gem installation for package creation. The Start-PSBootstrap function now checks for dpkg-deb and rpmbuild availability instead of installing fpm gems.

Customer Impact

  • Customer reported
  • Found internally

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

This backport was tested by verifying that the original PR successfully removed the Ruby gem dependency on fpm and replaced it with native dpkg-deb for DEB packages. The changes were validated against the release/v7.6 branch. Cherry-pick resulted in merge conflicts in build.psm1 and tools/packaging/packaging.psm1, which were resolved by accepting all THEIRS changes to fully implement the infrastructure change.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

This is an infrastructure change that replaces Ruby gem dependencies (fpm) with native Linux packaging tools (dpkg-deb for DEB, rpmbuild for RPM). While this significantly changes the build tooling, it simplifies the dependency chain and uses well-tested system tools. The change has been proven stable in the master branch and the risk is mitigated by the fact that it removes external dependencies rather than adding them.

Merge Conflicts

Conflicts occurred in 2 files during cherry-pick: 1) build.psm1 (2 conflicts): Conflict 1 expanded ValidateSet parameter to include 'Tools' and 'All' options with documentation comments. Conflict 2 replaced Install-GlobalGem calls for Ruby gems with native tool checks for rpmbuild and dpkg-deb. 2) tools/packaging/packaging.psm1 (7 conflicts): Removed fpm-specific macOS symlink workaround, replaced Get-FpmArguments function (146 lines) with New-NativeDeb function implementing dpkg-deb packaging, added New-MacOSPackage function for native macOS packaging, updated Test-Dependencies to check for dpkg-deb instead of fpm. All conflicts were resolved by accepting THEIRS changes to fully implement the native packaging infrastructure.

Copilot AI review requested due to automatic review settings November 20, 2025 21:30
@TravisEz13 TravisEz13 added the CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log label Nov 20, 2025
@TravisEz13 TravisEz13 requested a review from a team as a code owner November 20, 2025 21:30
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR backports changes from #26281 to the release/v7.6 branch, removing the Ruby gem dependency (fpm, dotenv, ffi, rexml) for Linux package creation and replacing it with native packaging tools. DEB packages now use dpkg-deb, RPM packages use rpmbuild, and macOS packages use pkgbuild/productbuild.

Key changes:

  • Removed Install-GlobalGem function and all fpm-related installation code from build.psm1
  • Added New-NativeDeb function to create DEB packages using native dpkg-deb
  • Added New-MacOSPackage function to create macOS packages using native pkgbuild/productbuild
  • Updated Start-PSBootstrap to check for and install dpkg-deb and rpmbuild instead of Ruby gems
  • Updated test expectations to require packages rather than skipping when not found

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 13 comments.

File Description
tools/packaging/packaging.psm1 Replaces fpm-based package generation with native tools: adds New-NativeDeb for DEB packages, New-MacOSPackage for macOS packages, and removes fpm-specific workarounds and the Get-FpmArguments function
build.psm1 Removes Ruby gem installation (Install-GlobalGem function), updates bootstrap to check for native packaging tools (dpkg-deb, rpmbuild), and adds new bootstrap scenarios ('Tools', 'All')
test/packaging/linux/package-validation.tests.ps1 Adds DEB package validation tests and changes from skipping when packages are missing to requiring packages to exist

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 2043 to 2077
$distributionPackage = New-MacOsDistributionPackage `
-ComponentPackage (Get-Item $componentPkgPath) `
-PackageName $Name `
-Version $Version `
-OutputDirectory $CurrentLocation `
-HostArchitecture $HostArchitecture `
-PackageIdentifier $pkgIdentifier `
-IsPreview:($Name -like '*-preview')
Copy link

Copilot AI Nov 20, 2025

Choose a reason for hiding this comment

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

The New-MacOSPackage function calls New-MacOsDistributionPackage with parameters (-ComponentPackage, -PackageName, -Version, -OutputDirectory, -PackageIdentifier) that don't match the function's signature. The existing New-MacOsDistributionPackage function (line 1458) only accepts -FpmPackage, -HostArchitecture, and -IsPreview parameters.

The comment at line 2042 mentions "using the refactored function", which suggests that New-MacOsDistributionPackage should have been refactored as part of this PR to accept the new parameter set, but this refactoring appears to be missing.

This will cause a runtime error when attempting to create macOS packages since PowerShell will complain about unrecognized parameters.

Copilot uses AI. Check for mistakes.
@TravisEz13 TravisEz13 force-pushed the backport/release/v7.6/26281-7e1ef1f74 branch from 93d230d to c95e9c1 Compare November 24, 2025 20:41
@TravisEz13
Copy link
Member Author

Branch updated with prerequisite PR #26326

This backport was failing due to missing prerequisite PR #26326 (log grouping functions). PR #26326 has now been merged to v7.6 via PR #26524.

Conflict Resolution:

  • build.psm1 line 2263: Added Tools and All to ValidateSet parameter for \, matching the main branch while preserving v7.6's code structure
  • build.psm1 line 2397: Replaced fpm installation code with dpkg-deb installation, adapted the condition from \ -in 'All', 'Both', 'Package'\ to v7.6's syntax \ -eq 'Both' -or \ -eq 'Package'`n
    The backport now includes the Write-LogGroup functions needed by the DEB packaging code.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 8 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@TravisEz13
Copy link
Member Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@SeeminglyScience SeeminglyScience left a comment

Choose a reason for hiding this comment

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

LGTM!

@TravisEz13 TravisEz13 merged commit 391284f into PowerShell:release/v7.6 Nov 25, 2025
42 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-BuildPackaging Indicates that a PR should be marked as a build or packaging change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants