summaryrefslogtreecommitdiffstats
path: root/php-justinrainbow-json-schema5-rpm.patch
diff options
context:
space:
mode:
Diffstat (limited to 'php-justinrainbow-json-schema5-rpm.patch')
-rw-r--r--php-justinrainbow-json-schema5-rpm.patch82
1 files changed, 67 insertions, 15 deletions
diff --git a/php-justinrainbow-json-schema5-rpm.patch b/php-justinrainbow-json-schema5-rpm.patch
index 28cbe0f..e354326 100644
--- a/php-justinrainbow-json-schema5-rpm.patch
+++ b/php-justinrainbow-json-schema5-rpm.patch
@@ -1,7 +1,7 @@
-diff -up bin/validate-json.rpm bin/validate-json
---- bin/validate-json.rpm 2016-04-15 11:02:32.629960716 +0200
-+++ bin/validate-json 2016-04-15 11:07:01.583136406 +0200
-@@ -6,28 +6,7 @@
+diff -up ./bin/validate-json.rpm ./bin/validate-json
+--- ./bin/validate-json.rpm 2017-03-23 08:58:50.000000000 +0100
++++ ./bin/validate-json 2017-03-23 09:23:35.797857285 +0100
+@@ -6,32 +6,7 @@
* @author Christian Weiske <christian.weiske@netresearch.de>
*/
@@ -16,7 +16,6 @@ diff -up bin/validate-json.rpm bin/validate-json
-{
- $className = ltrim($className, '\\');
- $fileName = '';
-- $namespace = '';
- if ($lastNsPos = strrpos($className, '\\')) {
- $namespace = substr($className, 0, $lastNsPos);
- $className = substr($className, $lastNsPos + 1);
@@ -27,19 +26,72 @@ diff -up bin/validate-json.rpm bin/validate-json
- require_once $fileName;
- }
-}
-+require_once '/usr/share/php/JsonSchema5/autoload.php';
-
- /**
- * Show the json parse error that happened last
-@@ -85,11 +64,6 @@ function parseHeaderValue($headerValue)
- }
-
-
+-
-// support running this tool from git checkout
-if (is_dir(__DIR__ . '/../src/JsonSchema')) {
- set_include_path(__DIR__ . '/../src' . PATH_SEPARATOR . get_include_path());
-}
--
++require_once '/usr/share/php/JsonSchema5/autoload.php';
+
$arOptions = array();
$arArgs = array();
- array_shift($argv);//script itself
+diff -up ./src/JsonSchema/Uri/UriRetriever.php.rpm ./src/JsonSchema/Uri/UriRetriever.php
+--- ./src/JsonSchema/Uri/UriRetriever.php.rpm 2017-03-23 08:58:50.000000000 +0100
++++ ./src/JsonSchema/Uri/UriRetriever.php 2017-03-23 09:23:35.797857285 +0100
+@@ -323,7 +323,8 @@ class UriRetriever implements BaseUriRet
+ }
+
+ // translate references to local files within the json-schema package
+- $uri = preg_replace('|^package://|', sprintf('file://%s/', realpath(__DIR__ . '/../../..')), $uri);
++ $path = (getenv('BUILDROOT_SCHEMA')?:'') . '/usr/share/php-justinrainbow-json-schema5';
++ $uri = preg_replace('|^package://|', sprintf('file://%s/', $path), $uri);
+
+ return $uri;
+ }
+diff -up ./tests/Uri/UriRetrieverTest.php.rpm ./tests/Uri/UriRetrieverTest.php
+--- ./tests/Uri/UriRetrieverTest.php.rpm 2017-03-23 08:58:50.000000000 +0100
++++ ./tests/Uri/UriRetrieverTest.php 2017-03-23 09:28:28.992372836 +0100
+@@ -295,7 +295,8 @@ EOF;
+ public function testPackageURITranslation()
+ {
+ $retriever = new UriRetriever();
+- $root = sprintf('file://%s/', realpath(__DIR__ . '/../..'));
++ $path = (getenv('BUILDROOT_SCHEMA')?:'') . '/usr/share/php-justinrainbow-json-schema5';
++ $root = sprintf('file://%s/', $path);
+
+ $uri = $retriever->translate('package://foo/bar.json');
+ $this->assertEquals("${root}foo/bar.json", $uri);
+@@ -304,7 +305,8 @@ EOF;
+ public function testDefaultDistTranslations()
+ {
+ $retriever = new UriRetriever();
+- $root = sprintf('file://%s/dist/schema/', realpath(__DIR__ . '/../..'));
++ $path = (getenv('BUILDROOT_SCHEMA')?:'') . '/usr/share/php-justinrainbow-json-schema5';
++ $root = sprintf('file://%s/dist/schema/', $path);
+
+ $this->assertEquals(
+ $root . 'json-schema-draft-03.json',
+@@ -322,11 +324,12 @@ EOF;
+ $retriever = new UriRetriever();
+
+ // load schema from package
+- $schema = $retriever->retrieve('package://tests/fixtures/foobar.json');
++ $schema = $retriever->retrieve('file://' . dirname(__DIR__) . '/fixtures/foobar.json');
+ $this->assertNotFalse($schema);
+
+ // check that the schema was loaded & processed correctly
+- $this->assertEquals('454f423bd7edddf0bc77af4130ed9161', md5(json_encode($schema)));
++ $schema->id = 'foo';
++ $this->assertEquals('c2ef5714b639cea176fdeeafe418aa09', md5(json_encode($schema)));
+ }
+
+ public function testJsonSchemaOrgMediaTypeHack()
+@@ -365,7 +367,7 @@ EOF;
+ 'JsonSchema\Exception\JsonDecodingException',
+ 'JSON syntax is malformed'
+ );
+- $schema = $retriever->retrieve('package://tests/fixtures/bad-syntax.json');
++ $schema = $retriever->retrieve('file://' . dirname(__DIR__) . '/fixtures/bad-syntax.json');
+ }
+
+ public function testGenerateURI()