dotnet-nerdbank-streams

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-nerdbank-streams
6_nugetid=Nerdbank.Streams
7pkgver=2.14.411
8pkgrel=1
9pkgdesc="Streams for full duplex in-proc communication, wrap a WebSocket, split a stream into multiple channels, Nerdbank.Streams (NuGet package)"
10arch=('any')
11url='https://github.com/dotnet/Nerdbank.Streams'
12license=('MIT')
13_dotnetsdkver="10.0"
14makedepends=(
15 dotnet-sdk-"$_dotnetsdkver"
16 dotnet-vs-threading
17 dotnet-vs-validation
18 jq
19)
20# The commit the package was published from (tag v2.14.411), and the commit of the MessagePack
21# submodule it uses some sources of
22_commit="bdd943456d04a2c68b87d6b559de7f3ab1186bc1"
23_messagepackcommit="a718919a6b01ca8bb883f579b3cc78f8cc219a81"
24source=("Nerdbank.Streams-$_commit.tar.gz::$url/archive/$_commit.tar.gz"
25 "MessagePack-CSharp-$_messagepackcommit.tar.gz::https://github.com/AArnott/MessagePack-CSharp/archive/$_messagepackcommit.tar.gz")
26sha512sums=('fff5fdff9affeb9172611082a857effbe234158a0e64ca97d5fcf99a31ca742fa76a53d8e400a0539e581a841f2373ec66bcf70ef8d994cb3390d91cc48dc832'
27 '94707a0f85e6fdb7c14be2d73e150ecd499846a795a316ca2534ee793877c3cc903f983790a7985668e5905700099f26692ba99b45ebb3d3556d18b7215701db')
28b2sums=('40555daef5ebad0070a1dbb62a172509ce2cf6274853368638cf03bc00dd4a4f8e6eb2edca4b839a8d526a2e298e6feaceb3c8419330b0515c704a0fb1bc234e'
29 '7f2cda90be668caed1410eaa5c7df29ca3eea644fac278f6740b47ec0116f10e6bd3478f391ced4ad9671897d27196fa49c8a7cf910b464b712292c9fc629fd5')
30
31_dotnet_env() {
32 export NUGET_PACKAGES="$srcdir/nuget"
33 export DOTNET_CLI_HOME="$srcdir/dotnet-home"
34 export DOTNET_CLI_TELEMETRY_OPTOUT=1
35 export DOTNET_NOLOGO=1
36
37 # Versions as in the official build, which Nerdbank.GitVersioning computes from git. The patch
38 # version is the git height, and the file version ends in the first two bytes of the commit. The
39 # repository information usually comes from git, which would find the repository this PKGBUILD is
40 # in instead. The packages from the source-built artifacts and the system feed are newer than the
41 # versions referenced (NU1603).
42 _build_arguments=(
43 --configuration Release
44 -p:Version="$pkgver"
45 -p:AssemblyVersion="${pkgver%.*}.0.0"
46 -p:FileVersion="$pkgver.$((16#${_commit:0:4}))"
47 -p:InformationalVersion="$pkgver+${_commit:0:10}"
48 -p:IncludeSourceRevisionInInformationalVersion=false
49 -p:EnableSourceControlManagerQueries=false
50 -p:RepositoryType=git
51 -p:RepositoryBranch="refs/heads/v${pkgver%.*}"
52 -p:RepositoryCommit="$_commit"
53 -p:RepositoryUrl="$url"
54 -p:WarningsNotAsErrors=NU1603
55 )
56}
57
58# .NET runtime packages the library is built against
59_runtimepackages=(
60 Microsoft.Bcl.AsyncInterfaces
61 System.IO.Pipelines
62)
63
64# Packages built from source by other packages (makedepends), in the system feed
65_systempackages=(
66 Microsoft.VisualStudio.Threading.Only
67 Microsoft.VisualStudio.Validation
68)
69
70# Writes nuget.config with the feed $1 (as key=url) for everything but the packages of the system
71# feed and the runtime packages, which are taken from the source-built artifacts if prepare() found
72# them there
73_nuget_config() {
74 local _package
75 {
76 cat <<EOF
77<?xml version="1.0" encoding="utf-8"?>
78<configuration>
79 <packageSources>
80 <clear />
81 <add key="dotnet-system" value="/usr/share/dotnet/nuget-packages" />
82 <add key="dotnet-source-built" value="$srcdir/nuget-local" />
83 <add key="${1%%=*}" value="${1#*=}" />
84 </packageSources>
85 <packageSourceMapping>
86 <clear />
87 <packageSource key="dotnet-system">
88EOF
89 for _package in "${_systempackages[@]}"; do
90 echo " <package pattern=\"$_package\" />"
91 done
92 echo ' </packageSource>'
93 if [[ -f "$srcdir/runtime-packages" ]]; then
94 echo ' <packageSource key="dotnet-source-built">'
95 for _package in "${_runtimepackages[@]}"; do
96 echo " <package pattern=\"$_package\" />"
97 done
98 echo ' </packageSource>'
99 fi
100 cat <<EOF
101 <packageSource key="${1%%=*}">
102 <package pattern="*" />
103 </packageSource>
104 </packageSourceMapping>
105</configuration>
106EOF
107 } >nuget.config
108}
109
110prepare() {
111 # The runtime packages are part of the source-built .NET of Arch Linux
112 # (dotnet-source-built-artifacts), which Arch Linux ARM doesn't have. It can't be a makedepends of
113 # an arch=any package, so it's used when it's installed, and they come from nuget.org otherwise.
114 mkdir -p nuget-local
115 local _artifacts
116 for _artifacts in /usr/share/dotnet/source-built-artifacts/Private.SourceBuilt.Artifacts.*.tar.gz; do
117 [[ -f "$_artifacts" ]] || continue
118 bsdtar -xf "$_artifacts" -C nuget-local "${_runtimepackages[@]/%/.*.nupkg}"
119 touch runtime-packages
120 done
121
122 cd "Nerdbank.Streams-$_commit" || exit
123 rmdir ext/MessagePack
124 ln -s "$srcdir/MessagePack-CSharp-$_messagepackcommit" ext/MessagePack
125 # Upstream pins a newer feature band of the .NET SDK, which isn't needed
126 jq 'del(.sdk)' global.json >global.json.new
127 mv global.json.new global.json
128 # Nerdbank.GitVersioning needs git, see _dotnet_env for the versions
129 sed -i '/GlobalPackageReference Include="Nerdbank.GitVersioning"/d' Directory.Packages.props
130 sed -i 's/ DependsOnTargets="GetBuildVersion"//' Directory.Build.props
131 _nuget_config "nuget.org=https://api.nuget.org/v3/index.json"
132}
133
134build() {
135 _dotnet_env
136 cd "Nerdbank.Streams-$_commit" || exit
137 # The assemblies are signed with the key in the repository, giving them the same strong names as
138 # upstream's
139 dotnet pack "src/$_nugetid/$_nugetid.csproj" "${_build_arguments[@]}" --output "$srcdir/nupkg"
140}
141
142check() {
143 _dotnet_env
144 cd "Nerdbank.Streams-$_commit" || exit
145 # The test runner targets .NET 8. global.json selects Microsoft.Testing.Platform for dotnet test.
146 # OfferNullErrorCompletedPipe expects the message .NET 8 gives NullReferenceException(null), newer
147 # .NET gives it the default message.
148 DOTNET_ROLL_FORWARD=Major dotnet test --project "test/$_nugetid.Tests/$_nugetid.Tests.csproj" "${_build_arguments[@]}" \
149 --filter-not-method '*.OfferNullErrorCompletedPipe'
150}
151
152# Fails if a binary in $pkgdir, also inside the .nupkg files there, is identical to one of the packages
153# restored from a remote feed like nuget.org into $1, so no prebuilt binary slips in instead of one built
154# from source
155_check_prebuilt() {
156 local _extracted="$srcdir/check-prebuilt" _metadata _file _hash _found=0
157 local _binaries=(-type f '(' -name '*.dll' -o -name '*.exe' -o -name '*.so' -o -name '*.so.*' -o -name '*.dylib' ')')
158 local -A _prebuilt=()
159 while IFS= read -r -d '' _metadata; do
160 grep -qE '"source": *"https?://' "$_metadata" || continue
161 while IFS= read -r -d '' _file; do
162 _prebuilt[$(sha256sum <"$_file")]="${_file#"$1"/}"
163 done < <(find "${_metadata%/*}" "${_binaries[@]}" -print0)
164 done < <(find "$1" -name .nupkg.metadata -print0)
165
166 rm -rf "$_extracted"
167 mkdir -p "$_extracted"
168 while IFS= read -r -d '' _file; do
169 mkdir -p "$_extracted/${_file#"$pkgdir"/}"
170 bsdtar -xf "$_file" -C "$_extracted/${_file#"$pkgdir"/}"
171 done < <(find "$pkgdir" -type f -name '*.nupkg' -print0)
172 while IFS= read -r -d '' _file; do
173 _hash=$(sha256sum <"$_file")
174 if [[ -v "_prebuilt[$_hash]" ]]; then
175 echo "Prebuilt binary: ${_file#"$_extracted"/} is ${_prebuilt[$_hash]}" >&2
176 _found=1
177 fi
178 done < <(find "$pkgdir" "$_extracted" "${_binaries[@]}" -print0)
179 rm -rf "$_extracted"
180 return "$_found"
181}
182
183package() {
184 install -Dm644 "$srcdir/nupkg/$_nugetid.$pkgver.nupkg" -t "$pkgdir/usr/share/dotnet/nuget-packages/"
185 install -Dm644 "Nerdbank.Streams-$_commit/LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"
186
187 _check_prebuilt "$srcdir/nuget"
188}
189

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