author | wenzelm |
Sat, 15 Oct 2016 21:08:04 +0200 | |
changeset 64232 | 367d83d6030e |
parent 64231 | dbc8294c75d3 |
child 64233 | ef6f7e8a018c |
permissions | -rw-r--r-- |
64160 | 1 |
/* Title: Pure/Admin/build_history.scala |
64021
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
2 |
Author: Makarius |
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
3 |
|
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
4 |
Build other history versions. |
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
5 |
*/ |
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
6 |
|
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
7 |
package isabelle |
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
8 |
|
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
9 |
|
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
10 |
import java.io.{File => JFile} |
64117 | 11 |
import java.time.format.DateTimeFormatter |
64118 | 12 |
import java.util.Locale |
64021
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
13 |
|
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
14 |
|
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
15 |
object Build_History |
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
16 |
{ |
64117 | 17 |
/* log files */ |
18 |
||
19 |
val BUILD_HISTORY = "build_history" |
|
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64118
diff
changeset
|
20 |
val META_INFO_MARKER = "\fmeta_info = " |
64117 | 21 |
|
22 |
||
64188 | 23 |
/* augment settings */ |
64050 | 24 |
|
64188 | 25 |
def augment_settings( |
26 |
other_isabelle: Other_Isabelle, |
|
27 |
threads: Int, |
|
28 |
arch_64: Boolean = false, |
|
29 |
heap: Int = default_heap, |
|
30 |
max_heap: Option[Int] = None, |
|
31 |
more_settings: List[String]): String = |
|
32 |
{ |
|
33 |
val (ml_platform, ml_settings) = |
|
34 |
{ |
|
35 |
val windows_32 = "x86-windows" |
|
36 |
val windows_64 = "x86_64-windows" |
|
37 |
val platform_32 = other_isabelle("getenv -b ISABELLE_PLATFORM32").check.out |
|
38 |
val platform_64 = other_isabelle("getenv -b ISABELLE_PLATFORM64").check.out |
|
39 |
val platform_family = other_isabelle("getenv -b ISABELLE_PLATFORM_FAMILY").check.out |
|
64049 | 40 |
|
64188 | 41 |
val polyml_home = |
42 |
try { Path.explode(other_isabelle("getenv -b ML_HOME").check.out).dir } |
|
43 |
catch { case ERROR(msg) => error("Bad ML_HOME: " + msg) } |
|
64049 | 44 |
|
64188 | 45 |
def ml_home(platform: String): Path = polyml_home + Path.explode(platform) |
64049 | 46 |
|
64188 | 47 |
def err(platform: String): Nothing = |
48 |
error("Platform " + platform + " unavailable on this machine") |
|
64050 | 49 |
|
64188 | 50 |
def check_dir(platform: String): Boolean = |
51 |
platform != "" && ml_home(platform).is_dir |
|
64050 | 52 |
|
64188 | 53 |
val ml_platform = |
54 |
if (Platform.is_windows && arch_64) { |
|
55 |
if (check_dir(windows_64)) windows_64 else err(windows_64) |
|
56 |
} |
|
57 |
else if (Platform.is_windows && !arch_64) { |
|
58 |
if (check_dir(windows_32)) windows_32 |
|
59 |
else platform_32 // x86-cygwin |
|
60 |
} |
|
61 |
else { |
|
62 |
val (platform, platform_name) = |
|
63 |
if (arch_64) (platform_64, "x86_64-" + platform_family) |
|
64 |
else (platform_32, "x86-" + platform_family) |
|
65 |
if (check_dir(platform)) platform else err(platform_name) |
|
66 |
} |
|
64050 | 67 |
|
64188 | 68 |
val ml_options = |
69 |
"--minheap " + heap + (if (max_heap.isDefined) " --maxheap " + max_heap.get else "") + |
|
70 |
" --gcthreads " + threads + |
|
71 |
(if (ml_platform.endsWith("-windows")) " --codepage utf8" else "") |
|
64050 | 72 |
|
64188 | 73 |
(ml_platform, |
74 |
List( |
|
75 |
"ML_HOME=" + File.bash_path(ml_home(ml_platform)), |
|
76 |
"ML_PLATFORM=" + quote(ml_platform), |
|
77 |
"ML_OPTIONS=" + quote(ml_options))) |
|
64050 | 78 |
} |
79 |
||
64188 | 80 |
val thread_settings = |
81 |
List( |
|
82 |
"ISABELLE_JAVA_SYSTEM_OPTIONS=\"$ISABELLE_JAVA_SYSTEM_OPTIONS -Disabelle.threads=" + threads + "\"", |
|
83 |
"ISABELLE_BUILD_OPTIONS=\"threads=" + threads + "\"") |
|
64050 | 84 |
|
64188 | 85 |
val settings = |
86 |
List(ml_settings, thread_settings) ::: |
|
87 |
(if (more_settings.isEmpty) Nil else List(more_settings)) |
|
64050 | 88 |
|
64188 | 89 |
File.append(other_isabelle.etc_settings, "\n" + cat_lines(settings.map(terminate_lines(_)))) |
64050 | 90 |
|
64188 | 91 |
ml_platform |
64049 | 92 |
} |
93 |
||
94 |
||
95 |
||
64050 | 96 |
/** build_history **/ |
64025 | 97 |
|
98 |
private val default_rev = "tip" |
|
64030 | 99 |
private val default_threads = 1 |
64034 | 100 |
private val default_heap = 1000 |
64025 | 101 |
private val default_isabelle_identifier = "build_history" |
102 |
||
103 |
def build_history( |
|
104 |
hg: Mercurial.Repository, |
|
64194
b5ada7dcceaa
integrity test of build_history vs. build_history_base;
wenzelm
parents:
64193
diff
changeset
|
105 |
progress: Progress = Ignore_Progress, |
64025 | 106 |
rev: String = default_rev, |
107 |
isabelle_identifier: String = default_isabelle_identifier, |
|
108 |
components_base: String = "", |
|
64026 | 109 |
fresh: Boolean = false, |
64025 | 110 |
nonfree: Boolean = false, |
64052 | 111 |
multicore_base: Boolean = false, |
64051 | 112 |
threads_list: List[Int] = List(default_threads), |
64030 | 113 |
arch_64: Boolean = false, |
114 |
heap: Int = default_heap, |
|
64036 | 115 |
max_heap: Option[Int] = None, |
64030 | 116 |
more_settings: List[String] = Nil, |
64026 | 117 |
verbose: Boolean = false, |
64194
b5ada7dcceaa
integrity test of build_history vs. build_history_base;
wenzelm
parents:
64193
diff
changeset
|
118 |
build_args: List[String] = Nil): List[(Process_Result, Path)] = |
64025 | 119 |
{ |
64031 | 120 |
/* sanity checks */ |
121 |
||
64213 | 122 |
if (File.eq(Path.explode("~~"), hg.root)) |
64046 | 123 |
error("Repository coincides with ISABELLE_HOME=" + Path.explode("~~").expand) |
124 |
||
64051 | 125 |
for (threads <- threads_list if threads < 1) error("Bad threads value < 1: " + threads) |
64036 | 126 |
|
64030 | 127 |
if (heap < 100) error("Bad heap value < 100: " + heap) |
128 |
||
64036 | 129 |
if (max_heap.isDefined && max_heap.get < heap) |
130 |
error("Bad max_heap value < heap: " + max_heap.get) |
|
131 |
||
64031 | 132 |
System.getenv("ISABELLE_SETTINGS_PRESENT") match { |
133 |
case null | "" => |
|
134 |
case _ => error("Cannot run build_history within existing Isabelle settings environment") |
|
135 |
} |
|
136 |
||
137 |
||
64049 | 138 |
/* init repository */ |
64031 | 139 |
|
64025 | 140 |
hg.update(rev = rev, clean = true) |
64049 | 141 |
progress.echo_if(verbose, hg.log(rev, options = "-l1")) |
64025 | 142 |
|
64232
367d83d6030e
clarified hg.id operation, with explicit tip as default;
wenzelm
parents:
64231
diff
changeset
|
143 |
val isabelle_version = hg.id(rev) |
64049 | 144 |
val other_isabelle = new Other_Isabelle(progress, hg.root, isabelle_identifier) |
64025 | 145 |
|
64051 | 146 |
|
64052 | 147 |
/* main */ |
64043 | 148 |
|
64117 | 149 |
val build_history_date = Date.now() |
64139 | 150 |
val build_host = Isabelle_System.hostname() |
64117 | 151 |
|
64051 | 152 |
var first_build = true |
64052 | 153 |
for (threads <- threads_list) yield |
154 |
{ |
|
155 |
/* init settings */ |
|
156 |
||
64188 | 157 |
other_isabelle.init_settings(components_base, nonfree) |
64051 | 158 |
other_isabelle.resolve_components(verbose) |
64117 | 159 |
val ml_platform = |
64188 | 160 |
augment_settings(other_isabelle, threads, arch_64, heap, max_heap, more_settings) |
64043 | 161 |
|
64052 | 162 |
val isabelle_output = Path.explode(other_isabelle("getenv -b ISABELLE_OUTPUT").check.out) |
163 |
val isabelle_output_log = isabelle_output + Path.explode("log") |
|
164 |
val isabelle_base_log = isabelle_output + Path.explode("../base_log") |
|
165 |
||
64051 | 166 |
if (first_build) { |
167 |
other_isabelle.resolve_components(verbose) |
|
168 |
other_isabelle.bash( |
|
169 |
"env PATH=\"" + File.bash_path(Path.explode("~~/lib/dummy_stty").expand) + ":$PATH\" " + |
|
170 |
"bin/isabelle jedit -b" + (if (fresh) " -f" else ""), |
|
171 |
redirect = true, echo = verbose).check |
|
64052 | 172 |
|
64213 | 173 |
Isabelle_System.rm_tree(isabelle_base_log) |
64051 | 174 |
} |
64025 | 175 |
|
64213 | 176 |
Isabelle_System.rm_tree(isabelle_output) |
64052 | 177 |
Isabelle_System.mkdirs(isabelle_output) |
178 |
||
179 |
||
180 |
/* build */ |
|
181 |
||
182 |
if (multicore_base && !first_build && isabelle_base_log.is_dir) |
|
64189 | 183 |
Isabelle_System.copy_dir(isabelle_base_log, isabelle_output_log) |
64052 | 184 |
|
64117 | 185 |
val build_start = Date.now() |
64121 | 186 |
val res = |
187 |
other_isabelle("build -v " + File.bash_args(build_args), redirect = true, echo = verbose) |
|
64117 | 188 |
val build_end = Date.now() |
189 |
||
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64118
diff
changeset
|
190 |
|
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64118
diff
changeset
|
191 |
/* output log */ |
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64118
diff
changeset
|
192 |
|
64117 | 193 |
val log_path = |
64193 | 194 |
other_isabelle.isabelle_home_user + |
195 |
Build_Log.log_subdir(build_history_date) + |
|
196 |
Build_Log.log_filename( |
|
197 |
BUILD_HISTORY, build_history_date, ml_platform, "M" + threads).ext("gz") |
|
64117 | 198 |
|
64120 | 199 |
val build_info = Build_Log.Log_File(log_path.base.implode, res.out_lines).parse_build_info() |
200 |
||
64117 | 201 |
val meta_info = |
202 |
List(Build_Log.Field.build_engine -> BUILD_HISTORY, |
|
203 |
Build_Log.Field.build_host -> build_host, |
|
64155 | 204 |
Build_Log.Field.build_start -> Build_Log.print_date(build_start), |
205 |
Build_Log.Field.build_end -> Build_Log.print_date(build_end), |
|
64117 | 206 |
Build_Log.Field.isabelle_version -> isabelle_version) |
207 |
||
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64118
diff
changeset
|
208 |
val ml_statistics = |
64120 | 209 |
build_info.finished_sessions.flatMap(session_name => |
210 |
{ |
|
211 |
val session_log = isabelle_output_log + Path.explode(session_name).ext("gz") |
|
212 |
if (session_log.is_file) { |
|
213 |
Build_Log.Log_File(session_log).parse_session_info(ml_statistics = true). |
|
214 |
ml_statistics.map(props => (Build_Log.SESSION_NAME -> session_name) :: props) |
|
215 |
} |
|
216 |
else Nil |
|
217 |
}) |
|
218 |
||
219 |
val heap_sizes = |
|
220 |
build_info.finished_sessions.flatMap(session_name => |
|
221 |
{ |
|
222 |
val heap = isabelle_output + Path.explode(session_name) |
|
223 |
if (heap.is_file) |
|
224 |
Some("Heap " + session_name + " (" + Value.Long(heap.file.length) + " bytes)") |
|
225 |
else None |
|
226 |
}) |
|
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64118
diff
changeset
|
227 |
|
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64118
diff
changeset
|
228 |
Isabelle_System.mkdirs(log_path.dir) |
64117 | 229 |
File.write_gzip(log_path, |
64173 | 230 |
terminate_lines( |
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64118
diff
changeset
|
231 |
Build_Log.Log_File.print_props(META_INFO_MARKER, meta_info) :: res.out_lines ::: |
64120 | 232 |
ml_statistics.map(Build_Log.Log_File.print_props(Build_Log.ML_STATISTICS_MARKER, _)) ::: |
233 |
heap_sizes)) |
|
64117 | 234 |
|
64119
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64118
diff
changeset
|
235 |
|
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64118
diff
changeset
|
236 |
/* next build */ |
8094eaa38d4b
inline session ML statistics into main build log;
wenzelm
parents:
64118
diff
changeset
|
237 |
|
64052 | 238 |
if (multicore_base && first_build && isabelle_output_log.is_dir) |
64189 | 239 |
Isabelle_System.copy_dir(isabelle_output_log, isabelle_base_log) |
64052 | 240 |
|
241 |
first_build = false |
|
242 |
||
64194
b5ada7dcceaa
integrity test of build_history vs. build_history_base;
wenzelm
parents:
64193
diff
changeset
|
243 |
(res, log_path) |
64051 | 244 |
} |
64025 | 245 |
} |
64021
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
246 |
|
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
247 |
|
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
248 |
/* command line entry point */ |
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
249 |
|
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
250 |
def main(args: Array[String]) |
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
251 |
{ |
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
252 |
Command_Line.tool0 { |
64052 | 253 |
var multicore_base = false |
64025 | 254 |
var components_base = "" |
64030 | 255 |
var heap: Option[Int] = None |
64036 | 256 |
var max_heap: Option[Int] = None |
64051 | 257 |
var threads_list = List(default_threads) |
64025 | 258 |
var isabelle_identifier = default_isabelle_identifier |
64030 | 259 |
var more_settings: List[String] = Nil |
64026 | 260 |
var fresh = false |
64030 | 261 |
var arch_64 = false |
64025 | 262 |
var nonfree = false |
263 |
var rev = default_rev |
|
264 |
var verbose = false |
|
64021
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
265 |
|
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
266 |
val getopts = Getopts(""" |
64026 | 267 |
Usage: isabelle build_history [OPTIONS] REPOSITORY [ARGS ...] |
64021
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
268 |
|
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
269 |
Options are: |
64052 | 270 |
-B first multicore build serves as base for scheduling information |
64025 | 271 |
-C DIR base directory for Isabelle components (default: $ISABELLE_HOME_USER/../contrib) |
64036 | 272 |
-H SIZE minimal ML heap in MB (default: """ + default_heap + """ for x86, """ + default_heap * 2 + """ for x86_64) |
64052 | 273 |
-M THREADS multicore configurations (comma-separated list, default: """ + default_threads + """) |
64025 | 274 |
-N NAME alternative ISABELLE_IDENTIFIER (default: """ + default_isabelle_identifier + """) |
64036 | 275 |
-U SIZE maximal ML heap in MB (default: unbounded) |
64030 | 276 |
-e TEXT additional text for generated etc/settings |
64026 | 277 |
-f fresh build of Isabelle/Scala components (recommended) |
64030 | 278 |
-m ARCH processor architecture (32=x86, 64=x86_64, default: x86) |
64025 | 279 |
-n include nonfree components |
64026 | 280 |
-r REV update to revision (default: """ + default_rev + """) |
64025 | 281 |
-v verbose |
64021
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
282 |
|
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
283 |
Build Isabelle sessions from the history of another REPOSITORY clone, |
64026 | 284 |
passing ARGS directly to its isabelle build tool. |
64021
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
285 |
""", |
64052 | 286 |
"B" -> (_ => multicore_base = true), |
64025 | 287 |
"C:" -> (arg => components_base = arg), |
64030 | 288 |
"H:" -> (arg => heap = Some(Value.Int.parse(arg))), |
64051 | 289 |
"M:" -> (arg => threads_list = space_explode(',', arg).map(Value.Int.parse(_))), |
64025 | 290 |
"N:" -> (arg => isabelle_identifier = arg), |
64036 | 291 |
"U:" -> (arg => max_heap = Some(Value.Int.parse(arg))), |
64030 | 292 |
"e:" -> (arg => more_settings = more_settings ::: List(arg)), |
64026 | 293 |
"f" -> (_ => fresh = true), |
64030 | 294 |
"m:" -> |
295 |
{ |
|
296 |
case "32" | "x86" => arch_64 = false |
|
297 |
case "64" | "x86_64" => arch_64 = true |
|
298 |
case bad => error("Bad processor architecture: " + quote(bad)) |
|
299 |
}, |
|
64025 | 300 |
"n" -> (_ => nonfree = true), |
301 |
"r:" -> (arg => rev = arg), |
|
302 |
"v" -> (_ => verbose = true)) |
|
64021
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
303 |
|
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
304 |
val more_args = getopts(args) |
64026 | 305 |
val (root, build_args) = |
306 |
more_args match { |
|
307 |
case root :: build_args => (root, build_args) |
|
308 |
case _ => getopts.usage() |
|
309 |
} |
|
64021
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
310 |
|
64162 | 311 |
val hg = Mercurial.repository(Path.explode(root)) |
312 |
val progress = new Console_Progress(stderr = true) |
|
313 |
val results = |
|
64194
b5ada7dcceaa
integrity test of build_history vs. build_history_base;
wenzelm
parents:
64193
diff
changeset
|
314 |
build_history(hg, progress = progress, rev = rev, isabelle_identifier = isabelle_identifier, |
64162 | 315 |
components_base = components_base, fresh = fresh, nonfree = nonfree, |
316 |
multicore_base = multicore_base, threads_list = threads_list, arch_64 = arch_64, |
|
317 |
heap = heap.getOrElse(if (arch_64) default_heap * 2 else default_heap), |
|
318 |
max_heap = max_heap, more_settings = more_settings, verbose = verbose, |
|
319 |
build_args = build_args) |
|
320 |
||
64194
b5ada7dcceaa
integrity test of build_history vs. build_history_base;
wenzelm
parents:
64193
diff
changeset
|
321 |
for ((_, log_path) <- results) |
b5ada7dcceaa
integrity test of build_history vs. build_history_base;
wenzelm
parents:
64193
diff
changeset
|
322 |
Output.writeln(log_path.implode, stdout = true) |
b5ada7dcceaa
integrity test of build_history vs. build_history_base;
wenzelm
parents:
64193
diff
changeset
|
323 |
|
b5ada7dcceaa
integrity test of build_history vs. build_history_base;
wenzelm
parents:
64193
diff
changeset
|
324 |
val rc = (0 /: results) { case (rc, (res, _)) => rc max res.rc } |
64162 | 325 |
if (rc != 0) sys.exit(rc) |
64021
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
326 |
} |
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
327 |
} |
64223
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
328 |
|
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
329 |
|
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
330 |
|
64225 | 331 |
/** remote build_history -- via command-line **/ |
64223
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
332 |
|
64225 | 333 |
def remote_build_history( |
64227 | 334 |
session: SSH.Session, |
335 |
isabelle_repos_self: Path, |
|
336 |
isabelle_repos_other: Path, |
|
337 |
isabelle_repos_source: String = "http://isabelle.in.tum.de/repos/isabelle", |
|
338 |
self_update: Boolean = false, |
|
64223
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
339 |
progress: Progress = Ignore_Progress, |
64227 | 340 |
options: String = "", |
341 |
args: String = ""): List[(String, Bytes)] = |
|
64223
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
342 |
{ |
64227 | 343 |
using(session.sftp())(sftp => |
64223
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
344 |
{ |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64227
diff
changeset
|
345 |
val isabelle_admin = sftp.path(isabelle_repos_self + Path.explode("Admin")) |
64223
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
346 |
|
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
347 |
|
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
348 |
/* prepare repository clones */ |
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
349 |
|
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
350 |
val isabelle_hg = |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64227
diff
changeset
|
351 |
Mercurial.setup_repository( |
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64227
diff
changeset
|
352 |
isabelle_repos_source, isabelle_repos_self, ssh = Some(session)) |
64223
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
353 |
|
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
354 |
if (self_update) { |
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
355 |
isabelle_hg.pull() |
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
356 |
isabelle_hg.update(clean = true) |
64227 | 357 |
session.execute(File.bash_string(isabelle_admin + "/build") + " jars_fresh").check |
64223
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
358 |
} |
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
359 |
|
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64227
diff
changeset
|
360 |
Mercurial.setup_repository( |
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64227
diff
changeset
|
361 |
sftp.path(isabelle_repos_self), isabelle_repos_other, ssh = Some(session)) |
64223
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
362 |
|
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
363 |
|
64225 | 364 |
/* Admin/build_history */ |
64223
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
365 |
|
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
366 |
val result = |
64227 | 367 |
session.execute( |
64225 | 368 |
File.bash_string(isabelle_admin + "/build_history") + " " + options + " " + |
64231
dbc8294c75d3
added remote_build_history tasks: parallel on several remote hosts;
wenzelm
parents:
64227
diff
changeset
|
369 |
File.bash_string(sftp.path(isabelle_repos_other)) + " " + args, |
64223
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
370 |
progress_stderr = progress.echo(_)) |
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
371 |
|
64227 | 372 |
result.check.out_lines.map(log => (Path.explode(log).base.implode, sftp.read_bytes(log))) |
64223
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
373 |
}) |
9d5b9f41df77
remove invocation of build_history: results are reported via stdout;
wenzelm
parents:
64213
diff
changeset
|
374 |
} |
64021
1e23caac8757
basic setup for Admin/build_history -- outside of Isabelle environment;
wenzelm
parents:
diff
changeset
|
375 |
} |