[release/v7.4] Update the macos package name for preview releases to match the previous pattern#26435
Conversation
…ous pattern (PowerShell#26429) Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
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.
| # 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) |
There was a problem hiding this comment.
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:$LTSThese lines should remain because the variable is needed for installation behavior, even though package naming no longer uses the preview prefix.
| $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') |
There was a problem hiding this comment.
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:
[email protected]powershell-7.4.13-rebuild-5-osx-arm64.pkg
Fix: Escape the dot in the pattern:
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') | |
| if($_.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*\.\d+\-)?osx\-(x64|arm64)\.pkg') |
| # - 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$' |
There was a problem hiding this comment.
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:
[email protected]powershell-7.4.13-rebuild-5-osx-arm64.pkg
Fix: Escape the dot in the pattern:
$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$' | |
| $pkgPackageNamePattern = '^powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*\.\d+\-)?osx\-(x64|arm64)\.pkg$' |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
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
This backports a fix for macOS package naming for preview releases to ensure consistent naming patterns across releases.
Customer Impact
Regression
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:
Risk
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.