summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-01-14 09:43:43 +0100
committerRemi Collet <fedora@famillecollet.com>2016-01-14 09:43:43 +0100
commit6e576f89b0b29f1762375bf1008022c8236a6529 (patch)
tree8aa4f7d154f34a834fc7955601b8a4aa90af3c92
php-league-flysystem: 1.0.16 - New package
-rw-r--r--Makefile4
-rwxr-xr-xmakesrc.sh28
-rw-r--r--php-league-flysystem-autoload.php15
-rw-r--r--php-league-flysystem-pr592.patch125
-rw-r--r--php-league-flysystem.spec147
5 files changed, 319 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..91b0fd5
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../common/Makefile
+
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..e9a1ec5
--- /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-$VERSION.json
+popd
+
+echo "Archiving..."
+tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT
+
+echo "Cleaning..."
+rm -rf $PROJECT-$COMMIT
+
+echo "Done."
diff --git a/php-league-flysystem-autoload.php b/php-league-flysystem-autoload.php
new file mode 100644
index 0000000..dcbdda2
--- /dev/null
+++ b/php-league-flysystem-autoload.php
@@ -0,0 +1,15 @@
+<?php
+/* Autoloader for league/flysystem and its dependencies */
+
+$vendorDir = '/usr/share/php';
+// Use Symfony autoloader
+if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) {
+ if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) {
+ require_once $vendorDir . '/Symfony/Component/ClassLoader/ClassLoader.php';
+ }
+
+ $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader();
+ $fedoraClassLoader->register();
+}
+
+$fedoraClassLoader->addPrefix('League\\Flysystem\\', dirname(dirname(__DIR__)));
diff --git a/php-league-flysystem-pr592.patch b/php-league-flysystem-pr592.patch
new file mode 100644
index 0000000..fde5df7
--- /dev/null
+++ b/php-league-flysystem-pr592.patch
@@ -0,0 +1,125 @@
+From a7e1a712ad94962692785a12a8656c9eb9b3004a Mon Sep 17 00:00:00 2001
+From: Remi Collet <fedora@famillecollet.com>
+Date: Thu, 14 Jan 2016 08:51:41 +0100
+Subject: [PATCH] drop dep on deprecated prophecy-phpunit (since PHPUnit 4.5)
+ and allow PHPUnit 5
+
+---
+ composer.json | 5 ++---
+ tests/FilesystemTests.php | 3 +--
+ tests/GetWithMetadataTests.php | 3 +--
+ tests/HandlerTests.php | 3 +--
+ tests/ListFilesTests.php | 3 +--
+ tests/ListPathsTests.php | 3 +--
+ tests/ListWithTests.php | 3 +--
+ 7 files changed, 8 insertions(+), 15 deletions(-)
+
+diff --git a/composer.json b/composer.json
+index 0b6721f..96a8f98 100644
+--- a/composer.json
++++ b/composer.json
+@@ -18,10 +18,9 @@
+ },
+ "require-dev": {
+ "ext-fileinfo": "*",
+- "phpunit/phpunit": "~4.8",
++ "phpunit/phpunit": "~4.8 || ~5.0",
+ "mockery/mockery": "~0.9",
+- "phpspec/phpspec": "^2.2",
+- "phpspec/prophecy-phpunit": "~1.0"
++ "phpspec/phpspec": "^2.2"
+ },
+ "autoload": {
+ "psr-4": {
+diff --git a/tests/FilesystemTests.php b/tests/FilesystemTests.php
+index 133177e..bab76bc 100644
+--- a/tests/FilesystemTests.php
++++ b/tests/FilesystemTests.php
+@@ -4,10 +4,9 @@
+ use League\Flysystem\Util;
+ use Prophecy\Argument;
+ use Prophecy\Argument\Token\TypeToken;
+-use Prophecy\PhpUnit\ProphecyTestCase;
+ use Prophecy\Prophecy\ObjectProphecy;
+
+-class FilesystemTests extends ProphecyTestCase
++class FilesystemTests extends \PHPUnit_Framework_TestCase
+ {
+ /**
+ * @var ObjectProphecy
+diff --git a/tests/GetWithMetadataTests.php b/tests/GetWithMetadataTests.php
+index 4b43725..dd4e639 100644
+--- a/tests/GetWithMetadataTests.php
++++ b/tests/GetWithMetadataTests.php
+@@ -2,10 +2,9 @@
+
+
+ use League\Flysystem\Plugin\GetWithMetadata;
+-use Prophecy\PhpUnit\ProphecyTestCase;
+ use Prophecy\Prophecy\ObjectProphecy;
+
+-class GetWithMetadataTests extends ProphecyTestCase
++class GetWithMetadataTests extends \PHPUnit_Framework_TestCase
+ {
+ /**
+ * @var ObjectProphecy
+diff --git a/tests/HandlerTests.php b/tests/HandlerTests.php
+index d282c6b..9ec279b 100644
+--- a/tests/HandlerTests.php
++++ b/tests/HandlerTests.php
+@@ -3,9 +3,8 @@
+
+ use League\Flysystem\Directory;
+ use League\Flysystem\File;
+-use Prophecy\PhpUnit\ProphecyTestCase;
+
+-class HandlerTests extends ProphecyTestCase
++class HandlerTests extends \PHPUnit_Framework_TestCase
+ {
+ public function testFileRead()
+ {
+diff --git a/tests/ListFilesTests.php b/tests/ListFilesTests.php
+index c393461..7e42303 100644
+--- a/tests/ListFilesTests.php
++++ b/tests/ListFilesTests.php
+@@ -2,9 +2,8 @@
+
+
+ use League\Flysystem\Plugin\ListFiles;
+-use Prophecy\PhpUnit\ProphecyTestCase;
+
+-class ListFilesTests extends ProphecyTestCase
++class ListFilesTests extends \PHPUnit_Framework_TestCase
+ {
+ private $filesystem;
+ private $actualFilesystem;
+diff --git a/tests/ListPathsTests.php b/tests/ListPathsTests.php
+index 328f1da..160d6ba 100644
+--- a/tests/ListPathsTests.php
++++ b/tests/ListPathsTests.php
+@@ -2,9 +2,8 @@
+
+
+ use League\Flysystem\Plugin\ListPaths;
+-use Prophecy\PhpUnit\ProphecyTestCase;
+
+-class ListPathsTests extends ProphecyTestCase
++class ListPathsTests extends \PHPUnit_Framework_TestCase
+ {
+ private $filesystem;
+ private $actualFilesystem;
+diff --git a/tests/ListWithTests.php b/tests/ListWithTests.php
+index e9a2a26..3f5db84 100644
+--- a/tests/ListWithTests.php
++++ b/tests/ListWithTests.php
+@@ -3,9 +3,8 @@
+ namespace League\Flysystem\Adapter;
+
+ use League\Flysystem\Plugin\ListWith;
+-use Prophecy\PhpUnit\ProphecyTestCase;
+
+-class ListWithTests extends ProphecyTestCase
++class ListWithTests extends \PHPUnit_Framework_TestCase
+ {
+ public function testHandle()
+ {
diff --git a/php-league-flysystem.spec b/php-league-flysystem.spec
new file mode 100644
index 0000000..81df1de
--- /dev/null
+++ b/php-league-flysystem.spec
@@ -0,0 +1,147 @@
+# remirepo/fedora spec file for php-league-flysystem
+#
+# Copyright (c) 2016 Remi Collet
+# License: CC-BY-SA
+# http://creativecommons.org/licenses/by-sa/4.0/
+#
+# Please, preserve the changelog entries
+#
+# Github
+%global gh_commit 183e1a610664baf6dcd6fceda415baf43cbdc031
+%global gh_short %(c=%{gh_commit}; echo ${c:0:7})
+%global gh_owner thephpleague
+%global gh_project flysystem
+# Packagist
+%global pk_vendor league
+%global pk_name flysystem
+# PSR-0 namespace
+%global ns_vendor League
+%global ns_project Flysystem
+
+Name: php-%{pk_vendor}-%{pk_name}
+Version: 1.0.16
+Release: 1%{?dist}
+Summary: Filesystem abstraction: Many filesystems, one API
+
+Group: Development/Libraries
+License: MIT
+URL: https://github.com/%{gh_owner}/%{gh_project}
+Source0: %{name}-%{version}-%{gh_short}.tgz
+# Create git snapshot as tests are excluded from official tarball
+Source1: makesrc.sh
+# Autoloader
+Source2: %{name}-autoload.php
+
+# https://github.com/thephpleague/flysystem/pull/592
+Patch1: %{name}-pr592.patch
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch: noarch
+BuildRequires: php(language) >= 5.4
+BuildRequires: php-date
+BuildRequires: php-fileinfo
+BuildRequires: php-ftp
+BuildRequires: php-mbstring
+BuildRequires: php-pcre
+BuildRequires: php-spl
+# From composer.json, "require-dev": {
+# "phpunit/phpunit": "~4.8", => 5.x is ok
+# "mockery/mockery": "~0.9",
+# "phpspec/phpspec": "^2.2",
+# "phpspec/prophecy-phpunit": "~1.0" => unneeded see our patch
+BuildRequires: php-composer(phpunit/phpunit) >= 4.0
+BuildRequires: php-composer(mockery/mockery) >= 0.9
+BuildRequires: php-composer(phpspec/phpspec) >= 2.2
+# Autoloader
+BuildRequires: php-composer(symfony/class-loader)
+
+# From composer.json, "require": {
+# "php": ">=5.4.0"
+Requires: php(language) >= 5.4
+# From phpcompatifo report for 1.0.16
+Requires: php-date
+Requires: php-fileinfo
+Requires: php-ftp
+Requires: php-mbstring
+Requires: php-pcre
+Requires: php-spl
+# Autoloader
+Requires: php-composer(symfony/class-loader)
+
+Provides: php-composer(%{pk_vendor}/%{pk_name}) = %{version}
+
+
+%description
+Flysystem is a filesystem abstraction which allows you to easily swap out
+a local filesystem for a remote one.
+
+Autoloader: '%{_datadir}/php/%{ns_vendor}/%{ns_project}/autoload.php';
+
+
+%prep
+%setup -q -n %{gh_project}-%{gh_commit}
+
+%patch1 -p1
+install -pm 644 %{SOURCE2} src/autoload.php
+
+
+%build
+# Nothing
+
+
+%install
+rm -rf %{buildroot}
+
+# Restore PSR-0 tree
+mkdir -p %{buildroot}%{_datadir}/php/%{ns_vendor}
+cp -pr src %{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}
+
+
+%check
+: Generate a simple autoloader
+mkdir vendor
+cat << 'EOF' | tee vendor/autoload.php
+<?php
+// Library
+require '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/autoload.php';
+
+// Test suite
+require_once '/%{_datadir}/php/Mockery/autoload.php';
+
+require_once '%{_datadir}/php/Symfony/Component/ClassLoader/Psr4ClassLoader.php';
+$Loader = new \Symfony\Component\ClassLoader\Psr4ClassLoader();
+$Loader->addPrefix("League\\Flysystem\\Stub\\", dirname(__DIR__).'/stub');
+$Loader->register();
+EOF
+
+: Fix bootstraping
+sed -e 's/file="[^"]*"//' -i phpunit.xml
+echo 'bootstrap: vendor/autoload.php' >>phpspec.yml
+
+: Run upstream test suite
+%{_bindir}/phpspec run
+%{_bindir}/phpunit --verbose
+
+if which php70; then
+ : Run upstream test suite with PHP 7
+ php70 %{_bindir}/phpspec run
+ php70 %{_bindir}/phpunit --verbose
+fi
+
+%clean
+rm -rf %{buildroot}
+
+
+%files
+%defattr(-,root,root,-)
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc *.md
+%doc composer.json
+%{_datadir}/php/%{ns_vendor}
+
+
+%changelog
+* Thu Jan 14 2016 Remi Collet <remi@fedoraproject.org> - 1.0.16-1
+- initial package
+- open https://github.com/thephpleague/flysystem/pull/592 - PHPUnit \ No newline at end of file