Skip to content
Merged
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
81 changes: 58 additions & 23 deletions tools/packaging/packaging.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,7 @@ function Start-PSPackage {
Version = $Version
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TravisEz13, your last commit had 1 failures in PowerShell-CI-static-analysis
Verify Markdown Links.Verify links in /home/vsts/work/1/s/README.md.https://github.com/PowerShell/PowerShell/releases/download/v7.0.0-rc.2/PowerShell-7.0.0-rc.2-win-x64.msi should work

Unable to read data from the transport connection: Connection reset by peer.
at <ScriptBlock>, /home/vsts/work/1/s/test/common/markdown/markdown-link.tests.ps1: line 114
114:                                 $null = Invoke-WebRequest -uri $url -RetryIntervalSec 10 -MaximumRetryCount 6

Force = $Force
Architecture = "arm32"
ExcludeSymbolicLinks = $true
}

if ($PSCmdlet.ShouldProcess("Create tar.gz Package")) {
Expand All @@ -392,6 +393,7 @@ function Start-PSPackage {
Version = $Version
Force = $Force
Architecture = "arm64"
ExcludeSymbolicLinks = $true
}

if ($PSCmdlet.ShouldProcess("Create tar.gz Package")) {
Expand All @@ -405,6 +407,7 @@ function Start-PSPackage {
Version = $Version
Force = $Force
Architecture = "alpine-x64"
ExcludeSymbolicLinks = $true
}

if ($PSCmdlet.ShouldProcess("Create tar.gz Package")) {
Expand Down Expand Up @@ -487,7 +490,9 @@ function New-TarballPackage {
[Parameter()]
[string] $Architecture = "x64",

[switch] $Force
[switch] $Force,

[switch] $ExcludeSymbolicLinks
)

if ($PackageNameSuffix) {
Expand Down Expand Up @@ -515,6 +520,10 @@ function New-TarballPackage {
}
}

if (-not $ExcludeSymbolicLinks.IsPresent) {
New-PSSymbolicLinks -Distribution 'ubuntu.16.04' -Staging $PackageSourcePath
}

if (Get-Command -Name tar -CommandType Application -ErrorAction Ignore) {
if ($Force -or $PSCmdlet.ShouldProcess("Create tarball package")) {
$options = "-czf"
Expand Down Expand Up @@ -800,6 +809,7 @@ function New-UnixPackage {

# Generate After Install and After Remove scripts
$AfterScriptInfo = New-AfterScripts -Link $Link -Distribution $DebDistro
New-PSSymbolicLinks -Distribution $DebDistro -Staging $Staging

# there is a weird bug in fpm
# if the target of the powershell symlink exists, `fpm` aborts
Expand Down Expand Up @@ -1228,6 +1238,47 @@ function New-AfterScripts
$Distribution
)

Write-Verbose -Message "AfterScript Distribution: $Distribution" -Verbose

if ($Environment.IsRedHatFamily) {
$AfterInstallScript = [io.path]::GetTempFileName()
$AfterRemoveScript = [io.path]::GetTempFileName()
$packagingStrings.RedHatAfterInstallScript -f "$Link" | Out-File -FilePath $AfterInstallScript -Encoding ascii
$packagingStrings.RedHatAfterRemoveScript -f "$Link" | Out-File -FilePath $AfterRemoveScript -Encoding ascii
}
elseif ($Environment.IsDebianFamily -or $Environment.IsSUSEFamily) {
$AfterInstallScript = [io.path]::GetTempFileName()
$AfterRemoveScript = [io.path]::GetTempFileName()
$packagingStrings.UbuntuAfterInstallScript -f "$Link" | Out-File -FilePath $AfterInstallScript -Encoding ascii
$packagingStrings.UbuntuAfterRemoveScript -f "$Link" | Out-File -FilePath $AfterRemoveScript -Encoding ascii
}
elseif ($Environment.IsMacOS) {
# NOTE: The macos pkgutil doesn't support uninstall actions so we did not implement it.
# Handling uninstall can be done in Homebrew so we'll take advantage of that in the brew formula.
$AfterInstallScript = [io.path]::GetTempFileName()
$packagingStrings.MacOSAfterInstallScript -f "$Link" | Out-File -FilePath $AfterInstallScript -Encoding ascii
}

return [PSCustomObject] @{
AfterInstallScript = $AfterInstallScript
AfterRemoveScript = $AfterRemoveScript
}
}

function New-PSSymbolicLinks
{
param(
[Parameter(Mandatory)]
[string]
$Distribution,

[Parameter(Mandatory)]
[string]
$Staging
)

Write-Verbose -Message "PSSymLinks-Distribution: $Distribution" -Verbose

if ($Environment.IsRedHatFamily) {
switch -regex ($Distribution)
{
Expand All @@ -1244,19 +1295,9 @@ function New-AfterScripts
New-Item -Force -ItemType SymbolicLink -Target "/lib64/libcrypto.so.10" -Path "$Staging/libcrypto.so.1.0.0" > $null
}
}

$AfterInstallScript = [io.path]::GetTempFileName()
$AfterRemoveScript = [io.path]::GetTempFileName()
$packagingStrings.RedHatAfterInstallScript -f "$Link" | Out-File -FilePath $AfterInstallScript -Encoding ascii
$packagingStrings.RedHatAfterRemoveScript -f "$Link" | Out-File -FilePath $AfterRemoveScript -Encoding ascii
}
elseif ($Environment.IsDebianFamily -or $Environment.IsSUSEFamily) {
$AfterInstallScript = [io.path]::GetTempFileName()
$AfterRemoveScript = [io.path]::GetTempFileName()
$packagingStrings.UbuntuAfterInstallScript -f "$Link" | Out-File -FilePath $AfterInstallScript -Encoding ascii
$packagingStrings.UbuntuAfterRemoveScript -f "$Link" | Out-File -FilePath $AfterRemoveScript -Encoding ascii

switch -regex ($Distribution)
switch -regex ($Distribution)
{
# add two symbolic links to system shared libraries that libmi.so is dependent on to handle
# platform specific changes. This appears to be a change in Debian 9; Debian 8 did not need these
Expand All @@ -1269,19 +1310,13 @@ function New-AfterScripts
New-Item -Force -ItemType SymbolicLink -Target "/usr/lib/x86_64-linux-gnu/libssl.so.1.1" -Path "$Staging/libssl.so.1.0.0" > $null
New-Item -Force -ItemType SymbolicLink -Target "/usr/lib/x86_64-linux-gnu/libcrypto.so.1.1" -Path "$Staging/libcrypto.so.1.0.0" > $null
}
default {
# Default to old behavior before this change
New-Item -Force -ItemType SymbolicLink -Target "/lib64/libssl.so.10" -Path "$Staging/libssl.so.1.0.0" > $null
New-Item -Force -ItemType SymbolicLink -Target "/lib64/libcrypto.so.10" -Path "$Staging/libcrypto.so.1.0.0" > $null
}
}
}
elseif ($Environment.IsMacOS) {
# NOTE: The macos pkgutil doesn't support uninstall actions so we did not implement it.
# Handling uninstall can be done in Homebrew so we'll take advantage of that in the brew formula.
$AfterInstallScript = [io.path]::GetTempFileName()
$packagingStrings.MacOSAfterInstallScript -f "$Link" | Out-File -FilePath $AfterInstallScript -Encoding ascii
}

return [PSCustomObject] @{
AfterInstallScript = $AfterInstallScript
AfterRemoveScript = $AfterRemoveScript
}
}

function New-ManGzip
Expand Down