dotnet-humanizer-core-2

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-humanizer-core-2
6_nugetid=Humanizer.Core
7pkgver=2.14.1
8pkgrel=1
9pkgdesc="Turns strings, type names, enum fields and dates into a human friendly format, 2.x (NuGet package)"
10arch=('any')
11url='https://github.com/Humanizr/Humanizer'
12license=('MIT')
13provides=("dotnet-humanizer-core=$pkgver")
14_dotnetsdkver="10.0"
15makedepends=(
16 dotnet-sdk-"$_dotnetsdkver"
17 git
18)
19# 2.x is what JsonPointer.Net 5.x (dotnet-jsonpointer-net-5) needs
20_commit="3ebc38de585fc641a04b0e78ed69468453b0f8a1"
21source=("git+$url.git#commit=$_commit")
22sha512sums=('1862b1d133f47bc4fdc28d00783d388853468e733c06aa2cf5c5a7dd2c4e4cbb5d8421901dc33037b2c8bcdcd4b87f1359dd9999a041a5b4f5594219cd66e640')
23b2sums=('5f1d710303399d3d1196f8ad30df6fdc89b1c111305e82663e22dab4a2cd54227aad0da722777ffd1681981038f8c1eba6a1a4dbd1c2de1998deeb1e6556306f')
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 # The versions Nerdbank.GitVersioning derives from version.json
32 _build_arguments=(
33 --configuration Release
34 -p:Version="$pkgver"
35 -p:AssemblyVersion="${pkgver%.*}.0.0"
36 -p:FileVersion="$pkgver.0"
37 -p:ContinuousIntegrationBuild=true
38 )
39}
40
41prepare() {
42 cd Humanizer || exit
43 # Nerdbank.GitVersioning is a prebuilt tool that derives the version from git, it's passed in build()
44 # instead. Source link isn't needed either.
45 sed -i -e '/Nerdbank.GitVersioning/d' -e '/Microsoft.SourceLink.GitHub/d' src/Directory.build.props
46 # The netstandard1.0 build would need its prebuilt reference assemblies
47 sed -i 's|<TargetFrameworks>netstandard1.0;|<TargetFrameworks>|' src/Humanizer/Humanizer.csproj
48 sed -i -e '/<group targetFramework="netstandard1.0">/,/<\/group>/d' -e '/bin\\Release\\netstandard1.0/d' \
49 NuSpecs/Humanizer.Core.nuspec
50}
51
52build() {
53 _dotnet_env
54 cd Humanizer || exit
55 # Humanizer.Core is packed from its nuspec like upstream's CI does, it only has the neutral (English)
56 # resources. The other languages are in packages of their own.
57 dotnet pack src/Humanizer/Humanizer.csproj "${_build_arguments[@]}" \
58 -p:NuspecFile="$PWD/NuSpecs/$_nugetid.nuspec" -p:NuspecBasePath="$PWD/src" \
59 "-p:NuspecProperties=\"version=$pkgver;RepositoryType=git;RepositoryCommit=$_commit;RepositoryUrl=$url\"" \
60 --output "$srcdir/nupkg"
61}
62
63check() {
64 _dotnet_env
65 cd Humanizer || exit
66 # Approve_Public_Api crashes in ApiApprover on current .NET, and the French byte sizes expect Windows'
67 # culture data, ICU uses a narrow no-break space as group separator
68 local _filter=(
69 'FullyQualifiedName!=Humanizer.Tests.ApiApprover.PublicApiApprovalTest.Approve_Public_Api'
70 'FullyQualifiedName!=Humanizer.Tests.Localisation.fr.Bytes.ByteSizeExtensionsTests.HumanizesBytes'
71 )
72 # There's no test build for net10.0, run the one for net6.0 on the current runtime.
73 # Tests change global configuration (EnumHumanizeWithCustomDescriptionPropertyNamesTests), which
74 # makes others fail randomly when run in parallel.
75 DOTNET_ROLL_FORWARD=Major dotnet test src/Humanizer.Tests/Humanizer.Tests.csproj "${_build_arguments[@]}" \
76 --framework net6.0 --filter "$(
77 IFS='&'
78 echo "${_filter[*]}"
79 )" -- xUnit.ParallelizeTestCollections=false
80}
81
82# Fails if a binary in $pkgdir, also inside the .nupkg files there, is identical to one of the packages
83# restored from a remote feed like nuget.org into $1, so no prebuilt binary slips in instead of one built
84# from source
85_check_prebuilt() {
86 local _extracted="$srcdir/check-prebuilt" _metadata _file _hash _found=0
87 local _binaries=(-type f '(' -name '*.dll' -o -name '*.exe' -o -name '*.so' -o -name '*.so.*' -o -name '*.dylib' ')')
88 local -A _prebuilt=()
89 while IFS= read -r -d '' _metadata; do
90 grep -qE '"source": *"https?://' "$_metadata" || continue
91 while IFS= read -r -d '' _file; do
92 _prebuilt[$(sha256sum <"$_file")]="${_file#"$1"/}"
93 done < <(find "${_metadata%/*}" "${_binaries[@]}" -print0)
94 done < <(find "$1" -name .nupkg.metadata -print0)
95
96 rm -rf "$_extracted"
97 mkdir -p "$_extracted"
98 while IFS= read -r -d '' _file; do
99 mkdir -p "$_extracted/${_file#"$pkgdir"/}"
100 bsdtar -xf "$_file" -C "$_extracted/${_file#"$pkgdir"/}"
101 done < <(find "$pkgdir" -type f -name '*.nupkg' -print0)
102 while IFS= read -r -d '' _file; do
103 _hash=$(sha256sum <"$_file")
104 if [[ -v "_prebuilt[$_hash]" ]]; then
105 echo "Prebuilt binary: ${_file#"$_extracted"/} is ${_prebuilt[$_hash]}" >&2
106 _found=1
107 fi
108 done < <(find "$pkgdir" "$_extracted" "${_binaries[@]}" -print0)
109 rm -rf "$_extracted"
110 return "$_found"
111}
112
113package() {
114 install -Dm644 "$srcdir/nupkg/$_nugetid.$pkgver.nupkg" -t "$pkgdir/usr/share/dotnet/nuget-packages/"
115 install -Dm644 Humanizer/LICENSE -t "$pkgdir/usr/share/licenses/$pkgname/"
116
117 _check_prebuilt "$srcdir/nuget"
118}
119

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