summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--composer.json5
-rwxr-xr-xmakesrc.sh28
-rw-r--r--php-sabre-xml2.spec97
3 files changed, 98 insertions, 32 deletions
diff --git a/composer.json b/composer.json
index 1b57603..2603aad 100644
--- a/composer.json
+++ b/composer.json
@@ -5,7 +5,7 @@
"homepage" : "https://sabre.io/xml/",
"license" : "BSD-3-Clause",
"require" : {
- "php" : ">=5.5.5",
+ "php" : ">=7.0",
"ext-xmlwriter" : "*",
"ext-xmlreader" : "*",
"ext-dom" : "*",
@@ -44,8 +44,7 @@
}
},
"require-dev": {
- "sabre/cs": "~1.0.0",
- "phpunit/phpunit" : "~4.8|~5.7"
+ "phpunit/phpunit" : "*"
},
"config" : {
"bin-dir" : "bin/"
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..37cb6a2
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1,28 @@
+#!/bin/bash
+
+NAME=$(basename $PWD)
+OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec)
+PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
+COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec)
+SHORT=${COMMIT:0:7}
+
+echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
+
+echo "Cloning..."
+rm -rf $PROJECT-$COMMIT
+git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
+
+echo "Getting commit..."
+pushd $PROJECT-$COMMIT
+git checkout $COMMIT
+cp composer.json ../composer.json
+popd
+
+echo "Archiving..."
+tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs $PROJECT-$COMMIT
+
+echo "Cleaning..."
+rm -rf $PROJECT-$COMMIT
+
+echo "Done."
diff --git a/php-sabre-xml2.spec b/php-sabre-xml2.spec
index 1bd190b..4094c4b 100644
--- a/php-sabre-xml2.spec
+++ b/php-sabre-xml2.spec
@@ -1,4 +1,4 @@
-# remirepo/fedora spec file for php-sabre-xml
+# remirepo/fedora spec file for php-sabre-xml2
#
# Copyright (c) 2016-2019 Remi Collet
# License: CC-BY-SA
@@ -6,71 +6,104 @@
#
# Please, preserve the changelog entries
#
-%global gh_commit a367665f1df614c3b8fefc30a54de7cd295e444e
+# Github
+%global gh_commit e15454e68805e3713271ea58c0b2d6a82dac56b7
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner sabre-io
%global gh_project xml
+# Packagist
+%global pk_vendor sabre
+%global pk_project %{gh_project}
+# Namespace
+%global ns_vendor Sabre
+%global ns_project Xml
+%global major 2
%global with_tests 0%{!?_without_tests:1}
-Name: php-sabre-%{gh_project}
+Name: php-%{pk_vendor}-%{pk_project}%{major}
Summary: XML library that you may not hate
-Version: 1.5.1
+Version: 2.1.2
Release: 1%{?dist}
URL: https://github.com/%{gh_owner}/%{gh_project}
License: BSD
-Source0: https://github.com/%{gh_owner}/%{gh_project}/archive/%{gh_commit}/%{name}-%{version}-%{gh_short}.tar.gz
-Source1: %{name}-autoload.php
+# Git snapshot with tests, because of .gitattributes
+Source0: %{name}-%{version}-%{gh_short}.tgz
+Source1: makesrc.sh
BuildArch: noarch
%if %{with_tests}
-BuildRequires: php(language) >= 5.5.5
+BuildRequires: php(language) >= 7.0
BuildRequires: php-xmlwriter
BuildRequires: php-xmlreader
BuildRequires: php-dom
-BuildRequires: php-composer(sabre/uri) >= 1.0
+# remirepo:1
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+BuildRequires: (php-composer(sabre/uri) >= 2.0 with php-composer(sabre/uri) < 3)
+# remirepo:3
+%else
+BuildRequires: php-sabre-uri2
+%endif
+BuildRequires: php-libxml
BuildRequires: php-pcre
BuildRequires: php-spl
# From composer.json, "require-dev": {
-# "sabre/cs": "~1.0.0",
-# "phpunit/phpunit" : "~4.8|~5.7"
-BuildRequires: php-composer(phpunit/phpunit)
-# Autoloader
-BuildRequires: php-composer(fedora/autoloader)
+# "phpunit/phpunit" : "*"
+BuildRequires: phpunit6
%endif
+# Autoloader
+BuildRequires: php-fedora-autoloader-devel
# From composer.json, "require" : {
-# "php" : ">=5.5.5",
+# "php" : ">=7.0",
# "ext-xmlwriter" : "*",
# "ext-xmlreader" : "*",
# "ext-dom" : "*",
# "lib-libxml" : ">=2.6.20",
# "sabre/uri" : ">=1.0,<3.0.0"
-Requires: php(language) >= 5.5.5
+Requires: php(language) >= 7.0
Requires: php-xmlwriter
Requires: php-xmlreader
Requires: php-dom
-Requires: php-composer(sabre/uri) >= 1.0
-Requires: php-composer(sabre/uri) < 3
-# From phpcompatinfo report for version 1.4.0
+# remirepo:1
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+Requires: (php-composer(sabre/uri) >= 2.0 with php-composer(sabre/uri) < 3)
+# remirepo:3
+%else
+Requires: php-sabre-uri2
+%endif
+# From phpcompatinfo report for version 2.1.2
+Requires: php-libxml
Requires: php-pcre
Requires: php-spl
# Autoloader
Requires: php-composer(fedora/autoloader)
-Provides: php-composer(sabre/xml) = %{version}
+Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
%description
The sabre/xml library is a specialized XML reader and writer.
-Autoloader: %{_datadir}/php/Sabre/Xml/autoload.php
+Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php
%prep
%setup -q -n %{gh_project}-%{gh_commit}
-cp %{SOURCE1} lib/autoload.php
+phpab -t fedora -o lib/autoload.php lib
+cat << 'EOF' | tee -a lib/autoload.php
+
+// Dependencies
+\Fedora\Autoloader\Dependencies::required([
+ '/usr/share/php/Sabre/Uri2/autoload.php',
+]);
+
+// Functions
+require_once __DIR__ . '/Deserializer/functions.php';
+require_once __DIR__ . '/Serializer/functions.php';
+EOF
+
%build
@@ -79,8 +112,8 @@ cp %{SOURCE1} lib/autoload.php
%install
# Install as a PSR-0 library
-mkdir -p %{buildroot}%{_datadir}/php/Sabre
-cp -pr lib %{buildroot}%{_datadir}/php/Sabre/Xml
+mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor}
+cp -pr lib %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
%check
@@ -88,18 +121,16 @@ cp -pr lib %{buildroot}%{_datadir}/php/Sabre/Xml
mkdir vendor
cat << 'EOF' | tee vendor/autoload.php
<?php
-require_once '%{buildroot}%{_datadir}/php/Sabre/Xml/autoload.php';
-// Tests
-require_once '%{_datadir}/php/Symfony/Component/ClassLoader/Psr4ClassLoader.php';
+require_once '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php';
\Fedora\Autoloader\Autoload::addPsr4('Sabre\\Xml\\', dirname(__DIR__).'/tests/Sabre/Xml/');
EOF
cd tests
: Run upstream test suite against installed library
ret=0
-for cmd in php php56 php70 php71 php72 php73; do
+for cmd in php php71 php72 php73 php74; do
if which $cmd; then
- $cmd %{_bindir}/phpunit || ret=1
+ $cmd %{_bindir}/phpunit7 || ret=1
fi
done
exit $ret
@@ -109,14 +140,22 @@ exit $ret
%files
+# remirepo:1
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *md
%doc composer.json
-%{_datadir}/php/Sabre/Xml
+%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
%changelog
+* Mon Jul 1 2019 Remi Collet <remi@remirepo.net> - 2.1.2-1
+- update to 2.1.2
+- rename to php-sabre-xml2
+- move to /usr/share/php/Sabre/Xml2
+- raise dependency on PHP 7
+- switch to classmap autoloader
+
* Wed Jan 9 2019 Remi Collet <remi@remirepo.net> - 1.5.1-1
- update to 1.5.1