app-admin/drush: new revision with better php8 support and a bugfix.

Closes: https://bugs.gentoo.org/865483
Signed-off-by: Michael Orlitzky <mjo@gentoo.org>
This commit is contained in:
Michael Orlitzky
2022-09-26 21:09:37 -04:00
parent 449268522b
commit 06d8c8e98a
3 changed files with 180 additions and 0 deletions

View File

@@ -0,0 +1,68 @@
# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=8
inherit bash-completion-r1
DESCRIPTION="Command line shell and scripting interface for Drupal"
HOMEPAGE="https://github.com/drush-ops/drush"
SRC_URI="https://github.com/drush-ops/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE=""
DEPEND=""
RDEPEND="dev-lang/php[cli,ctype,json(+),simplexml]
dev-php/PEAR-Console_Table"
PATCHES=(
"${FILESDIR}/update-bash-completion-script-for-2.1.patch"
"${FILESDIR}/array-syntax.patch"
"${FILESDIR}/${P}-php8.0.patch"
"${FILESDIR}/${P}-gzip-mime.patch"
)
src_prepare() {
default
# dodoc compresses all of the documentation, so we fix the filenames
# in a few places.
#
# First, the README location in bootstrap.inc.
sed -i -e \
"s!/share/doc/drush!/share/doc/${PF}!" \
-e "s!README\.md!\0.bz2!g" \
includes/bootstrap.inc || die
# Next, the list of documentation in docs.drush.inc. Note that
# html files don't get compressed.
sed -i \
-e "s!\.bashrc'!.bashrc.bz2'!" \
-e "s!\.inc'!.inc.bz2'!" \
-e "s!\.ini'!.ini.bz2'!" \
-e "s!\.md'!.md.bz2'!" \
-e "s!\.php'!.php.bz2'!" \
-e "s!\.script'!.script.bz2'!" \
-e "s!\.txt'!.txt.bz2'!" \
commands/core/docs.drush.inc || die
}
src_install() {
# Always install the examples; they're referenced within the source
# code and too difficult to exorcise.
dodoc -r README.md docs examples
insinto /usr/share/drush
doins -r classes commands includes lib misc
doins drush_logo-black.png drush.info drush.php
exeinto /usr/share/drush
doexe drush
dosym ../share/drush/drush /usr/bin/drush
keepdir /etc/drush
newbashcomp drush.complete.sh drush
}

View File

@@ -0,0 +1,25 @@
From 48a16a67ec072428339cc165743fedab6264edfe Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <michael@orlitzky.com>
Date: Mon, 26 Sep 2022 20:01:41 -0400
Subject: [PATCH 1/4] includes/drush.inc: support application/gzip MIME type.
This type is actually registered, as opposed to application/x-gzip.
---
includes/drush.inc | 1 +
1 file changed, 1 insertion(+)
diff --git a/includes/drush.inc b/includes/drush.inc
index f869b37..a748a0c 100644
--- a/includes/drush.inc
+++ b/includes/drush.inc
@@ -930,6 +930,7 @@ function drush_file_is_tarball($path) {
$content_type = drush_mime_content_type($path);
$supported = array(
'application/x-bzip2',
+ 'application/gzip',
'application/x-gzip',
'application/x-tar',
'application/x-zip',
--
2.35.1

View File

@@ -0,0 +1,87 @@
From 7be49f4d78111372fc58d91132daf6c4230b08ba Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <michael@orlitzky.com>
Date: Mon, 26 Sep 2022 19:08:09 -0400
Subject: [PATCH 1/3] includes/drush.inc: replace create_function() with
function(){...}
---
includes/drush.inc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/includes/drush.inc b/includes/drush.inc
index a748a0c..7b8dda3 100644
--- a/includes/drush.inc
+++ b/includes/drush.inc
@@ -987,9 +987,9 @@ function drush_tarball_extract($path, $destination = FALSE, $listing = FALSE, $t
// Remove the header line.
array_shift($output);
// Remove the prefix verb from each line.
- $output = array_map(create_function('$str', 'return substr($str, strpos($str, ":") + 3 + ' . strlen($destination) . ');'), $output);
+ $output = array_map(function($str){ return substr($str, strpos($str, ":") + 3 + strlen($destination)) ; }, $output);
// Remove any remaining blank lines.
- $return = array_filter($output, create_function('$str', 'return $str != "";'));
+ $return = array_filter($output, function($str){return $str != "";});
}
}
// Otherwise we have a possibly-compressed Tar file.
--
2.35.1
From f118117814ef690ec71f484dc3c4906f82d9c726 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <michael@orlitzky.com>
Date: Mon, 26 Sep 2022 19:32:13 -0400
Subject: [PATCH 2/3] includes/backend.inc: replace usage of each().
---
includes/backend.inc | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/includes/backend.inc b/includes/backend.inc
index d004850..0ca010d 100644
--- a/includes/backend.inc
+++ b/includes/backend.inc
@@ -355,8 +355,8 @@ function _drush_backend_proc_open($cmds, $process_limit, $context = NULL) {
if (count($cmds) && (count($open_processes) < $process_limit)) {
// Pop the site and command (key / value) from the cmds array
end($cmds);
- list($site, $cmd) = each($cmds);
- unset($cmds[$site]);
+ $site = key($cmds);
+ $cmd = array_pop($cmds);
if (is_array($cmd)) {
$c = $cmd['cmd'];
--
2.35.1
From 7d718639b68bd09c262005cff133d24ffdf800f1 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <michael@orlitzky.com>
Date: Mon, 26 Sep 2022 19:36:29 -0400
Subject: [PATCH 3/3] includes/environment.inc: default fifth parameter in
error handler.
The fifth parameter was removed in php-8.0:
https://www.php.net/manual/en/function.set-error-handler.php
We now default it to the empty array in drush_error_handler().
---
includes/environment.inc | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/includes/environment.inc b/includes/environment.inc
index 7837104..8f2f414 100644
--- a/includes/environment.inc
+++ b/includes/environment.inc
@@ -24,7 +24,7 @@ define('CONSOLE_TABLE_BASE_URL', 'https://github.com/RobLoach/Console_Table/arch
* Log PHP errors to the Drush log. This is in effect until Drupal's error
* handler takes over.
*/
-function drush_error_handler($errno, $message, $filename, $line, $context) {
+function drush_error_handler($errno, $message, $filename, $line, $context=[]) {
// E_DEPRECATED was added in PHP 5.3. Drupal 6 will not fix all the
// deprecated errors, but suppresses them. So we suppress them as well.
if (defined('E_DEPRECATED')) {
--
2.35.1