dotnet-vs-threading
LOW
maintainer ChrisTX
0 votes
scanned 2026-10-31 07:58:04.077835
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
5
pkgname=dotnet-vs-threading
6
_nugetid=Microsoft.VisualStudio.Threading.Only
7
_project=Microsoft.VisualStudio.Threading
8
pkgver=18.12.1
9
pkgrel=1
10
pkgdesc="Async synchronization primitives, async collections, TPL and dataflow extensions, Microsoft.VisualStudio.Threading.Only (NuGet package)"
11
arch=('any')
12
url='https://github.com/microsoft/vs-threading'
13
license=('MIT')
14
_dotnetsdkver="10.0"
15
makedepends=(
16
dotnet-sdk-"$_dotnetsdkver"
17
dotnet-vs-validation
18
jq
19
python
20
)
21
# The commit the package was published from (tag v18.12.1)
22
_commit="816950dca421b07df18e26aa75adcf09a35a0db6"
23
# Microsoft's internal build signs the assemblies, so they're public signed with the public key from
24
# Arcade, giving them the same strong name as upstream's
25
_arcadecommit="94f797268292122de4b6344d6265fad658c53703"
26
source=("vs-threading-$_commit.tar.gz::$url/archive/$_commit.tar.gz"
27
"MSFT.snk::https://raw.githubusercontent.com/dotnet/arcade/$_arcadecommit/src/Microsoft.DotNet.Arcade.Sdk/tools/snk/MSFT.snk"
28
"lcl-to-resx.py")
29
sha512sums=('d8e5bf92bb94d4a01e29c104f2f0d41330e7aa3413d8de981ddd73a0c4e10a394e7ed8b406dd01b981e5266a5fea6050ea036616c210ddcd4406adae824bb0c7'
30
'98c02c09b9fed2ad77d8403efa5788053abb66a9c6c2cb8dd5d15ce49daf25e3a128b9b281fa2bc79e7cfc33adfbbfff6901b63fc9b882a890c13737892e71e1'
31
'1b70bc00f549a828208d65bba339e4b30a677cc02cb5d336c9a698b01aa0589c22c1cac7256e45b325039a0df94bc9efc7d99a6039cff4f7f36f90f721d72ae1')
32
b2sums=('b2f3c835c7b97159cb5b36c90cbbcd61ae4f0d3e930beb0e93e05431676e3f7aaea7a5a0f530b79f9a249f22302520be2405b886d6be932dea1af5923c936f6e'
33
'df52cdab9f311499106f30869455797a02345bf43fd01e942fbb0312228660c88122fba00188484cb03616dfa4b234a83e73f132377c94169f2a26da175ff2ee'
34
'2dd7539d81671b5d0bcf44245b41083f913492ade4ccfe7b37da972f559b048277983bf6835d535fd1924d01f73737498073682c517b12e0f38f2a38fa541355')
35
36
_dotnet_env() {
37
export NUGET_PACKAGES="$srcdir/nuget"
38
export DOTNET_CLI_HOME="$srcdir/dotnet-home"
39
export DOTNET_CLI_TELEMETRY_OPTOUT=1
40
export DOTNET_NOLOGO=1
41
42
# Versions as in the official build, which Nerdbank.GitVersioning computes from git and
43
# version.json. The file version ends in the first two bytes of the commit. The repository
44
# information usually comes from git, which would find the repository this PKGBUILD is in instead.
45
_build_arguments=(
46
--configuration Release
47
-p:Version="$pkgver"
48
-p:AssemblyVersion="$(jq -r .assemblyVersion "$srcdir/vs-threading-$_commit/version.json").0.0"
49
-p:FileVersion="$pkgver.$((16#${_commit:0:4}))"
50
-p:InformationalVersion="$pkgver+${_commit:0:10}"
51
-p:IncludeSourceRevisionInInformationalVersion=false
52
-p:EnableSourceControlManagerQueries=false
53
-p:RepositoryType=git
54
-p:RepositoryCommit="$_commit"
55
-p:RepositoryUrl="$url"
56
-p:SignAssembly=true
57
-p:PublicSign=true
58
-p:AssemblyOriginatorKeyFile="$srcdir/MSFT.snk"
59
)
60
}
61
62
# .NET runtime packages the library is built against
63
_runtimepackages=(
64
Microsoft.Bcl.AsyncInterfaces
65
)
66
67
# Packages built from source by other packages (makedepends), in the system feed
68
_systempackages=(
69
Microsoft.VisualStudio.Validation
70
)
71
72
# Writes nuget.config with the feed $1 (as key=url) for everything but the packages of the system
73
# feed and the runtime packages, which are taken from the source-built artifacts if prepare() found
74
# them there
75
_nuget_config() {
76
local _package
77
{
78
cat <<EOF
79
<?xml version="1.0" encoding="utf-8"?>
80
<configuration>
81
<packageSources>
82
<clear />
83
<add key="dotnet-system" value="/usr/share/dotnet/nuget-packages" />
84
<add key="dotnet-source-built" value="$srcdir/nuget-local" />
85
<add key="${1%%=*}" value="${1#*=}" />
86
</packageSources>
87
<packageSourceMapping>
88
<clear />
89
<packageSource key="dotnet-system">
90
EOF
91
for _package in "${_systempackages[@]}"; do
92
echo " <package pattern=\"$_package\" />"
93
done
94
echo ' </packageSource>'
95
if [[ -f "$srcdir/runtime-packages" ]]; then
96
echo ' <packageSource key="dotnet-source-built">'
97
for _package in "${_runtimepackages[@]}"; do
98
echo " <package pattern=\"$_package\" />"
99
done
100
echo ' </packageSource>'
101
fi
102
cat <<EOF
103
<packageSource key="${1%%=*}">
104
<package pattern="*" />
105
</packageSource>
106
</packageSourceMapping>
107
</configuration>
108
EOF
109
} >nuget.config
110
}
111
112
prepare() {
113
# The runtime packages are part of the source-built .NET of Arch Linux
114
# (dotnet-source-built-artifacts), which Arch Linux ARM doesn't have. It can't be a makedepends of
115
# an arch=any package, so it's used when it's installed, and they come from nuget.org otherwise.
116
mkdir -p nuget-local
117
local _artifacts
118
for _artifacts in /usr/share/dotnet/source-built-artifacts/Private.SourceBuilt.Artifacts.*.tar.gz; do
119
[[ -f "$_artifacts" ]] || continue
120
bsdtar -xf "$_artifacts" -C nuget-local "${_runtimepackages[@]/%/.*.nupkg}"
121
touch runtime-packages
122
done
123
124
cd "vs-threading-$_commit" || exit
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), and MicroBuild is Microsoft's
129
# internal signing and localization
130
sed -i -E '/GlobalPackageReference Include="(Nerdbank.GitVersioning|Microsoft.VisualStudio.Internal.MicroBuild.VisualStudio)"/d' \
131
Directory.Packages.props
132
sed -i 's/ DependsOnTargets="GetBuildVersion"//' Directory.Build.props
133
# The translations, which MicroBuild applies to the assemblies
134
python -I "$srcdir/lcl-to-resx.py" loc/lcl "$_project" "src/$_project"
135
136
# Upstream's NuGet.config, which has the feed the tests need
137
mv nuget.config nuget.config.upstream
138
}
139
140
build() {
141
_dotnet_env
142
cd "vs-threading-$_commit" || exit
143
# Only the library, the analyzers would need Roslyn for Visual Basic. On Linux, upstream builds for
144
# all frameworks but the one for Windows (WPF).
145
_nuget_config "nuget.org=https://api.nuget.org/v3/index.json"
146
dotnet pack "src/$_project/$_project.csproj" "${_build_arguments[@]}" --output "$srcdir/nupkg"
147
}
148
149
check() {
150
_dotnet_env
151
cd "vs-threading-$_commit" || exit
152
# The tests need packages from the feed upstream uses, which mirrors nuget.org
153
_nuget_config "$(sed -n -E 's|.*<add key="([^"]+)" value="(https[^"]+)".*|\1=\2|p' nuget.config.upstream)"
154
# The test runner targets .NET 8. global.json selects Microsoft.Testing.Platform for dotnet test.
155
# Like upstream's CI (tools/dotnet-test-cloud.ps1), without the tests marked as unstable, see
156
# https://github.com/microsoft/vs-threading/issues/1041
157
DOTNET_ROLL_FORWARD=Major dotnet test --project "test/$_project.Tests/$_project.Tests.csproj" "${_build_arguments[@]}" \
158
--filter-not-trait 'TestCategory=FailsInCloudTest'
159
}
160
161
# Fails if a binary in $pkgdir, also inside the .nupkg files there, is identical to one of the packages
162
# restored from a remote feed like nuget.org into $1, so no prebuilt binary slips in instead of one built
163
# from source
164
_check_prebuilt() {
165
local _extracted="$srcdir/check-prebuilt" _metadata _file _hash _found=0
166
local _binaries=(-type f '(' -name '*.dll' -o -name '*.exe' -o -name '*.so' -o -name '*.so.*' -o -name '*.dylib' ')')
167
local -A _prebuilt=()
168
while IFS= read -r -d '' _metadata; do
169
grep -qE '"source": *"https?://' "$_metadata" || continue
170
while IFS= read -r -d '' _file; do
171
_prebuilt[$(sha256sum <"$_file")]="${_file#"$1"/}"
172
done < <(find "${_metadata%/*}" "${_binaries[@]}" -print0)
173
done < <(find "$1" -name .nupkg.metadata -print0)
174
175
rm -rf "$_extracted"
176
mkdir -p "$_extracted"
177
while IFS= read -r -d '' _file; do
178
mkdir -p "$_extracted/${_file#"$pkgdir"/}"
179
bsdtar -xf "$_file" -C "$_extracted/${_file#"$pkgdir"/}"
180
done < <(find "$pkgdir" -type f -name '*.nupkg' -print0)
181
while IFS= read -r -d '' _file; do
182
_hash=$(sha256sum <"$_file")
183
if [[ -v "_prebuilt[$_hash]" ]]; then
184
echo "Prebuilt binary: ${_file#"$_extracted"/} is ${_prebuilt[$_hash]}" >&2
185
_found=1
186
fi
187
done < <(find "$pkgdir" "$_extracted" "${_binaries[@]}" -print0)
188
rm -rf "$_extracted"
189
return "$_found"
190
}
191
192
package() {
193
install -Dm644 "$srcdir/nupkg/$_nugetid.$pkgver.nupkg" -t "$pkgdir/usr/share/dotnet/nuget-packages/"
194
install -Dm644 "vs-threading-$_commit/LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"
195
196
_check_prebuilt "$srcdir/nuget"
197
}
198
Scan history
| Scanned at (UTC) | Severity | Rules |
|---|---|---|
| 2026-10-31 07:58:04 | Low | 1 |