aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@qt.io>2023-03-27 08:26:24 +0000
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2023-03-27 11:15:31 +0000
commit7dbad0e44ab1930f5714a8b5188688562a298170 (patch)
treee929e9cad4d21704fecc2c7cea962319cd42034d
parent1207a463f79fac7189984f21ccb970dfad06538c (diff)
qbsp: try to find docker
Try few extra paths were docker might be in case those are not set in PATH. Change-Id: I5a27c2c4829e1caf8e860032555493866f1eba8f Reviewed-by: Mikko Gronoff <mikko.gronoff@qt.io> (cherry picked from commit 349cea8182f9eedc7015612996c172fb5dc44d88) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--meta-boot2qt/files/qbsp/toolchain_installscript.qs24
1 files changed, 21 insertions, 3 deletions
diff --git a/meta-boot2qt/files/qbsp/toolchain_installscript.qs b/meta-boot2qt/files/qbsp/toolchain_installscript.qs
index 0e8d4618..69b357ae 100644
--- a/meta-boot2qt/files/qbsp/toolchain_installscript.qs
+++ b/meta-boot2qt/files/qbsp/toolchain_installscript.qs
@@ -52,6 +52,7 @@ Component.prototype.createOperations = function()
container = true;
var path = installer.value("TargetDir") + installPath;
+ var docker;
if (!container) {
if (systemInfo.kernelType !== "winnt") {
var script = path + "/" + sdkFile;
@@ -62,6 +63,23 @@ Component.prototype.createOperations = function()
path = path.replace(/\\/g, "/");
}
} else {
+ var dockerPaths = [];
+ if (systemInfo.kernelType == "winnt")
+ dockerPaths.push("C:/Program Files/Docker/Docker/resources/bin/docker");
+ else if (systemInfo.kernelType == "darwin")
+ dockerPaths.push(
+ "/usr/local/bin/docker",
+ "/Applications/Docker.app/Contents/Resources/bin/docker",
+ "/opt/homebrew/bin/docker");
+ dockerPaths.push("docker");
+ for (i in dockerPaths) {
+ docker = dockerPaths[i];
+ var ret = installer.execute(docker, ["--version"]);
+ if (ret.length != 0) {
+ break;
+ }
+ }
+
component.addOperation("AppendFile", path + "/Dockerfile",
"\
FROM --platform=linux/@DOCKER_ARCH@ ubuntu:22.04\n\
@@ -71,15 +89,15 @@ COPY *.sh /\n\
RUN sh *.sh -d /opt/toolchain -y && rm *.sh\n");
component.addOperation("Execute", [
- "docker",
+ docker,
"build", path,
"-t", imageTag,
- "errormessage=Installer was unable to run docker. " +
+ "errormessage=Installer was unable to run docker.\n" +
"Make sure Docker is installed and running before continuing.\n\n" +
"The toolchain Docker container can also be created manually by running command:\n" +
"docker build " + path + " -t " + imageTag,
"UNDOEXECUTE",
- "docker", "image", "rm", "-f", imageTag]);
+ docker, "image", "rm", "-f", imageTag]);
path = "/opt/toolchain";
dockerPrefix = "docker://" + imageTag;
}