src/Pure/Tools/phabricator.scala
changeset 71634 5d5be87330b5
parent 71633 5de8c6d92bd0
child 71651 760e19aa9b09
equal deleted inserted replaced
71633:5de8c6d92bd0 71634:5d5be87330b5
   218       }
   218       }
   219     })
   219     })
   220   }
   220   }
   221 
   221 
   222   def phabricator_setup(
   222   def phabricator_setup(
       
   223     options: Options,
   223     name: String = default_name,
   224     name: String = default_name,
   224     root: String = "",
   225     root: String = "",
   225     repo: String = "",
   226     repo: String = "",
   226     package_update: Boolean = false,
   227     package_update: Boolean = false,
   227     mercurial_source: String = "",
   228     mercurial_source: String = "",
   285     progress.bash(cwd = root_path.file, echo = true,
   286     progress.bash(cwd = root_path.file, echo = true,
   286       script = """
   287       script = """
   287         set -e
   288         set -e
   288         echo "Cloning distribution repositories:"
   289         echo "Cloning distribution repositories:"
   289 
   290 
       
   291         git clone --branch stable https://github.com/phacility/arcanist.git
       
   292         git -C arcanist reset --hard """ +
       
   293           Bash.string(options.string("phabricator_version_arcanist")) + """
       
   294 
   290         git clone --branch stable https://github.com/phacility/libphutil.git
   295         git clone --branch stable https://github.com/phacility/libphutil.git
   291         git -C libphutil reset --hard 034cf7cc39940b935e83923dbb1bacbcfe645a85
   296         git -C libphutil reset --hard """ +
   292 
   297           Bash.string(options.string("phabricator_version_libphutil")) + """
   293         git clone --branch stable https://github.com/phacility/arcanist.git
       
   294         git -C arcanist reset --hard 729100955129851a52588cdfd9b425197cf05815
       
   295 
   298 
   296         git clone --branch stable https://github.com/phacility/phabricator.git
   299         git clone --branch stable https://github.com/phacility/phabricator.git
   297         git -C phabricator reset --hard 46fcd135ae681bb90a1282114fb2147ab21e4f34
   300         git -C phabricator reset --hard """ +
       
   301           Bash.string(options.string("phabricator_version_phabricator")) + """
   298       """).check
   302       """).check
   299 
   303 
   300     val config = Config(name, root_path)
   304     val config = Config(name, root_path)
   301     write_config(configs ::: List(config))
   305     write_config(configs ::: List(config))
   302 
   306 
   527     {
   531     {
   528       var mercurial_source = ""
   532       var mercurial_source = ""
   529       var repo = ""
   533       var repo = ""
   530       var package_update = false
   534       var package_update = false
   531       var name = default_name
   535       var name = default_name
       
   536       var options = Options.init()
   532       var root = ""
   537       var root = ""
   533 
   538 
   534       val getopts =
   539       val getopts =
   535         Getopts("""
   540         Getopts("""
   536 Usage: isabelle phabricator_setup [OPTIONS]
   541 Usage: isabelle phabricator_setup [OPTIONS]
   539     -M SOURCE    install Mercurial from source: local PATH, or URL, or ":" for
   544     -M SOURCE    install Mercurial from source: local PATH, or URL, or ":" for
   540                  """ + standard_mercurial_source + """
   545                  """ + standard_mercurial_source + """
   541     -R DIR       repository directory (default: """ + default_repo("NAME") + """)
   546     -R DIR       repository directory (default: """ + default_repo("NAME") + """)
   542     -U           full update of system packages before installation
   547     -U           full update of system packages before installation
   543     -n NAME      Phabricator installation name (default: """ + quote(default_name) + """)
   548     -n NAME      Phabricator installation name (default: """ + quote(default_name) + """)
       
   549     -o OPTION    override Isabelle system OPTION (via NAME=VAL or NAME)
   544     -r DIR       installation root directory (default: """ + default_root("NAME") + """)
   550     -r DIR       installation root directory (default: """ + default_root("NAME") + """)
   545 
   551 
   546   Install Phabricator as LAMP application (Linux, Apache, MySQL, PHP).
   552   Install Phabricator as LAMP application (Linux, Apache, MySQL, PHP).
   547 
   553 
   548   The installation name (default: """ + quote(default_name) + """) is mapped to a regular
   554   The installation name (default: """ + quote(default_name) + """) is mapped to a regular
   550 """,
   556 """,
   551           "M:" -> (arg => mercurial_source = (if (arg == ":") standard_mercurial_source else arg)),
   557           "M:" -> (arg => mercurial_source = (if (arg == ":") standard_mercurial_source else arg)),
   552           "R:" -> (arg => repo = arg),
   558           "R:" -> (arg => repo = arg),
   553           "U" -> (_ => package_update = true),
   559           "U" -> (_ => package_update = true),
   554           "n:" -> (arg => name = arg),
   560           "n:" -> (arg => name = arg),
       
   561           "o:" -> (arg => options = options + arg),
   555           "r:" -> (arg => root = arg))
   562           "r:" -> (arg => root = arg))
   556 
   563 
   557       val more_args = getopts(args)
   564       val more_args = getopts(args)
   558       if (more_args.nonEmpty) getopts.usage()
   565       if (more_args.nonEmpty) getopts.usage()
   559 
   566 
   560       val progress = new Console_Progress
   567       val progress = new Console_Progress
   561 
   568 
   562       val release = Linux.Release()
   569       val release = Linux.Release()
   563       if (!release.is_ubuntu_18_04) error("Bad Linux version: Ubuntu 18.04 LTS required")
   570       if (!release.is_ubuntu_18_04) error("Bad Linux version: Ubuntu 18.04 LTS required")
   564 
   571 
   565       phabricator_setup(name = name, root = root, repo = repo,
   572       phabricator_setup(options, name = name, root = root, repo = repo,
   566         package_update = package_update, mercurial_source = mercurial_source, progress = progress)
   573         package_update = package_update, mercurial_source = mercurial_source, progress = progress)
   567     })
   574     })
   568 
   575 
   569 
   576 
   570 
   577