--- a/src/Pure/Admin/build_cygwin.scala Sat Dec 08 14:28:14 2018 +0100
+++ b/src/Pure/Admin/build_cygwin.scala Sat Dec 08 14:58:56 2018 +0100
@@ -54,8 +54,7 @@
(cygwin + Path.explode("Cygwin.bat")).file.delete
val archive = "cygwin-" + Date.Format("uuuuMMdd")(Date.now()) + ".tar.gz"
- Isabelle_System.gnutar("-C " + File.bash_path(tmp_dir) +
- " -czf " + Bash.string(archive) + " cygwin").check
+ Isabelle_System.gnutar("-czf " + Bash.string(archive) + " cygwin", dir = tmp_dir).check
})
}
--- a/src/Pure/Admin/build_jdk.scala Sat Dec 08 14:28:14 2018 +0100
+++ b/src/Pure/Admin/build_jdk.scala Sat Dec 08 14:58:56 2018 +0100
@@ -102,8 +102,7 @@
"unzip -x " + File.bash_path(archive.absolute), cwd = tmp_dir.file).check
}
else {
- Isabelle_System.gnutar(
- "-C " + File.bash_path(tmp_dir) + " -xzf " + File.bash_path(archive)).check
+ Isabelle_System.gnutar("-xzf " + File.bash_path(archive), dir = tmp_dir).check
}
val dir_entry =
@@ -204,8 +203,9 @@
}
progress.echo("Archiving ...")
- Isabelle_System.gnutar("--owner=root --group=root -C " + File.bash_path(dir) +
- " -czf " + File.bash_path(target_dir + jdk_path.ext("tar.gz")) + " " + jdk_name).check
+ Isabelle_System.gnutar(
+ "-czf " + File.bash_path(target_dir + jdk_path.ext("tar.gz")) + " " + jdk_name,
+ dir = dir).check
})
}
--- a/src/Pure/Admin/build_release.scala Sat Dec 08 14:28:14 2018 +0100
+++ b/src/Pure/Admin/build_release.scala Sat Dec 08 14:58:56 2018 +0100
@@ -221,10 +221,7 @@
Isabelle_System.bash(script, cwd = dir.file).check
private def execute_tar(dir: Path, args: String): Unit =
- Isabelle_System.gnutar(args, cwd = dir.file).check
-
- private def tar_options: String =
- if (Platform.is_macos) "--owner=root --group=staff" else "--owner=root --group=root"
+ Isabelle_System.gnutar(args, dir = dir).check
private val default_platform_families: List[Platform.Family.Value] =
List(Platform.Family.linux, Platform.Family.windows, Platform.Family.macos)
@@ -365,7 +362,7 @@
find "$DIST_NAME" -type f "(" -name "*.thy" -o -name "*.ML" -o -name "*.scala" ")" -print | xargs chmod -f u-w
""")
- execute_tar(release.dist_dir, tar_options + " -czf " +
+ execute_tar(release.dist_dir, "-czf " +
File.bash_path(release.isabelle_archive) + " " + Bash.string(release.dist_name))
execute_dist_name("""
@@ -726,8 +723,7 @@
execute(tmp_dir, "chmod -R a+r " + Bash.string(release.dist_name))
execute(tmp_dir, "chmod -R g=o " + Bash.string(release.dist_name))
- execute_tar(tmp_dir,
- tar_options + " -czf " + File.bash_path(release.isabelle_library_archive) +
+ execute_tar(tmp_dir, "-czf " + File.bash_path(release.isabelle_library_archive) +
" " + Bash.string(release.dist_name + "/browser_info"))
})
}
--- a/src/Pure/System/components.scala Sat Dec 08 14:28:14 2018 +0100
+++ b/src/Pure/System/components.scala Sat Dec 08 14:58:56 2018 +0100
@@ -36,8 +36,7 @@
{
val name = Archive.get_name(archive.file_name)
progress.echo("Unpacking " + name)
- Isabelle_System.gnutar(
- "-C " + File.bash_path(dir) + " -xzf " + File.bash_path(archive.absolute)).check
+ Isabelle_System.gnutar("-xzf " + File.bash_path(archive), dir = dir).check
name
}
--- a/src/Pure/System/isabelle_system.scala Sat Dec 08 14:28:14 2018 +0100
+++ b/src/Pure/System/isabelle_system.scala Sat Dec 08 14:58:56 2018 +0100
@@ -314,9 +314,17 @@
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 =
+ def gnutar(
+ args: String,
+ dir: Path = Path.current,
+ original_owner: Boolean = false,
+ redirect: Boolean = false): Process_Result =
{
- if (gnutar_check) bash("tar " + args, cwd = cwd, redirect = redirect)
+ val options =
+ (if (dir.is_current) "" else "-C " + File.bash_path(dir) + " ") +
+ (if (original_owner) "" else "--owner=root --group=staff ")
+
+ if (gnutar_check) bash("tar " + options + args, redirect = redirect)
else error("Expected to find GNU tar executable")
}