EBernhardson has uploaded a new change for review. ( 
https://gerrit.wikimedia.org/r/325815 )

Change subject: Use a local install for phan instead of docker
......................................................................

Use a local install for phan instead of docker

For some reason phan isn't working right on cindy, it just exits after
2s with no output. Debugging docker is a pain in the arse, and sury now
has complete packages for phan, so point to those instead.

Makes setup a little more cumbersome, but more explicit and less
magical.

Needs a pre-patch to cleanup any errors that have been created since
phan stopped running correctly on cindy.

Change-Id: Ibd79b53753b75269e1f1069903357d9cb4ab4d65
---
M .phan/config.php
M scripts/run-phan.sh
2 files changed, 22 insertions(+), 37 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/CirrusSearch 
refs/changes/15/325815/1

diff --git a/.phan/config.php b/.phan/config.php
index 6a2019d..3f833b7 100644
--- a/.phan/config.php
+++ b/.phan/config.php
@@ -12,7 +12,7 @@
 $otherDirs = [
        'includes', 'vendor', 'maintenance', 'languages',
        'extensions/Elastica', 'extensions/GeoData', 'extensions/BetaFeatures',
-       'extensions/CirrusSearch/vendor',
+       'extensions/CirrusSearch/vendor', 'extensions/SiteMatrix',
 ];
 foreach ( $cirrusDirs as $dir ) {
        $directoryList[] = "$IP/extensions/CirrusSearch/$dir";
diff --git a/scripts/run-phan.sh b/scripts/run-phan.sh
index d186935..4b16412 100755
--- a/scripts/run-phan.sh
+++ b/scripts/run-phan.sh
@@ -7,56 +7,41 @@
        }
 fi
 
-MW_PREFIX=$(realpath "${MW_PREFIX:-$(dirname "$0")/../../..}")
-
-if ! which docker > /dev/null; then
-       echo "Docker not installed. Press any key to install docker or Ctrl-C 
to quit"
-       read -n 1
-       sudo apt-get -y install docker.io 
-       if [ -d /vagrant ]; then
-               # May also be required elsewhere..but not comfortable just 
installing
-               # cgroup-lite to random peoples machines.
-               sudo apt-get -y install cgroup-lite
-       fi
+if ! which php7.0 > /dev/null; then
+       echo "PHP 7.0 not installed. For ubuntu/debian based systems see 
https://deb.sury.org/";
+       echo "Suggested packages:"
+       echo -e "\tapt-get install php7.0-cli php7.0-common php7.0-curl 
php7.0-intl php7.0-mysql php7.0-xmlrpc php7.0-dev php7.0-ldap php7.0-gd 
php7.0-pgsql php7.0-sqlite3 php7.0-tidy php7.0-phpdbg php7.0-bcmath 
php7.0-mbstring php7.0-xml php-imagick php-memcached php-redis php-ast"
+       echo ""
+       exit 1
 fi
 
-if ! id -Gn | grep docker > /dev/null; then
-       sudo adduser $(id -un) docker
-       echo "User added to docker group. You need to log out and log back in 
to continue."
+if [ ! -f "$PHAN" ]; then
+       echo "The PHAN environment variable must point to a valid phan checkout"
+       echo ""
+       exit 1
+fi
+
+if [ ! -d "$(dirname $PHAN)/vendor" ]; then
+       echo "phan is not configured. Run \`composer install\` in the phan 
directory"
        echo
        exit 1
 fi
 
-if ! docker images | grep cloudflare/phan > /dev/null; then
-       git clone https://github.com/cloudflare/docker-phan.git 
/tmp/docker-phan.$$
-       pushd /tmp/docker-phan.$$
-       ./build
-       popd
-       # Once build we can safely remove this repo
-       rm -rf /tmp/docker-phan.$$
-fi
-
 SED_PATTERN=$(echo $MW_PREFIX | sed 's/[\/&]/\\&/g')
+OUTFILE="phan.out.$$"
 
-docker run \
-       --volume="$MW_PREFIX:/mnt/src" \
-       --rm \
-       --user "$(id -u):$(id -g)" \
-       cloudflare/phan:edge \
-       --project-root-directory /mnt/src/extensions/CirrusSearch \
+php7.0 $PHAN \
+       --project-root-directory $(realpath $(dirname $0)/..) \
        --output "php://stdout" \
-       | sed "s/\/mnt\/src/$SED_PATTERN/" \
        | php $(dirname $0)/postprocess-phan.php \
-       | sed "s/$SED_PATTERN//" \
-       > /tmp/phan.out
-
+       > $OUTFILE
 
 RETVAL=0
-if [ "$(wc -l < /tmp/phan.out)" -ne 0 ]; then
+if [ "$(wc -l < $OUTFILE)" -ne 0 ]; then
        RETVAL=1
 fi
 
-cat /tmp/phan.out
-rm /tmp/phan.out
+cat $OUTFILE
+rm $OUTFILE
 exit $RETVAL
 

-- 
To view, visit https://gerrit.wikimedia.org/r/325815
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd79b53753b75269e1f1069903357d9cb4ab4d65
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/CirrusSearch
Gerrit-Branch: master
Gerrit-Owner: EBernhardson <ebernhard...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to