diff --git a/.gitignore b/.gitignore index 6d2ff70..567c985 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -Perl-Critic-1.05.tar.gz +/Perl-Critic-[0-9.]*.tar.gz diff --git a/Perl-Critic-1.05-678628c8.patch b/Perl-Critic-1.05-678628c8.patch new file mode 100644 index 0000000..6b8b78c --- /dev/null +++ b/Perl-Critic-1.05-678628c8.patch @@ -0,0 +1,39 @@ +From 678628c8eb4614c45d644f33b6cadf2e9c410e69 Mon Sep 17 00:00:00 2001 +From: Tom Wyant +Date: Sat, 11 Dec 2010 08:19:59 +0000 +Subject: [PATCH] RT #63816: installation fails when using lastest version of + List::MoreUtils + +The proximate problem is that the behavior of all() when the list is +empty has changed. Previous behavior (as of List::MoreUtils 0.26, +anyway) was that all() with an empty list returned false. With +List::MoreUtils it returns true. But the code relies on the old +behavior. + +Unfortunately, what's really needed is first a review of the +List::MoreUtils functions used by Perl::Critic, then protection of all +affected functions. Or maybe just protect them all, to be truly +paranoid. +--- +--- lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitNoStrict.pm ++++ lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitNoStrict.pm +@@ -61,7 +61,7 @@ sub violates { + return if !$stmnt; + my @words = split m{ [^a-z]+ }mx, $stmnt; + @words = grep { $_ !~ m{ qw|no|strict }mx } @words; +- return if all { exists $self->{_allow}->{$_} } @words; ++ return if @words && all { exists $self->{_allow}->{$_} } @words; + + #If we get here, then it must be a violation + return $self->violation( $desc, $expl, $elem ); +--- lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitNoWarnings.pm ++++ lib/Perl/Critic/Policy/TestingAndDebugging/ProhibitNoWarnings.pm +@@ -61,7 +61,7 @@ sub violates { + return if !$stmnt; + my @words = split m{ [^a-z]+ }mx, $stmnt; + @words = grep { $_ !~ m{ qw|no|warnings }mx } @words; +- return if all { exists $self->{_allow}->{$_} } @words; ++ return if @words && all { exists $self->{_allow}->{$_} } @words; + + #If we get here, then it must be a violation + return $self->violation( $desc, $expl, $elem ); diff --git a/Perl-Critic-1.05-rt30139.patch b/Perl-Critic-1.05-rt30139.patch new file mode 100644 index 0000000..677373e --- /dev/null +++ b/Perl-Critic-1.05-rt30139.patch @@ -0,0 +1,11 @@ +--- t/BuiltinFunctions/RequireGlobFunction.run ++++ t/BuiltinFunctions/RequireGlobFunction.run +@@ -17,7 +17,7 @@ foreach my $file (<*.pl>) { + #----------------------------------------------------------------------------- + + ## name Multiple globs via <...> +-## failures 1 ++## failures 2 + ## cut + + @files = (<*.pl>, <*.pm>); diff --git a/perl-Perl-Critic.spec b/perl-Perl-Critic.spec index 56e9610..082526c 100644 --- a/perl-Perl-Critic.spec +++ b/perl-Perl-Critic.spec @@ -1,37 +1,75 @@ Name: perl-Perl-Critic Version: 1.05 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Critique Perl source code for best-practices - Group: Development/Libraries -License: GPL or Artistic +License: GPL+ or Artistic URL: http://search.cpan.org/dist/Perl-Critic/ -Source0: http://www.cpan.org/authors/id/T/TH/THALJEF/perlcritic/Perl-Critic-%{version}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) - +Source0: https://cpan.metacpan.org/authors/id/T/TH/THALJEF/perlcritic/Perl-Critic-%{version}.tar.gz +Patch0: Perl-Critic-1.05-678628c8.patch +Patch1: Perl-Critic-1.05-rt30139.patch +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -nu) BuildArch: noarch +# Module Build +BuildRequires: coreutils +BuildRequires: perl BuildRequires: perl(Module::Build) +# Module Runtime BuildRequires: perl(B::Keywords) >= 1.05 +BuildRequires: perl(base) +BuildRequires: perl(Carp) +BuildRequires: perl(charnames) BuildRequires: perl(Config::Tiny) >= 2 -BuildRequires: perl(File::HomeDir) +BuildRequires: perl(English) +BuildRequires: perl(Exporter) +BuildRequires: perl(File::Basename) +BuildRequires: perl(File::Find) +BuildRequires: perl(File::Path) +BuildRequires: perl(File::Spec) +BuildRequires: perl(File::Spec::Unix) +BuildRequires: perl(File::Temp) BuildRequires: perl(IO::String) BuildRequires: perl(List::MoreUtils) -BuildRequires: perl(Module::Pluggable) >= 3.1 +BuildRequires: perl(List::Util) +BuildRequires: perl(overload) +BuildRequires: perl(Pod::PlainText) BuildRequires: perl(PPI) >= 1.118 +BuildRequires: perl(PPI::Document) +BuildRequires: perl(PPI::Document::File) +BuildRequires: perl(PPI::Token::Whitespace) +BuildRequires: perl(Scalar::Util) +BuildRequires: perl(strict) BuildRequires: perl(String::Format) >= 1.13 -BuildRequires: perl(Perl::Tidy) +BuildRequires: perl(warnings) +# Script Runtime +BuildRequires: perl(Getopt::Long) +BuildRequires: perl(Pod::Usage) +# Test Suite +BuildRequires: perl(lib) +BuildRequires: perl(PPI::Cache) +BuildRequires: perl(Test::More) +# Optional Tests (Devel::EnforceEncapsulation not available in EPEL-5) BuildRequires: perl(Test::Memory::Cycle) -# Author tests -#BuildRequires: perl(Test::Perl::Critic) -#BuildRequires: perl(Test::Kwalitee) -BuildRequires: aspell +# Author Tests BuildRequires: perl(File::Which) -BuildRequires: perl(Test::Spelling) -BuildRequires: perl(Test::Pod) -BuildRequires: perl(Test::Pod::Coverage) -Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version)) +BuildRequires: perl(Test::Kwalitee) +BuildRequires: perl(Test::Perl::Critic) +BuildRequires: perl(Test::Pod) >= 1.00 +BuildRequires: perl(Test::Pod::Coverage) >= 1.04 +BuildRequires: perl(Test::Spelling), aspell-en +# Dependencies +Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version)) +# Optional Functionality +BuildRequires: perl(ExtUtils::Manifest) +BuildRequires: perl(File::HomeDir) +BuildRequires: perl(Module::Pluggable) >= 3.1 +BuildRequires: perl(Perl::Tidy) +BuildRequires: perl(Term::ANSIColor) +Requires: perl(ExtUtils::Manifest) +Requires: perl(File::HomeDir) Requires: perl(Module::Pluggable) >= 3.1 -Requires(hint): perl(Perl::Tidy) +Requires: perl(Perl::Tidy) +Requires: perl(Term::ANSIColor) %description Perl::Critic is an extensible framework for creating and applying coding @@ -44,42 +82,54 @@ even support Policies that contradict Conway. You can enable, disable, and customize those Polices through the Perl::Critic interface. You can also create new Policy modules that suit your own tastes. - %prep %setup -q -n Perl-Critic-%{version} +# Don't rely on the behavior of all() when the list is empty (CPAN RT#63816) +%patch0 + +# Fix expected failure count for multiple glob test in +# BuiltinFunctions::RequireGlobFunction, changed with later version of PPI +# (CPAN RT#30139) +%patch1 %build -%{__perl} Build.PL installdirs=vendor +perl Build.PL --installdirs=vendor ./Build - %install -rm -rf $RPM_BUILD_ROOT -./Build install destdir=$RPM_BUILD_ROOT create_packlist=0 -chmod -R u+w $RPM_BUILD_ROOT/* - +rm -rf %{buildroot} +./Build install --destdir=%{buildroot} --create_packlist=0 +%{_fixperms} %{buildroot} %check -# Additional requirements of author tests: -# Test::Perl::Critic, Test::Kwalitee -TEST_AUTHOR=1 ./Build test - +LANG=en_US TEST_AUTHOR=1 ./Build test %clean -rm -rf $RPM_BUILD_ROOT - +rm -rf %{buildroot} %files -%defattr(-,root,root,-) %doc Changes LICENSE README TODO.pod -%{_bindir}/* +%{_bindir}/perlcritic %{perl_vendorlib}/Perl/ -%{_mandir}/man1/*.1* -%{_mandir}/man3/*.3pm* - +%{_mandir}/man1/perlcritic.1* +%{_mandir}/man3/Perl::Critic*.3* %changelog +* Thu Jan 21 2016 Paul Howarth - 1.05-2 +- Don't rely on the behavior of all() when the list is empty (CPAN RT#63816) +- Fix expected failure count for multiple glob test in + BuiltinFunctions::RequireGlobFunction, changed with later version of PPI + (CPAN RT#30139) +- Fix license tag +- Fix source URL to point to MetaCPAN, where it can still be found +- Classify buildreqs by usage +- Run tests with LANG=en_US so spell check works properly +- Drop %%defattr, redundant since rpm 4.4 +- Don't use macros for commands +- Make %%files list more explicit +- Use %%{_fixperms} macro rather than our own chmod incantation + * Tue Mar 20 2007 Jose Pedro Oliveira - 1.05-1 - Update to 1.05.