support for Phabricator upgrade;
authorwenzelm
Mon, 16 Dec 2019 13:58:46 +0100
changeset 71283 cfcc1a2233ca
parent 71282 de59dd86760f
child 71284 49bc17bf4384
support for Phabricator upgrade;
src/Pure/Tools/phabricator.scala
--- a/src/Pure/Tools/phabricator.scala	Mon Dec 16 13:24:36 2019 +0100
+++ b/src/Pure/Tools/phabricator.scala	Mon Dec 16 13:58:46 2019 +0100
@@ -284,9 +284,9 @@
       script = """
         set -e
         echo "Cloning distribution repositories:"
-        git clone https://github.com/phacility/libphutil.git
-        git clone https://github.com/phacility/arcanist.git
-        git clone https://github.com/phacility/phabricator.git
+        git clone --branch stable https://github.com/phacility/libphutil.git
+        git clone --branch stable https://github.com/phacility/arcanist.git
+        git clone --branch stable https://github.com/phacility/phabricator.git
       """).check
 
     val config = Config(name, root_path)
@@ -380,6 +380,37 @@
 "$ROOT/phabricator/bin/storage" dump --compress --output "$ROOT/database/dump.sql.gz" 2>&1 | fgrep -v '[Warning] Using a password on the command line interface can be insecure' """)
 
 
+    /* Phabricator upgrade */
+
+    command_setup(isabelle_phabricator_name(name = "upgrade"),
+      init =
+"""BRANCH="${1:stable}"
+if [ "$BRANCH" != "master" -a "$BRANCH" != "stable" ]
+then
+  echo "Bad branch: \"$BRANCH\""
+  exit 1
+fi
+
+systemctl stop isabelle-phabricator-phd
+systemctl stop apache2
+""",
+      body =
+"""echo -e "\nUpgrading phabricator \"$NAME\" root \"$ROOT\" ..."
+for REPO in libphutil arcanist phabricator
+do
+  cd "$ROOT/$REPO"
+  echo -e "\nUpdating \"$REPO\" ..."
+  git checkout "$BRANCH"
+  git pull
+done
+echo -e "\nUpgrading storage ..."
+"$ROOT/phabricator/bin/storage" upgrade --force
+""",
+      exit =
+"""systemctl start apache2
+systemctl start isabelle-phabricator-phd""")
+
+
     /* PHP setup */
 
     val php_version =