summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-03-17 16:01:35 +0100
committerRemi Collet <remi@remirepo.net>2021-03-17 16:01:35 +0100
commitf447b149e0148d61ff9132dca830790d74bea804 (patch)
tree26f1b1788bd813a54ccfc264c71b48207315ad66
parent81746e329cc9e664d86825a426d0efa9470ad9ad (diff)
update to 2.7.4
drop patch merged upstream switch to phpunit8
-rw-r--r--170.patch23
-rw-r--r--composer.json4
l---------makesrc.sh1
-rwxr-xr-xphp-masterminds-html5-get-source.sh71
-rw-r--r--php-masterminds-html5.spec38
5 files changed, 101 insertions, 36 deletions
diff --git a/170.patch b/170.patch
deleted file mode 100644
index 076b8d4..0000000
--- a/170.patch
+++ /dev/null
@@ -1,23 +0,0 @@
-From 70d36f21e9223cad511dbc149c299b1143d264e4 Mon Sep 17 00:00:00 2001
-From: Remi Collet <remi@remirepo.net>
-Date: Fri, 11 Oct 2019 10:30:57 +0200
-Subject: [PATCH] Fix Trying to access array offset on value of type null
-
----
- test/HTML5/Parser/TokenizerTest.php | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/test/HTML5/Parser/TokenizerTest.php b/test/HTML5/Parser/TokenizerTest.php
-index 153dd23..6c90686 100644
---- a/test/HTML5/Parser/TokenizerTest.php
-+++ b/test/HTML5/Parser/TokenizerTest.php
-@@ -26,7 +26,8 @@ public function assertEventEquals($type, $expects, $event)
- if (is_array($expects)) {
- $this->assertEquals($expects, $event['data'], "Event $type should equal " . print_r($expects, true) . ': ' . print_r($event, true));
- } else {
-- $this->assertEquals($expects, $event['data'][0], "Event $type should equal $expects: " . print_r($event, true));
-+ $d = (is_array($event['data']) ? $event['data'][0] : null);
-+ $this->assertEquals($expects, $d, "Event $type should equal $expects: " . print_r($event, true));
- }
- }
-
diff --git a/composer.json b/composer.json
index 6504790..6e5dddb 100644
--- a/composer.json
+++ b/composer.json
@@ -26,9 +26,7 @@
"php" : ">=5.3.0"
},
"require-dev": {
- "satooshi/php-coveralls": "1.0.*",
- "phpunit/phpunit" : "^4.8.35",
- "sami/sami": "~2.0"
+ "phpunit/phpunit" : "^4.8.35"
},
"autoload": {
"psr-4": {"Masterminds\\": "src"}
diff --git a/makesrc.sh b/makesrc.sh
new file mode 120000
index 0000000..a456189
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1 @@
+php-masterminds-html5-get-source.sh \ No newline at end of file
diff --git a/php-masterminds-html5-get-source.sh b/php-masterminds-html5-get-source.sh
new file mode 100755
index 0000000..4ad1051
--- /dev/null
+++ b/php-masterminds-html5-get-source.sh
@@ -0,0 +1,71 @@
+#/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
+
+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)
+TAR_FILE=$PWD/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz
+CMP_FILE=$PWD/composer.json
+
+pushd $TEMP_DIR
+ print "Cloning git repo..."
+ $GIT clone $GIT_REPO
+
+ pushd $GIT_DIR
+ print "Checking out commit..."
+ $GIT checkout $GIT_COMMIT
+ cp composer.json $CMP_FILE
+ popd
+
+ TAR_DIR=${GIT_NAME}-${GIT_COMMIT}
+ print "TAR_DIR = $TAR_DIR"
+
+ mv $GIT_DIR $TAR_DIR
+
+ 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-masterminds-html5.spec b/php-masterminds-html5.spec
index 6a011d5..b461425 100644
--- a/php-masterminds-html5.spec
+++ b/php-masterminds-html5.spec
@@ -2,7 +2,7 @@
#
# Fedora spec file for php-masterminds-html5
#
-# Copyright (c) 2015-2019 Shawn Iwinski <shawn.iwinski@gmail.com>
+# Copyright (c) 2015-2020 Shawn Iwinski <shawn.iwinski@gmail.com>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -12,8 +12,8 @@
%global github_owner Masterminds
%global github_name html5-php
-%global github_version 2.7.0
-%global github_commit 104443ad663d15981225f99532ba73c2f1d6b6f2
+%global github_version 2.7.4
+%global github_commit 9227822783c75406cfe400984b2f095cdf03d417
%global composer_vendor masterminds
%global composer_project html5
@@ -33,9 +33,10 @@ Summary: An HTML5 parser and serializer
License: MIT
URL: http://masterminds.github.io/html5-php
-Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
-
-Patch0: https://patch-diff.githubusercontent.com/raw/Masterminds/html5-php/pull/170.patch
+# GitHub export does not include tests.
+# Run php-league-container-get-source.sh to create full source.
+Source0: %{name}-%{github_version}-%{github_commit}.tar.gz
+Source1: %{name}-get-source.sh
BuildArch: noarch
# Autoload generation
@@ -44,7 +45,7 @@ BuildRequires: %{_bindir}/phpab
%if %{with_tests}
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
-BuildRequires: php-composer(phpunit/phpunit) >= 4.8.35
+BuildRequires: phpunit8
BuildRequires: php-ctype
BuildRequires: php-dom
## phpcompatinfo (computed from version 2.7.0)
@@ -85,7 +86,6 @@ refactoring work, we began a new parser.
%prep
%setup -qn %{github_name}-%{github_commit}
-%patch0 -p1 -b .pr170
: Docs
mkdir -p docs/{Parser,Serializer}
@@ -121,10 +121,23 @@ require '%{buildroot}%{phpdir}/Masterminds/HTML5/autoload.php';
require __DIR__ . '/../test/autoload.php';
AUTOLOAD
+: fix for phpunit8
+find test \
+ -name \*.php \
+ -exec sed \
+ -e 's/function setUp()/function setUp():void/' \
+ -i {} \;
+
+sed -e 's/assertContains(/assertStringContainsString(/' \
+ -i test/HTML5/Html5Test.php
+
+grep -v blacklist < phpunit.xml.dist | \
+ grep -v '<file' > phpunit.xml
+
: Upstream tests
RETURN_CODE=0
-PHPUNIT=$(which phpunit)
-for PHP_EXEC in "" %{?rhel:php54 php55 php56 php70} php71 php72 php73 php74; do
+PHPUNIT=$(which phpunit8)
+for PHP_EXEC in "" php72 php73 php74 php80; do
if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
$PHP_EXEC $PHPUNIT --verbose || RETURN_CODE=1
fi
@@ -143,6 +156,11 @@ exit $RETURN_CODE
%changelog
+* Wed Mar 17 2021 Remi Collet <remi@remirepo.net> - 2.7.4-1
+- update to 2.7.4
+- drop patch merged upstream
+- switch to phpunit8
+
* Fri Oct 11 2019 Remi Collet <remi@remirepo.net> - 2.7.0-1
- update to 2.7.0
- add patch for PHP 7.4 from