Skip to content
Closed
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
12 changes: 6 additions & 6 deletions build.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -2303,7 +2303,7 @@ function Start-PSBootstrap {
# Packaging tools
# Note: ruby-dev, libffi-dev, g++, and make are no longer needed for DEB packaging
# DEB packages now use native dpkg-deb (pre-installed)
if ($Scenario -eq 'Both' -or $Scenario -eq 'Package') { $Deps += "groff", "rpm" }
if ($Scenario -in 'All', 'Both', 'Package') { $Deps += "groff", "rpm" }

# Install dependencies
# change the fontend from apt-get to noninteractive
Expand All @@ -2329,7 +2329,7 @@ function Start-PSBootstrap {
# Packaging tools
# Note: ruby-devel and libffi-devel are no longer needed
# RPM packages use rpmbuild, DEB packages use dpkg-deb
if ($Scenario -eq 'Both' -or $Scenario -eq 'Package') { $Deps += "rpm-build", "groff" }
if ($Scenario -in 'All', 'Both', 'Package') { $Deps += "rpm-build", "groff" }

$PackageManager = Get-RedHatPackageManager

Expand All @@ -2351,7 +2351,7 @@ function Start-PSBootstrap {

# Packaging tools
# Note: ruby-devel and libffi-devel are no longer needed for packaging
if ($Scenario -eq 'Both' -or $Scenario -eq 'Package') { $Deps += "rpmbuild", "groff" }
if ($Scenario -in 'All', 'Both', 'Package') { $Deps += "rpmbuild", "groff" }

$PackageManager = "zypper --non-interactive install"
$baseCommand = "$sudo $PackageManager"
Expand Down Expand Up @@ -2413,8 +2413,8 @@ function Start-PSBootstrap {

Write-Verbose -Verbose "Installing azurelinux-repos-extended for Mariner..."

Start-NativeExecution -sb ([ScriptBlock]::Create("$sudo $PackageManager azurelinux-repos-extended")) -IgnoreExitcode -Verbose
Start-NativeExecution -sb ([ScriptBlock]::Create("$sudo $PackageManager dpkg")) -IgnoreExitcode -Verbose
Start-NativeExecution -sb ([ScriptBlock]::Create("$sudo $PackageManager azurelinux-repos-extended")) -IgnoreExitcode
Start-NativeExecution -sb ([ScriptBlock]::Create("$sudo $PackageManager dpkg")) -IgnoreExitcode
} else {
Start-NativeExecution -sb ([ScriptBlock]::Create("$sudo apt-get install -y dpkg")) -IgnoreExitcode
}
Expand Down Expand Up @@ -2477,7 +2477,7 @@ function Start-PSBootstrap {
$psInstallFile = [System.IO.Path]::Combine($PSScriptRoot, "tools", "install-powershell.ps1")
& $psInstallFile -AddToPath
}
if ($Scenario -eq 'Both' -or $Scenario -eq 'Package') {
if ($Scenario -in 'All', 'Both', 'Package') {
Import-Module "$PSScriptRoot\tools\wix\wix.psm1"
$isArm64 = "$env:RUNTIME" -eq 'arm64'
Install-Wix -arm64:$isArm64
Expand Down
19 changes: 16 additions & 3 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1351,6 +1351,8 @@ function New-UnixPackage {
}
catch {
Write-Verbose -Message "!!!Handling error in native DEB creation!!!" -Verbose -ErrorAction SilentlyContinue
Get-Error -InputObject $_
throw
}
}
} elseif ($Type -eq 'osxpkg') {
Expand Down Expand Up @@ -1814,16 +1816,17 @@ Installed-Size: $installedSizeKB
Priority: optional
Section: shells
Homepage: https://microsoft.com/powershell
Depends: $(if ($Dependencies) { $Dependencies -join ', ' })
Description: $shortDescription
$(if ($Dependencies -and $Dependencies.Count -gt 0) { "Depends: $($Dependencies -join ', ')`n" })Description: $shortDescription
$(if ($extendedDescription) { $extendedDescription + "`n" })
"@

$controlFile = Join-Path $debianDir "control"
$controlContent | Out-File -FilePath $controlFile -Encoding ascii -NoNewline

Write-Verbose "Control file created: $controlFile" -Verbose
Write-LogGroup -Title "DEB Control File Content" -Message $controlContent
Write-LogGroupStart -Title "DEB Control File Content"
Write-Verbose $controlContent -Verbose
Write-LogGroupEnd -Title "DEB Control File Content"

# Copy postinst script if provided
if ($AfterInstallScript -and (Test-Path $AfterInstallScript)) {
Expand Down Expand Up @@ -2195,6 +2198,16 @@ function Test-Dependencies
$Dependencies += "dpkg-deb"
$Dependencies += "rpmbuild"
}

# Check for dpkg-deb on Debian-based systems
if ($Environment.IsDebianFamily) {
$Dependencies += "dpkg-deb"
}

# Check for rpmbuild on RPM-based systems
if ($Environment.IsRedHatFamily -or $Environment.IsSUSEFamily) {
$Dependencies += "rpmbuild"
}

# Check for macOS packaging tools
if ($Environment.IsMacOS) {
Expand Down