@@ -2249,43 +2249,6 @@ function Get-RedHatPackageManager {
22492249 }
22502250}
22512251
2252- function Install-GlobalGem {
2253- param (
2254- [Parameter ()]
2255- [string ]
2256- $Sudo = " " ,
2257-
2258- [Parameter (Mandatory )]
2259- [string ]
2260- $GemName ,
2261-
2262- [Parameter (Mandatory )]
2263- [string ]
2264- $GemVersion
2265- )
2266- try {
2267- # We cannot guess if the user wants to run gem install as root on linux and windows,
2268- # but macOs usually requires sudo
2269- $gemsudo = ' '
2270- if ($environment.IsMacOS -or $env: TF_BUILD -or $env: GITHUB_ACTIONS ) {
2271- $gemsudo = $sudo
2272- }
2273-
2274- Start-NativeExecution ([ScriptBlock ]::Create(" $gemsudo gem install $GemName -v $GemVersion --no-document" ))
2275-
2276- } catch {
2277- Write-Warning " Installation of gem $GemName $GemVersion failed! Must resolve manually."
2278- $logs = Get-ChildItem " /var/lib/gems/*/extensions/x86_64-linux/*/$GemName -*/gem_make.out" | Select-Object - ExpandProperty FullName
2279- foreach ($log in $logs ) {
2280- Write-Verbose " Contents of: $log " - Verbose
2281- Get-Content - Raw - Path $log - ErrorAction Ignore | ForEach-Object { Write-Verbose $_ - Verbose }
2282- Write-Verbose " END Contents of: $log " - Verbose
2283- }
2284-
2285- throw
2286- }
2287- }
2288-
22892252function Start-PSBootstrap {
22902253 [CmdletBinding ()]
22912254 param (
@@ -2297,7 +2260,12 @@ function Start-PSBootstrap {
22972260 [switch ]$BuildLinuxArm ,
22982261 [switch ]$Force ,
22992262 [Parameter (Mandatory = $true )]
2300- [ValidateSet (" Package" , " DotNet" , " Both" )]
2263+ # Package: Install dependencies for packaging tools (rpmbuild, dpkg-deb, pkgbuild, WiX)
2264+ # DotNet: Install the .NET SDK
2265+ # Both: Package and DotNet scenarios
2266+ # Tools: Install .NET global tools (e.g., dotnet-format)
2267+ # All: Install all dependencies (packaging, .NET SDK, and tools)
2268+ [ValidateSet (" Package" , " DotNet" , " Both" , " Tools" , " All" )]
23012269 [string ]$Scenario = " Package"
23022270 )
23032271
@@ -2333,7 +2301,9 @@ function Start-PSBootstrap {
23332301 elseif ($environment.IsUbuntu18 ) { $Deps += " libicu60" }
23342302
23352303 # Packaging tools
2336- if ($Scenario -eq ' Both' -or $Scenario -eq ' Package' ) { $Deps += " ruby-dev" , " groff" , " libffi-dev" , " rpm" , " g++" , " make" }
2304+ # Note: ruby-dev, libffi-dev, g++, and make are no longer needed for DEB packaging
2305+ # DEB packages now use native dpkg-deb (pre-installed)
2306+ if ($Scenario -eq ' Both' -or $Scenario -eq ' Package' ) { $Deps += " groff" , " rpm" }
23372307
23382308 # Install dependencies
23392309 # change the fontend from apt-get to noninteractive
@@ -2357,7 +2327,9 @@ function Start-PSBootstrap {
23572327 $Deps += " libicu" , " openssl-libs"
23582328
23592329 # Packaging tools
2360- if ($Scenario -eq ' Both' -or $Scenario -eq ' Package' ) { $Deps += " ruby-devel" , " rpm-build" , " groff" , ' libffi-devel' , " gcc-c++" }
2330+ # Note: ruby-devel and libffi-devel are no longer needed
2331+ # RPM packages use rpmbuild, DEB packages use dpkg-deb
2332+ if ($Scenario -eq ' Both' -or $Scenario -eq ' Package' ) { $Deps += " rpm-build" , " groff" }
23612333
23622334 $PackageManager = Get-RedHatPackageManager
23632335
@@ -2378,7 +2350,8 @@ function Start-PSBootstrap {
23782350 $Deps += " wget"
23792351
23802352 # Packaging tools
2381- if ($Scenario -eq ' Both' -or $Scenario -eq ' Package' ) { $Deps += " ruby-devel" , " rpmbuild" , " groff" , ' libffi-devel' , " gcc" }
2353+ # Note: ruby-devel and libffi-devel are no longer needed for packaging
2354+ if ($Scenario -eq ' Both' -or $Scenario -eq ' Package' ) { $Deps += " rpmbuild" , " groff" }
23822355
23832356 $PackageManager = " zypper --non-interactive install"
23842357 $baseCommand = " $sudo $PackageManager "
@@ -2417,17 +2390,7 @@ function Start-PSBootstrap {
24172390 }
24182391 }
24192392
2420- # Install [fpm](https://github.com/jordansissel/fpm)
2421- # Note: fpm is now only needed for DEB and macOS packages; RPM packages use rpmbuild directly
2422- if ($Scenario -eq ' Both' -or $Scenario -eq ' Package' ) {
2423- # Install fpm on Debian-based systems, macOS, and Mariner (where DEB packages are built)
2424- if (($environment.IsLinux -and ($environment.IsDebianFamily -or $environment.IsMariner )) -or $environment.IsMacOS ) {
2425- Install-GlobalGem - Sudo $sudo - GemName " dotenv" - GemVersion " 2.8.1"
2426- Install-GlobalGem - Sudo $sudo - GemName " ffi" - GemVersion " 1.16.3"
2427- Install-GlobalGem - Sudo $sudo - GemName " fpm" - GemVersion " 1.15.1"
2428- Install-GlobalGem - Sudo $sudo - GemName " rexml" - GemVersion " 3.2.5"
2429- }
2430-
2393+ if ($Scenario -in ' All' , ' Both' , ' Package' ) {
24312394 # For RPM-based systems, ensure rpmbuild is available
24322395 if ($environment.IsLinux -and ($environment.IsRedHatFamily -or $environment.IsSUSEFamily -or $environment.IsMariner )) {
24332396 Write-Verbose - Verbose " Checking for rpmbuild..."
@@ -2436,6 +2399,22 @@ function Start-PSBootstrap {
24362399 Start-NativeExecution - sb ([ScriptBlock ]::Create(" $sudo $PackageManager install -y rpm-build" )) - IgnoreExitcode
24372400 }
24382401 }
2402+
2403+ # For Debian-based systems and Mariner, ensure dpkg-deb is available
2404+ if ($environment.IsLinux -and ($environment.IsDebianFamily -or $environment.IsMariner )) {
2405+ Write-Verbose - Verbose " Checking for dpkg-deb..."
2406+ if (! (Get-Command dpkg- deb - ErrorAction SilentlyContinue)) {
2407+ Write-Warning " dpkg-deb not found. Installing dpkg package..."
2408+ if ($environment.IsMariner ) {
2409+ # For Mariner (Azure Linux), install the extended repo first to access dpkg.
2410+ Write-Verbose - Verbose " Installing azurelinux-repos-extended for Mariner..."
2411+ Start-NativeExecution - sb ([ScriptBlock ]::Create(" $sudo $PackageManager azurelinux-repos-extended" )) - IgnoreExitcode
2412+ Start-NativeExecution - sb ([ScriptBlock ]::Create(" $sudo $PackageManager dpkg" )) - IgnoreExitcode
2413+ } else {
2414+ Start-NativeExecution - sb ([ScriptBlock ]::Create(" $sudo apt-get install -y dpkg" )) - IgnoreExitcode
2415+ }
2416+ }
2417+ }
24392418 }
24402419 Write-LogGroupEnd - Title " Install Native Dependencies"
24412420 }
0 commit comments