summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Master/texmf-dist/doc/support/tlcockpit/NEWS5
-rw-r--r--Master/texmf-dist/doc/support/tlcockpit/README.md8
-rw-r--r--Master/texmf-dist/scripts/tlcockpit/tlcockpit.jarbin13031610 -> 16591125 bytes
-rwxr-xr-xMaster/texmf-dist/scripts/tlcockpit/tlcockpit.sh18
-rw-r--r--Master/texmf-dist/source/support/tlcockpit/build.sbt8
-rw-r--r--Master/texmf-dist/source/support/tlcockpit/project/assembly.sbt2
-rw-r--r--Master/texmf-dist/source/support/tlcockpit/src/main/scala/TLCockpit/ApplicationMain.scala51
-rw-r--r--Master/texmf-dist/source/support/tlcockpit/src/main/scala/TLCockpit/Utils.scala8
-rw-r--r--Master/texmf-dist/source/support/tlcockpit/src/main/scala/TeXLive/OsTools.scala14
-rw-r--r--Master/texmf-dist/source/support/tlcockpit/src/main/scala/TeXLive/TlmgrProcess.scala17
10 files changed, 112 insertions, 19 deletions
diff --git a/Master/texmf-dist/doc/support/tlcockpit/NEWS b/Master/texmf-dist/doc/support/tlcockpit/NEWS
index 1be72691ded..8534c067fdd 100644
--- a/Master/texmf-dist/doc/support/tlcockpit/NEWS
+++ b/Master/texmf-dist/doc/support/tlcockpit/NEWS
@@ -1,5 +1,10 @@
NEWS for tlcockpit
+version 1.0 (20181006)
+----------------------
+- check for used Java version and abort if less than < 1.8 (Java 8)
+- add support for Cygwin
+
version 0.9 (20180408)
----------------------
- make package info dialog content copyable (as far as possible)
diff --git a/Master/texmf-dist/doc/support/tlcockpit/README.md b/Master/texmf-dist/doc/support/tlcockpit/README.md
index d4a767c1ed2..c5b9bbd8d26 100644
--- a/Master/texmf-dist/doc/support/tlcockpit/README.md
+++ b/Master/texmf-dist/doc/support/tlcockpit/README.md
@@ -30,7 +30,7 @@ Requirements
You need at least `tlmgr` from after 2017-11-23, in TeX Live language at least
version 45888 or `texlive.infra`.
-A recent Java installation that includes JavaFX is required. If you see
+A recent Java (at least Java 8) installation that includes JavaFX is required. If you see
errors like
```
Error: A JNI error has occurred, please check your installation and try again
@@ -44,6 +44,12 @@ that means that the Java installation does not provides JavaFX.
On Windows the latest JRE from Oracle include JavaFX. On Linux one might
need to install some extra packages (Debian/Ubuntu: openjfx).
+With recent release of Java 11 problems are getting worse, since JavaFX is now
+separately packaged, and ScalaFX only supports (by now) JavaFX8. That means, for
+now it is necessary to have a Java 8 installation. As soon as ScalaFX supports
+JavaFX11 we will move to use it.
+
+
Development
-----------
diff --git a/Master/texmf-dist/scripts/tlcockpit/tlcockpit.jar b/Master/texmf-dist/scripts/tlcockpit/tlcockpit.jar
index 8cc6fce91cf..4ccd7cb962e 100644
--- a/Master/texmf-dist/scripts/tlcockpit/tlcockpit.jar
+++ b/Master/texmf-dist/scripts/tlcockpit/tlcockpit.jar
Binary files differ
diff --git a/Master/texmf-dist/scripts/tlcockpit/tlcockpit.sh b/Master/texmf-dist/scripts/tlcockpit/tlcockpit.sh
index 734ffe54c3c..56333fb47b4 100755
--- a/Master/texmf-dist/scripts/tlcockpit/tlcockpit.sh
+++ b/Master/texmf-dist/scripts/tlcockpit/tlcockpit.sh
@@ -1,10 +1,16 @@
#!/bin/sh
+# Public domain. Originally written by Norbert Preining and Karl Berry, 2018.
-kernel=`uname -s`
-if test "${kernel#*CYGWIN}" != "$kernel"
-then
- jarpath=`cygpath -w $(kpsewhich --progname=tlcockpit --format=texmfscripts tlcockpit.jar)`
-else
- jarpath=`kpsewhich --progname=tlcockpit --format=texmfscripts tlcockpit.jar`
+scriptname=`basename "$0"`
+jar="$scriptname.jar"
+jarpath=`kpsewhich --progname="$scriptname" --format=texmfscripts "$jar"`
+
+kernel=`uname -s 2>/dev/null`
+if echo "$kernel" | grep CYGWIN >/dev/null; then
+ CYGWIN_ROOT=`cygpath -w /`
+ export CYGWIN_ROOT
+ jarpath=`cygpath -w "$jarpath"`
fi
+
exec java -jar "$jarpath" "$@"
+
diff --git a/Master/texmf-dist/source/support/tlcockpit/build.sbt b/Master/texmf-dist/source/support/tlcockpit/build.sbt
index 8de4ff3e483..737ee577c2b 100644
--- a/Master/texmf-dist/source/support/tlcockpit/build.sbt
+++ b/Master/texmf-dist/source/support/tlcockpit/build.sbt
@@ -1,13 +1,15 @@
name := "tlcockpit"
-version := "0.9"
+version := "1.0"
-scalaVersion := "2.12.3"
+scalaVersion := "2.12.7"
-libraryDependencies += "org.scalafx" % "scalafx_2.12" % "8.0.102-R11"
+libraryDependencies += "org.scalafx" % "scalafx_2.12" % "8.0.181-R13"
libraryDependencies += "io.spray" %% "spray-json" % "1.3.3"
libraryDependencies += "com.typesafe.scala-logging" %% "scala-logging" % "3.7.2"
libraryDependencies += "ch.qos.logback" % "logback-classic" % "1.2.3"
+libraryDependencies += "org.json4s" %% "json4s-native" % "3.6.0-M3"
+libraryDependencies += "org.json4s" %% "json4s-jackson" % "3.6.0-M3"
mainClass in assembly := Some("TLCockpit.ApplicationMain")
diff --git a/Master/texmf-dist/source/support/tlcockpit/project/assembly.sbt b/Master/texmf-dist/source/support/tlcockpit/project/assembly.sbt
index 15a88b09365..d6540b84c5a 100644
--- a/Master/texmf-dist/source/support/tlcockpit/project/assembly.sbt
+++ b/Master/texmf-dist/source/support/tlcockpit/project/assembly.sbt
@@ -1 +1 @@
-addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.5")
+addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.8")
diff --git a/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TLCockpit/ApplicationMain.scala b/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TLCockpit/ApplicationMain.scala
index dadb8c516df..8ba576002bd 100644
--- a/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TLCockpit/ApplicationMain.scala
+++ b/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TLCockpit/ApplicationMain.scala
@@ -10,6 +10,7 @@ import javafx.scene.Node
import TLCockpit.Utils._
import TeXLive._
+import TeXLive.OsTools._
import scala.collection.{immutable, mutable}
import scala.collection.mutable.ArrayBuffer
@@ -49,6 +50,9 @@ import scalafx.collections.ObservableMap
// JSON support - important load TLPackageJsonProtocol later!
import spray.json._
import TeXLive.JsonProtocol._
+import org.json4s._
+import org.json4s.jackson.JsonMethods._
+
// logging
import com.typesafe.scalalogging.LazyLogging
@@ -84,6 +88,42 @@ object ApplicationMain extends JFXApp with LazyLogging {
logger.trace("starting program tlcockpit")
+ val javaVersion = System.getProperty("java.version")
+ val javaVersionSplit: Array[String] = javaVersion.split('.')
+ logger.debug(s"Got javaVersion ${javaVersion}")
+ if (javaVersionSplit.length == 1) {
+ logger.warn(s"Cannot find Java version from ${javaVersion}, continuing anyway!")
+ } else {
+ val major = toInt(javaVersionSplit(0))
+ val minor = toInt(javaVersionSplit(1))
+ major match {
+ case Some(i) =>
+ if (major.get == 1) {
+ minor match {
+ case Some(j) =>
+ if (minor.get < 8) {
+ logger.error(s"Java version ${javaVersion} too old, need >= 1.8, terminating!")
+ Platform.exit()
+ sys.exit(1)
+ }
+ case None =>
+ logger.warn(s"Cannot find Java version from ${javaVersion}, continuing anyway!")
+ }
+ } else {
+ if (major.get > 9) {
+ logger.warn(s"Currently Java versions > 8 (1.8) are not supported (${javaVersion}), trying anyway!")
+ } else {
+ logger.warn(s"Strange version number, please report: ${javaVersion}, continuing anyway!")
+ }
+ }
+ case None =>
+ logger.warn(s"Cannot find Java version from ${javaVersion}, continuing anyway!")
+ }
+ // in all other cases just hope it is fine
+ logger.info(s"Running on Java Version ${javaVersion}")
+ }
+
+
var tlmgrBusy = BooleanProperty(false)
// necessary action when Window is closed with X or some other operation
@@ -274,11 +314,12 @@ object ApplicationMain extends JFXApp with LazyLogging {
// outputText.append(s"Running ${ss.mkString(" ")}" + (if (unbuffered) " (unbuffered)" else " (buffered)"))
val foo = Future {
ss.foreach { s =>
+ val runcmd = if (isCygwin) "bash -l -c \"" + s + "\"" else s
Platform.runLater {
outputText.append(s"Running ${s}" + (if (unbuffered) " (unbuffered)" else " (buffered)"))
actionLabel.text = s"[${s}]"
}
- s ! ProcessLogger(
+ runcmd ! ProcessLogger(
line => if (unbuffered) Platform.runLater(outputText.append(line))
else OutputBuffer.synchronized(OutputBuffer.append(line + "\n")),
line => Platform.runLater(logText.append(line))
@@ -755,6 +796,7 @@ tlmgr>
logger.debug(s"load tlpdb update (no json) pkgs: got status ${status}")
logger.trace(s"load tlpdb update (no json) pkgs: got lines = " + lines.head)
val newtlpkgs: Map[String, TLPackageShort] = lines.map(l => {
+ // logger.debug(s"got line >>>${l}<<<")
val fields = l.split(",",8)
val pkgname = fields(0)
val shortdesc = fields(7).stripPrefix(""""""").stripSuffix(""""""").replaceAll("""\\"""",""""""")
@@ -1525,7 +1567,9 @@ tlmgr>
def tlmgr_run_one_cmd(s: String, onCompleteFunc: (String, Array[String]) => Unit): Unit = {
currentPromise = Promise[(String, Array[String])]()
tlmgrBusy.value = true
- actionLabel.text = s"[${s}]"
+ Platform.runLater {
+ actionLabel.text = s"[${s}]"
+ }
currentPromise.future.onComplete {
case Success((a, b)) =>
logger.debug("tlmgr run one cmd: current future completed!")
@@ -1544,7 +1588,8 @@ tlmgr>
def tlmgr_send(s: String, onCompleteFunc: (String, Array[String]) => Unit): Unit = {
// logText.clear()
outputText.clear()
- outerrpane.expanded = false
+ // don't close debug panel when it is open
+ // outerrpane.expanded = false
if (!currentPromise.isCompleted) {
logger.debug(s"tlmgr busy, put onto pending jobs: $s")
logger.debug("Currently running job: " + currentPromise)
diff --git a/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TLCockpit/Utils.scala b/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TLCockpit/Utils.scala
index aae40d5db37..0753e127c6b 100644
--- a/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TLCockpit/Utils.scala
+++ b/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TLCockpit/Utils.scala
@@ -21,4 +21,12 @@ object Utils {
f"${fileSize/Math.pow(1024, digitGroup)}%3.1f ${units(digitGroup)}"
}
+ def toInt(s: String): Option[Int] = {
+ try {
+ Some(s.toInt)
+ } catch {
+ case e: Exception => None
+ }
+ }
+
}
diff --git a/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TeXLive/OsTools.scala b/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TeXLive/OsTools.scala
index 45a50ae884c..1e0aa0f03ce 100644
--- a/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TeXLive/OsTools.scala
+++ b/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TeXLive/OsTools.scala
@@ -11,20 +11,30 @@ import sys.process._
object OsTools {
val OS: String = System.getProperty("os.name").map(_.toLower)
+ val CygwinRootIsSet: Boolean =
+ sys.env.get("CYGWIN_ROOT") match {
+ case Some(_) => true
+ case None => false
+ }
def isWindows: Boolean = {
- OS.startsWith("windows")
+ OS.startsWith("windows") && !CygwinRootIsSet
+ }
+ def isCygwin: Boolean = {
+ OS.startsWith("windows") && CygwinRootIsSet
}
def isApple: Boolean = {
OS.startsWith("mac os")
}
def isUnix: Boolean = {
- !(isWindows || isApple)
+ !(isWindows || isApple || isCygwin)
}
def openFileCmd(f: String): Seq[String] = {
val absf = new java.io.File(f).getCanonicalPath
if (isWindows) {
Seq("cmd", "/c", "start", absf)
+ } else if (isCygwin) {
+ Seq("cygstart", absf)
} else if (isApple) {
Seq("open", absf)
} else {
diff --git a/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TeXLive/TlmgrProcess.scala b/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TeXLive/TlmgrProcess.scala
index 5776daef76d..3040d3abf74 100644
--- a/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TeXLive/TlmgrProcess.scala
+++ b/Master/texmf-dist/source/support/tlcockpit/src/main/scala/TeXLive/TlmgrProcess.scala
@@ -52,7 +52,18 @@ class TlmgrProcess(updout: String => Unit, upderr: String => Unit) extends Lazy
if (process == null) {
logger.debug("tlmgr process: start_process: creating procIO")
val procIO = new ProcessIO(inputFn, outputFn(_, updout), outputFn(_, upderr))
- val processBuilder: ProcessBuilder = Seq({if (isWindows) "tlmgr.bat" else "tlmgr"}, "-v", "--machine-readable", "shell")
+ val startCmd =
+ if (isWindows) {
+ logger.debug("detected Windows, using tlmgr.bat")
+ Seq("tlmgr.bat", "-v", "--machine-readable", "shell")
+ } else if (isCygwin) {
+ logger.debug("detected Cygwin, using bash -l -c tlmgr")
+ Seq("bash", "-l", "-c", "tlmgr -v --machine-readable shell")
+ } else {
+ logger.debug("detected Unixish, using tlmgr")
+ Seq("tlmgr", "-v", "--machine-readable", "shell")
+ }
+ val processBuilder: ProcessBuilder = startCmd
logger.debug("tlmgr process: start_process: running new tlmgr process")
process = processBuilder.run(procIO)
}
@@ -90,8 +101,8 @@ class TlmgrProcess(updout: String => Unit, upderr: String => Unit) extends Lazy
stdin.close()
} catch {
case exc: Throwable =>
- stdin.close()
logger.warn("Exception in inputFn thread: " + exc + "\n")
+ stdin.close()
}
}
@@ -112,8 +123,8 @@ class TlmgrProcess(updout: String => Unit, upderr: String => Unit) extends Lazy
outStr.close()
} catch {
case exc: Throwable =>
- outStr.close()
logger.warn("Exception in outputFn thread: " + exc + "\n")
+ outStr.close()
}
}
}