commit:     6c5283e1c0774fc35d1ad5dc0e8eb492a848f9c9
Author:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
AuthorDate: Tue Nov 23 22:46:06 2021 +0000
Commit:     Michael Orlitzky <mjo <AT> gentoo <DOT> org>
CommitDate: Tue Nov 23 22:46:19 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6c5283e1

app-admin/drush: new revision to silence deprecation warnings.

I'm still happily using this to update some drupal-7.x sites, but with
php-7.4, there are a few deprecation warnings that will later become
errors in php-8.0. The fixes are trivial, so I've added a small patch
to cure them.

Package-Manager: Portage-3.0.28, Repoman-3.0.3
Signed-off-by: Michael Orlitzky <mjo <AT> gentoo.org>

 app-admin/drush/drush-6.7.0-r3.ebuild    | 66 ++++++++++++++++++++++++++++++++
 app-admin/drush/files/array-syntax.patch | 58 ++++++++++++++++++++++++++++
 2 files changed, 124 insertions(+)

diff --git a/app-admin/drush/drush-6.7.0-r3.ebuild 
b/app-admin/drush/drush-6.7.0-r3.ebuild
new file mode 100644
index 000000000000..38e4125922de
--- /dev/null
+++ b/app-admin/drush/drush-6.7.0-r3.ebuild
@@ -0,0 +1,66 @@
+# Copyright 1999-2021 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"
+)
+
+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
+}

diff --git a/app-admin/drush/files/array-syntax.patch 
b/app-admin/drush/files/array-syntax.patch
new file mode 100644
index 000000000000..60abeea984e5
--- /dev/null
+++ b/app-admin/drush/files/array-syntax.patch
@@ -0,0 +1,58 @@
+From 354d3d4f7a0c56926bd5124d2ec5bb363a9f9bc8 Mon Sep 17 00:00:00 2001
+From: Michael Orlitzky <[email protected]>
+Date: Tue, 23 Nov 2021 17:34:24 -0500
+Subject: [PATCH 1/1] includes: don't access array elements with curly braces.
+
+The array{idx} syntax was deprecated in php-7.4 and has been removed
+in php-8.0. It's trivial to use square brackets, like array[idx],
+instead; so we do it.
+---
+ includes/command.inc   | 6 +++---
+ includes/sitealias.inc | 6 +++---
+ 2 files changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/includes/command.inc b/includes/command.inc
+index af039ad..ed0e817 100644
+--- a/includes/command.inc
++++ b/includes/command.inc
+@@ -749,16 +749,16 @@ function drush_parse_args() {
+       $command_args[] = $opt;
+     }
+     // Is the arg an option (starting with '-')?
+-    if (!empty($opt) && $opt{0} == "-" && strlen($opt) != 1) {
++    if (!empty($opt) && $opt[0] == "-" && strlen($opt) != 1) {
+       // Do we have multiple options behind one '-'?
+-      if (strlen($opt) > 2 && $opt{1} != "-") {
++      if (strlen($opt) > 2 && $opt[1] != "-") {
+         // Each char becomes a key of its own.
+         for ($j = 1; $j < strlen($opt); $j++) {
+           $options[substr($opt, $j, 1)] = true;
+         }
+       }
+       // Do we have a longopt (starting with '--')?
+-      elseif ($opt{1} == "-") {
++      elseif ($opt[1] == "-") {
+         if ($pos = strpos($opt, '=')) {
+           $options[substr($opt, 2, $pos - 2)] = substr($opt, $pos + 1);
+         }
+diff --git a/includes/sitealias.inc b/includes/sitealias.inc
+index b9f0bb9..13a38c1 100644
+--- a/includes/sitealias.inc
++++ b/includes/sitealias.inc
+@@ -133,10 +133,10 @@ function 
drush_sitealias_resolve_sitespecs($site_specifications, $alias_path_con
+ function drush_sitealias_valid_alias_format($alias) {
+   return ( (strpos($alias, ',') !== false) ||
+     ((strpos($alias, '@') === FALSE ? 0 : 1) + (strpos($alias, '/') === FALSE 
? 0 : 1) + (strpos($alias, '#') === FALSE ? 0 : 1) >= 2) ||
+-    ($alias{0} == '#') ||
+-    ($alias{0} == '@')
++    ($alias[0] == '#') ||
++    ($alias[0] == '@')
+   );
+-  return $alias{0} == '@';
++  return $alias[0] == '@';
+ }
+ 
+ /**
+-- 
+2.32.0
+

Reply via email to