summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-07-01 17:36:08 +0200
committerRemi Collet <remi@remirepo.net>2019-07-01 17:36:08 +0200
commit7e4494b5cf38a3dce9de84363871c181e689a629 (patch)
tree102d6b4236eeb42777b6dfee40eb0ec7c47810e7
parent10e2f99c2cfd3071e4fe8646d45499e4601a1ac7 (diff)
- update to 2.1.2
- rename to php-sabre-uri2 - move to /usr/share/php/Sabre/Uri2 - raise dependency on PHP 7 - switch to classmap autoloader
-rw-r--r--composer.json10
-rwxr-xr-xmakesrc.sh28
-rw-r--r--php-sabre-uri2.spec93
3 files changed, 86 insertions, 45 deletions
diff --git a/composer.json b/composer.json
index 49d69e7..30f3829 100644
--- a/composer.json
+++ b/composer.json
@@ -9,7 +9,7 @@
"homepage": "http://sabre.io/uri/",
"license": "BSD-3-Clause",
"require": {
- "php": ">=5.4.7"
+ "php": ">=7"
},
"authors": [
{
@@ -31,9 +31,13 @@
"Sabre\\Uri\\" : "lib/"
}
},
+ "autoload-dev": {
+ "psr-4": {
+ "Sabre\\Uri\\": "tests/"
+ }
+ },
"require-dev": {
- "sabre/cs": "~1.0.0",
- "phpunit/phpunit" : ">=4.0,<6.0"
+ "phpunit/phpunit" : "^6"
},
"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-uri2.spec b/php-sabre-uri2.spec
index eabf44f..fa4a843 100644
--- a/php-sabre-uri2.spec
+++ b/php-sabre-uri2.spec
@@ -1,48 +1,55 @@
-# remirepo/fedora spec file for php-sabre-uri
+# remirepo/fedora spec file for php-sabre-uri2
#
-# Copyright (c) 2016-2017 Remi Collet
+# Copyright (c) 2016-2019 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
# Please, preserve the changelog entries
#
-%global gh_commit ada354d83579565949d80b2e15593c2371225e61
+# Github
+%global gh_commit c260a55cbd2083c03484f56f72fe042fee0c17ed
%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
%global gh_owner sabre-io
%global gh_project uri
+# Packagist
+%global pk_vendor sabre
+%global pk_project %{gh_project}
+# Namespace
+%global ns_vendor Sabre
+%global ns_project Uri
+%global major 2
%global with_tests 0%{!?_without_tests:1}
-Name: php-sabre-%{gh_project}
+Name: php-%{pk_vendor}-%{pk_project}%{major}
Summary: Functions for making sense out of URIs
-Version: 1.2.1
-Release: 4%{?dist}
+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
+Source0: %{name}-%{version}-%{gh_short}.tgz
+Source1: makesrc.sh
BuildArch: noarch
%if %{with_tests}
-BuildRequires: php(language) > 5.4.7
+BuildRequires: php(language) >= 7
# From composer.json, "require-dev": {
-# "sabre/cs": "~1.0.0",
-# "phpunit/phpunit" : ">=4.0,<6.0"
+# "phpunit/phpunit" : "^6"
BuildRequires: php-pcre
-BuildRequires: php-composer(phpunit/phpunit)
-# Autoloader
-BuildRequires: php-composer(fedora/autoloader)
+BuildRequires: phpunit6
%endif
+# Autoloader
+BuildRequires: php-fedora-autoloader-devel
# From composer.json, "require" : {
-# "php": ">=5.4.7"
-Requires: php(language) > 5.4.7
-# From phpcompatinfo report for version 1.1.0
+# "php": ">=7"
+Requires: php(language) > 7
+# From phpcompatinfo report for version 2.1.2
Requires: php-pcre
# Autoloader
Requires: php-composer(fedora/autoloader)
-Provides: php-composer(sabre/uri) = %{version}
+Provides: php-composer(%{pk_vendor}/%{pk_project}) = %{version}
%description
@@ -61,14 +68,16 @@ The library provides the following functions:
* split to easily get the 'dirname' and 'basename' of a URL without
all the problems those two functions have.
-Autoloader: %{_datadir}/php/Sabre/Uri/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
+require_once __DIR__ . '/functions.php';
+EOF
%build
# nothing to build
@@ -76,31 +85,23 @@ 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/Uri
+mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor}
+cp -pr lib %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}
%check
%if %{with_tests}
: Run upstream test suite against installed library
+mkdir vendor
+ln -s %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}%{major}/autoload.php vendor/autoload.php
+
cd tests
-# remirepo:11
-run=0
-ret=0
-if which php56; then
- php56 %{_bindir}/phpunit --bootstrap=%{buildroot}%{_datadir}/php/Sabre/Uri/autoload.php || ret=1
- run=1
-fi
-if which php71; then
- php71 %{_bindir}/phpunit --bootstrap=%{buildroot}%{_datadir}/php/Sabre/Uri/autoload.php || ret=1
- run=1
-fi
-if [ $run -eq 0 ]; then
-%{_bindir}/phpunit \
- --bootstrap=%{buildroot}%{_datadir}/php/Sabre/Uri/autoload.php \
- --verbose
-# remirepo:2
-fi
+for cmd in php php71 php72 php73 php74
+do
+ if which $cmd; then
+ $cmd %{_bindir}/phpunit6 --verbose || ret=1
+ fi
+done
exit $ret
%else
: Skip upstream test suite
@@ -108,15 +109,23 @@ exit $ret
%files
+# remirepo:1
%{!?_licensedir:%global license %%doc}
%license LICENSE
%doc *md
%doc composer.json
-%dir %{_datadir}/php/Sabre
- %{_datadir}/php/Sabre/Uri
+%dir %{_datadir}/php/%{ns_vendor}
+ %{_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-uri2
+- move to /usr/share/php/Sabre/Uri2
+- raise dependency on PHP 7
+- switch to classmap autoloader
+
* Tue Jun 5 2018 Remi Collet <remi@remirepo.net> - 1.2.1-4
- fix project URL