blob: 09d94a3736a1888af06474e8dceb3496bdc58982 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
|
# Maintainer: Aikawa Yataro <aikawayataro at protonmail dot com>
# Contributor: Carl Smedstad <carl.smedstad at protonmail dot com>
# Contributor: Rikarnto Bariampa <richard1996ba@gmail.com>
# Contributor: Kyle Sferrazza <kyle.sferrazza@gmail.com>
# Contributor: Max Liebkies <mail@maxliebkies.de>
pkgname=powershell
pkgver=7.5.0
pkgrel=1
pkgdesc="A cross-platform automation and configuration tool/framework"
arch=('x86_64')
url='https://microsoft.com/PowerShell'
license=('MIT')
depends=(
dotnet-runtime-9.0
)
makedepends=(
dotnet-sdk-9.0
git
unzip
)
checkdepends=(
inetutils
iputils
xdg-utils
)
install=powershell.install
_commit=713e77f15f63bae9f23fb02045c7843ad6a8769b
source=(
"git+https://github.com/PowerShell/PowerShell.git#commit=$_commit"
'Microsoft.PowerShell.SDK.csproj.TypeCatalog.targets'
'https://globalcdn.nuget.org/packages/pester.4.10.1.nupkg'
'nuget-source.patch'
)
noextract=('pester.4.10.1.nupkg')
sha256sums=('ea5e18b0f3514f89be46b2c3cc7bcc77382ad47d238a2cccdf3128d01ab7eb72'
'0c81200e5211a2f63bc8d9941432cbf98b5988249f0ceeb1f118a14adddbaa8e'
'6c996dc4dc8bef068cefb1680292154f45577c66fb0600dd0fb50939bbf8a3a3'
'84d34a09759271aa7aa614b97ff62642c773b2f81a712ac18d99985cf7a3c3ea')
prepare() {
cd PowerShell
# Use nuget.org source
patch --strip=1 --input=../nuget-source.patch
# I couldn't find any way of silencing the very verbose warnings from
# Microsoft.SourceLink other than to set the remote to a proper URL..
git remote set-url origin "https://github.com/PowerShell/PowerShell.git"
export NUGET_PACKAGES="$PWD/nuget"
export DOTNET_NOLOGO=true
export DOTNET_CLI_TELEMETRY_OPTOUT=true
# Replicating build.psm1:Start-PSBuild()
## Restore-PSPackage()
dotnet restore src/powershell-unix -p:PublishReadyToRun=true
dotnet restore src/TypeCatalogGen
dotnet restore src/ResGen
dotnet restore src/Modules
dotnet restore src/Microsoft.PowerShell.GlobalTool.Shim
dotnet restore test/tools/TestAlc
dotnet restore test/tools/TestExe
dotnet restore test/tools/UnixSocket
dotnet restore test/tools/Modules
dotnet restore test/tools/TestService -p:RuntimeIdentifiers=linux-x64
dotnet restore test/tools/WebListener -p:RuntimeIdentifiers=linux-x64
dotnet restore test/tools/NamedPipeConnection/src/code
}
build() {
cd PowerShell
export NUGET_PACKAGES="$PWD/nuget"
export DOTNET_NOLOGO=true
export DOTNET_CLI_TELEMETRY_OPTOUT=true
## Start-ResGen()
pushd src/ResGen
dotnet run --no-restore
popd
## Start-TypeGen()
cp -t src/Microsoft.PowerShell.SDK/obj \
"$srcdir/Microsoft.PowerShell.SDK.csproj.TypeCatalog.targets"
local inc_file="$PWD/src/TypeCatalogGen/powershell_linux-x64.inc"
dotnet msbuild \
src/Microsoft.PowerShell.SDK \
-t:_GetDependencies \
-p:DesignTimeBuild=true \
-p:_DependencyFile="$inc_file" \
-nologo
dotnet run \
--no-restore \
--project src/TypeCatalogGen \
src/System.Management.Automation/CoreCLR/CorePsTypeCatalog.cs \
"$inc_file"
## Publish PowerShell
dotnet publish \
--no-restore \
--runtime linux-x64 \
--no-self-contained \
--configuration Release \
--output lib \
src/powershell-unix/
## Publish reference assemblies
grep 'Microsoft.NETCore.App' "$inc_file" | sed 's/;//' | while read -r assembly; do
install -Dm755 -t lib/ref "$assembly"
done
## Restore-PSModuleToBuild()
cp -a "$NUGET_PACKAGES/microsoft.powershell.archive/1.2.5/." lib/Modules/Microsoft.PowerShell.Archive
cp -a "$NUGET_PACKAGES/microsoft.powershell.psresourceget/1.1.0/." lib/Modules/Microsoft.PowerShell.PSResourceGet
cp -a "$NUGET_PACKAGES/packagemanagement/1.4.8.1/." lib/Modules/PackageManagement
cp -a "$NUGET_PACKAGES/powershellget/2.2.5/." lib/Modules/PowerShellGet
cp -a "$NUGET_PACKAGES/psreadline/2.3.6/." lib/Modules/PSReadLine
cp -a "$NUGET_PACKAGES/threadjob/2.0.3/." lib/Modules/ThreadJob
}
check() {
cd PowerShell
export NUGET_PACKAGES="$PWD/nuget"
export DOTNET_NOLOGO=true
export DOTNET_CLI_TELEMETRY_OPTOUT=true
# Two failing tests, don't know why
rm test/powershell/engine/Help/HelpSystem.Tests.ps1
# Opens browser, skipping
rm test/powershell/Language/Scripting/NativeExecution/NativeCommandProcessor.Tests.ps1
rm test/powershell/Modules/Microsoft.PowerShell.Utility/Invoke-Item.Tests.ps1
# Creates & leaves directories in $HOME, skipping
rm test/powershell/Language/Parser/ParameterBinding.Tests.ps1
rm test/powershell/Language/Scripting/ScriptHelp.Tests.ps1
rm test/powershell/Modules/Microsoft.PowerShell.Utility/Add-Type.Tests.ps1
rm test/powershell/Modules/Microsoft.PowerShell.Utility/Set-PSBreakpoint.Tests.ps1
rm test/powershell/engine/Basic/Assembly.LoadFrom.Tests.ps1
rm test/powershell/engine/Basic/Assembly.LoadNative.Tests.ps1
# Some users report this test failing, cannot reproduce but removing anyway
rm test/powershell/Modules/Microsoft.PowerShell.Management/Start-Process.Tests.ps1
# Can't figure out why it fails
# If you want to dig into this, your patch will be appreciated
rm test/powershell/Modules/Microsoft.PowerShell.Utility/Format-Table.Tests.ps1
rm test/powershell/Language/Parser/RedirectionOperator.Tests.ps1
rm test/powershell/Language/Scripting/NativeExecution/NativeWindowsTildeExpansion.Tests.ps1
rm test/powershell/Modules/Microsoft.PowerShell.Utility/WebCmdlets.Tests.ps1
rm test/powershell/Modules/Microsoft.PowerShell.PSResourceGet/Microsoft.PowerShell.PSResourceGet.Tests.ps1
## Restore-PSPester()
unzip -ud temp_pester "$srcdir/pester.4.10.1.nupkg"
cp -a temp_pester/tools lib/Modules/Pester
unzip -ud test/tools/Modules/SelfSignedCertificate \
"$NUGET_PACKAGES/selfsignedcertificate/0.0.4/selfsignedcertificate.0.0.4.nupkg"
dotnet publish \
--no-restore \
--configuration Debug \
test/tools/TestAlc
for project in TestExe TestService UnixSocket WebListener; do
dotnet publish \
--no-restore \
--runtime linux-x64 \
--self-contained \
--configuration Debug \
--output test/tools/$project/bin \
test/tools/$project
export PATH="$PATH:$PWD/test/tools/$project/bin/Debug/net9.0/linux-x64"
done
dotnet publish \
--no-restore \
--configuration Debug \
--framework net9.0 \
--output test/tools/Modules/Microsoft.PowerShell.NamedPipeConnection \
test/tools/NamedPipeConnection/src/code
install -Dm644 -t test/tools/Modules/Microsoft.PowerShell.NamedPipeConnection \
test/tools/NamedPipeConnection/src/Microsoft.PowerShell.NamedPipeConnection.psd1
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
# shellcheck disable=SC2016
lib/pwsh -noprofile -command '
$env:PSModulePath = "$(Get-Location)/test/tools/Modules:" + $env:PSModulePath
Import-Module "Pester"
Invoke-Pester -Show Header,Failed,Summary -EnableExit `
-OutputFormat NUnitXml -OutputFile pester-tests.xml `
-ExcludeTag @("Slow", "RequireSudoOnUnix") `
-Tag @("CI", "Feature") `
"test/powershell"
'
}
package() {
cd PowerShell
local pkgnum=${pkgver:0:1}
install -dm755 "$pkgdir/usr/lib/$pkgname-$pkgnum"
cp -a -t "$pkgdir/usr/lib/$pkgname-$pkgnum" lib/*
install -dm755 "$pkgdir/usr/bin"
ln -s "/usr/lib/$pkgname-$pkgnum/pwsh" "$pkgdir/usr/bin/pwsh"
install -Dm644 -t "$pkgdir/usr/share/licenses/$pkgname" LICENSE.txt
}
|