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

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pipelines/templates/release-validate-packagenames.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:
- pwsh: |
$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')
{
$messageInstance = "$($_.Name) is not a valid package name"
$message += $messageInstance
Expand Down
9 changes: 3 additions & 6 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1147,15 +1147,12 @@ function New-UnixPackage {
}

# 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)
$Name = if($LTS) {
"powershell-lts"
}
elseif ($IsPreview) {
"powershell-preview"
}
else {
"powershell"
}
Comment on lines +1150 to 1158
Copy link

Copilot AI Dec 2, 2025

Choose a reason for hiding this comment

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

The code that sets $IsPreview = Test-IsPreview -Version $Version -IsLTS:$LTS has been removed, but $IsPreview is still referenced later in the function on lines 1170, 1186, and 1200. This will cause a runtime error when those lines are executed because $IsPreview will be undefined.

To fix this issue, add back the line that computes $IsPreview:

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

This line should be added before line 1153 (before the $Name assignment), since the $IsPreview variable is needed later for determining the installation suffix and file paths.

Copilot uses AI. Check for mistakes.
Expand Down
25 changes: 23 additions & 2 deletions tools/packaging/releaseTests/macOSPackage.tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,28 @@ Describe "Verify macOS Package" {
$script:package | Should -Not -BeNullOrEmpty -Because "A .pkg file should be created"
$script:package.Extension | Should -Be ".pkg"
}


It "Package name should follow correct naming convention" {
$script:package | Should -Not -BeNullOrEmpty

# Regex pattern for valid macOS PKG package names.
# This pattern matches the validation used in release-validate-packagenames.yml
# Valid examples:
# - powershell-7.4.13-osx-x64.pkg (Stable release)
# - 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$'

$script:package.Name | Should -Match $pkgPackageNamePattern -Because "Package name should follow the standard naming convention"
}

It "Package name should NOT use x86_64 with underscores" {
$script:package | Should -Not -BeNullOrEmpty

$script:package.Name | Should -Not -Match 'x86_64' -Because "Package should use 'x64' not 'x86_64' (with underscores) for compatibility"
}

It "Package should expand successfully" {
$script:expandDir | Should -Exist
Get-ChildItem -Path $script:expandDir | Should -Not -BeNullOrEmpty
Expand Down Expand Up @@ -159,4 +180,4 @@ Describe "Verify macOS Package" {
}
}
}
}
}