From adda0dfc23650f258a37817ba81dcdd4627dd5e2 Mon Sep 17 00:00:00 2001 From: DistroBaker Date: Mon, 22 Feb 2021 18:10:21 +0000 Subject: [PATCH] Merged update from upstream sources This is an automated DistroBaker update from upstream sources. If you do not know what this is about or would like to opt out, contact the OSCI team. Source: https://src.fedoraproject.org/rpms/perl-JSON.git#9f9f4a764b97f1a36cb12d4da3726d0d46f581c1 --- .fmf/version | 1 + gating.yaml | 7 ++++++ perl-JSON.spec | 46 ++++++++++++++++++++++++++++++++++++---- plans/sanity.fmf | 5 +++++ tests/upstream-tests.fmf | 4 ++++ 5 files changed, 59 insertions(+), 4 deletions(-) create mode 100644 .fmf/version create mode 100644 gating.yaml create mode 100644 plans/sanity.fmf create mode 100644 tests/upstream-tests.fmf diff --git a/.fmf/version b/.fmf/version new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/.fmf/version @@ -0,0 +1 @@ +1 diff --git a/gating.yaml b/gating.yaml new file mode 100644 index 0000000..282e16b --- /dev/null +++ b/gating.yaml @@ -0,0 +1,7 @@ +--- !Policy +product_versions: + - fedora-* +decision_context: bodhi_update_push_stable +subject_type: koji_build +rules: + - !PassingTestCaseRule {test_case_name: fedora-ci.koji-build.tier0.functional} diff --git a/perl-JSON.spec b/perl-JSON.spec index 263e250..5317068 100644 --- a/perl-JSON.spec +++ b/perl-JSON.spec @@ -1,7 +1,7 @@ Name: perl-JSON Summary: Parse and convert to JSON (JavaScript Object Notation) Version: 4.03 -Release: 2%{?dist} +Release: 3%{?dist} License: GPL+ or Artistic URL: https://metacpan.org/release/JSON @@ -25,6 +25,7 @@ BuildRequires: perl(:VERSION) >= 5.5.30 BuildRequires: perl(base) BuildRequires: perl(bytes) BuildRequires: perl(Carp) +BuildRequires: perl(Config) BuildRequires: perl(constant) BuildRequires: perl(Data::Dumper) BuildRequires: perl(Encode) @@ -50,19 +51,32 @@ BuildRequires: perl(warnings) %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)\\) -%{?perl_default_subpackage_tests} - %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} = %{?epoch:%{epoch}:}%{version}-%{release} +Requires: coreutils +Requires: perl-Test-Harness +Requires: perl(Tie::IxHash) + +%description tests +Tests from %{name}. Execute them +with "%{_libexecdir}/%{name}/test". + %prep %setup -q -n JSON-%{version} # make rpmlint happy... find . -type f -exec chmod -c -x {} + -find t/ -type f -exec perl -pi -e 's|^#! perl|#!/usr/bin/perl|' {} + 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 %build /usr/bin/perl Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1 NO_PERLLOCAL=1 @@ -70,10 +84,28 @@ sed -i 's/\r//' README t/* %install %{make_install} +# Install tests +mkdir -p %{buildroot}%{_libexecdir}/%{name} +cp -a t %{buildroot}%{_libexecdir}/%{name} +rm %{buildroot}%{_libexecdir}/%{name}/t/00_pod.t +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 unset PERL_JSON_BACKEND PERL_JSON_DEBUG PERL_JSON_PP_USE_B +export HARNESS_OPTIONS=j$(perl -e 'if ($ARGV[0] =~ /.*-j([0-9][0-9]*).*/) {print $1} else {print 1}' -- '%{?_smp_mflags}') %{make_build} test %files @@ -81,7 +113,13 @@ unset PERL_JSON_BACKEND PERL_JSON_DEBUG PERL_JSON_PP_USE_B %{perl_vendorlib}/* %{_mandir}/man3/* +%files tests +%{_libexecdir}/%{name} + %changelog +* Mon Feb 22 2021 Petr Pisar - 4.03-3 +- Package tests manually + * Wed Jan 27 2021 Fedora Release Engineering - 4.03-2 - Rebuilt for https://fedoraproject.org/wiki/Fedora_34_Mass_Rebuild diff --git a/plans/sanity.fmf b/plans/sanity.fmf new file mode 100644 index 0000000..a72ded4 --- /dev/null +++ b/plans/sanity.fmf @@ -0,0 +1,5 @@ +summary: Sanity tests +discover: + how: fmf +execute: + how: tmt diff --git a/tests/upstream-tests.fmf b/tests/upstream-tests.fmf new file mode 100644 index 0000000..1ca60cc --- /dev/null +++ b/tests/upstream-tests.fmf @@ -0,0 +1,4 @@ +summary: Upstream tests +component: perl-JSON +require: perl-JSON-tests +test: /usr/libexec/perl-JSON/test