summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Orlitzky <mjo@gentoo.org>2017-01-09 23:07:38 -0500
committerMichael Orlitzky <mjo@gentoo.org>2017-01-09 23:32:47 -0500
commitc122fda674ae055121fecd550bb3d814d76ae4f2 (patch)
tree9c2b29b82f3a2a5865caaa8f68c7f3bcfc0be32e /dev-php/PEAR-PHP_Beautifier
parentapp-misc/ranger: version bump to 1.8.1 (diff)
downloadgentoo-c122fda674ae055121fecd550bb3d814d76ae4f2.tar.gz
gentoo-c122fda674ae055121fecd550bb3d814d76ae4f2.tar.bz2
gentoo-c122fda674ae055121fecd550bb3d814d76ae4f2.zip
dev-php/PEAR-PHP_Beautifier: new revision sans the php-pear-r1 eclass.
This new revision drops the php-pear-r1 eclass in order to fix some otherwise-unfixable issues. First, the ebuild has been updated to EAPI=6; that one was easy. Two new USE flags to enable the CLI and installation of the examples were added -- that and the removal of the eclass caused some RDEPEND changes. We now have custom src_prepare() and src_install() phases: * In src_prepare, we replace the strings @package_version@ and @php_bin@ everywhere in the source code using sed. We also apply a new patch to use the default error_reporting, which hides a bunch of ugly errors. * The src_install phase now installs the examples to the proper location, and only installs the CLI script with USE=cli. Package-Manager: portage-2.3.0
Diffstat (limited to 'dev-php/PEAR-PHP_Beautifier')
-rw-r--r--dev-php/PEAR-PHP_Beautifier/PEAR-PHP_Beautifier-0.1.15-r1.ebuild23
-rw-r--r--dev-php/PEAR-PHP_Beautifier/PEAR-PHP_Beautifier-0.1.15-r2.ebuild45
-rw-r--r--dev-php/PEAR-PHP_Beautifier/files/use_default_error_reporting.patch44
-rw-r--r--dev-php/PEAR-PHP_Beautifier/metadata.xml17
4 files changed, 102 insertions, 27 deletions
diff --git a/dev-php/PEAR-PHP_Beautifier/PEAR-PHP_Beautifier-0.1.15-r1.ebuild b/dev-php/PEAR-PHP_Beautifier/PEAR-PHP_Beautifier-0.1.15-r1.ebuild
deleted file mode 100644
index 70f59124a801..000000000000
--- a/dev-php/PEAR-PHP_Beautifier/PEAR-PHP_Beautifier-0.1.15-r1.ebuild
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright 1999-2014 Gentoo Foundation
-# Distributed under the terms of the GNU General Public License v2
-# $Id$
-
-EAPI=5
-inherit php-pear-r1
-
-KEYWORDS="~amd64 ~x86"
-
-DESCRIPTION="Code Beautifier for PHP"
-LICENSE="PHP-3"
-SLOT="0"
-IUSE=""
-
-DEPEND="dev-lang/php[tokenizer]"
-RDEPEND="$DEPEND >=dev-php/PEAR-Log-1.8"
-
-pkg_postinst() {
- if ! has_version dev-lang/php[bzip2] ; then
- elog "${PN} can optionally use bzip2 features."
- elog "If you want those, emerge dev-lang/php with this flag in USE."
- fi
-}
diff --git a/dev-php/PEAR-PHP_Beautifier/PEAR-PHP_Beautifier-0.1.15-r2.ebuild b/dev-php/PEAR-PHP_Beautifier/PEAR-PHP_Beautifier-0.1.15-r2.ebuild
new file mode 100644
index 000000000000..0e6cb5d43163
--- /dev/null
+++ b/dev-php/PEAR-PHP_Beautifier/PEAR-PHP_Beautifier-0.1.15-r2.ebuild
@@ -0,0 +1,45 @@
+# Copyright 1999-2017 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=6
+
+MY_PN="${PN/PEAR-/}"
+MY_P="${MY_PN}-${PV}"
+
+DESCRIPTION="Code Beautifier for PHP"
+HOMEPAGE="http://pear.php.net/package/${MY_PN}"
+SRC_URI="http://download.pear.php.net/package/${MY_P}.tgz"
+LICENSE="PHP-3.01"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+IUSE="cli examples"
+
+# Require automagic dependencies unconditionally to avoid surprises.
+RDEPEND="dev-lang/php:*[bzip2,cli?,tokenizer]
+ dev-php/PEAR-Archive_Tar
+ dev-php/PEAR-Log
+ dev-php/PEAR-PEAR
+ cli? ( dev-php/PEAR-Console_Getopt )"
+
+S="${WORKDIR}/${MY_P}"
+
+PATCHES=( "${FILESDIR}/use_default_error_reporting.patch" )
+
+src_prepare() {
+ default
+ shopt -s globstar
+ for file in scripts/php_beautifier **/*.php; do
+ sed -i "s|@package_version@|${PV}|g" "${file}" || die
+ sed -i "s|@php_bin@|${EPREFIX}/usr/bin/php|g" "${file}" || die
+ done
+ shopt -u globstar
+}
+
+src_install() {
+ insinto /usr/share/php/PHP
+ doins Beautifier.php
+ doins -r Beautifier
+ use examples && dodoc -r examples
+ use cli && dobin scripts/php_beautifier
+}
diff --git a/dev-php/PEAR-PHP_Beautifier/files/use_default_error_reporting.patch b/dev-php/PEAR-PHP_Beautifier/files/use_default_error_reporting.patch
new file mode 100644
index 000000000000..cf1019b3399c
--- /dev/null
+++ b/dev-php/PEAR-PHP_Beautifier/files/use_default_error_reporting.patch
@@ -0,0 +1,44 @@
+From 39e6b5605bd15db6a1f2f223dede9c8d2265140c Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <michael@orlitzky.com>
+Date: Mon, 9 Jan 2017 22:34:30 -0500
+Subject: [PATCH 1/1] Use the default PHP error_reporting value.
+
+The php_beautifier script triggers some strict/deprecation warnings
+with newer versions of PHP. With error_reporting = E_ALL, they are
+shown to the user. Instead, we can at least respect the default
+value of error_reporting from php.ini which (on Gentoo, anyway)
+hides strict/deprecation warnings.
+---
+ Beautifier.php | 2 +-
+ scripts/php_beautifier | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/Beautifier.php b/Beautifier.php
+index 584ac4d..90d8d0b 100755
+--- a/Beautifier.php
++++ b/Beautifier.php
+@@ -19,7 +19,7 @@
+ * @license http://www.php.net/license/3_0.txt PHP License 3.0
+ * @version CVS: $Id:$
+ */
+-error_reporting(E_ALL);
++// error_reporting(E_ALL);
+ // Before all, test the tokenizer extension
+ if (!extension_loaded('tokenizer')) {
+ throw new Exception("Compile php with tokenizer extension. Use --enable-tokenizer or don't use --disable-all on configure.");
+diff --git a/scripts/php_beautifier b/scripts/php_beautifier
+index 255a264..6e87f4e 100755
+--- a/scripts/php_beautifier
++++ b/scripts/php_beautifier
+@@ -52,7 +52,7 @@
+ */
+ require_once 'PHP/Beautifier/Batch.php';
+ define('PHP_Beautifier_WINDOWS', substr(PHP_OS, 0, 3) == 'WIN');
+- error_reporting(E_ALL);
++ // error_reporting(E_ALL);
+ // get log object
+ $oLog = PHP_Beautifier_Common::getLog();
+
+--
+2.10.2
+
diff --git a/dev-php/PEAR-PHP_Beautifier/metadata.xml b/dev-php/PEAR-PHP_Beautifier/metadata.xml
index b86acf66c756..f4c6d8d4f90c 100644
--- a/dev-php/PEAR-PHP_Beautifier/metadata.xml
+++ b/dev-php/PEAR-PHP_Beautifier/metadata.xml
@@ -1,8 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
- <maintainer type="project">
- <email>php-bugs@gentoo.org</email>
- <name>PHP</name>
- </maintainer>
+ <maintainer type="project">
+ <email>php-bugs@gentoo.org</email>
+ <name>PHP</name>
+ </maintainer>
+ <use>
+ <flag name="cli">
+ Require <pkg>dev-lang/php</pkg> to be built with the "cli" SAPI
+ and install the php_beautifier script.
+ </flag>
+ </use>
+ <upstream>
+ <remote-id type="github">clbustos/PHP_Beautifier</remote-id>
+ </upstream>
</pkgmetadata>