equal
deleted
inserted
replaced
16 import scala.jdk.CollectionConverters._ |
16 import scala.jdk.CollectionConverters._ |
17 |
17 |
18 |
18 |
19 object Isabelle_System |
19 object Isabelle_System |
20 { |
20 { |
21 /* settings */ |
21 /* settings environment */ |
22 |
22 |
23 def settings(putenv: List[(String, String)] = Nil): JMap[String, String] = |
23 def settings(putenv: List[(String, String)] = Nil): JMap[String, String] = |
24 { |
24 { |
25 val env0 = isabelle.setup.Environment.settings() |
25 val env0 = isabelle.setup.Environment.settings() |
26 if (putenv.isEmpty) env0 |
26 if (putenv.isEmpty) env0 |
126 val hg = Mercurial.repository(root) |
126 val hg = Mercurial.repository(root) |
127 hg.tags(rev = hg.parent()) |
127 hg.tags(rev = hg.parent()) |
128 } |
128 } |
129 else "" |
129 else "" |
130 } |
130 } |
|
131 |
|
132 def export_isabelle_identifier(isabelle_identifier: String): String = |
|
133 if (isabelle_identifier == "") "" |
|
134 else "export ISABELLE_IDENTIFIER=" + Bash.string(isabelle_identifier) + "\n" |
131 |
135 |
132 def isabelle_identifier(): Option[String] = proper_string(getenv("ISABELLE_IDENTIFIER")) |
136 def isabelle_identifier(): Option[String] = proper_string(getenv("ISABELLE_IDENTIFIER")) |
133 |
137 |
134 def isabelle_heading(): String = |
138 def isabelle_heading(): String = |
135 isabelle_identifier() match { |
139 isabelle_identifier() match { |
403 description = description, cwd = cwd, env = env, redirect = redirect, cleanup = cleanup). |
407 description = description, cwd = cwd, env = env, redirect = redirect, cleanup = cleanup). |
404 result(input = input, progress_stdout = progress_stdout, progress_stderr = progress_stderr, |
408 result(input = input, progress_stdout = progress_stdout, progress_stderr = progress_stderr, |
405 watchdog = watchdog, strict = strict) |
409 watchdog = watchdog, strict = strict) |
406 } |
410 } |
407 |
411 |
|
412 |
|
413 /* command-line tools */ |
|
414 |
|
415 def require_command(cmd: String, test: String = "--version"): Unit = |
|
416 { |
|
417 if (!bash(Bash.string(cmd) + " " + test).ok) error("Missing system command: " + quote(cmd)) |
|
418 } |
|
419 |
408 private lazy val gnutar_check: Boolean = |
420 private lazy val gnutar_check: Boolean = |
409 try { bash("tar --version").check.out.containsSlice("GNU tar") || error("") } |
421 try { bash("tar --version").check.out.containsSlice("GNU tar") || error("") } |
410 catch { case ERROR(_) => false } |
422 catch { case ERROR(_) => false } |
411 |
423 |
412 def gnutar( |
424 def gnutar( |
421 (if (original_owner) "" else "--owner=root --group=staff ") + |
433 (if (original_owner) "" else "--owner=root --group=staff ") + |
422 (if (strip <= 0) "" else "--strip-components=" + strip + " ") |
434 (if (strip <= 0) "" else "--strip-components=" + strip + " ") |
423 |
435 |
424 if (gnutar_check) bash("tar " + options + args, redirect = redirect) |
436 if (gnutar_check) bash("tar " + options + args, redirect = redirect) |
425 else error("Expected to find GNU tar executable") |
437 else error("Expected to find GNU tar executable") |
426 } |
|
427 |
|
428 def require_command(cmd: String, test: String = "--version"): Unit = |
|
429 { |
|
430 if (!bash(Bash.string(cmd) + " " + test).ok) error("Missing system command: " + quote(cmd)) |
|
431 } |
438 } |
432 |
439 |
433 def hostname(): String = bash("hostname -s").check.out |
440 def hostname(): String = bash("hostname -s").check.out |
434 |
441 |
435 def open(arg: String): Unit = |
442 def open(arg: String): Unit = |
449 else open(name) |
456 else open(name) |
450 } |
457 } |
451 external |
458 external |
452 } |
459 } |
453 |
460 |
454 def export_isabelle_identifier(isabelle_identifier: String): String = |
|
455 if (isabelle_identifier == "") "" |
|
456 else "export ISABELLE_IDENTIFIER=" + Bash.string(isabelle_identifier) + "\n" |
|
457 |
461 |
458 |
462 |
459 /** Isabelle resources **/ |
463 /** Isabelle resources **/ |
460 |
464 |
461 /* repository clone with Admin */ |
465 /* repository clone with Admin */ |