diff --git a/perl-JSON.spec b/perl-JSON.spec index 0252aaa2b2e5115ed6975a0f9d8b7d90a24578f0..af98a01e6c8c07329c66efc98b2be1d7b85a45ef 100644 --- a/perl-JSON.spec +++ b/perl-JSON.spec @@ -1,4 +1,8 @@ -%define anolis_release 1 +%define anolis_release 2 + +%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}perl\\(JSON::(Backend::PP|backportPP::Boolean|Boolean|PP|PP::IncrParser)\\) +%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\\(JSON::(backportPP|backportPP::Boolean)\\) + Name: perl-JSON Summary: Parse and convert to JSON (JavaScript Object Notation) Version: 4.10 @@ -8,67 +12,33 @@ URL: https://metacpan.org/release/JSON Source0: https://cpan.metacpan.org/modules/by-module/JSON/JSON-%{version}.tar.gz BuildArch: noarch # Build -BuildRequires: coreutils -BuildRequires: findutils -BuildRequires: make -BuildRequires: perl-generators -BuildRequires: perl-interpreter -BuildRequires: perl(Config) -BuildRequires: perl(ExtUtils::MakeMaker) -BuildRequires: perl(lib) -BuildRequires: perl(:VERSION) >= 5.5.30 +BuildRequires: make coreutils findutils +BuildRequires: perl(Config) perl-interpreter perl-generators +BuildRequires: perl(:VERSION) >= 5.5.30 perl(lib) perl(ExtUtils::MakeMaker) # Module -BuildRequires: perl(B) -BuildRequires: perl(bytes) -BuildRequires: perl(Carp) -BuildRequires: perl(constant) -BuildRequires: perl(Encode) -BuildRequires: perl(Exporter) -BuildRequires: perl(Math::BigFloat) -BuildRequires: perl(Math::BigInt) -BuildRequires: perl(overload) -BuildRequires: perl(Scalar::Util) -BuildRequires: perl(strict) -BuildRequires: perl(warnings) -# subs not used +BuildRequires: perl(constant) perl(B) perl(bytes) perl(Carp) +BuildRequires: perl(strict) perl(overload) perl(Exporter) perl(Encode) perl(warnings) +BuildRequires: perl(Math::BigInt) perl(Math::BigFloat) perl(Scalar::Util) # Tests -BuildRequires: perl(charnames) -BuildRequires: perl(Data::Dumper) -BuildRequires: perl(Test::More) -BuildRequires: perl(Tie::Array) -BuildRequires: perl(Tie::Hash) -BuildRequires: perl(Tie::IxHash) -BuildRequires: perl(utf8) -BuildRequires: perl(vars) +BuildRequires: perl(utf8) perl(Data::Dumper) perl(charnames) perl(Test::More) perl(vars) +BuildRequires: perl(Tie::IxHash) perl(Tie::Hash) perl(Tie::Array) # Optional tests -BuildRequires: perl(JSON::XS) >= 4.00 -BuildRequires: perl(Types::Serialiser) +BuildRequires: perl(Types::Serialiser) perl(JSON::XS) >= 4.00 # Dependencies -Requires: perl(B) -Requires: perl(Encode) -Requires: perl(Math::BigFloat) -Requires: perl(Math::BigInt) -Suggests: perl(Scalar::Util) -Requires: perl(warnings) +Requires: perl(Encode) perl(warnings) perl(B) +Requires: perl(Scalar::Util) perl(Math::BigInt) perl(Math::BigFloat) + +Obsoletes: %{name}-tests < %{EVR} %{?perl_default_filter} -%global __provides_exclude %{?__provides_exclude:%__provides_exclude|}perl\\(JSON::(Backend::PP|backportPP::Boolean|Boolean|PP|PP::IncrParser)\\) -%global __requires_exclude %{?__requires_exclude:%__requires_exclude|}perl\\(JSON::(backportPP|backportPP::Boolean)\\) %description -This module converts between JSON (JavaScript Object Notation) and Perl -data structure into each other. For JSON, see http://www.crockford.com/JSON/. - -%package tests -Summary: Tests for %{name} -Requires: %{name} = %{version}-%{release} -Requires: coreutils -Requires: perl-Test-Harness -Requires: perl(Tie::IxHash) - -%description tests -Tests from %{name}. Execute them -with "%{_libexecdir}/%{name}/test". +This module is a thin wrapper for JSON::XS-compatible modules with a few additional features. All the +backend modules convert a Perl data structure to a JSON text and vice versa. This module uses JSON::XS +by default, and when JSON::XS is not available, falls back on JSON::PP, which is in the Perl core +since 5.14. If JSON::PP is not available either, this module then falls back on JSON::backportPP +(which is actually JSON::PP in a different .pm file) bundled in the same distribution as this module. +You can also explicitly specify to use Cpanel::JSON::XS, a fork of JSON::XS by Reini Urban. %package doc Summary: Documentation files for %{name} @@ -79,16 +49,7 @@ BuildArch: noarch The %{name}-doc package contains documentation files for %{name}. %prep -%setup -q -n JSON-%{version} - -# make rpmlint happy... -find . -type f -exec chmod -c -x {} + -sed -i 's/\r//' README t/* -# Help generators to recognize Perl scripts -for F in t/*.t; do - perl -i -MConfig -ple 'print $Config{startperl} if $. == 1' "$F" - chmod +x "$F" -done +%autosetup -p1 -n JSON-%{version} %build /usr/bin/perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 @@ -96,22 +57,6 @@ done %install %{make_install} -# Install tests -mkdir -p %{buildroot}%{_libexecdir}/%{name} -cp -a t %{buildroot}%{_libexecdir}/%{name} -cat > %{buildroot}%{_libexecdir}/%{name}/test << 'EOF' -#!/bin/bash -# t/20_unknown.t writes to CWD -DIR=$(mktemp -d) -cp -a %{_libexecdir}/%{name}/t "$DIR" -unset PERL_JSON_BACKEND PERL_JSON_DEBUG PERL_JSON_PP_USE_B -pushd "$DIR" -prove -I . -j "$(getconf _NPROCESSORS_ONLN)" -popd -rm -r "$DIR" -EOF -chmod +x %{buildroot}%{_libexecdir}/%{name}/test -# Correct permissions %{_fixperms} -c %{buildroot} %check @@ -124,11 +69,11 @@ export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print %{_mandir}/man3/* %files doc -%doc Changes README - -%files tests -%{_libexecdir}/%{name} +%doc README Changes %changelog +* Sat Apr 15 2023 yuanhui - 4.10-2 +- Optimize the spec file + * Mon Jan 30 2023 Funda Wang - 4.10-1 - Import package for anolis 23