-
Notifications
You must be signed in to change notification settings - Fork 8.1k
[release/v7.6] Replace fpm with native rpmbuild for RPM package generation #26441
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
TravisEz13
merged 1 commit into
PowerShell:release/v7.6
from
TravisEz13:backport/release/v7.6/26233-5661a5152
Nov 20, 2025
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,91 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT License. | ||
|
|
||
| Describe "Linux Package Name Validation" { | ||
| BeforeAll { | ||
| # Determine artifacts directory (GitHub Actions or Azure DevOps) | ||
| $artifactsDir = if ($env:GITHUB_ACTIONS -eq 'true') { | ||
| "$env:GITHUB_WORKSPACE/../packages" | ||
| } else { | ||
| $env:SYSTEM_ARTIFACTSDIRECTORY | ||
| } | ||
|
|
||
| if (-not $artifactsDir) { | ||
| throw "Artifacts directory not found. GITHUB_WORKSPACE or SYSTEM_ARTIFACTSDIRECTORY must be set." | ||
TravisEz13 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| Write-Verbose "Artifacts directory: $artifactsDir" -Verbose | ||
| } | ||
|
|
||
| Context "RPM Package Names" { | ||
| It "Should have valid RPM package names" { | ||
| $rpmPackages = Get-ChildItem -Path $artifactsDir -Recurse -Filter *.rpm -ErrorAction SilentlyContinue | ||
|
|
||
| if ($rpmPackages.Count -eq 0) { | ||
| Set-ItResult -Skipped -Because "No RPM packages found in artifacts directory" | ||
| return | ||
| } | ||
|
|
||
| $invalidPackages = @() | ||
| # Regex pattern for valid RPM package names. | ||
| # Breakdown: | ||
| # ^powershell\- : Starts with 'powershell-' | ||
| # (preview-|lts-)? : Optionally 'preview-' or 'lts-' | ||
| # \d+\.\d+\.\d+ : Version number (e.g., 7.6.0) | ||
| # (_[a-z]*\.\d+)? : Optional underscore, letters, dot, and digits (e.g., _alpha.1) | ||
| # -1\. : Literal '-1.' | ||
| # (preview\.\d+\.)? : Optional 'preview.' and digits, followed by a dot | ||
| # (rh|cm)\. : Either 'rh.' or 'cm.' | ||
| # (x86_64|aarch64)\.rpm$ : Architecture and file extension | ||
| $rpmPackageNamePattern = 'powershell\-(preview-|lts-)?\d+\.\d+\.\d+(_[a-z]*\.\d+)?-1\.(preview\.\d+\.)?(rh|cm)\.(x86_64|aarch64)\.rpm' | ||
|
|
||
| foreach ($package in $rpmPackages) { | ||
| if ($package.Name -notmatch $rpmPackageNamePattern) { | ||
| $invalidPackages += "$($package.Name) is not a valid RPM package name" | ||
| Write-Warning "$($package.Name) is not a valid RPM package name" | ||
| } | ||
| } | ||
|
|
||
| if ($invalidPackages.Count -gt 0) { | ||
| throw ($invalidPackages | Out-String) | ||
| } | ||
|
|
||
| $rpmPackages.Count | Should -BeGreaterThan 0 | ||
| } | ||
| } | ||
|
|
||
| Context "Tar.Gz Package Names" { | ||
| It "Should have valid tar.gz package names" { | ||
| $tarPackages = Get-ChildItem -Path $artifactsDir -Recurse -Filter *.tar.gz -ErrorAction SilentlyContinue | ||
|
|
||
| if ($tarPackages.Count -eq 0) { | ||
| Set-ItResult -Skipped -Because "No tar.gz packages found in artifacts directory" | ||
| return | ||
| } | ||
|
|
||
| $invalidPackages = @() | ||
| foreach ($package in $tarPackages) { | ||
| # Pattern matches: powershell-7.6.0-preview.6-linux-x64.tar.gz or powershell-7.6.0-linux-x64.tar.gz | ||
| # Also matches various runtime configurations | ||
| if ($package.Name -notmatch 'powershell-(lts-)?\d+\.\d+\.\d+\-([a-z]*.\d+\-)?(linux|osx|linux-musl)+\-(x64\-fxdependent|x64|arm32|arm64|x64\-musl-noopt\-fxdependent)\.(tar\.gz)') { | ||
| $invalidPackages += "$($package.Name) is not a valid tar.gz package name" | ||
| Write-Warning "$($package.Name) is not a valid tar.gz package name" | ||
| } | ||
| } | ||
|
|
||
| if ($invalidPackages.Count -gt 0) { | ||
| throw ($invalidPackages | Out-String) | ||
| } | ||
|
|
||
| $tarPackages.Count | Should -BeGreaterThan 0 | ||
| } | ||
| } | ||
|
|
||
| Context "Package Existence" { | ||
| It "Should find at least one package in artifacts directory" { | ||
| $allPackages = Get-ChildItem -Path $artifactsDir -Recurse -Include *.rpm, *.tar.gz, *.deb -ErrorAction SilentlyContinue | ||
|
|
||
| $allPackages.Count | Should -BeGreaterThan 0 -Because "At least one package should exist in the artifacts directory" | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.