dotnet-omnisharp-extensions

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-omnisharp-extensions
6pkgver=0.19.11
7pkgrel=1
8pkgdesc="Language Server Protocol and Debug Adapter Protocol for .NET, OmniSharp.Extensions.* (NuGet packages)"
9arch=('any')
10url='https://github.com/OmniSharp/csharp-language-server-protocol'
11license=('MIT')
12_dotnetsdkver="10.0"
13makedepends=(
14 dotnet-mediatr-12
15 dotnet-nerdbank-streams
16 dotnet-newtonsoft-json
17 dotnet-sdk-"$_dotnetsdkver"
18 dotnet-system-reactive
19 dotnet-vs-threading
20 dotnet-vs-validation
21 jq
22)
23# The commit the packages were published from (tag v0.19.11). OmniSharp.Extensions.JsonRpc.Generators
24# 0.19.11 was published from an earlier commit, only CI and dependency versions changed since.
25_commit="a601a66c59e570d297e83987aff79038c5449724"
26source=("csharp-language-server-protocol-$_commit.tar.gz::$url/archive/$_commit.tar.gz")
27sha512sums=('cc3e223c5dc2e0096495722e485a296c790cd88a5e55b6990e8e0ab5acfef14ae13ae499616a2e8ccc488f81ac9efaaa5e21961bd5c464d28ba11fc0e5faacfc')
28b2sums=('bc564390c993b2cd14c38c909ae485846214569130d604c6242b5e28af9c62c7954496156373fde793e4cfbfbdd0737c013deab0ba464d0f1bfbbe686246e30e')
29
30_dotnet_env() {
31 export NUGET_PACKAGES="$srcdir/nuget"
32 export DOTNET_CLI_HOME="$srcdir/dotnet-home"
33 export DOTNET_CLI_TELEMETRY_OPTOUT=1
34 export DOTNET_NOLOGO=1
35
36 # Versions as in the official build, which GitVersion computes from git. The repository information
37 # usually comes from git, which would find the repository this PKGBUILD is in instead. The upstream
38 # build downloads the package icon. The packages from the source-built artifacts and the system feed
39 # are newer than the versions referenced (NU1603).
40 _build_arguments=(
41 --configuration Release
42 -p:GitVersion_SemVer="$pkgver"
43 -p:GitVersion_AssemblySemVer="$pkgver.0"
44 -p:GitVersion_Major="${pkgver%%.*}"
45 -p:GitVersion_Minor="$(cut -d. -f2 <<<"$pkgver")"
46 -p:GitVersion_InformationalVersion="$pkgver+Branch.master.Sha.$_commit"
47 -p:SourceRevisionId="$_commit"
48 -p:EnableSourceControlManagerQueries=false
49 -p:RepositoryType=git
50 -p:RepositoryBranch=refs/heads/master
51 -p:RepositoryCommit="$_commit"
52 -p:RepositoryUrl="$url"
53 -p:IncludeSymbols=false
54 -p:PackageIcon=
55 -p:WarningsNotAsErrors=NU1603
56 )
57}
58
59# .NET runtime packages the libraries are built against
60_runtimepackages=(
61 Microsoft.Bcl.AsyncInterfaces
62 Microsoft.Extensions.Configuration
63 Microsoft.Extensions.Configuration.Abstractions
64 Microsoft.Extensions.Configuration.Binder
65 Microsoft.Extensions.DependencyInjection
66 Microsoft.Extensions.DependencyInjection.Abstractions
67 Microsoft.Extensions.Logging
68 Microsoft.Extensions.Logging.Abstractions
69 Microsoft.Extensions.Options
70 Microsoft.Extensions.Options.ConfigurationExtensions
71 Microsoft.Extensions.Primitives
72 System.Collections.Immutable
73 System.Diagnostics.DiagnosticSource
74 System.IO.Pipelines
75 System.Threading.Channels
76)
77
78# Packages built from source by other packages (makedepends), in the system feed
79_systempackages=(
80 MediatR
81 MediatR.Contracts
82 Microsoft.VisualStudio.Threading.Only
83 Microsoft.VisualStudio.Validation
84 Nerdbank.Streams
85 Newtonsoft.Json
86 System.Reactive
87)
88
89# Writes NuGet.config with the feed $1 (as key=url) for everything but the packages of the system
90# feed and the runtime packages, which are taken from the source-built artifacts if prepare() found
91# them there
92_nuget_config() {
93 local _package
94 {
95 cat <<EOF
96<?xml version="1.0" encoding="utf-8"?>
97<configuration>
98 <packageSources>
99 <clear />
100 <add key="dotnet-system" value="/usr/share/dotnet/nuget-packages" />
101 <add key="dotnet-source-built" value="$srcdir/nuget-local" />
102 <add key="${1%%=*}" value="${1#*=}" />
103 </packageSources>
104 <packageSourceMapping>
105 <clear />
106 <packageSource key="dotnet-system">
107EOF
108 for _package in "${_systempackages[@]}"; do
109 echo " <package pattern=\"$_package\" />"
110 done
111 echo ' </packageSource>'
112 if [[ -f "$srcdir/runtime-packages" ]]; then
113 echo ' <packageSource key="dotnet-source-built">'
114 for _package in "${_runtimepackages[@]}"; do
115 echo " <package pattern=\"$_package\" />"
116 done
117 echo ' </packageSource>'
118 fi
119 cat <<EOF
120 <packageSource key="${1%%=*}">
121 <package pattern="*" />
122 </packageSource>
123 </packageSourceMapping>
124</configuration>
125EOF
126 } >NuGet.config
127}
128
129prepare() {
130 # The runtime packages are part of the source-built .NET of Arch Linux
131 # (dotnet-source-built-artifacts), which Arch Linux ARM doesn't have. It can't be a makedepends of
132 # an arch=any package, so it's used when it's installed, and they come from nuget.org otherwise.
133 mkdir -p nuget-local
134 local _artifacts
135 for _artifacts in /usr/share/dotnet/source-built-artifacts/Private.SourceBuilt.Artifacts.*.tar.gz; do
136 [[ -f "$_artifacts" ]] || continue
137 bsdtar -xf "$_artifacts" -C nuget-local "${_runtimepackages[@]/%/.*.nupkg}"
138 touch runtime-packages
139 done
140
141 cd "csharp-language-server-protocol-$_commit" || exit
142 # Upstream pins a newer feature band of the .NET SDK, which isn't needed
143 jq 'del(.sdk)' global.json >global.json.new
144 mv global.json.new global.json
145 # With the newer runtime packages, NuGet would pick System.Threading.Tasks.Extensions 4.6.0, which
146 # Roslyn asks for, for the source generator, and fail as System.IO.Pipelines needs 4.6.3 (NU1605)
147 sed -i '0,/<PackageReference /s|\( *\)<PackageReference |\1<PackageReference Include="System.Threading.Tasks.Extensions" VersionOverride="4.6.3" PrivateAssets="all" />\n\1<PackageReference |' \
148 src/JsonRpc.Generators/JsonRpc.Generators.csproj
149 # MediatR 12.5 passes a CancellationToken to RequestHandlerDelegate, which some tests don't take
150 sed -i 's/, () => Task\.FromResult(/, _ => Task.FromResult(/' test/Lsp.Tests/Matchers/ResolveCommandMatcherTests.cs
151 _nuget_config "nuget.org=https://api.nuget.org/v3/index.json"
152}
153
154build() {
155 _dotnet_env
156 cd "csharp-language-server-protocol-$_commit" || exit
157 # The assemblies are signed with the key in the repository, giving them the same strong names as
158 # upstream's
159 local _project
160 for _project in src/*/*.csproj; do
161 dotnet pack "$_project" "${_build_arguments[@]}" --output "$srcdir/nupkg"
162 done
163}
164
165check() {
166 _dotnet_env
167 cd "csharp-language-server-protocol-$_commit" || exit
168 local _project
169 for _project in test/*/*.csproj; do
170 dotnet test "$_project" "${_build_arguments[@]}"
171 done
172}
173
174# Fails if a binary in $pkgdir, also inside the .nupkg files there, is identical to one of the packages
175# restored from a remote feed like nuget.org into $1, so no prebuilt binary slips in instead of one built
176# from source
177_check_prebuilt() {
178 local _extracted="$srcdir/check-prebuilt" _metadata _file _hash _found=0
179 local _binaries=(-type f '(' -name '*.dll' -o -name '*.exe' -o -name '*.so' -o -name '*.so.*' -o -name '*.dylib' ')')
180 local -A _prebuilt=()
181 while IFS= read -r -d '' _metadata; do
182 grep -qE '"source": *"https?://' "$_metadata" || continue
183 while IFS= read -r -d '' _file; do
184 _prebuilt[$(sha256sum <"$_file")]="${_file#"$1"/}"
185 done < <(find "${_metadata%/*}" "${_binaries[@]}" -print0)
186 done < <(find "$1" -name .nupkg.metadata -print0)
187
188 rm -rf "$_extracted"
189 mkdir -p "$_extracted"
190 while IFS= read -r -d '' _file; do
191 mkdir -p "$_extracted/${_file#"$pkgdir"/}"
192 bsdtar -xf "$_file" -C "$_extracted/${_file#"$pkgdir"/}"
193 done < <(find "$pkgdir" -type f -name '*.nupkg' -print0)
194 while IFS= read -r -d '' _file; do
195 _hash=$(sha256sum <"$_file")
196 if [[ -v "_prebuilt[$_hash]" ]]; then
197 echo "Prebuilt binary: ${_file#"$_extracted"/} is ${_prebuilt[$_hash]}" >&2
198 _found=1
199 fi
200 done < <(find "$pkgdir" "$_extracted" "${_binaries[@]}" -print0)
201 rm -rf "$_extracted"
202 return "$_found"
203}
204
205package() {
206 install -Dm644 "$srcdir/nupkg/"*".$pkgver.nupkg" -t "$pkgdir/usr/share/dotnet/nuget-packages/"
207 install -Dm644 "csharp-language-server-protocol-$_commit/LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"
208
209 _check_prebuilt "$srcdir/nuget"
210}
211

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