summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2016-11-06 19:06:06 +0100
committerRemi Collet <fedora@famillecollet.com>2016-11-06 19:06:06 +0100
commit77c1472edf9e3b2b5dd6efb421ef9aa0b9753baf (patch)
treef1d46373f42dc577abb56418849d044bdb582389
php-sentry: import from Fedora
-rwxr-xr-xphp-sentry-get-source.sh69
-rw-r--r--php-sentry.spec188
2 files changed, 257 insertions, 0 deletions
diff --git a/php-sentry-get-source.sh b/php-sentry-get-source.sh
new file mode 100755
index 0000000..ba71f5d
--- /dev/null
+++ b/php-sentry-get-source.sh
@@ -0,0 +1,69 @@
+#/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)
+
+pushd $TEMP_DIR
+ print "Cloning git repo..."
+ $GIT clone $GIT_REPO
+
+ pushd $GIT_DIR
+ print "Checking out commit..."
+ $GIT checkout $GIT_COMMIT
+ popd
+
+ TAR_DIR=${GIT_NAME}-${GIT_COMMIT}
+ print "TAR_DIR = $TAR_DIR"
+
+ mv $GIT_DIR $TAR_DIR
+
+ TAR_FILE=`$RPM --eval='%{_sourcedir}'`/${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-sentry.spec b/php-sentry.spec
new file mode 100644
index 0000000..59ffb5f
--- /dev/null
+++ b/php-sentry.spec
@@ -0,0 +1,188 @@
+#
+# Fedora spec file for php-sentry
+#
+# Copyright (c) 2016 Shawn Iwinski <shawn@iwin.ski>
+#
+# License: MIT
+# http://opensource.org/licenses/MIT
+#
+# Please preserve the changelog entries
+#
+
+%global github_owner getsentry
+%global github_name sentry-php
+%global github_version 0.22.0
+%global github_commit 49d4c0c4f2c298c9f15a07416debb5352a209b79
+
+%global composer_vendor sentry
+%global composer_project sentry
+
+# "php": ">=5.2.4"
+%global php_min_ver 5.2.4
+# "monolog/monolog": "*"
+# NOTE: Min version because autoloader required
+%global monolog_min_ver 1.15.0
+
+# Build using "--without tests" to disable tests
+%global with_tests 0%{!?_without_tests:1}
+
+%{!?phpdir: %global phpdir %{_datadir}/php}
+
+Name: php-%{composer_project}
+Version: %{github_version}
+Release: 1%{?github_release}%{?dist}
+Summary: PHP client for Sentry
+
+Group: Development/Libraries
+# ASL 2.0:
+# - lib/Raven/Serializer.php
+# BSD:
+# - Everything else
+License: BSD and ASL 2.0
+URL: https://github.com/%{github_owner}/%{github_name}
+
+# GitHub export does not include tests.
+# Run php-sentry-get-source.sh to create full source.
+Source0: %{name}-%{github_version}-%{github_commit}.tar.gz
+Source1: %{name}-get-source.sh
+
+BuildArch: noarch
+# Library version value check
+BuildRequires: php-cli
+# Tests
+%if %{with_tests}
+## composer.json
+BuildRequires: php(language) >= %{php_min_ver}
+BuildRequires: php-composer(phpunit/phpunit)
+BuildRequires: php-composer(monolog/monolog) >= %{monolog_min_ver}
+BuildRequires: php-curl
+## phpcompatinfo (computed from version 0.22.0)
+BuildRequires: php-date
+BuildRequires: php-hash
+BuildRequires: php-mbstring
+BuildRequires: php-pcre
+BuildRequires: php-reflection
+BuildRequires: php-session
+BuildRequires: php-spl
+BuildRequires: php-zlib
+%if 0%{?fedora} >= 25
+# Required for PHPUnit with PHP 7
+# See https://github.com/getsentry/sentry-php/pull/365
+BuildRequires: php-uopz
+%endif
+# Conflict because Monolog will load obsoleted package's autoloader and classes.
+BuildConflicts: php-Raven
+%endif
+
+Requires: php-cli
+Requires: ca-certificates
+# composer.json
+Requires: php(language) >= %{php_min_ver}
+Requires: php-composer(monolog/monolog) >= %{monolog_min_ver}
+Requires: php-curl
+# phpcompatinfo (computed from version 0.22.0)
+Requires: php-date
+Requires: php-hash
+Requires: php-mbstring
+Requires: php-pcre
+Requires: php-reflection
+Requires: php-session
+Requires: php-spl
+Requires: php-zlib
+
+# Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming
+Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release}
+# Composer
+Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
+
+# Rename
+Obsoletes: php-Raven < %{version}
+Provides: php-Raven = %{version}-%{release}
+Provides: php-composer(raven/raven) = %{version}
+
+
+%description
+%{summary} (http://getsentry.com).
+
+Autoloader: %{phpdir}/Raven/autoload.php
+
+
+%prep
+%setup -qn %{github_name}-%{github_commit}
+
+: Remove bundled cert
+rm -rf lib/Raven/data
+sed "/return.*cacert\.pem/s#.*# return '%{_sysconfdir}/pki/tls/cert.pem';#" \
+ -i lib/Raven/Client.php
+
+: Update autoloader require in bin
+sed "/require.*Autoloader/s#.*#require_once '%{phpdir}/Raven/Autoloader.php';#" \
+ -i bin/sentry
+
+
+%build
+: Create autoloader
+cat <<'AUTOLOAD' | tee lib/Raven/autoload.php
+<?php
+/**
+ * Autoloader for %{name} and its' dependencies
+ * (created by %{name}-%{version}-%{release}).
+ */
+
+require_once dirname(__FILE__).'/Autoloader.php';
+Raven_Autoloader::register();
+
+// Required dependency
+require_once '%{phpdir}/Monolog/autoload.php';
+AUTOLOAD
+
+
+%install
+mkdir -p %{buildroot}%{phpdir}
+cp -rp lib/* %{buildroot}%{phpdir}/
+
+mkdir -p %{buildroot}%{_bindir}
+install -pm 0755 bin/sentry %{buildroot}%{_bindir}/
+: Compat bin
+ln -s sentry %{buildroot}%{_bindir}/raven
+
+
+%check
+: Library version value check
+%{_bindir}/php -r '
+ require_once "%{buildroot}%{phpdir}/Raven/Client.php";
+ $version = Raven_Client::VERSION;
+ echo "Version $version (expected %{version})\n";
+ exit(version_compare("%{version}", "$version", "=") ? 0 : 1);
+'
+
+%if %{with_tests}
+: Create tests bootstrap
+cat <<'BOOTSTRAP' | tee bootstrap.php
+<?php
+session_start();
+require_once '%{buildroot}%{phpdir}/Raven/autoload.php';
+BOOTSTRAP
+
+: Run tests
+%{_bindir}/phpunit --verbose --bootstrap bootstrap.php
+%else
+: Tests skipped
+%endif
+
+
+%files
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc *.rst
+%doc AUTHORS
+%doc CHANGES
+%doc composer.json
+%{phpdir}/Raven
+%{_bindir}/raven
+%{_bindir}/sentry
+
+
+%changelog
+* Thu Nov 03 2016 Shawn Iwinski <shawn@iwin.ski> - 0.22.0-1
+- Initial package