dotnet-roslyn
LOW
maintainer ChrisTX
0 votes
scanned 2026-10-31 05:57:59.662655
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-roslyn
6
pkgver=5.9.0
7
pkgrel=2
8
pkgdesc="The .NET Compiler Platform for C#, Microsoft.CodeAnalysis.Common and .CSharp (NuGet packages)"
9
arch=('any')
10
url='https://github.com/dotnet/roslyn'
11
license=('MIT')
12
_dotnetsdkver="10.0"
13
makedepends=(
14
dotnet-sdk-"$_dotnetsdkver"
15
)
16
# The commit the packages were published from (release/insiders), and the official build of them, see
17
# the file version 5.900.26.35703 of their assemblies (Arcade encodes the date and build number in it)
18
_commit="35d9211b841e7613c1d2f8f5af6d628ace696c4c"
19
_officialbuildid="20260707.3"
20
# The git history is several gigabytes, the tarball of the commit is enough
21
source=("roslyn-$_commit.tar.gz::$url/archive/$_commit.tar.gz")
22
sha512sums=('4fe7d11a37a11f66721d9c1155409ab52e1a594b90999809e0efa37b4136797ad828cb1abcc06ac9885928812693e621f77da956ddcb582c6a16c9555c63bc83')
23
b2sums=('9871ff6860d0cef76ba1dad7b8d6957f8528f2589bbe320f6e3d438022cb44f425b2cbaf1b17c43313bcce6562d418133383acc290f7b6d9bc558fedf0101349')
24
25
_dotnet_env() {
26
export NUGET_PACKAGES="$srcdir/nuget"
27
export DOTNET_CLI_HOME="$srcdir/dotnet-home"
28
export DOTNET_CLI_TELEMETRY_OPTOUT=1
29
export DOTNET_NOLOGO=1
30
31
# Versions as in the official build, see eng/Versions.props. The repository information usually
32
# comes from git, which would find the repository this PKGBUILD is in instead.
33
_build_arguments=(
34
--configuration Release
35
-p:OfficialBuildId="$_officialbuildid"
36
-p:DotNetFinalVersionKind=release
37
-p:RepositoryCommit="$_commit"
38
-p:RepositoryUrl="$url"
39
-p:SourceRevisionId="$_commit"
40
-p:EnableSourceControlManagerQueries=false
41
)
42
}
43
44
# Writes NuGet.config with the given feeds ($@, as key=url) for everything but Arcade, the build SDK
45
# of the repository. It's taken from the source-built artifacts if prepare() found it there, otherwise
46
# from Microsoft's dotnet-eng feed like upstream does.
47
_nuget_config() {
48
local _arcadefeed=dotnet-eng _feed _package
49
[[ -f "$srcdir/arcade-version" ]] && _arcadefeed=dotnet-source-built
50
{
51
cat <<EOF
52
<?xml version="1.0" encoding="utf-8"?>
53
<configuration>
54
<packageSources>
55
<clear />
56
<add key="dotnet-source-built" value="$srcdir/nuget-local" />
57
EOF
58
for _feed in "dotnet-eng=https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-eng/nuget/v3/index.json" "$@"; do
59
echo " <add key=\"${_feed%%=*}\" value=\"${_feed#*=}\" />"
60
done
61
cat <<EOF
62
</packageSources>
63
<packageSourceMapping>
64
<clear />
65
<packageSource key="$_arcadefeed">
66
EOF
67
for _package in Microsoft.DotNet.Arcade.Sdk Microsoft.DotNet.XliffTasks; do
68
echo " <package pattern=\"$_package\" />"
69
done
70
echo ' </packageSource>'
71
for _feed in "$@"; do
72
printf ' <packageSource key="%s">\n <package pattern="*" />\n </packageSource>\n' "${_feed%%=*}"
73
done
74
cat <<EOF
75
</packageSourceMapping>
76
</configuration>
77
EOF
78
} >NuGet.config
79
}
80
81
prepare() {
82
# Arcade is part of the source-built .NET of Arch Linux (dotnet-source-built-artifacts), which
83
# Arch Linux ARM doesn't have. It can't be a makedepends of an arch=any package, so it's used when
84
# it's installed, and Arcade comes from dotnet-eng otherwise.
85
mkdir -p nuget-local
86
local _artifacts _arcade
87
for _artifacts in /usr/share/dotnet/source-built-artifacts/Private.SourceBuilt.Artifacts.*.tar.gz; do
88
[[ -f "$_artifacts" ]] || continue
89
bsdtar -xf "$_artifacts" -C nuget-local 'Microsoft.DotNet.Arcade.Sdk.*.nupkg' 'Microsoft.DotNet.XliffTasks.*.nupkg'
90
done
91
for _arcade in nuget-local/Microsoft.DotNet.Arcade.Sdk.*.nupkg; do
92
[[ -f "$_arcade" ]] || continue
93
_arcade="${_arcade##*/Microsoft.DotNet.Arcade.Sdk.}"
94
echo "${_arcade%.nupkg}" >arcade-version
95
done
96
97
cd "roslyn-$_commit" || exit
98
# Upstream's NuGet.config, which has all of Microsoft's feeds the tests need
99
mv NuGet.config NuGet.config.upstream
100
if [[ -f "$srcdir/arcade-version" ]]; then
101
sed -i -E 's|("Microsoft.DotNet.Arcade.Sdk": ")[^"]*"|\1'"$(<"$srcdir/arcade-version")"'"|' global.json
102
fi
103
# The syntax generator, which runs while compiling, is checked by a prebuilt analyzer from Microsoft's
104
# feeds, which isn't needed for building
105
sed -i '/<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" PrivateAssets="all" \/>/d' \
106
src/Tools/CompilerGeneratorTools/Source/CSharpSyntaxGenerator/CSharpSyntaxGenerator.csproj
107
}
108
109
build() {
110
_dotnet_env
111
cd "roslyn-$_commit" || exit
112
# The source-only mode .NET's source-build uses, which leaves out Roslyn's own analyzers (prebuilt
113
# packages from Microsoft's feeds) and the tests. The assemblies are public signed with Microsoft's key
114
# like in source-build, giving them the same strong name as upstream's.
115
_nuget_config "nuget.org=https://api.nuget.org/v3/index.json"
116
local _project
117
for _project in src/Compilers/Core/Portable/Microsoft.CodeAnalysis.csproj \
118
src/Compilers/CSharp/Portable/Microsoft.CodeAnalysis.CSharp.csproj; do
119
dotnet pack "$_project" "${_build_arguments[@]}" -p:DotNetBuildSourceOnly=true --output "$srcdir/nupkg"
120
done
121
}
122
123
check() {
124
_dotnet_env
125
cd "roslyn-$_commit" || exit
126
# The tests are only built outside the source-only mode. They need test packages from all of
127
# Microsoft's feeds upstream uses (dotnet-eng is set up by _nuget_config).
128
local _feeds=()
129
mapfile -t _feeds < <(sed -n -E 's|.*<add key="([^"]+)" value="(https[^"]+)".*|\1=\2|p' NuGet.config.upstream |
130
grep -v '^dotnet-eng=')
131
_nuget_config "${_feeds[@]}"
132
# The TooDeepObjectInitializer tests expect the parser to run out of stack at a fixed nesting depth,
133
# but how much stack there is depends on the thread they run on, so they fail about every other run
134
local _test _filter=()
135
for _test in TooDeepObjectInitializer TooDeepObjectInitializerAsExpression TooDeepObjectInitializerAsStatement; do
136
_filter+=("FullyQualifiedName!=Microsoft.CodeAnalysis.CSharp.UnitTests.ParserErrorMessageTests.$_test")
137
done
138
local _project
139
for _project in src/Compilers/Core/CodeAnalysisTest/Microsoft.CodeAnalysis.UnitTests.csproj \
140
src/Compilers/CSharp/Test/Syntax/Microsoft.CodeAnalysis.CSharp.Syntax.UnitTests.csproj \
141
src/Compilers/CSharp/Test/Semantic/Microsoft.CodeAnalysis.CSharp.Semantic.UnitTests.csproj \
142
src/Compilers/CSharp/Test/Symbol/Microsoft.CodeAnalysis.CSharp.Symbol.UnitTests.csproj; do
143
# Without the official versions, some tests expect the version of development builds (42.42.42.42)
144
dotnet test "$_project" --configuration Release -p:RepositoryCommit="$_commit" -p:RepositoryUrl="$url" \
145
--framework "net$_dotnetsdkver" --filter "$(
146
IFS='&'
147
echo "${_filter[*]}"
148
)"
149
done
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
183
package() {
184
install -Dm644 "$srcdir"/nupkg/Microsoft.CodeAnalysis.{Common,CSharp}."$pkgver".nupkg \
185
-t "$pkgdir/usr/share/dotnet/nuget-packages/"
186
install -Dm644 "roslyn-$_commit/License.txt" -t "$pkgdir/usr/share/licenses/$pkgname/"
187
188
_check_prebuilt "$srcdir/nuget"
189
}
190
Scan history
| Scanned at (UTC) | Severity | Rules |
|---|---|---|
| 2026-10-31 05:57:59 | Low | 1 |