Add ability to produce tar.gz pkg for Raspbian (#5387)

This commit is contained in:
Steve Lee
2017-11-09 10:48:55 -08:00
committed by Dongbo Wang
parent 3bfae4f1dd
commit 8b42e1748e
2 changed files with 39 additions and 24 deletions
+24 -12
View File
@@ -20,7 +20,7 @@ function Start-PSPackage {
[string]$Name = "powershell",
# Ubuntu, CentOS, Fedora, macOS, and Windows packages are supported
[ValidateSet("deb", "osxpkg", "rpm", "msi", "zip", "AppImage", "nupkg", "tar")]
[ValidateSet("deb", "osxpkg", "rpm", "msi", "zip", "AppImage", "nupkg", "tar", "tar-arm")]
[string[]]$Type,
# Generate windows downlevel package
@@ -33,10 +33,6 @@ function Start-PSPackage {
[Switch] $SkipReleaseChecks
)
# The package type 'deb-arm' is current disabled for '-Type' parameter because 'New-UnixPackage' doesn't support
# creating package for 'deb-arm'. It should be added back to the ValidateSet of '-Type' once the implementation
# of creating 'deb-arm' package is done.
DynamicParam {
if ($Type -eq "zip") {
# Add a dynamic parameter '-IncludeSymbols' when the specified package type is 'zip'.
@@ -62,7 +58,7 @@ function Start-PSPackage {
# Runtime and Configuration settings required by the package
($Runtime, $Configuration) = if ($WindowsRuntime) {
$WindowsRuntime, "Release"
} elseif ($Type -eq "deb-arm") {
} elseif ($Type -eq "tar-arm") {
New-PSOptions -Configuration "Release" -Runtime "Linux-ARM" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
} else {
New-PSOptions -Configuration "Release" -WarningAction SilentlyContinue | ForEach-Object { $_.Runtime, $_.Configuration }
@@ -79,7 +75,7 @@ function Start-PSPackage {
$Script:Options = Get-PSOptions
$crossGenCorrect = $false
if ($Type -eq "deb-arm") {
if ($Type -eq "tar-arm") {
# crossgen doesn't support arm32 yet
$crossGenCorrect = $true
}
@@ -154,7 +150,7 @@ function Start-PSPackage {
$Source = New-TempFolder
$symbolsSource = New-TempFolder
try
try
{
# Copy files which go into the root package
Get-ChildItem -Path $publishSource | Copy-Item -Destination $Source -Recurse
@@ -287,7 +283,7 @@ function Start-PSPackage {
New-NugetPackage @Arguments
}
}
'tar' {
"tar" {
$Arguments = @{
PackageSourcePath = $Source
Name = $Name
@@ -299,6 +295,19 @@ function Start-PSPackage {
New-TarballPackage @Arguments
}
}
"tar-arm" {
$Arguments = @{
PackageSourcePath = $Source
Name = $Name
Version = $Version
Force = $Force
Architecture = "arm32"
}
if ($PSCmdlet.ShouldProcess("Create tar.gz Package")) {
New-TarballPackage @Arguments
}
}
'deb' {
$Arguments = @{
Type = 'deb'
@@ -346,15 +355,18 @@ function New-TarballPackage {
# Must start with 'powershell' but may have any suffix
[Parameter(Mandatory)]
[ValidatePattern("^powershell")]
[string]$Name,
[string] $Name,
[Parameter(Mandatory)]
[string]$Version,
[string] $Version,
[Parameter()]
[string] $Architecture = "x64",
[switch] $Force
)
$packageName = "$Name-$Version-{0}-x64.tar.gz"
$packageName = "$Name-$Version-{0}-$Architecture.tar.gz"
if ($Environment.IsWindows) {
throw "Must be on Linux or macOS to build 'tar.gz' packages!"
} elseif ($Environment.IsLinux) {
+15 -12
View File
@@ -19,23 +19,23 @@ function Send-DailyWebHook
{
log "Sending DailyWebHook with result '$result'."
$webhook = $env:WebHookUrl
$Body = @{
'text'= @"
Build Result: $result </br>
Build Result: $result </br>
OS Type: $($PSVersionTable.OS) </br>
<a href="https://travis-ci.org/$env:TRAVIS_REPO_SLUG/builds/$env:TRAVIS_BUILD_ID">Build $env:TRAVIS_BUILD_NUMBER</a> </br>
<a href="https://travis-ci.org/$env:TRAVIS_REPO_SLUG/jobs/$env:TRAVIS_JOB_ID">Job $env:TRAVIS_JOB_NUMBER</a>
"@
}
$params = @{
Headers = @{'accept'='application/json'}
Body = $Body | convertto-json
Method = 'Post'
URI = $webhook
URI = $webhook
}
Invoke-RestMethod @params
}
else
@@ -126,7 +126,7 @@ function Set-DailyBuildBadge
$headers["Authorization"] = "SharedKey " + $storageAccountName + ":" + $signature
if ( $PSCmdlet.ShouldProcess("$signaturestring"))
if ( $PSCmdlet.ShouldProcess("$signaturestring"))
{
# if this fails, it will throw, you can't check the response for a success code
$response = Invoke-RestMethod -Uri $Url -Method $method -headers $headers -Body $body -ContentType "image/svg+xml"
@@ -174,17 +174,17 @@ elseif($Stage -eq 'Build')
$output = Split-Path -Parent (Get-PSOutput -Options (New-PSOptions))
$originalProgressPreference = $ProgressPreference
$ProgressPreference = 'SilentlyContinue'
$ProgressPreference = 'SilentlyContinue'
try {
## We use CrossGen build to run tests only if it's the daily build.
Start-PSBuild -CrossGen -PSModuleRestore
}
finally{
$ProgressPreference = $originalProgressPreference
$ProgressPreference = $originalProgressPreference
}
$pesterParam = @{
'binDir' = $output
$pesterParam = @{
'binDir' = $output
'PassThru' = $true
'Terse' = $true
}
@@ -222,7 +222,7 @@ elseif($Stage -eq 'Build')
}
try {
Start-PSxUnit
Start-PSxUnit
}
catch {
$result = "FAIL"
@@ -253,8 +253,11 @@ elseif($Stage -eq 'Build')
{
log "pushing $package to $env:NUGET_URL"
Start-NativeExecution -sb {dotnet nuget push $package --api-key $env:NUGET_KEY --source "$env:NUGET_URL/api/v2/package"} -IgnoreExitcode
}
}
}
# Create and package Raspbian .tgz
Start-PSBuild -Clean -Runtime linux-arm
Start-PSPackage @packageParams -Type tar-arm -SkipReleaseChecks
}
# if the tests did not pass, throw the reason why