mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
Replace fpm with dpkg-deb for DEB package generation (#26281)
This commit is contained in:
1 parent
47e8e900ab
commit
7e1ef1f744
3 files changed
+315
-271
No files matched your search
@@ -21,10 +21,7 @@ Describe "Linux Package Name Validation" {
|
||||
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
|
||||
}
|
||||
$rpmPackages.Count | Should -BeGreaterThan 0 -Because "At least one RPM package should exist in the artifacts directory"
|
||||
|
||||
$invalidPackages = @()
|
||||
# Regex pattern for valid RPM package names.
|
||||
@@ -49,8 +46,42 @@ Describe "Linux Package Name Validation" {
|
||||
if ($invalidPackages.Count -gt 0) {
|
||||
throw ($invalidPackages | Out-String)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Context "DEB Package Names" {
|
||||
It "Should have valid DEB package names" {
|
||||
$debPackages = Get-ChildItem -Path $artifactsDir -Recurse -Filter *.deb -ErrorAction SilentlyContinue
|
||||
|
||||
$rpmPackages.Count | Should -BeGreaterThan 0
|
||||
$debPackages.Count | Should -BeGreaterThan 0 -Because "At least one DEB package should exist in the artifacts directory"
|
||||
|
||||
$invalidPackages = @()
|
||||
# Regex pattern for valid DEB package names.
|
||||
# Valid examples:
|
||||
# - powershell-preview_7.6.0-preview.6-1.deb_amd64.deb
|
||||
# - powershell-lts_7.4.13-1.deb_amd64.deb
|
||||
# - powershell_7.4.13-1.deb_amd64.deb
|
||||
# Breakdown:
|
||||
# ^powershell : Starts with 'powershell'
|
||||
# (-preview|-lts)? : Optionally '-preview' or '-lts'
|
||||
# _\d+\.\d+\.\d+ : Underscore followed by version number (e.g., _7.6.0)
|
||||
# (-[a-z]+\.\d+)? : Optional dash, letters, dot, and digits (e.g., -preview.6)
|
||||
# -1 : Literal '-1'
|
||||
# \.deb_ : Literal '.deb_'
|
||||
# (amd64|arm64) : Architecture
|
||||
# \.deb$ : File extension
|
||||
$debPackageNamePattern = '^powershell(-preview|-lts)?_\d+\.\d+\.\d+(-[a-z]+\.\d+)?-1\.deb_(amd64|arm64)\.deb$'
|
||||
|
||||
foreach ($package in $debPackages) {
|
||||
if ($package.Name -notmatch $debPackageNamePattern) {
|
||||
$invalidPackages += "$($package.Name) is not a valid DEB package name"
|
||||
Write-Warning "$($package.Name) is not a valid DEB package name"
|
||||
}
|
||||
}
|
||||
|
||||
if ($invalidPackages.Count -gt 0) {
|
||||
throw ($invalidPackages | Out-String)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,10 +89,7 @@ Describe "Linux Package Name Validation" {
|
||||
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
|
||||
}
|
||||
$tarPackages.Count | Should -BeGreaterThan 0 -Because "At least one tar.gz package should exist in the artifacts directory"
|
||||
|
||||
$invalidPackages = @()
|
||||
foreach ($package in $tarPackages) {
|
||||
@@ -76,8 +104,6 @@ Describe "Linux Package Name Validation" {
|
||||
if ($invalidPackages.Count -gt 0) {
|
||||
throw ($invalidPackages | Out-String)
|
||||
}
|
||||
|
||||
$tarPackages.Count | Should -BeGreaterThan 0
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user