Spec clean-up

- Cosmetic spec changes:
  - Use tabs
  - Comment patch applications
  - Don't use macros for commands
  - Use %{buildroot} rather than $RPM_BUILD_ROOT
- Provide perl-Perl-Tidy for benefit of people looking for CPAN module
- Use a patch rather than scripted iconv run to fix character encoding
- BR: perl(Getopt::Long)
- Don't need to remove empty directories from the buildroot
- Use DESTDIR rather than PERL_INSTALL_ROOT
This commit is contained in:
Paul Howarth 2014-03-25 15:33:37 +00:00
parent 411d66ecd4
commit fa91c831da
2 changed files with 86 additions and 39 deletions

30
Perl-Tidy-utf8.patch Normal file
View File

@ -0,0 +1,30 @@
--- CHANGES
+++ CHANGES
@@ -639,8 +639,8 @@ Perltidy Change Log
-improved breakpoint choices involving '->'
- -Corrected tokenization of things like ${#} or ${©}. For example,
- ${©} is valid, but ${© } is a syntax error.
+ -Corrected tokenization of things like ${#} or ${©}. For example,
+ ${©} is valid, but ${© } is a syntax error.
-Corrected minor tokenization errors with indirect object notation.
For example, 'new A::()' works now.
@@ -813,14 +813,14 @@ Perltidy Change Log
closing side comments (-csc) could have incorrect text. This is
annoying but will be correct the next time perltidy is run with -csc.
- -Implemented XHTML patch submitted by Ville Skyttä.
+ -Implemented XHTML patch submitted by Ville Skyttä.
-Fixed bug where whitespace was being removed between 'Bar' and '()'
in a use statement like:
use Foo::Bar ();
- Thanks to Ville Skyttä for reporting this.
+ Thanks to Ville Skyttä for reporting this.
-Whenever possible, if a logical expression is broken with leading
'&&', '||', 'and', or 'or', then the leading line will be padded

View File

@ -1,60 +1,66 @@
Name: perltidy
Version: 20130922
Release: 1%{?dist}
Summary: Tool for indenting and reformatting Perl scripts
License: GPLv2+
URL: http://perltidy.sourceforge.net/
Source0: http://www.cpan.org/modules/by-module/Perl/Perl-Tidy-%{version}.tar.gz
Source1: http://cdn.debian.net/debian/pool/main/p/perltidy/perltidy_20130922-1.debian.tar.xz
Patch0: %{name}-20130922-tmpnamdoc.patch
BuildArch: noarch
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(Carp)
BuildRequires: perl(constant)
BuildRequires: perl(Cwd)
BuildRequires: perl(Exporter)
BuildRequires: perl(IO::File)
BuildRequires: perl(Test)
Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
Name: perltidy
Version: 20130922
Release: 2%{?dist}
Summary: Tool for indenting and re-formatting Perl scripts
License: GPLv2+
URL: http://perltidy.sourceforge.net/
Source0: http://www.cpan.org/modules/by-module/Perl/Perl-Tidy-%{version}.tar.gz
Source1: http://cdn.debian.net/debian/pool/main/p/perltidy/perltidy_20130922-1.debian.tar.xz
Patch0: perltidy-20130922-tmpnamdoc.patch
Patch1: Perl-Tidy-utf8.patch
BuildArch: noarch
BuildRequires: perl(Carp)
BuildRequires: perl(constant)
BuildRequires: perl(Cwd)
BuildRequires: perl(Exporter)
BuildRequires: perl(ExtUtils::MakeMaker)
BuildRequires: perl(Getopt::Long)
BuildRequires: perl(IO::File)
BuildRequires: perl(Test)
Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
Provides: perl-Perl-Tidy = %{version}-%{release}
%description
Perltidy is a Perl script which indents and reformats Perl scripts to
Perltidy is a Perl script that indents and re-formats Perl scripts to
make them easier to read. If you write Perl scripts, or spend much
time reading them, you will probably find it useful. The formatting
can be controlled with command line parameters. The default parameter
time reading them, you will probably find it useful. The formatting
can be controlled with command line parameters. The default parameter
settings approximately follow the suggestions in the Perl Style Guide.
Perltidy can also output HTML of both POD and source code. Besides
reformatting scripts, Perltidy can be a great help in tracking down
Perltidy can also output HTML of both POD and source code. Besides
re-formatting scripts, Perltidy can be a great help in tracking down
errors with missing or extra braces, parentheses, and square brackets
because it is very good at localizing errors.
%prep
%setup -q -n Perl-Tidy-%{version} -a 1
%{__patch} -p1 -i debian/patches/fix_insecure_tmpnam_usage_740670
%patch0 -p1
rm -f docs/perltidy.1 examples/pt.bat
f=CHANGES ; iconv -f iso-8859-1 -t utf-8 $f > $f.utf8 ; mv $f.utf8 $f
# Fix from Debian for insecure temporary file usage (CVE-2014-2277, #1074721)
patch -p1 -i debian/patches/fix_insecure_tmpnam_usage_740670
# Related man page fix
%patch0 -p1
# Re-format documentation as UTF-8
%patch1
# Don't need Windows batch file
rm examples/pt.bat
# We'll ship the perltidy manpage in %%{_mandir} so we don't need another copy
rm docs/perltidy.1
%build
%{__perl} Makefile.PL INSTALLDIRS=vendor
perl Makefile.PL INSTALLDIRS=vendor
make %{?_smp_mflags}
%install
make pure_install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT
find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} ';'
find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null ';'
%{_fixperms} $RPM_BUILD_ROOT/*
make pure_install DESTDIR=%{buildroot}
find %{buildroot} -type f -name .packlist -exec rm -f {} ';'
%{_fixperms} %{buildroot}
%check
make test
%files
%doc BUGS CHANGES COPYING README TODO docs/ examples/
%{_bindir}/perltidy
@ -62,8 +68,19 @@ make test
%{_mandir}/man1/perltidy.1*
%{_mandir}/man3/Perl::Tidy.3*
%changelog
* Tue Mar 25 2014 Paul Howarth <paul@city-fan.org> - 20130922-2
- Cosmetic spec changes:
- Use tabs
- Comment patch applications
- Don't use macros for commands
- Use %%{buildroot} rather than $RPM_BUILD_ROOT
- Provide perl-Perl-Tidy for benefit of people looking for CPAN module
- Use a patch rather than scripted iconv run to fix character encoding
- BR: perl(Getopt::Long)
- Don't need to remove empty directories from the buildroot
- Use DESTDIR rather than PERL_INSTALL_ROOT
* Wed Mar 12 2014 Ville Skyttä <ville.skytta@iki.fi> - 20130922-1
- Update to 20130922.
- Fix for CVE-2014-2277 from Debian (#1074721) + related man page fix.