[php-JsonSchema] Updated to 1.3.7 (BZ #1133519)

Shawn Iwinski siwinski at fedoraproject.org
Sat Aug 30 02:19:37 UTC 2014


commit da343c64fa56e8749b56c36ab9e82bb26f120fef
Author: Shawn Iwinski <shawn.iwinski at gmail.com>
Date:   Fri Aug 29 22:19:07 2014 -0400

    Updated to 1.3.7 (BZ #1133519)
    
    - Added option to build without tests ("--without tests")
    - Added "php-composer(justinrainbow/json-schema)" virtual provide
    - Added PHP < 5.4.0 compatibility for "--dump-schema"
    - %check tweaks
    - Added %license usage

 .gitignore          |    1 +
 php-JsonSchema.spec |   84 +++++++++++++++++++++++++++++++++++---------------
 sources             |   10 +-----
 3 files changed, 61 insertions(+), 34 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 60f8356..7b2c0ab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,3 +7,4 @@
 /php-JsonSchema-1.3.4-ad8b959e5962624004738d50a2d8e83c5668e143.tar.gz
 /php-JsonSchema-1.3.5-01949f6d2130e9737ffae5d3952909a8de70d114.tar.gz
 /php-JsonSchema-1.3.6-d97cf3ce890fe80f247fc08594a1c8a1029fc7ed.tar.gz
+/php-JsonSchema-1.3.7-87b54b460febed69726c781ab67462084e97a105.tar.gz
diff --git a/php-JsonSchema.spec b/php-JsonSchema.spec
index 7dae11a..6a93d4a 100644
--- a/php-JsonSchema.spec
+++ b/php-JsonSchema.spec
@@ -1,16 +1,30 @@
+#
+# RPM spec file for php-JsonSchema
+#
+# Copyright (c) 2012-2014 Shawn Iwinski <shawn.iwinski at gmail.com>
+#
+# License: MIT
+# http://opensource.org/licenses/MIT
+#
+# Please preserve changelog entries
+#
+
 %global github_owner   justinrainbow
 %global github_name    json-schema
-%global github_version 1.3.6
-%global github_commit  d97cf3ce890fe80f247fc08594a1c8a1029fc7ed
+%global github_version 1.3.7
+%global github_commit  87b54b460febed69726c781ab67462084e97a105
 
 # See https://github.com/justinrainbow/json-schema/pull/96
 %global php_min_ver    5.3.2
 
 %global lib_name       JsonSchema
 
+# Build using "--without tests" to disable tests
+%global with_tests     %{?_without_tests:0}%{!?_without_tests:1}
+
 Name:          php-%{lib_name}
 Version:       %{github_version}
-Release:       2%{?dist}
+Release:       1%{?dist}
 Summary:       PHP implementation of JSON schema
 
 Group:         Development/Libraries
@@ -19,10 +33,11 @@ URL:           https://github.com/%{github_owner}/%{github_name}
 Source0:       %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
 
 BuildArch: noarch
+%if %{with_tests}
 # For tests
 BuildRequires: php(language) >= %{php_min_ver}
-BuildRequires: php-pear(pear.phpunit.de/PHPUnit)
-# For tests: phpcompatinfo (computed from v1.3.6)
+BuildRequires: php-phpunit-PHPUnit
+# For tests: phpcompatinfo (computed from v1.3.7)
 BuildRequires: php-curl
 BuildRequires: php-date
 BuildRequires: php-filter
@@ -30,9 +45,10 @@ BuildRequires: php-json
 BuildRequires: php-mbstring
 BuildRequires: php-pcre
 BuildRequires: php-spl
+%endif
 
 Requires:      php(language) >= %{php_min_ver}
-# phpcompatinfo (computed from v1.3.6)
+# phpcompatinfo (computed from v1.3.7)
 Requires:      php-curl
 Requires:      php-filter
 Requires:      php-json
@@ -40,6 +56,8 @@ Requires:      php-mbstring
 Requires:      php-pcre
 Requires:      php-spl
 
+Provides:      php-composer(justinrainbow/json-schema) = %{version}
+
 %description
 A PHP implementation for validating JSON structures against a given schema.
 
@@ -49,22 +67,15 @@ See http://json-schema.org for more details.
 %prep
 %setup -qn %{github_name}-%{github_commit}
 
-# Clean up unnecessary files
-find . -type f -name '.git*' -delete
-
-# Create autoloader for tests
-( cat <<'AUTOLOAD'
-<?php
-spl_autoload_register(function ($class) {
-    $src = str_replace('\\', '/', $class).'.php';
-    require_once $src;
-});
-AUTOLOAD
-) > autoload.php
-
 # Update bin file
+## Shebang
 sed 's#/usr/bin/env php#%{_bindir}/php#' \
     -i bin/validate-json
+## PHP < 5.4.0 compatibility for "--dump-schema"
+%if "%{php_version}" < "5.4"
+sed 's#,\s*JSON_PRETTY_PRINT##' \
+    -i bin/validate-json
+%endif
 
 
 %build
@@ -73,33 +84,56 @@ sed 's#/usr/bin/env php#%{_bindir}/php#' \
 
 %install
 # Install lib
-mkdir -pm 755 %{buildroot}%{_datadir}/php
-cp -rp src/%{lib_name} %{buildroot}%{_datadir}/php/
+mkdir -pm 0755 %{buildroot}%{_datadir}/php
+cp -rp src/* %{buildroot}%{_datadir}/php/
 
 # Install bin
 mkdir -pm 0755 %{buildroot}%{_bindir}
-cp -p bin/validate-json %{buildroot}%{_bindir}/
+install -pm 0755 bin/validate-json %{buildroot}%{_bindir}/
 
 
 %check
+%if %{with_tests}
+# Create autoloader
+cat > autoload.php <<'AUTOLOAD'
+<?php
+spl_autoload_register(function ($class) {
+    $src = str_replace('\\', '/', $class).'.php';
+    require_once $src;
+});
+AUTOLOAD
+
 # Remove empty tests
 rm -rf tests/JsonSchema/Tests/Drafts
 
+# Create PHPUnit config w/ colors turned off
+sed 's/colors\s*=\s*"true"/colors="false"/' phpunit.xml.dist > phpunit.xml
+
 %{_bindir}/phpunit \
     --include-path="./src:./tests" \
     --bootstrap="./autoload.php" \
     -d date.timezone="UTC"
+%else
+: Tests skipped
+%endif
 
 
 %files
-%doc LICENSE README.md composer.json
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc README.md composer.json
 %{_datadir}/php/%{lib_name}
 %{_bindir}/validate-json
 
 
 %changelog
-* Sat Jun 07 2014 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 1.3.6-2
-- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild
+* Fri Aug 29 2014 Shawn Iwinski <shawn.iwinski at gmail.com> - 1.3.7-1
+- Updated to 1.3.7 (BZ #1133519)
+- Added option to build without tests ("--without tests")
+- Added "php-composer(justinrainbow/json-schema)" virtual provide
+- Added PHP < 5.4.0 compatibility for "--dump-schema"
+- %%check tweaks
+- Added %%license usage
 
 * Fri Mar 07 2014 Shawn Iwinski <shawn.iwinski at gmail.com> - 1.3.6-1
 - Updated to 1.3.6 (BZ #1073969)
diff --git a/sources b/sources
index 50efd4d..b029327 100644
--- a/sources
+++ b/sources
@@ -1,9 +1 @@
-7dc9aeab73ff02dc0be1ff3c3db8e8cb  1.2.2.tar.gz
-56f1d82091fff9f3b3f491ecde14efe3  php-JsonSchema-1.2.4-e26066573e11fef790ec9bdfaf7c98ccf35728d9.tar.gz
-ffe15f72e1c9a5c7995b9cb0437f00bd  php-JsonSchema-1.3.0-93907953341530a748aa88a5380c418eb774b895.tar.gz
-d39aa911f107567e14bdc668be4d4ce2  php-JsonSchema-1.3.1-40cb851130a4cdbff7f680b77f6979b0e785c544.tar.gz
-7970daea742784708e84be2083b2c099  php-JsonSchema-1.3.2-3ec2db504e7a79d6504ad8172a706adec5eec681.tar.gz
-521f68bcae24e3dea40acab8c96260c8  php-JsonSchema-1.3.3-56fe099669ff3ec3be859ec02e3da965a720184d.tar.gz
-8ef3ea842e20b27697e112243233c376  php-JsonSchema-1.3.4-ad8b959e5962624004738d50a2d8e83c5668e143.tar.gz
-246626fb649b93c8cdf8f6b98f63870f  php-JsonSchema-1.3.5-01949f6d2130e9737ffae5d3952909a8de70d114.tar.gz
-d9b28dcb3de543d5ab24535b280ad65f  php-JsonSchema-1.3.6-d97cf3ce890fe80f247fc08594a1c8a1029fc7ed.tar.gz
+7d06b9acbf1199df6fc4a277ce7b77d9  php-JsonSchema-1.3.7-87b54b460febed69726c781ab67462084e97a105.tar.gz


More information about the scm-commits mailing list