dotnet-newtonsoft-json

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-newtonsoft-json
6_nugetid=Newtonsoft.Json
7pkgver=13.0.4
8pkgrel=1
9pkgdesc="Popular high-performance JSON framework for .NET (NuGet package)"
10arch=('any')
11url='https://www.newtonsoft.com/json'
12license=('MIT')
13_dotnetsdkver="10.0"
14makedepends=(
15 dotnet-sdk-"$_dotnetsdkver"
16 git
17)
18# The release key isn't public, so the assemblies are public signed with the public key from .NET's
19# source-build, giving them the same strong name as upstream's (see prereqs/keys/README.md there)
20_vmrcommit="4099f83977f4d29604a9aeb971fb0a7bc1d5f699"
21source=("git+https://github.com/JamesNK/Newtonsoft.Json.git#tag=$pkgver"
22 "$_nugetid.snk::https://raw.githubusercontent.com/dotnet/dotnet/$_vmrcommit/prereqs/keys/$_nugetid.snk")
23sha512sums=('6773243e2746c67f4e22d64bdc59d07a168e2796a641e9d97b8040be40d79c05e9b20c207eda37f88bbb7f0b1d1439857e7b2383d902afa74cf1891d432a4c84'
24 '8f0c4e63db6fd02a07d1db79a33813f6790380273f9db5a6a3193054bca742d873a138bfc8e4ec1f5486ce143dd4aa5e2534d4ba3caa5cb1dfbca4be38450ef4')
25b2sums=('c1807d526f5cad588137b145d83cf803e92b44d4fe46be0dee00d2b66d1ad4a027c7674caa1e49a47eb915f4c0b51814381df385b0f234e1cfa9ed25e8397b14'
26 'a80f1e89f7e3728a308f74f080794fa5df388c818b8901aca0ccde825c21528fc19f04c20666315b5c26bf104dc64b75402dfc1b8487aaaf23705a3dfe221cbf')
27
28_dotnet_env() {
29 export NUGET_PACKAGES="$srcdir/nuget"
30 export DOTNET_CLI_HOME="$srcdir/dotnet-home"
31 export DOTNET_CLI_TELEMETRY_OPTOUT=1
32 export DOTNET_NOLOGO=1
33
34 # Like upstream's Build/build.ps1 and .NET's source-build (src/source-build-assets), but only for
35 # the frameworks .NET uses. The .NET Framework and netstandard1.x builds would need their prebuilt
36 # reference assemblies, and the trim analyzers an old prebuilt ILLink.
37 _build_arguments=(
38 --configuration Release
39 "-p:LibraryFrameworks=\"net6.0;netstandard2.0\""
40 -p:VersionPrefix="$pkgver"
41 -p:VersionSuffix=
42 -p:AssemblyVersion="${pkgver%%.*}.0.0.0"
43 -p:FileVersion="$pkgver.0"
44 -p:SignAssembly=true
45 -p:PublicSign=true
46 -p:AssemblyOriginatorKeyFile="$srcdir/$_nugetid.snk"
47 -p:AdditionalConstants=SIGNED
48 -p:TreatWarningsAsErrors=false
49 -p:ContinuousIntegrationBuild=true
50 -p:EnableTrimAnalyzer=false
51 -p:EnableAotAnalyzer=false
52 -p:EnableSingleFileAnalyzer=false
53 )
54}
55
56prepare() {
57 cd Newtonsoft.Json || exit
58 # Pins an SDK we don't have
59 rm Src/global.json
60 # Neither analyzers nor source link are needed for this build, and package validation would
61 # compare against the prebuilt package from nuget.org
62 sed -i -e '/Microsoft.CodeAnalysis.NetAnalyzers\|Microsoft.SourceLink.GitHub/d' \
63 -e '/<CodeAnalysisRuleset>/d' \
64 -e 's|<EnablePackageValidation>true|<EnablePackageValidation>false|' \
65 Src/Newtonsoft.Json/Newtonsoft.Json.csproj
66}
67
68build() {
69 _dotnet_env
70 cd Newtonsoft.Json || exit
71 dotnet pack Src/Newtonsoft.Json/Newtonsoft.Json.csproj "${_build_arguments[@]}" \
72 -p:IncludeSymbols=false --output "$srcdir/nupkg"
73}
74
75check() {
76 _dotnet_env
77 cd Newtonsoft.Json || exit
78 # The tests assume Windows, i.e. CRLF line endings (TraceWriter and BufferErroringWithInvalidSize),
79 # c:\ being an absolute path (Issue1619) and Windows' culture data (NewZealandCulture)
80 local _test _filter=()
81 for _test in Documentation.TraceWriterTests.MemoryTraceWriterTest \
82 Serialization.TraceWriterTests.MemoryTraceWriterDeserializeTest \
83 Serialization.TraceWriterTests.MemoryTraceWriterSerializeTest \
84 JsonTextWriterTest.BufferErroringWithInvalidSize \
85 Issues.Issue1619.Test \
86 Converters.IsoDateTimeConverterTests.SerializeFormattedDateTimeNewZealandCulture; do
87 _filter+=("FullyQualifiedName!=Newtonsoft.Json.Tests.$_test")
88 done
89 # There's no test build for net10.0, run the one for net8.0 on the current runtime
90 DOTNET_ROLL_FORWARD=Major dotnet test Src/Newtonsoft.Json.Tests/Newtonsoft.Json.Tests.csproj \
91 "${_build_arguments[@]}" -p:LibraryFrameworks=net6.0 -p:TestFrameworks=net8.0 \
92 --filter "$(
93 IFS='&'
94 echo "${_filter[*]}"
95 )"
96}
97
98# Fails if a binary in $pkgdir, also inside the .nupkg files there, is identical to one of the packages
99# restored from a remote feed like nuget.org into $1, so no prebuilt binary slips in instead of one built
100# from source
101_check_prebuilt() {
102 local _extracted="$srcdir/check-prebuilt" _metadata _file _hash _found=0
103 local _binaries=(-type f '(' -name '*.dll' -o -name '*.exe' -o -name '*.so' -o -name '*.so.*' -o -name '*.dylib' ')')
104 local -A _prebuilt=()
105 while IFS= read -r -d '' _metadata; do
106 grep -qE '"source": *"https?://' "$_metadata" || continue
107 while IFS= read -r -d '' _file; do
108 _prebuilt[$(sha256sum <"$_file")]="${_file#"$1"/}"
109 done < <(find "${_metadata%/*}" "${_binaries[@]}" -print0)
110 done < <(find "$1" -name .nupkg.metadata -print0)
111
112 rm -rf "$_extracted"
113 mkdir -p "$_extracted"
114 while IFS= read -r -d '' _file; do
115 mkdir -p "$_extracted/${_file#"$pkgdir"/}"
116 bsdtar -xf "$_file" -C "$_extracted/${_file#"$pkgdir"/}"
117 done < <(find "$pkgdir" -type f -name '*.nupkg' -print0)
118 while IFS= read -r -d '' _file; do
119 _hash=$(sha256sum <"$_file")
120 if [[ -v "_prebuilt[$_hash]" ]]; then
121 echo "Prebuilt binary: ${_file#"$_extracted"/} is ${_prebuilt[$_hash]}" >&2
122 _found=1
123 fi
124 done < <(find "$pkgdir" "$_extracted" "${_binaries[@]}" -print0)
125 rm -rf "$_extracted"
126 return "$_found"
127}
128
129package() {
130 install -Dm644 "$srcdir/nupkg/$_nugetid.$pkgver.nupkg" -t "$pkgdir/usr/share/dotnet/nuget-packages/"
131 install -Dm644 Newtonsoft.Json/LICENSE.md -t "$pkgdir/usr/share/licenses/$pkgname/"
132
133 _check_prebuilt "$srcdir/nuget"
134}
135

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