[perl-File-MimeInfo] apply test fix from cpan RT#66841 & clean spec

Marcela Mašláňová mmaslano at fedoraproject.org
Wed Jun 22 08:47:48 UTC 2011


commit 3d6ab7b01362c1dc83242a13f70af5262d0f2a58
Author: Marcela Mašláňová <mmaslano at redhat.com>
Date:   Wed Jun 22 10:47:27 2011 +0200

    apply test fix from cpan RT#66841 & clean spec

 perl-File-MimeInfo.spec |   12 +++-------
 tests514.patch          |   48 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 8 deletions(-)
---
diff --git a/perl-File-MimeInfo.spec b/perl-File-MimeInfo.spec
index c8b35d9..7ec8198 100644
--- a/perl-File-MimeInfo.spec
+++ b/perl-File-MimeInfo.spec
@@ -6,7 +6,8 @@ License:        GPL+ or Artistic
 Group:          Development/Libraries
 URL:            http://search.cpan.org/dist/File-MimeInfo/
 Source0:        http://www.cpan.org/authors/id/P/PA/PARDUS/File-MimeInfo/File-MimeInfo-%{version}.tar.gz
-BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+# https://rt.cpan.org/Public/Bug/Display.html?id=66841
+Patch0:         tests514.patch
 BuildArch:      noarch
 BuildRequires:  perl(Module::Build) perl(Test::More) perl(Test::Pod)
 BuildRequires:  perl(Test::Pod::Coverage)
@@ -25,14 +26,13 @@ implement the freedesktop specification for a shared MIME database.
 
 %prep
 %setup -q -n File-MimeInfo-%{version}
+%patch0 -p1
 
 %build
 %{__perl} Makefile.PL INSTALLDIRS=vendor
 make %{?_smp_mflags}
 
 %install
-rm -rf $RPM_BUILD_ROOT
-
 make pure_install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT
 
 find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \;
@@ -43,11 +43,7 @@ find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \;
 %check
 make test
 
-%clean
-rm -rf $RPM_BUILD_ROOT
-
 %files
-%defattr(-,root,root,-)
 %doc Changes README
 %{_bindir}/mimeopen
 %{_bindir}/mimetype
@@ -57,7 +53,7 @@ rm -rf $RPM_BUILD_ROOT
 
 %changelog
 * Tue Jun 21 2011 Marcela Mašláňová <mmaslano at redhat.com> - 0.15-9
-- Perl mass rebuild
+- Perl mass rebuild & apply test fix from cpan RT#66841 & clean spec
 
 * Tue Feb 08 2011 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.15-8
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_15_Mass_Rebuild
diff --git a/tests514.patch b/tests514.patch
new file mode 100644
index 0000000..c1e3adb
--- /dev/null
+++ b/tests514.patch
@@ -0,0 +1,48 @@
+From 807262f4aeb0694b6eabcc1acffecfa87e1df783 Mon Sep 17 00:00:00 2001
+From: Kent Fredric <kentfredric at gmail.com>
+Date: Sat, 7 May 2011 09:35:19 +1200
+Subject: [PATCH] Suggested fix for RT#66841
+
+Replace regexp validation tests with similar tests that permit it to be
+any one of a list of values.
+---
+ t/01_normal.t |   23 +++++++++++++++++------
+ 1 files changed, 17 insertions(+), 6 deletions(-)
+
+diff --git a/t/01_normal.t b/t/01_normal.t
+index 305da37..08c57f4 100644
+--- a/t/01_normal.t
++++ b/t/01_normal.t
+@@ -18,12 +18,23 @@ use_ok('File::MimeInfo', qw/mimetype describe globs/); # 1
+ 
+ # test _glob_to_regexp
+ my $i = 0;
+-for (
+-	[ '*.pl',	'(?-xism:^.*\.pl$)'	],	# 4
+-	[ '*.h++',	'(?-xism:^.*\.h\+\+$)'	],	# 5
+-	[ '*.[tar].*',	'(?-xism:^.*\.[tar]\..*$)'],	# 6
+-	[ '*.?',	'(?-xism:^.*\..?$)'],		# 7
+-) { is( File::MimeInfo::_glob_to_regexp($_->[0]), $_->[1], 'glob '.++$i ) }
++for my $glob (
++  [ '*.pl',      [ '(?-xism:^.*\.pl$)',        '(?^u:^.*\.pl$)' ] ],           # 4
++  [ '*.h++',     [ '(?-xism:^.*\.h\+\+$)',     '(?^u:^.*\.h\+\+$)' ] ],        # 5
++  [ '*.[tar].*', [ '(?-xism:^.*\.[tar]\..*$)', '(?^u:^.*\.[tar]\..*$)' ] ],    # 6
++  [ '*.?',       [ '(?-xism:^.*\..?$)',        '(?^u:^.*\..?$)' ] ],           # 7
++  )
++{
++  my $converted = File::MimeInfo::_glob_to_regexp( $glob->[0] );
++  my $number    = ++$i;
++  if ( my ($match) = grep { $_ eq "$converted" } @{ $glob->[1] } ) {
++    pass( 'glob ' . $number . ' matches an expected value' );
++    note explain $match;
++    next;
++  }
++  fail( 'glob ' . $number . ' matches an expected value' );
++  diag explain { got => "$converted", expected_one_of => $glob->[1] };
++}
+ 
+ # test parsing file names
+ $i = 0;
+-- 
+1.7.5.rc3
+



More information about the perl-devel mailing list