remove invocation of build_history: results are reported via stdout;
authorwenzelm
Sat Oct 15 15:14:46 2016 +0200 (2016-10-15)
changeset 642239d5b9f41df77
parent 64222 184e3a932778
child 64224 3ed43cfc8b14
remove invocation of build_history: results are reported via stdout;
Admin/build_history
src/Pure/Admin/build_history.scala
     1.1 --- a/Admin/build_history	Sat Oct 15 14:15:29 2016 +0200
     1.2 +++ b/Admin/build_history	Sat Oct 15 15:14:46 2016 +0200
     1.3 @@ -4,5 +4,5 @@
     1.4  
     1.5  THIS="$(cd "$(dirname "$0")"; pwd)"
     1.6  
     1.7 -"$THIS/build" jars || exit $?
     1.8 +"$THIS/build" jars > /dev/null || exit $?
     1.9  exec "$THIS/../bin/isabelle_java" isabelle.Build_History "$@"
     2.1 --- a/src/Pure/Admin/build_history.scala	Sat Oct 15 14:15:29 2016 +0200
     2.2 +++ b/src/Pure/Admin/build_history.scala	Sat Oct 15 15:14:46 2016 +0200
     2.3 @@ -325,4 +325,60 @@
     2.4        if (rc != 0) sys.exit(rc)
     2.5      }
     2.6    }
     2.7 +
     2.8 +
     2.9 +
    2.10 +  /** build_history_remote **/
    2.11 +
    2.12 +  sealed case class File_Content(name: String, content: Bytes)
    2.13 +
    2.14 +  def build_history_remote(
    2.15 +    ssh_session: SSH.Session,
    2.16 +    isabelle_repos: Path,
    2.17 +    isabelle_repos_build_history: Path,
    2.18 +    build_history_options: List[String],
    2.19 +    build_history_args: List[String],
    2.20 +    progress: Progress = Ignore_Progress,
    2.21 +    isabelle_repos_source: String = "http://isabelle.in.tum.de/repos/isabelle",
    2.22 +    self_update: Boolean = false): List[File_Content] =
    2.23 +  {
    2.24 +    using(ssh_session.sftp())(sftp =>
    2.25 +      {
    2.26 +        val isabelle_admin = (isabelle_repos + Path.explode("Admin")).implode
    2.27 +
    2.28 +
    2.29 +        /* prepare repository clones */
    2.30 +
    2.31 +        val ssh = Some(ssh_session)
    2.32 +
    2.33 +        val isabelle_hg =
    2.34 +          if (sftp.stat(isabelle_repos.implode).nonEmpty)
    2.35 +            Mercurial.repository(isabelle_repos, ssh = ssh)
    2.36 +          else
    2.37 +            Mercurial.clone_repository(isabelle_repos_source, isabelle_repos, ssh = ssh)
    2.38 +
    2.39 +        if (self_update) {
    2.40 +          isabelle_hg.pull()
    2.41 +          isabelle_hg.update(clean = true)
    2.42 +          ssh_session.execute(File.bash_string(isabelle_admin + "/build") + " jars_fresh").check
    2.43 +        }
    2.44 +
    2.45 +        if (sftp.stat(isabelle_repos_build_history.implode).isEmpty)
    2.46 +          Mercurial.clone_repository(isabelle_repos.implode, isabelle_repos_build_history, ssh = ssh)
    2.47 +
    2.48 +
    2.49 +        /* build_history */
    2.50 +
    2.51 +        val result =
    2.52 +          ssh_session.execute(
    2.53 +            File.bash_string(isabelle_admin + "/build_history") + " " +
    2.54 +              File.bash_args(build_history_options) + " " +
    2.55 +              File.bash_path(isabelle_repos_build_history) + " " +
    2.56 +              File.bash_args(build_history_args),
    2.57 +            progress_stderr = progress.echo(_))
    2.58 +
    2.59 +        result.check.out_lines.map(name =>
    2.60 +          File_Content(Path.explode(name).base.implode, sftp.read_bytes(name)))
    2.61 +      })
    2.62 +  }
    2.63  }