--- a/src/Pure/Admin/build_jdk.scala Sun Jan 22 15:02:06 2017 +0100
+++ b/src/Pure/Admin/build_jdk.scala Sun Jan 22 16:15:08 2017 +0100
@@ -106,8 +106,8 @@
try {
val tmp_dir = dir + Path.explode("tmp")
Isabelle_System.mkdirs(tmp_dir)
- Isabelle_System.bash(
- "tar -C " + File.bash_path(tmp_dir) + " -xzf " + File.bash_path(archive)).check
+ Isabelle_System.gnutar(
+ "-C " + File.bash_path(tmp_dir) + " -xzf " + File.bash_path(archive)).check
val dir_entry =
File.read_dir(tmp_dir) match {
case List(s) => s
@@ -204,7 +204,7 @@
}
progress.echo("Archiving ...")
- Isabelle_System.bash("tar -C " + File.bash_path(dir) + " -czf " +
+ Isabelle_System.gnutar("-C " + File.bash_path(dir) + " -czf " +
File.bash_path(target_dir + jdk_path.ext("tar.gz")) + " " + jdk_name).check
})
}
--- a/src/Pure/Admin/build_release.scala Sun Jan 22 15:02:06 2017 +0100
+++ b/src/Pure/Admin/build_release.scala Sun Jan 22 16:15:08 2017 +0100
@@ -155,11 +155,13 @@
{
def execute(script: String): Unit =
Isabelle_System.bash(script, cwd = tmp_dir.file).check
+ def execute_tar(args: String): Unit =
+ Isabelle_System.gnutar(args, cwd = tmp_dir.file).check
val name = release_info.name
val platform = Isabelle_System.getenv_strict("ISABELLE_PLATFORM_FAMILY")
val bundle = release_info.dist_dir + Path.explode(name + "_" + platform + ".tar.gz")
- execute("tar xzf " + File.bash_path(bundle))
+ execute_tar("xzf " + File.bash_path(bundle))
val other_isabelle =
new Other_Isabelle(progress, tmp_dir + Path.explode(name), name + "-build")
@@ -171,7 +173,7 @@
execute("chmod -R a+r " + Bash.string(name))
execute("chmod -R g=o " + Bash.string(name))
- execute("tar czf " + File.bash_path(release_info.dist_library_archive) +
+ execute_tar("czf " + File.bash_path(release_info.dist_library_archive) +
" " + Bash.string(name + "/browser_info"))
})
}
--- a/src/Pure/System/isabelle_system.scala Sun Jan 22 15:02:06 2017 +0100
+++ b/src/Pure/System/isabelle_system.scala Sun Jan 22 16:15:08 2017 +0100
@@ -302,6 +302,16 @@
result(progress_stdout, progress_stderr, progress_limit, strict)
}
+ private lazy val gnutar_check: Boolean =
+ try { bash("tar --version").check.out.containsSlice("GNU tar") || error("") }
+ catch { case ERROR(_) => false }
+
+ def gnutar(args: String, cwd: JFile = null, redirect: Boolean = false): Process_Result =
+ {
+ if (gnutar_check) bash("tar " + args, cwd = cwd, redirect = redirect)
+ else error("Expected to find GNU tar executable")
+ }
+
def hostname(): String = bash("hostname -s").check.out
def open(arg: String): Unit =