@@ -2234,43 +2234,6 @@ function Get-RedHatPackageManager {
22342234 }
22352235}
22362236
2237- function Install-GlobalGem {
2238- param (
2239- [Parameter ()]
2240- [string ]
2241- $Sudo = " " ,
2242-
2243- [Parameter (Mandatory )]
2244- [string ]
2245- $GemName ,
2246-
2247- [Parameter (Mandatory )]
2248- [string ]
2249- $GemVersion
2250- )
2251- try {
2252- # We cannot guess if the user wants to run gem install as root on linux and windows,
2253- # but macOs usually requires sudo
2254- $gemsudo = ' '
2255- if ($environment.IsMacOS -or $env: TF_BUILD -or $env: GITHUB_ACTIONS ) {
2256- $gemsudo = $sudo
2257- }
2258-
2259- Start-NativeExecution ([ScriptBlock ]::Create(" $gemsudo gem install $GemName -v $GemVersion --no-document" ))
2260-
2261- } catch {
2262- Write-Warning " Installation of gem $GemName $GemVersion failed! Must resolve manually."
2263- $logs = Get-ChildItem " /var/lib/gems/*/extensions/x86_64-linux/*/$GemName -*/gem_make.out" | Select-Object - ExpandProperty FullName
2264- foreach ($log in $logs ) {
2265- Write-Verbose " Contents of: $log " - Verbose
2266- Get-Content - Raw - Path $log - ErrorAction Ignore | ForEach-Object { Write-Verbose $_ - Verbose }
2267- Write-Verbose " END Contents of: $log " - Verbose
2268- }
2269-
2270- throw
2271- }
2272- }
2273-
22742237function Start-PSBootstrap {
22752238 [CmdletBinding ()]
22762239 param (
@@ -2282,7 +2245,7 @@ function Start-PSBootstrap {
22822245 [switch ]$BuildLinuxArm ,
22832246 [switch ]$Force ,
22842247 [Parameter (Mandatory = $true )]
2285- # Package: Install dependencies for packaging tools (fpm, rpmbuild , WiX)
2248+ # Package: Install dependencies for packaging tools (rpmbuild, dpkg-deb, pkgbuild , WiX)
22862249 # DotNet: Install the .NET SDK
22872250 # Both: Package and DotNet scenarios
22882251 # Tools: Install .NET global tools (e.g., dotnet-format)
@@ -2321,7 +2284,9 @@ function Start-PSBootstrap {
23212284 elseif ($environment.IsUbuntu18 ) { $Deps += " libicu60" }
23222285
23232286 # Packaging tools
2324- if ($Scenario -eq ' Both' -or $Scenario -eq ' Package' ) { $Deps += " ruby-dev" , " groff" , " libffi-dev" , " rpm" , " g++" , " make" }
2287+ # Note: ruby-dev, libffi-dev, g++, and make are no longer needed for DEB packaging
2288+ # DEB packages now use native dpkg-deb (pre-installed)
2289+ if ($Scenario -eq ' Both' -or $Scenario -eq ' Package' ) { $Deps += " groff" , " rpm" }
23252290
23262291 # Install dependencies
23272292 # change the fontend from apt-get to noninteractive
@@ -2345,7 +2310,9 @@ function Start-PSBootstrap {
23452310 $Deps += " libicu" , " openssl-libs"
23462311
23472312 # Packaging tools
2348- if ($Scenario -eq ' Both' -or $Scenario -eq ' Package' ) { $Deps += " ruby-devel" , " rpm-build" , " groff" , ' libffi-devel' , " gcc-c++" }
2313+ # Note: ruby-devel and libffi-devel are no longer needed
2314+ # RPM packages use rpmbuild, DEB packages use dpkg-deb
2315+ if ($Scenario -eq ' Both' -or $Scenario -eq ' Package' ) { $Deps += " rpm-build" , " groff" }
23492316
23502317 $PackageManager = Get-RedHatPackageManager
23512318
@@ -2366,7 +2333,8 @@ function Start-PSBootstrap {
23662333 $Deps += " wget"
23672334
23682335 # Packaging tools
2369- if ($Scenario -eq ' Both' -or $Scenario -eq ' Package' ) { $Deps += " ruby-devel" , " rpmbuild" , " groff" , ' libffi-devel' , " gcc" }
2336+ # Note: ruby-devel and libffi-devel are no longer needed for packaging
2337+ if ($Scenario -eq ' Both' -or $Scenario -eq ' Package' ) { $Deps += " rpmbuild" , " groff" }
23702338
23712339 $PackageManager = " zypper --non-interactive install"
23722340 $baseCommand = " $sudo $PackageManager "
@@ -2405,17 +2373,7 @@ function Start-PSBootstrap {
24052373 }
24062374 }
24072375
2408- # Install [fpm](https://github.com/jordansissel/fpm)
2409- # Note: fpm is now only needed for DEB and macOS packages; RPM packages use rpmbuild directly
24102376 if ($Scenario -in ' All' , ' Both' , ' Package' ) {
2411- # Install fpm on Debian-based systems, macOS, and Mariner (where DEB packages are built)
2412- if (($environment.IsLinux -and ($environment.IsDebianFamily -or $environment.IsMariner )) -or $environment.IsMacOS ) {
2413- Install-GlobalGem - Sudo $sudo - GemName " dotenv" - GemVersion " 2.8.1"
2414- Install-GlobalGem - Sudo $sudo - GemName " ffi" - GemVersion " 1.16.3"
2415- Install-GlobalGem - Sudo $sudo - GemName " fpm" - GemVersion " 1.15.1"
2416- Install-GlobalGem - Sudo $sudo - GemName " rexml" - GemVersion " 3.2.5"
2417- }
2418-
24192377 # For RPM-based systems, ensure rpmbuild is available
24202378 if ($environment.IsLinux -and ($environment.IsRedHatFamily -or $environment.IsSUSEFamily -or $environment.IsMariner )) {
24212379 Write-Verbose - Verbose " Checking for rpmbuild..."
@@ -2424,6 +2382,22 @@ function Start-PSBootstrap {
24242382 Start-NativeExecution - sb ([ScriptBlock ]::Create(" $sudo $PackageManager install -y rpm-build" )) - IgnoreExitcode
24252383 }
24262384 }
2385+
2386+ # For Debian-based systems and Mariner, ensure dpkg-deb is available
2387+ if ($environment.IsLinux -and ($environment.IsDebianFamily -or $environment.IsMariner )) {
2388+ Write-Verbose - Verbose " Checking for dpkg-deb..."
2389+ if (! (Get-Command dpkg- deb - ErrorAction SilentlyContinue)) {
2390+ Write-Warning " dpkg-deb not found. Installing dpkg package..."
2391+ if ($environment.IsMariner ) {
2392+ # For Mariner (Azure Linux), install the extended repo first to access dpkg.
2393+ Write-Verbose - Verbose " Installing azurelinux-repos-extended for Mariner..."
2394+ Start-NativeExecution - sb ([ScriptBlock ]::Create(" $sudo $PackageManager install -y azurelinux-repos-extended" )) - IgnoreExitcode
2395+ Start-NativeExecution - sb ([ScriptBlock ]::Create(" $sudo $PackageManager install -y dpkg" )) - IgnoreExitcode
2396+ } else {
2397+ Start-NativeExecution - sb ([ScriptBlock ]::Create(" $sudo apt-get install -y dpkg" )) - IgnoreExitcode
2398+ }
2399+ }
2400+ }
24272401 }
24282402 }
24292403
0 commit comments