From af332916f62f832f77773bbf8be903a2f7ab900d Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 24 Feb 2020 09:07:25 +0100 Subject: v0.9.1 from Fedora --- composer.json | 43 +++++++++++++++++++++++ makesrc.sh | 1 + php-EasyRdf-fix-php-7-4.patch | 22 ++++++++++++ php-EasyRdf-get-source.sh | 73 ++++++++++++++++++++++++++++++++++++++ php-EasyRdf.spec | 82 +++++++++++++++++++++++++++++-------------- 5 files changed, 194 insertions(+), 27 deletions(-) create mode 100644 composer.json create mode 120000 makesrc.sh create mode 100644 php-EasyRdf-fix-php-7-4.patch create mode 100755 php-EasyRdf-get-source.sh diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..6d0e6ec --- /dev/null +++ b/composer.json @@ -0,0 +1,43 @@ +{ + "name": "easyrdf/easyrdf", + "description": "EasyRdf is a PHP library designed to make it easy to consume and produce RDF.", + "version": "0.9.1", + "type": "library", + "keywords": ["RDF", "Semantic Web", "Linked Data", "Turtle", "RDFa", "SPARQL"], + "homepage": "http://www.easyrdf.org/", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Nicholas Humfrey", + "email": "njh@aelius.com", + "homepage": "http://www.aelius.com/njh/", + "role": "Developer" + }, + { + "name": "Alexey Zakhlestin", + "email": "indeyets@gmail.com", + "role": "Developer" + } + ], + "support": { + "forum": "http://groups.google.com/group/easyrdf/", + "issues": "http://github.com/njh/easyrdf/issues", + "irc": "irc://chat.freenode.net/easyrdf" + }, + "require": { + "php": ">=5.2.8", + "ext-mbstring": "*", + "ext-pcre": "*" + }, + "suggest": { + "ml/json-ld": "~1.0" + }, + "require-dev": { + "phpunit/PHPUnit": "~3.5", + "squizlabs/php_codesniffer": "~1.4.3", + "sami/sami": "~1.4" + }, + "autoload": { + "psr-0": { "EasyRdf_": "lib/" } + } +} diff --git a/makesrc.sh b/makesrc.sh new file mode 120000 index 0000000..9bfa979 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1 @@ +php-EasyRdf-get-source.sh \ No newline at end of file diff --git a/php-EasyRdf-fix-php-7-4.patch b/php-EasyRdf-fix-php-7-4.patch new file mode 100644 index 0000000..c6a23fd --- /dev/null +++ b/php-EasyRdf-fix-php-7-4.patch @@ -0,0 +1,22 @@ +From 656a86feff97afaff2b1ff7dbc7cc696b66e8a06 Mon Sep 17 00:00:00 2001 +From: Alex Pott +Date: Fri, 18 Oct 2019 21:07:16 +0100 +Subject: [PATCH] Fix PHP 7.4 deprecation + +--- + lib/ParsedUri.php | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/EasyRdf/ParsedUri.php b/lib/EasyRdf/ParsedUri.php +index 037c1f80..23cc3bd6 100644 +--- a/lib/EastRdf/ParsedUri.php ++++ b/lib/EasyRdf/ParsedUri.php +@@ -242,7 +242,7 @@ public function normalise() + } + + // Construct the new normalised path +- $this->path = implode($newSegments, '/'); ++ $this->path = implode('/', $newSegments); + + // Allow easy chaining of methods + return $this; diff --git a/php-EasyRdf-get-source.sh b/php-EasyRdf-get-source.sh new file mode 100755 index 0000000..b2ac62b --- /dev/null +++ b/php-EasyRdf-get-source.sh @@ -0,0 +1,73 @@ +#/bin/sh + +GIT=`which git` +RPM=`which rpm` + +if [ -z "$GIT" ] +then + echo "ERROR: 'git' command not found" 1>&2 + exit 1 +elif [ -z "$RPM" ] +then + echo "ERROR: 'rpm' command not found" 1>&2 + exit 1 +fi + +function print { + echo -e "\e[0;33m>>>>> ${1}\e[0m" +} + +if [ -x "$1" ] +then + SPEC=$1 +else + SPEC=`ls *.spec | head -1` +fi + +SPEC_DIR=`pwd` + +print "SPEC_DIR = $SPEC_DIR" + +NAME=`echo $SPEC | sed 's#\.spec##'` +VERSION=`egrep '%global\s*github_version' $SPEC | awk '{print $3}'` + +print "SPEC = $SPEC" +print "NAME = $NAME" + +GIT_OWNER=`egrep '%global\s*github_owner' $SPEC | awk '{print $3}'` +GIT_NAME=`egrep '%global\s*github_name' $SPEC | awk '{print $3}'` +GIT_COMMIT=`egrep '%global\s*github_commit' $SPEC | awk '{print $3}'` +GIT_REPO=https://github.com/${GIT_OWNER}/${GIT_NAME} +GIT_DIR=`echo $GIT_REPO | sed 's#.*/##'` + +print "GIT_OWNER = $GIT_OWNER" +print "GIT_NAME = $GIT_NAME" +print "GIT_COMMIT = $GIT_COMMIT" +print "GIT_REPO = $GIT_REPO" +print "GIT_DIR = $GIT_DIR" + +TEMP_DIR=$(mktemp --dir) + +pushd $TEMP_DIR + print "Cloning git repo..." + $GIT clone $GIT_REPO + + pushd $GIT_DIR + print "Checking out commit..." + $GIT checkout $GIT_COMMIT + popd + + TAR_DIR=${GIT_NAME}-${GIT_COMMIT} + print "TAR_DIR = $TAR_DIR" + + mv $GIT_DIR $TAR_DIR + + TAR_FILE=${SPEC_DIR}/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz + print "TAR_FILE = $TAR_FILE" + + [ -e $TAR_FILE ] && rm -f $TAR_FILE + tar --exclude-vcs -czf $TAR_FILE $TAR_DIR + chmod 0644 $TAR_FILE +popd + +rm -rf $TEMP_DIR diff --git a/php-EasyRdf.spec b/php-EasyRdf.spec index 617fa4a..6ea79da 100644 --- a/php-EasyRdf.spec +++ b/php-EasyRdf.spec @@ -2,12 +2,16 @@ # # Fedora spec file for php-EasyRdf # -# Copyright (c) 2013-2017 Shawn Iwinski +# Copyright (c) 2013-2020 Shawn Iwinski # # License: MIT # http://opensource.org/licenses/MIT # -# + +%global github_owner njh +%global github_name easyrdf +%global github_version 0.9.1 +%global github_commit acd09dfe0555fbcfa254291e433c45fdd4652566 %global composer_vendor easyrdf %global composer_project easyrdf @@ -35,18 +39,32 @@ %{!?phpdir: %global phpdir %{_datadir}/php} Name: php-EasyRdf -Version: 0.9.0 -Release: 8%{?dist} +Version: 0.9.1 +Release: 1%{?dist} Summary: A PHP library designed to make it easy to consume and produce RDF -Group: Development/Libraries License: BSD URL: http://www.easyrdf.org -Source0: %{url}/downloads/easyrdf-%{version}.tar.gz + +# GitHub export does not include tests. +# Run php-EasyRdf-get-source.sh to create full source. +Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz +Source1: %{name}-get-source.sh # Upstream patches +## Fix PHP 7.1 bug +## https://github.com/njh/easyrdf/commit/4ed264051ed407d59c2fde4128be176e96e8f22a +## https://github.com/njh/easyrdf/commit/4ed264051ed407d59c2fde4128be176e96e8f22a.patch Patch0: 4ed264051ed407d59c2fde4128be176e96e8f22a.patch +## Fix potential bugs and incomplete docs +## https://github.com/njh/easyrdf/commit/5eb5154fec8b3d3df666628ba2f3636c0fa385c3 +## https://github.com/njh/easyrdf/commit/5eb5154fec8b3d3df666628ba2f3636c0fa385c3.patch Patch1: 5eb5154fec8b3d3df666628ba2f3636c0fa385c3.patch +## Fix PHP 7.4 deprecation +## https://github.com/njh/easyrdf/commit/656a86feff97afaff2b1ff7dbc7cc696b66e8a06 +## https://github.com/njh/easyrdf/commit/656a86feff97afaff2b1ff7dbc7cc696b66e8a06.patch +## NOTE: Modified for un-namespaced version 0.9: `lib/ParsedUri.php` => `lib/EastRdf/ParsedUri.php` +Patch2: %{name}-fix-php-7-4.patch BuildArch: noarch # Tests @@ -60,7 +78,7 @@ BuildRequires: php-redland ## composer.json BuildRequires: php(language) >= %{php_min_ver} BuildRequires: php-composer(phpunit/phpunit) -## phpcompatinfo (computed from version 0.9.0) +## phpcompatinfo (computed from version 0.9.1) BuildRequires: php-ctype BuildRequires: php-date BuildRequires: php-dom @@ -78,7 +96,7 @@ BuildRequires: php-composer(fedora/autoloader) # composer.json Requires: php(language) >= %{php_min_ver} -# phpcompatinfo requires (computed from version 0.9.0) +# phpcompatinfo requires (computed from version 0.9.1) Requires: php-ctype Requires: php-date Requires: php-dom @@ -131,16 +149,20 @@ Autoloader: %{phpdir}/EasyRdf/autoload.php %package doc Summary: Documentation for %{name} -Group: Documentation %description doc %{summary}. %prep -%setup -qn easyrdf-%{version} +%setup -qn %{github_name}-%{github_commit} + +# Fix PHP 7.1 bug %patch0 -p1 +# Fix potential bugs and incomplete docs %patch1 -p1 +# Fix PHP 7.4 deprecation +%patch2 -p1 %build @@ -164,12 +186,6 @@ cp -rp lib/* %{buildroot}%{phpdir}/ %check %if %{with_tests} -: Skip tests that sometimes cause timeout exceptions -sed -e 's/testSerialiseSvg/SKIP_testSerialiseSvg/' \ - -e 's/testSerialiseGif/SKIP_testSerialiseGif/' \ - -e 's/testSerialiseSvg/SKIP_testSerialisePng/' \ - -i test/EasyRdf/Serialiser/GraphVizTest.php - : Create PHPUnit config cat <<'PHPUNIT' | tee phpunit.xml @@ -184,23 +200,32 @@ cat <<'PHPUNIT' | tee phpunit.xml PHPUNIT +: Skip tests that sometimes cause timeout exceptions +sed -e 's/testSerialiseSvg/SKIP_testSerialiseSvg/' \ + -e 's/testSerialiseSvg/SKIP_testSerialisePng/' \ + -i test/EasyRdf/Serialiser/GraphVizTest.php + +%if 0%{?fedora} >= 31 +: Skip test known to fail on f31+ +sed 's/function testAddInvalidObject/function SKIP_testAddInvalidObject/' \ + -i test/EasyRdf/GraphTest.php \ + -i test/EasyRdf/ResourceTest.php +%endif + %if !%{redland_support} : No redland support rm -f test/EasyRdf/Parser/RedlandTest.php %endif : Upstream tests -%{_bindir}/phpunit --verbose - -: Upstream tests with SCLs if available -SCL_RETURN_CODE=0 -# Note: No php71 because of skipped tests above -for SCL in %{?rhel:php54 php55} php56 php70 php71 php72; do - if which $SCL; then - $SCL %{_bindir}/phpunit || SCL_RETURN_CODE=1 +RETURN_CODE=0 +PHPUNIT=$(which phpunit) +for PHP_EXEC in php php71 php72 php73 php74; do + if [ "php" == "$PHP_EXEC" ] || which $PHP_EXEC; then + $PHP_EXEC $PHPUNIT --verbose || RETURN_CODE=1 fi done -exit $SCL_RETURN_CODE +exit $RETURN_CODE %else : Tests skipped %endif @@ -212,17 +237,20 @@ exit $SCL_RETURN_CODE %doc CHANGELOG.md %doc README.md %doc composer.json -%doc doap.rdf %{phpdir}/EasyRdf.php %{phpdir}/EasyRdf %files doc -%defattr(-,root,root,-) %doc docs %doc examples %changelog +* Sat Feb 22 2020 Shawn Iwinski - 0.9.1-1 +- Update to 0.9.1 +- Switch source to GitHub as download from www.easyrdf.org is corrupt +- Fix FTBFS (RHBZ #1799864) + * Thu Nov 2 2017 Remi Collet - 0.9.0-8 - add upstream patch for PHP 7.1 - add upstream patch for PHP 7.2 -- cgit