dotnet-vs-validation

LOW
maintainer ChrisTX 0 votes scanned 2026-10-31 07:58:04.077835
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-vs-validation
6_nugetid=Microsoft.VisualStudio.Validation
7pkgver=17.13.22
8pkgrel=1
9pkgdesc="Common input validation and state verification utility methods, Microsoft.VisualStudio.Validation (NuGet package)"
10arch=('any')
11url='https://github.com/microsoft/vs-validation'
12license=('MIT')
13_dotnetsdkver="10.0"
14makedepends=(
15 dotnet-sdk-"$_dotnetsdkver"
16 jq
17 python
18)
19# The commit the package was published from (tag v17.13.22)
20_commit="fd7027e236db97b472614237b1453022e24ef146"
21# Microsoft's internal build signs the assemblies, so they're public signed with the public key from
22# Arcade, giving them the same strong name as upstream's
23_arcadecommit="94f797268292122de4b6344d6265fad658c53703"
24source=("vs-validation-$_commit.tar.gz::$url/archive/$_commit.tar.gz"
25 "MSFT.snk::https://raw.githubusercontent.com/dotnet/arcade/$_arcadecommit/src/Microsoft.DotNet.Arcade.Sdk/tools/snk/MSFT.snk"
26 "lcl-to-resx.py")
27sha512sums=('c3927f30bfa58d8ff777cc3b4fab257cf42c71782ed6fb0e3de850b643d5591a9def41ba7800da90af8b382f3a9ce94cf10ffd3f4b9c775c9ef5a2ce305f42e9'
28 '98c02c09b9fed2ad77d8403efa5788053abb66a9c6c2cb8dd5d15ce49daf25e3a128b9b281fa2bc79e7cfc33adfbbfff6901b63fc9b882a890c13737892e71e1'
29 '1b70bc00f549a828208d65bba339e4b30a677cc02cb5d336c9a698b01aa0589c22c1cac7256e45b325039a0df94bc9efc7d99a6039cff4f7f36f90f721d72ae1')
30b2sums=('3b5a3a05e017349eccf30484d1422c84a260f3e4ff7a6308dea96c86f6a911dd6bef78027aaceb96650744fab692b58ad9911d6ed376c565ab61b9d7c60097ae'
31 'df52cdab9f311499106f30869455797a02345bf43fd01e942fbb0312228660c88122fba00188484cb03616dfa4b234a83e73f132377c94169f2a26da175ff2ee'
32 '2dd7539d81671b5d0bcf44245b41083f913492ade4ccfe7b37da972f559b048277983bf6835d535fd1924d01f73737498073682c517b12e0f38f2a38fa541355')
33
34_dotnet_env() {
35 export NUGET_PACKAGES="$srcdir/nuget"
36 export DOTNET_CLI_HOME="$srcdir/dotnet-home"
37 export DOTNET_CLI_TELEMETRY_OPTOUT=1
38 export DOTNET_NOLOGO=1
39
40 # Versions as in the official build, which Nerdbank.GitVersioning computes from git. The file
41 # version ends in the first two bytes of the commit. The repository information usually comes from
42 # git, which would find the repository this PKGBUILD is in instead.
43 _build_arguments=(
44 --configuration Release
45 -p:Version="$pkgver"
46 -p:AssemblyVersion="${pkgver%.*}.0.0"
47 -p:FileVersion="$pkgver.$((16#${_commit:0:4}))"
48 -p:InformationalVersion="$pkgver+${_commit:0:10}"
49 -p:IncludeSourceRevisionInInformationalVersion=false
50 -p:EnableSourceControlManagerQueries=false
51 -p:RepositoryType=git
52 -p:RepositoryCommit="$_commit"
53 -p:RepositoryUrl="$url"
54 -p:SignAssembly=true
55 -p:PublicSign=true
56 -p:AssemblyOriginatorKeyFile="$srcdir/MSFT.snk"
57 )
58}
59
60prepare() {
61 cd "vs-validation-$_commit" || exit
62 # Upstream pins the .NET 9 SDK, the libraries build with newer ones just as well
63 jq 'del(.sdk)' global.json >global.json.new
64 mv global.json.new global.json
65 # Nerdbank.GitVersioning needs git (see _dotnet_env for the versions), and MicroBuild is Microsoft's
66 # internal signing and localization
67 sed -i -E '/GlobalPackageReference Include="(Nerdbank.GitVersioning|Microsoft.VisualStudio.Internal.MicroBuild.VisualStudio)"/d' \
68 Directory.Packages.props
69 sed -i 's/ DependsOnTargets="GetBuildVersion"//' Directory.Build.props
70 # The translations, which MicroBuild applies to the assemblies
71 python -I "$srcdir/lcl-to-resx.py" loc/lcl "$_nugetid" "src/$_nugetid"
72
73 # Upstream's NuGet.config, which has the feed the tests need
74 mv nuget.config nuget.config.upstream
75 _nuget_config "nuget.org=https://api.nuget.org/v3/index.json"
76}
77
78# Writes nuget.config with the feed $1 (as key=url)
79_nuget_config() {
80 cat >nuget.config <<EOF
81<?xml version="1.0" encoding="utf-8"?>
82<configuration>
83 <packageSources>
84 <clear />
85 <add key="${1%%=*}" value="${1#*=}" />
86 </packageSources>
87</configuration>
88EOF
89}
90
91build() {
92 _dotnet_env
93 cd "vs-validation-$_commit" || exit
94 dotnet pack "src/$_nugetid/$_nugetid.csproj" "${_build_arguments[@]}" --output "$srcdir/nupkg"
95}
96
97check() {
98 _dotnet_env
99 cd "vs-validation-$_commit" || exit
100 # The tests need packages from the feed upstream uses, which mirrors nuget.org
101 _nuget_config "$(sed -n -E 's|.*<add key="([^"]+)" value="(https[^"]+)".*|\1=\2|p' nuget.config.upstream)"
102 # The test runner targets .NET 8
103 DOTNET_ROLL_FORWARD=Major dotnet test "test/$_nugetid.Tests/$_nugetid.Tests.csproj" "${_build_arguments[@]}"
104}
105
106# Fails if a binary in $pkgdir, also inside the .nupkg files there, is identical to one of the packages
107# restored from a remote feed like nuget.org into $1, so no prebuilt binary slips in instead of one built
108# from source
109_check_prebuilt() {
110 local _extracted="$srcdir/check-prebuilt" _metadata _file _hash _found=0
111 local _binaries=(-type f '(' -name '*.dll' -o -name '*.exe' -o -name '*.so' -o -name '*.so.*' -o -name '*.dylib' ')')
112 local -A _prebuilt=()
113 while IFS= read -r -d '' _metadata; do
114 grep -qE '"source": *"https?://' "$_metadata" || continue
115 while IFS= read -r -d '' _file; do
116 _prebuilt[$(sha256sum <"$_file")]="${_file#"$1"/}"
117 done < <(find "${_metadata%/*}" "${_binaries[@]}" -print0)
118 done < <(find "$1" -name .nupkg.metadata -print0)
119
120 rm -rf "$_extracted"
121 mkdir -p "$_extracted"
122 while IFS= read -r -d '' _file; do
123 mkdir -p "$_extracted/${_file#"$pkgdir"/}"
124 bsdtar -xf "$_file" -C "$_extracted/${_file#"$pkgdir"/}"
125 done < <(find "$pkgdir" -type f -name '*.nupkg' -print0)
126 while IFS= read -r -d '' _file; do
127 _hash=$(sha256sum <"$_file")
128 if [[ -v "_prebuilt[$_hash]" ]]; then
129 echo "Prebuilt binary: ${_file#"$_extracted"/} is ${_prebuilt[$_hash]}" >&2
130 _found=1
131 fi
132 done < <(find "$pkgdir" "$_extracted" "${_binaries[@]}" -print0)
133 rm -rf "$_extracted"
134 return "$_found"
135}
136
137package() {
138 install -Dm644 "$srcdir/nupkg/$_nugetid.$pkgver.nupkg" -t "$pkgdir/usr/share/dotnet/nuget-packages/"
139 install -Dm644 "vs-validation-$_commit/LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"
140
141 _check_prebuilt "$srcdir/nuget"
142}
143

Scan history

Scanned at (UTC)SeverityRules
2026-10-31 07:58:04 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