Skip to content

Commit 969ba76

Browse files
author
Steve Lee (POWERSHELL HE/HIM) (from Dev Box)
committed
add error handling
1 parent 9833157 commit 969ba76

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

build.ps1

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -922,17 +922,18 @@ if ($packageType -eq 'msixbundle') {
922922

923923
# Read the spec template and replace placeholders
924924
$specTemplate = Get-Content "$PSScriptRoot/packaging/rpm/dsc.spec" -Raw
925-
$specContent = $specTemplate.Replace('VERSION_PLACEHOLDER', $productVersion).Replace('ARCH_PLACEHOLDER', $rpmArch)
925+
$specContent = $specTemplate.Replace('VERSION_PLACEHOLDER', $productVersion.Replace('-','~')).Replace('ARCH_PLACEHOLDER', $rpmArch)
926926
$specFile = Join-Path $rpmBuildRoot 'SPECS' 'dsc.spec'
927927
Set-Content -Path $specFile -Value $specContent
928928

929929
Write-Verbose -Verbose "Building RPM package"
930930
$rpmPackageName = "dsc-$productVersion-1.$rpmArch.rpm"
931931

932932
# Build the RPM
933-
rpmbuild -bb --define "_topdir $rpmBuildRoot" $specFile
933+
rpmbuild -v -bb --define "_topdir $rpmBuildRoot" --buildroot "$rpmBuildRoot/BUILDROOT" $specFile 2>&1 > $rpmTarget/rpmbuild.log
934934

935935
if ($LASTEXITCODE -ne 0) {
936+
Write-Error (Get-Content $rpmTarget/rpmbuild.log -Raw)
936937
throw "Failed to create RPM package"
937938
}
938939

@@ -1015,9 +1016,10 @@ if ($packageType -eq 'msixbundle') {
10151016
$debPackageName = "dsc_$productVersion-1_$debArch.deb"
10161017

10171018
# Build the DEB
1018-
dpkg-deb --build $debBuildRoot
1019+
dpkg-deb --build $debBuildRoot 2>&1 > $debTarget/debbuild.log
10191020

10201021
if ($LASTEXITCODE -ne 0) {
1022+
Write-Error (Get-Content $debTarget/debbuild.log -Raw)
10211023
throw "Failed to create DEB package"
10221024
}
10231025

0 commit comments

Comments
 (0)