dotnet-powershellstandard-library

LOW
maintainer ChrisTX 0 votes scanned 2026-10-31 05:57:59.662655
View on AUR
Why flagged

Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.

Triggered rules

Low Few votes, recently uploaded zero_votes_recent

Uploaded within the last 14 days with 2 or fewer community votes — little peer review so far.

PKGBUILD

1# Maintainer: Christian Pfeiffer <cpfeiffer at rev-crew dot info>
2# shellcheck disable=SC2034,SC2154
3# shellcheck shell=bash
4
5pkgname=dotnet-powershellstandard-library
6_nugetid=PowerShellStandard.Library
7pkgver=5.1.1
8pkgrel=1
9pkgdesc="Reference assembly for PowerShell modules that run on Windows PowerShell 5.1 and PowerShell 7 (NuGet package)"
10arch=('any')
11url='https://github.com/PowerShell/PowerShellStandard'
12license=('MIT')
13_dotnetsdkver="10.0"
14makedepends=(
15 dotnet-sdk-"$_dotnetsdkver"
16 dotnet-source-build-reference-packages
17 git
18)
19checkdepends=(
20 powershell
21 powershell-pester-4
22)
23# The commit of the 5.1.1 release ("release 5.1.1 - which adds an assembly for net452"), upstream
24# doesn't tag. The later commits only change documentation and the template, before master moves on to
25# PowerShell Standard 7.
26_commit="b69d5e6a5107287a5981db515bae4d5631278f76"
27source=("git+$url.git#commit=$_commit"
28 "invoke-tests.ps1")
29sha512sums=('e06ea3440792c4c7ad1cffa48cfff9f11434edc88344b200b1f4aa828d2fd0a81e5ff57f9b20f22838e74cec8997f23a88c559adc07ca355443b37e5fe3b447d'
30 'c031d359563d2551e48e61d4373450c2047492465ec3becee39c7279c2c14a59ba5c80eaf5b005090ad84529e6a1816d991a57eb5b9333ae29b71b7b8f9a09df')
31b2sums=('88d59ba95cf513d89e59dab0a1e7869c2dd7f28e8073160335689c5f685325be210039875504f992778a00fef531b6fc00d8b2744e6ff8b3ab5c4289e15433c1'
32 '55f0889ec1ddc893f155f9bf972d606d28b4b2620cd489a59698cdcfad3fc4ccb40499cb1133cbdb48ad2d298c88f4809d6281090364eace573c54a9ab6eccf4')
33
34_dotnet_env() {
35 export NUGET_PACKAGES="$srcdir/nuget"
36 export DOTNET_CLI_HOME="$srcdir/dotnet-home"
37 export DOTNET_CLI_TELEMETRY_OPTOUT=1
38 export DOTNET_NOLOGO=1
39
40 # The repository information usually comes from git, which would find the repository this PKGBUILD
41 # is in instead
42 _build_arguments=(
43 --configuration Release
44 -p:SourceRevisionId="$_commit"
45 -p:EnableSourceControlManagerQueries=false
46 )
47}
48
49prepare() {
50 cd PowerShellStandard || exit
51 # NETStandard.Library and the System.* reference packages come from dotnet-source-build-reference-packages
52 cat >nuget.config <<EOF
53<?xml version="1.0" encoding="utf-8"?>
54<configuration>
55 <packageSources>
56 <clear />
57 <add key="dotnet-source-build-reference-packages" value="/usr/share/dotnet/source-build-reference-packages" />
58 </packageSources>
59</configuration>
60EOF
61 # Only for .NET Standard: the .NET Framework 4.5.2 build would need its reference assemblies, and is
62 # only used by Windows PowerShell. Public signed with the key in the repository, giving it the same
63 # strong name as upstream's. The packages it compiles against in the versions the reference packages
64 # have; System.Security.SecureString and System.Security.Principal are part of .NET Standard 2.0. The
65 # nuspec's file name differs in case.
66 sed -i -E \
67 -e 's|<TargetFrameworks>netstandard2.0;net452</TargetFrameworks>|<TargetFramework>netstandard2.0</TargetFramework>|' \
68 -e 's|<DelaySign>True</DelaySign>|<PublicSign>True</PublicSign>|' \
69 -e 's|(Include="System.IO.FileSystem.AccessControl" Version=)"[^"]*"|\1"5.0.0"|' \
70 -e 's|(Include="System.Security.AccessControl" Version=)"[^"]*"|\1"6.0.0"|' \
71 -e 's|(Include="System.Security.Permissions" Version=)"[^"]*"|\1"6.0.0"|' \
72 -e '/Include="System.Security.(SecureString|Principal)"/d' \
73 -e 's|PowershellStandard.Library.nuspec|PowerShellStandard.Library.nuspec|' \
74 src/5/System.Management.Automation-lib.csproj
75 sed -i '/net452/d' src/5/PowerShellStandard.Library.nuspec
76
77 # The tests compare the types with the PowerShell running them, which no longer has some: PowerShell 7
78 # removed the workflow job proxies (PowerShell/PowerShell#10083, #9618), and powershell's
79 # cim-windows-only.patch the CIM type adapter
80 # shellcheck disable=SC2016
81 sed -i 's/-difference \$asmT /-difference ($asmT | Where-Object { $_ -notin @("System.Management.Automation.JobDataAddedEventArgs", "System.Management.Automation.PSChildJobProxy", "System.Management.Automation.PSJobProxy", "System.Management.Automation.Runspaces.PSSessionType", "Microsoft.PowerShell.Cim.CimInstanceAdapter") }) /' \
82 test/5/core/PSS5.Tests.ps1
83}
84
85build() {
86 _dotnet_env
87 cd PowerShellStandard || exit
88 dotnet pack src/5/System.Management.Automation-lib.csproj "${_build_arguments[@]}" --output "$srcdir/nupkg"
89}
90
91check() {
92 _dotnet_env
93 # The tests of the release files (test/Build.Tests.ps1) list the .NET Framework build as well
94 HOME="$srcdir/home" pwsh -NoProfile -NonInteractive -File "$srcdir/invoke-tests.ps1" -Path "$srcdir/PowerShellStandard"
95}
96
97# Fails if a binary in $pkgdir, also inside the .nupkg files there, is identical to one of the packages
98# restored from a remote feed like nuget.org into $1, so no prebuilt binary slips in instead of one built
99# from source
100_check_prebuilt() {
101 local _extracted="$srcdir/check-prebuilt" _metadata _file _hash _found=0
102 local _binaries=(-type f '(' -name '*.dll' -o -name '*.exe' -o -name '*.so' -o -name '*.so.*' -o -name '*.dylib' ')')
103 local -A _prebuilt=()
104 while IFS= read -r -d '' _metadata; do
105 grep -qE '"source": *"https?://' "$_metadata" || continue
106 while IFS= read -r -d '' _file; do
107 _prebuilt[$(sha256sum <"$_file")]="${_file#"$1"/}"
108 done < <(find "${_metadata%/*}" "${_binaries[@]}" -print0)
109 done < <(find "$1" -name .nupkg.metadata -print0)
110
111 rm -rf "$_extracted"
112 mkdir -p "$_extracted"
113 while IFS= read -r -d '' _file; do
114 mkdir -p "$_extracted/${_file#"$pkgdir"/}"
115 bsdtar -xf "$_file" -C "$_extracted/${_file#"$pkgdir"/}"
116 done < <(find "$pkgdir" -type f -name '*.nupkg' -print0)
117 while IFS= read -r -d '' _file; do
118 _hash=$(sha256sum <"$_file")
119 if [[ -v "_prebuilt[$_hash]" ]]; then
120 echo "Prebuilt binary: ${_file#"$_extracted"/} is ${_prebuilt[$_hash]}" >&2
121 _found=1
122 fi
123 done < <(find "$pkgdir" "$_extracted" "${_binaries[@]}" -print0)
124 rm -rf "$_extracted"
125 return "$_found"
126}
127
128package() {
129 install -Dm644 "$srcdir/nupkg/$_nugetid.$pkgver.nupkg" -t "$pkgdir/usr/share/dotnet/nuget-packages/"
130 install -Dm644 PowerShellStandard/LICENSE.txt -t "$pkgdir/usr/share/licenses/$pkgname/"
131
132 _check_prebuilt "$srcdir/nuget"
133}
134

Scan history

Scanned at (UTC)SeverityRules
2026-10-31 05:57:59 Low 1

Report a package

Reports go to the AURWatch maintainer (one person) and are read by hand. No login required.

0 / 4000
Your suggestion