rpms/perl-JSON-Any/F-8 perl-JSON-Any.spec, NONE, 1.1 with_older_json.patch, NONE, 1.1 sources, 1.1, 1.2

Chris Weyl cweyl at fedoraproject.org
Sat Mar 22 18:52:57 UTC 2008


Author: cweyl

Update of /cvs/extras/rpms/perl-JSON-Any/F-8
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv11295

Modified Files:
	sources 
Added Files:
	perl-JSON-Any.spec with_older_json.patch 
Log Message:
* Sat Mar 22 2008 Chris Weyl <cweyl at alumni.drew.edu> 1.16-3
- patch to allow utf8 to work properly with JSON::XS earlier than version 2
- patch to skip JSON when JSON is earlier than version 2



--- NEW FILE perl-JSON-Any.spec ---
Name:           perl-JSON-Any
Version:        1.16
Release:        3%{?dist}
Summary:        A meta-module to make working with JSON easier
License:        GPL+ or Artistic
Group:          Development/Libraries
URL:            http://search.cpan.org/dist/JSON-Any/
Source0:        http://www.cpan.org/authors/id/P/PE/PERIGRIN/JSON-Any-%{version}.tar.gz
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch:      noarch
Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

Patch:          with_older_json.patch 

# JSON::XS is fastest, so we require it 
Requires:       perl(JSON::XS)

# core
BuildRequires:  perl(Carp)
BuildRequires:  perl(ExtUtils::MakeMaker)
# testing
BuildRequires:  perl(Test::More) >= 0.62
BuildRequires:  perl(JSON::XS)   >= 1.52
# optional tests -- JSON::Any can handle any of the following to actually do
# the JSON parsing.  We use JSON::XS above, as it's both already in Fedora and
# the fastest of the following.  As other JSON modules are added to Fedora,
# we'll uncomment the tests below.
BuildRequires:  perl(JSON)       
#BuildRequires:  perl(JSON::DWIM)
#BuildRequires:  perl(JSON::PC)
BuildRequires:  perl(JSON::Syck) 


%description
JSON::Any provides a coherent API to bring together the various JSON modules
currently on CPAN.

%prep
%setup -q -n JSON-Any-%{version}
%patch0 -p1

find .  -type f -exec chmod -c -x {} +
find t/ -type f -exec perl -pi -e 's|^#!perl|#!/usr/bin/perl|' {} +

cat Changes | iconv -f ISO-8859-1 -t UTF-8 > Changes.foo
mv  Changes.foo Changes

%build
%{__perl} Makefile.PL INSTALLDIRS=vendor --default
make

%install
rm -rf %{buildroot}

make pure_install PERL_INSTALL_ROOT=%{buildroot}

find %{buildroot} -type f -name .packlist -exec rm -f {} +
find %{buildroot} -depth -type d -exec rmdir {} 2>/dev/null \;

%{_fixperms} %{buildroot}/*

%check
make test

%clean
rm -rf %{buildroot}

%files
%defattr(-,root,root,-)
%doc Changes README t/
%{perl_vendorlib}/*
%{_mandir}/man3/*

%changelog
* Sat Mar 22 2008 Chris Weyl <cweyl at alumni.drew.edu> 1.16-3
- patch to allow utf8 to work properly with JSON::XS earlier than version 2
- patch to skip JSON when JSON is earlier than version 2

* Wed Mar 12 2008 Chris Weyl <cweyl at alumni.drew.edu> 1.16-2
- bump

* Sun Mar 09 2008 Chris Weyl <cweyl at alumni.drew.edu> 1.16-1
- Specfile autogenerated by cpanspec 1.74.

with_older_json.patch:

--- NEW FILE with_older_json.patch ---
diff -ur JSON-Any-1.16.orig/lib/JSON/Any.pm JSON-Any-1.16/lib/JSON/Any.pm
--- JSON-Any-1.16.orig/lib/JSON/Any.pm	2008-02-13 15:15:46.000000000 -0800
+++ JSON-Any-1.16/lib/JSON/Any.pm	2008-03-22 10:50:12.831848606 -0700
@@ -110,6 +110,8 @@
                   max_depth
                 );
 
+                local $conf->{utf8} = !$conf->{utf8};    # it means the opposite
+
                 my $obj = $handler->new;
                 for my $mutator (@params) {
                     next unless exists $conf->{$mutator};
@@ -199,6 +201,7 @@
     foreach my $testmod (@order) {
         $testmod = "JSON::$testmod" unless $testmod eq "JSON";
         eval "require $testmod";
+        $@ = 'JSON too old' if $testmod eq 'JSON' && "$JSON::VERSION" =~ /^1/;
         unless ($@) {
             $handler = $testmod;
             my $key = _make_key($handler);
diff -ur JSON-Any-1.16.orig/t/04-ENV.t JSON-Any-1.16/t/04-ENV.t
--- JSON-Any-1.16.orig/t/04-ENV.t	2008-01-01 12:05:35.000000000 -0800
+++ JSON-Any-1.16/t/04-ENV.t	2008-03-22 10:36:06.260856865 -0700
@@ -13,7 +13,8 @@
 
 SKIP: {
     eval { require JSON; };
-    skip "JSON not installed: $@", 1 if $@;
+    skip "JSON unusable or not installed: $@", 1 
+        if $@ || $JSON::VERSION =~ /^1/;
 
     $ENV{JSON_ANY_ORDER} = qw(JSON);
     JSON::Any->import();


Index: sources
===================================================================
RCS file: /cvs/extras/rpms/perl-JSON-Any/F-8/sources,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- sources	12 Mar 2008 17:31:50 -0000	1.1
+++ sources	22 Mar 2008 18:52:18 -0000	1.2
@@ -0,0 +1 @@
+37325d39aa62b291d05b9e90d2df12a0  JSON-Any-1.16.tar.gz




More information about the Fedora-perl-devel-list mailing list