summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2019-12-02 10:46:20 +0100
committerRemi Collet <remi@remirepo.net>2019-12-02 10:46:20 +0100
commitdd8db2ea52ca3e0a99ef76ca245d2352d5d8b9eb (patch)
treeda105fcc65102363bf2ea3fb0b267ea851db68e9
parentd9a108de7945f5e2c52e2713ae442ebccf4c33a4 (diff)
v1.6.0 from FedoraHEADmaster
-rw-r--r--composer.json19
l---------makesrc.sh1
-rwxr-xr-xphp-PhpOption-get-source.sh74
-rw-r--r--php-PhpOption.spec56
4 files changed, 118 insertions, 32 deletions
diff --git a/composer.json b/composer.json
index 553a375..7289208 100644
--- a/composer.json
+++ b/composer.json
@@ -1,27 +1,32 @@
{
"name": "phpoption/phpoption",
"description": "Option Type for PHP",
- "keywords": ["php","option","language","type"],
- "type": "library",
- "license": "Apache2",
+ "keywords": ["php", "option", "language", "type"],
+ "license": "Apache-2.0",
"authors": [
{
"name": "Johannes M. Schmitt",
"email": "schmittjoh@gmail.com"
+ },
+ {
+ "name": "Graham Campbell",
+ "email": "graham@alt-three.com"
}
],
"require": {
- "php": ">=5.3.0"
+ "php": "^5.5.9 || ^7.0"
},
"require-dev": {
- "phpunit/phpunit": "4.7.*"
+ "phpunit/phpunit": "^4.8.35 || ^5.0 || ^6.0 || ^7.0"
},
"autoload": {
- "psr-0": { "PhpOption\\": "src/" }
+ "psr-4": {
+ "PhpOption\\": "src/PhpOption/"
+ }
},
"extra": {
"branch-alias": {
- "dev-master": "1.3-dev"
+ "dev-master": "1.6-dev"
}
}
}
diff --git a/makesrc.sh b/makesrc.sh
new file mode 120000
index 0000000..f3fb774
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1 @@
+php-PhpOption-get-source.sh \ No newline at end of file
diff --git a/php-PhpOption-get-source.sh b/php-PhpOption-get-source.sh
new file mode 100755
index 0000000..3947de4
--- /dev/null
+++ b/php-PhpOption-get-source.sh
@@ -0,0 +1,74 @@
+#/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
+ cp composer.json ${SPEC_DIR}/composer.json
+ 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-PhpOption.spec b/php-PhpOption.spec
index 6641117..20b0c2c 100644
--- a/php-PhpOption.spec
+++ b/php-PhpOption.spec
@@ -2,7 +2,7 @@
#
# Fedora spec file for php-PhpOption
#
-# Copyright (c) 2013-2017 Shawn Iwinski <shawn.iwinski@gmail.com>
+# Copyright (c) 2013-2019 Shawn Iwinski <shawn.iwinski@gmail.com>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -12,14 +12,14 @@
%global github_owner schmittjoh
%global github_name php-option
-%global github_version 1.5.0
-%global github_commit 94e644f7d2051a5f0fcf77d81605f152eecff0ed
+%global github_version 1.6.0
+%global github_commit f4e7a6a1382183412246f0d361078c29fb85089e
%global composer_vendor phpoption
%global composer_project phpoption
-# "php": ">=5.3.0"
-%global php_min_ver 5.3.0
+# "php": "^5.5.9 || ^7.0"
+%global php_min_ver 5.5.9
# Build using "--without tests" to disable tests
%global with_tests 0%{!?_without_tests:1}
@@ -28,13 +28,16 @@
Name: php-PhpOption
Version: %{github_version}
-Release: 3%{?dist}
+Release: 1%{?dist}
Summary: Option type for PHP
-Group: Development/Libraries
License: ASL 2.0
URL: https://github.com/%{github_owner}/%{github_name}
-Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
+
+# GitHub export does not include tests.
+# Run php-PhpOption-get-source.sh to create full source.
+Source0: %{name}-%{github_version}-%{github_commit}.tar.gz
+Source1: %{name}-get-source.sh
BuildArch: noarch
# Tests
@@ -42,7 +45,7 @@ BuildArch: noarch
BuildRequires: php-composer(phpunit/phpunit)
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
-## phpcompatinfo (computed from version 1.5.0)
+## phpcompatinfo (computed from version 1.6.0)
BuildRequires: php-spl
## Autoloader
BuildRequires: php-composer(fedora/autoloader)
@@ -50,7 +53,7 @@ BuildRequires: php-composer(fedora/autoloader)
# composer.json
Requires: php(language) >= %{php_min_ver}
-# phpcompatinfo (computed from version 1.5.0)
+# phpcompatinfo (computed from version 1.6.0)
Requires: php-spl
# Autoloader
Requires: php-composer(fedora/autoloader)
@@ -62,25 +65,25 @@ Provides: php-%{composer_vendor} = %{version}-%{release}
Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
%description
-This package adds an Option type for PHP.
+An Option type for PHP.
The Option type is intended for cases where you sometimes might return a value
-(typically an object), and sometimes you might return no value (typically null)
-depending on arguments, or other runtime factors.
+(typically an object), and sometimes you might return a base value (typically
+null) depending on arguments, or other runtime factors.
-Often times, you forget to handle the case where no value is returned. Not
-intentionally of course, but maybe you did not account for all possible states
-of the system; or maybe you indeed covered all cases, then time goes on, code
-is refactored, some of these your checks might become invalid, or incomplete.
-Suddenly, without noticing, the no value case is not handled anymore. As a
-result, you might sometimes get fatal PHP errors telling you that you called a
-method on a non-object; users might see blank pages, or worse.
+Often times, you forget to handle the case where a base value should be
+returned. Not intentionally of course, but maybe you did not account for all
+possible states of the system; or maybe you indeed covered all cases, then time
+goes on, code is refactored, some of these your checks might become invalid, or
+incomplete. Suddenly, without noticing, the base value case is not handled
+anymore. As a result, you might sometimes get fatal PHP errors telling you that
+you called a method on a non-object; users might see blank pages, or worse.
On one hand, the Option type forces a developer to consciously think about both
-cases (returning a value, or returning no value). That in itself will already
-make your code more robust. On the other hand, the Option type also allows the
-API developer to provide more concise API methods, and empowers the API user in
-how he consumes these methods.
+cases (returning a value, or returning a base value). That in itself will
+already make your code more robust. On the other hand, the Option type also
+allows the API developer to provide more concise API methods, and empowers the
+API user in how he consumes these methods.
Autoloader: %{phpdir}/PhpOption/autoload.php
@@ -113,7 +116,7 @@ cp -rp src/PhpOption %{buildroot}%{phpdir}/
: Upstream tests
RETURN_CODE=0
PHPUNIT=$(which phpunit)
-for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do
+for PHP_EXEC in "" %{?rhel:php56 php70} php71 php72 php73 php74; do
if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
$PHP_EXEC $PHPUNIT --verbose \
--bootstrap %{buildroot}%{phpdir}/PhpOption/autoload.php \
@@ -135,6 +138,9 @@ exit $RETURN_CODE
%changelog
+* Sun Dec 01 2019 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.6.0-1
+- Update to 1.6.0 (RHBZ #1771062)
+
* Thu Sep 07 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.5.0-3
- Bump release for rebuild