mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Add Linux package dependencies for packaging (#16807)
This commit is contained in:
+43
-16
@@ -1894,6 +1894,43 @@ function Get-RedHatPackageManager {
|
||||
}
|
||||
}
|
||||
|
||||
function Install-GlobalGem {
|
||||
param(
|
||||
[Parameter()]
|
||||
[string]
|
||||
$Sudo = "",
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[string]
|
||||
$GemName,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[string]
|
||||
$GemVersion
|
||||
)
|
||||
try {
|
||||
# We cannot guess if the user wants to run gem install as root on linux and windows,
|
||||
# but macOs usually requires sudo
|
||||
$gemsudo = ''
|
||||
if($environment.IsMacOS -or $env:TF_BUILD) {
|
||||
$gemsudo = $sudo
|
||||
}
|
||||
|
||||
Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install $GemName -v $GemVersion --no-document"))
|
||||
|
||||
} catch {
|
||||
Write-Warning "Installation of gem $GemName $GemVersion failed! Must resolve manually."
|
||||
$logs = Get-ChildItem "/var/lib/gems/*/extensions/x86_64-linux/*/$GemName-*/gem_make.out" | Select-Object -ExpandProperty FullName
|
||||
foreach ($log in $logs) {
|
||||
Write-Verbose "Contents of: $log" -Verbose
|
||||
Get-Content -Raw -Path $log -ErrorAction Ignore | ForEach-Object { Write-Verbose $_ -Verbose }
|
||||
Write-Verbose "END Contents of: $log" -Verbose
|
||||
}
|
||||
|
||||
throw
|
||||
}
|
||||
}
|
||||
|
||||
function Start-PSBootstrap {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
@@ -1938,7 +1975,7 @@ function Start-PSBootstrap {
|
||||
elseif ($environment.IsUbuntu18) { $Deps += "libicu60"}
|
||||
|
||||
# Packaging tools
|
||||
if ($Package) { $Deps += "ruby-dev", "groff", "libffi-dev", "rpm" }
|
||||
if ($Package) { $Deps += "ruby-dev", "groff", "libffi-dev", "rpm", "g++", "make" }
|
||||
|
||||
# Install dependencies
|
||||
# change the fontend from apt-get to noninteractive
|
||||
@@ -1962,7 +1999,7 @@ function Start-PSBootstrap {
|
||||
$Deps += "libicu", "libunwind"
|
||||
|
||||
# Packaging tools
|
||||
if ($Package) { $Deps += "ruby-devel", "rpm-build", "groff", 'libffi-devel' }
|
||||
if ($Package) { $Deps += "ruby-devel", "rpm-build", "groff", 'libffi-devel', "gcc-c++" }
|
||||
|
||||
$PackageManager = Get-RedHatPackageManager
|
||||
|
||||
@@ -1983,7 +2020,7 @@ function Start-PSBootstrap {
|
||||
$Deps += "wget"
|
||||
|
||||
# Packaging tools
|
||||
if ($Package) { $Deps += "ruby-devel", "rpmbuild", "groff", 'libffi-devel' }
|
||||
if ($Package) { $Deps += "ruby-devel", "rpmbuild", "groff", 'libffi-devel', "gcc" }
|
||||
|
||||
$PackageManager = "zypper --non-interactive install"
|
||||
$baseCommand = "$sudo $PackageManager"
|
||||
@@ -2024,19 +2061,9 @@ function Start-PSBootstrap {
|
||||
|
||||
# Install [fpm](https://github.com/jordansissel/fpm) and [ronn](https://github.com/rtomayko/ronn)
|
||||
if ($Package) {
|
||||
try {
|
||||
# We cannot guess if the user wants to run gem install as root on linux and windows,
|
||||
# but macOs usually requires sudo
|
||||
$gemsudo = ''
|
||||
if($environment.IsMacOS -or $env:TF_BUILD) {
|
||||
$gemsudo = $sudo
|
||||
}
|
||||
Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install ffi -v 1.12.0 --no-document"))
|
||||
Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install fpm -v 1.11.0 --no-document"))
|
||||
Start-NativeExecution ([ScriptBlock]::Create("$gemsudo gem install ronn -v 0.7.3 --no-document"))
|
||||
} catch {
|
||||
Write-Warning "Installation of fpm and ronn gems failed! Must resolve manually."
|
||||
}
|
||||
Install-GlobalGem -Sudo $sudo -GemName "ffi" -GemVersion "1.12.0"
|
||||
Install-GlobalGem -Sudo $sudo -GemName "fpm" -GemVersion "1.11.0"
|
||||
Install-GlobalGem -Sudo $sudo -GemName "ronn" -GemVersion "0.7.3"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -77,7 +77,7 @@ try
|
||||
Sync-PSTags -AddRemoteIfMissing
|
||||
|
||||
Write-Verbose "Bootstrapping powershell build..." -Verbose
|
||||
Start-PSBootstrap -Force -Package
|
||||
Start-PSBootstrap -Force -Package -ErrorAction Stop
|
||||
|
||||
if ($PSCmdlet.ParameterSetName -eq 'packageSigned')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user