Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@TravisEz13
Copy link
Member

Backport of #26429 to release/v7.4

Triggered by @TravisEz13 on behalf of @TravisEz13

Original CL Label: CL-BuildPackaging

/cc @PowerShell/powershell-maintainers

Impact

Tooling Impact

  • Required tooling change

This backports a fix for macOS package naming for preview releases to ensure consistent naming patterns across releases.

Customer Impact

  • Customer reported
  • Found internally

Regression

  • Yes
  • No

This is a packaging improvement to maintain consistent naming patterns, not fixing a regression.

Testing

Original PR was tested through CI/CD pipeline validation. Backport verified by:

  1. Cherry-pick applied cleanly without conflicts
  2. Changes are isolated to packaging configuration
  3. No functional code changes that require additional testing

Risk

  • High
  • Medium
  • Low

Medium risk as it affects packaging infrastructure, but changes are well-scoped to macOS preview package naming only. Not taking this change would create inconsistency in package naming patterns between versions.

@TravisEz13 TravisEz13 requested a review from a team as a code owner November 12, 2025 19:44
Copilot AI review requested due to automatic review settings November 12, 2025 19:44
@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 12, 2025
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 #26429 to remove the "powershell-preview" prefix from macOS package names for preview releases. Preview releases are now identified by the version string itself (e.g., "7.6.0-preview.6") rather than a package name prefix, aligning with naming patterns used in other release types.

Key Changes:

  • Removes "powershell-preview" package naming prefix; preview versions now identified by version string only
  • Updates regex validation patterns to match the new naming convention
  • Removes legacy macOS 10.12 pattern from validation

Reviewed Changes

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

File Description
tools/packaging/packaging.psm1 Removes preview-specific package naming logic, but incorrectly removes $IsPreview variable still needed for installation paths
test/packaging/macos/package-validation.tests.ps1 Updates validation regex pattern and example comments to reflect new naming without "preview" prefix
.pipelines/templates/release-validate-packagenames.yml Updates package name validation regex and removes deprecated macOS 10.12 pattern

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

Comment on lines 1147 to +1150
# Determine if the version is a preview version
$IsPreview = Test-IsPreview -Version $Version -IsLTS:$LTS

# Preview versions have preview in the name
# Only LTS packages get a prefix in the name
# Preview versions are identified by the version string itself (e.g., 7.6.0-preview.6)
# Rebuild versions are also identified by the version string (e.g., 7.4.13-rebuild.5)
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

Critical Bug: This change removes the $IsPreview variable assignment, but the variable is still used later in the function on lines 1168, 1184, and 1198, causing an undefined variable error.

The change correctly removes "powershell-preview" from package naming, but incorrectly removes the $IsPreview variable that's needed for:

  • Installation path suffix determination (line 1168: $Suffix = if ($IsPreview) { ... })
  • Executable path generation (line 1184: Get-PwshExecutablePath -IsPreview:$IsPreview)
  • Man page generation (line 1198: New-ManGzip -IsPreview:$IsPreview -IsLTS:$LTS)

Fix: Restore the removed lines:

$IsPreview = Test-IsPreview -Version $Version -IsLTS:$LTS

These lines should remain because the variable is needed for installation behavior, even though package naming no longer uses the preview prefix.

Copilot uses AI. Check for mistakes.
$message = @()
Get-ChildItem $(System.ArtifactsDirectory)\* -recurse -filter *.pkg | ForEach-Object {
if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?osx(\.10\.12)?\-(x64|arm64)\.pkg')
if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?osx\-(x64|arm64)\.pkg')
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

The regex pattern uses an unescaped . which matches any character, not just a literal dot. In the pattern [a-z]*., the dot should be escaped as \. to specifically match the dot in version suffixes like "preview.6" or "rebuild.5".

Currently, the pattern would incorrectly match malformed names like:

Fix: Escape the dot in the pattern:

if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*\.\d+\-)?osx\-(x64|arm64)\.pkg')
Suggested change
if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?osx\-(x64|arm64)\.pkg')
if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*\.\d+\-)?osx\-(x64|arm64)\.pkg')

Copilot uses AI. Check for mistakes.
# - powershell-7.6.0-preview.6-osx-x64.pkg (Preview version string)
# - powershell-7.4.13-rebuild.5-osx-arm64.pkg (Rebuild version)
# - powershell-lts-7.4.13-osx-arm64.pkg (LTS package)
$pkgPackageNamePattern = '^powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?osx\-(x64|arm64)\.pkg$'
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

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

The regex pattern uses an unescaped . which matches any character, not just a literal dot. In the pattern [a-z]*., the dot should be escaped as \. to specifically match the dot in version suffixes like "preview.6" or "rebuild.5".

Currently, the pattern would incorrectly match malformed names like:

Fix: Escape the dot in the pattern:

$pkgPackageNamePattern = '^powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*\.\d+\-)?osx\-(x64|arm64)\.pkg$'
Suggested change
$pkgPackageNamePattern = '^powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?osx\-(x64|arm64)\.pkg$'
$pkgPackageNamePattern = '^powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*\.\d+\-)?osx\-(x64|arm64)\.pkg$'

Copilot uses AI. Check for mistakes.
@microsoft-github-policy-service microsoft-github-policy-service bot added the Review - Needed The PR is being reviewed label Nov 20, 2025
@microsoft-github-policy-service
Copy link
Contributor

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

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 Review - Needed The PR is being reviewed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant