dotnet-gherkin-5

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-gherkin-5
6_nugetid=Gherkin
7pkgver=5.1.0
8pkgrel=1
9pkgdesc="Parser for the Gherkin language of Cucumber, Gherkin (NuGet package, version 5)"
10arch=('any')
11url='https://github.com/cucumber/gherkin-dotnet'
12license=('MIT')
13_dotnetsdkver="10.0"
14makedepends=(
15 dotnet-newtonsoft-json
16 dotnet-sdk-"$_dotnetsdkver"
17)
18checkdepends=(
19 jq
20)
21# Gherkin 6 merged ScenarioOutline into Scenario, which Pester 4 (powershell-pester-4) relies on.
22# The commit 5.1.0 was released from ("gherkin: Release v5.1.0"), upstream only tagged it in the
23# monorepo it was developed in then (cucumber/cucumber).
24_commit="55ab34d45dcd8249349704335c2aa2f90839fae3"
25source=("gherkin-dotnet-$_commit.tar.gz::$url/archive/$_commit.tar.gz")
26sha512sums=('923d3c712104941ed3b8d79c7d728df472611fc34a7877d405c50660519bf7a06de0f44782680f50c3f9b4ed231a590b63745808e78498481fc9c04398decd62')
27b2sums=('09724099044d2430fd257dfa7c196cc112a0b18c75538a48ae1bb7a1428abcb9d3b2c64968c26f98d2a48a7828f1355e4e4c4c31ea47b1f32326fec93f297180')
28
29_dotnet_env() {
30 export NUGET_PACKAGES="$srcdir/nuget"
31 export DOTNET_CLI_HOME="$srcdir/dotnet-home"
32 export DOTNET_CLI_TELEMETRY_OPTOUT=1
33 export DOTNET_NOLOGO=1
34
35 # The repository information usually comes from git, which would find the repository this PKGBUILD
36 # is in instead. Newtonsoft.Json from the system feed is newer than the version referenced (NU1603).
37 _build_arguments=(
38 --configuration Release
39 -p:SourceRevisionId="$_commit"
40 -p:EnableSourceControlManagerQueries=false
41 -p:IncludeSourceRevisionInInformationalVersion=false
42 -p:RepositoryType=git
43 -p:RepositoryCommit="$_commit"
44 -p:RepositoryUrl="$url"
45 -p:WarningsNotAsErrors=NU1603
46 )
47}
48
49prepare() {
50 cd "gherkin-dotnet-$_commit" || exit
51 # Newtonsoft.Json is built from source by dotnet-newtonsoft-json
52 cat >NuGet.Config <<EOF
53<?xml version="1.0" encoding="utf-8"?>
54<configuration>
55 <packageSources>
56 <clear />
57 <add key="dotnet-system" value="/usr/share/dotnet/nuget-packages" />
58 <add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
59 </packageSources>
60 <packageSourceMapping>
61 <clear />
62 <packageSource key="dotnet-system">
63 <package pattern="Newtonsoft.Json" />
64 </packageSource>
65 <packageSource key="nuget.org">
66 <package pattern="*" />
67 </packageSource>
68 </packageSourceMapping>
69</configuration>
70EOF
71 # Upstream builds with the .NET SDK 2.1, the installed one works as well
72 rm global.json
73 # Newtonsoft.Json from dotnet-newtonsoft-json only targets .NET Standard 2.0 and .NET 6, so Gherkin
74 # targets .NET Standard 2.0 instead of 1.5 and .NET Framework 4.5 (which can use the .NET Standard 2.0
75 # build since 4.6.2). netfx.props only points .NET Framework builds at Mono's reference assemblies.
76 sed -i '/netfx.props/d' ./*/*.csproj
77 sed -i "s|<TargetFrameworks>netstandard1.5;net45</TargetFrameworks>|<TargetFramework>netstandard2.0</TargetFramework>|" \
78 Gherkin/Gherkin.csproj Gherkin.TokensGeneratorLib/Gherkin.TokensGeneratorLib.csproj
79 sed -i 's/#if (NETSTANDARD1_5 ||/#if (NETSTANDARD1_5_OR_GREATER ||/' Gherkin/GherkinDialectProvider.cs Gherkin/GherkinLine.cs
80 # The tools and tests target .NET Core 2.0 and its test packages, use the .NET runtime that's
81 # installed and current ones
82 sed -i -E "s|<TargetFrameworks>netcoreapp2.0;net45[0-9]?</TargetFrameworks>|<TargetFramework>net$_dotnetsdkver</TargetFramework>|" \
83 Gherkin.CLI/Gherkin.CLI.csproj Gherkin.TokensGenerator/Gherkin.TokensGenerator.csproj \
84 Gherkin.Specs/Gherkin.Specs.csproj
85 sed -i -E \
86 -e '/Microsoft.TestPlatform.TestHost|DotNetCliToolReference/d' \
87 -e 's|(Include="Microsoft.NET.Test.Sdk" Version=)"[^"]*"|\1"18.11.0"|' \
88 -e 's|(Include="xunit" Version=)"[^"]*"|\1"2.9.3"|' \
89 -e 's|(Include="xunit.runner.visualstudio" Version=)"[^"]*"|\1"3.1.5"|' \
90 Gherkin.Specs/Gherkin.Specs.csproj
91}
92
93build() {
94 _dotnet_env
95 cd "gherkin-dotnet-$_commit" || exit
96 # Strong named with the key in the repository, like the official package
97 dotnet pack "$_nugetid/$_nugetid.csproj" "${_build_arguments[@]}" --output "$srcdir/nupkg"
98}
99
100check() {
101 _dotnet_env
102 cd "gherkin-dotnet-$_commit" || exit
103 dotnet test Gherkin.Specs/Gherkin.Specs.csproj "${_build_arguments[@]}"
104
105 # The acceptance tests of the Makefile, without the .NET Framework builds that need Mono: the
106 # tokens, AST, pickles and errors of the test features have to match the expected ones
107 dotnet build Gherkin.CLI/Gherkin.CLI.csproj "${_build_arguments[@]}"
108 dotnet build Gherkin.TokensGenerator/Gherkin.TokensGenerator.csproj "${_build_arguments[@]}"
109 local _cli="Gherkin.CLI/bin/Release/net$_dotnetsdkver/Gherkin.CLI.dll"
110 local _tokens="Gherkin.TokensGenerator/bin/Release/net$_dotnetsdkver/Gherkin.TokensGenerator.dll"
111 local _feature
112 for _feature in testdata/good/*.feature; do
113 diff --unified "$_feature.tokens" <(dotnet "$_tokens" "$_feature")
114 diff --unified <(jq --sort-keys . "$_feature.source.ndjson") \
115 <(dotnet "$_cli" --no-ast --no-pickles "$_feature" | jq --sort-keys .)
116 diff --unified <(jq --sort-keys . "$_feature.ast.ndjson") \
117 <(dotnet "$_cli" --no-source --no-pickles "$_feature" | jq --sort-keys .)
118 diff --unified <(jq --sort-keys . "$_feature.pickles.ndjson") \
119 <(dotnet "$_cli" --no-source --no-ast "$_feature" | jq --sort-keys .)
120 done
121 for _feature in testdata/bad/*.feature; do
122 diff --unified <(jq --sort-keys . "$_feature.errors.ndjson") \
123 <(dotnet "$_cli" --no-pickles "$_feature" | jq --sort-keys .)
124 done
125}
126
127# Fails if a binary in $pkgdir, also inside the .nupkg files there, is identical to one of the packages
128# restored from a remote feed like nuget.org into $1, so no prebuilt binary slips in instead of one built
129# from source
130_check_prebuilt() {
131 local _extracted="$srcdir/check-prebuilt" _metadata _file _hash _found=0
132 local _binaries=(-type f '(' -name '*.dll' -o -name '*.exe' -o -name '*.so' -o -name '*.so.*' -o -name '*.dylib' ')')
133 local -A _prebuilt=()
134 while IFS= read -r -d '' _metadata; do
135 grep -qE '"source": *"https?://' "$_metadata" || continue
136 while IFS= read -r -d '' _file; do
137 _prebuilt[$(sha256sum <"$_file")]="${_file#"$1"/}"
138 done < <(find "${_metadata%/*}" "${_binaries[@]}" -print0)
139 done < <(find "$1" -name .nupkg.metadata -print0)
140
141 rm -rf "$_extracted"
142 mkdir -p "$_extracted"
143 while IFS= read -r -d '' _file; do
144 mkdir -p "$_extracted/${_file#"$pkgdir"/}"
145 bsdtar -xf "$_file" -C "$_extracted/${_file#"$pkgdir"/}"
146 done < <(find "$pkgdir" -type f -name '*.nupkg' -print0)
147 while IFS= read -r -d '' _file; do
148 _hash=$(sha256sum <"$_file")
149 if [[ -v "_prebuilt[$_hash]" ]]; then
150 echo "Prebuilt binary: ${_file#"$_extracted"/} is ${_prebuilt[$_hash]}" >&2
151 _found=1
152 fi
153 done < <(find "$pkgdir" "$_extracted" "${_binaries[@]}" -print0)
154 rm -rf "$_extracted"
155 return "$_found"
156}
157
158package() {
159 install -Dm644 "$srcdir/nupkg/$_nugetid.$pkgver.nupkg" -t "$pkgdir/usr/share/dotnet/nuget-packages/"
160 install -Dm644 "gherkin-dotnet-$_commit/LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"
161
162 _check_prebuilt "$srcdir/nuget"
163}
164

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