Commit Graph

122 Commits

Author SHA1 Message Date
Christian Stenger
ae16958fd8 Docker: Improve marking daemon problems
Small positive exit codes can result for different reasons.
Real docker issues result in small negative exit codes.

Change-Id: Ibd800b7806f3014ffccd39638c06b2dd93e8a5a1
Reviewed-by: hjk <hjk@qt.io>
2021-07-16 08:26:45 +00:00
Christian Stenger
88310df13d Docker: Handle docker daemon
Avoid calling the docker daemon again and again
if it is currently not running.

Change-Id: I17afa2eca098589bd362149d18e090252ef83f6e
Reviewed-by: hjk <hjk@qt.io>
2021-07-15 13:21:23 +00:00
hjk
f8c7d2e848 Docker: Rework auto-detection and removal of kit items
- Use more uniform messages for the different kinds of items
- Remove all auto-detected items

Change-Id: I0b0df0bca484337039432b163bd8e19593b1cd22
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-14 12:55:53 +00:00
hjk
5d17ff7a67 Docker: Make temporary messages shorter
Kinder to the translators.

Change-Id: If9c7eb265b2f86fec274e9db7b0d76424cd703cc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-14 12:21:34 +00:00
Christian Stenger
d61600a8e2 Docker: Disable merged channel access for Windows
This is not supported and anything related to accessing
merged channels on Windows fails due to the need of
using wsl or a named pipe.
On the downside this may crash QC in cases where e.g.
Qt detection still tries to handle qmake as if running
locally, but at the current state this seems to no more
happen automatically (e.g. when using the auto detection).

Change-Id: I983cad66c1210de38a33e26958857a5dcaeef767
Reviewed-by: hjk <hjk@qt.io>
2021-07-14 11:52:03 +00:00
hjk
324ff024d7 QtSupport: Rename BaseQtVersion::autodetection* to detection
It's also used for manually triggered detection nowadays and
closer in naming to what kit, debugger and kit have.

Change-Id: I68705aafe297d61afc8b5918650e47353d3ccce1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-07-14 10:19:05 +00:00
Tim Jenssen
22121885fe baseqtversion: commands are FilePathes
also renamed the qmlscene* qmlRuntime*

Change-Id: Ifd522e21f5ce30aaa54060fdcebee2cd8b9463c4
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-07-14 09:50:01 +00:00
hjk
a4c05f585f Docker: Move some cmake detection logic to cmake plugin
This make the code better re-usable from other places that
wish to put a cmake version into a new kit.

Change-Id: I1ef7770a7f8efa36e88b2f3862b011fecd38de98
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-14 09:41:30 +00:00
hjk
076d1bf10a Docker: Fix debugger auto-detection
Mark detected debuggers as such and give them some bonus to match,
overriding other hacks.

Change-Id: Iaf4d88fa22dd50e68124b61087d4c742f7a56d0f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-14 08:28:56 +00:00
hjk
e8521e6fe1 Utils: Add/fix FilePath::isFile and FilePath::isDir
In general, the more specific isReadableFile etc are preferred, but for
porting a 1:1 match to QFileInfo functionality is helpful.

Change-Id: I5b575ca9a5053f13f63c0fbe0e3dcc222494280f
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-07-14 08:16:57 +00:00
hjk
bb77053e6d Docker: Add a hint on what to do with "Paths to mount"
Change-Id: I992e73f78ff18ac5ed89ff5ce6fb6e7f98e1cb2c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-13 07:26:43 +00:00
Christian Stenger
d0172f80b4 Docker: Guard against empty mounts
Using empty mounts makes using the container fail.

Change-Id: I65041eae3a1ebeec936861b4f85977981bbd84d3
Reviewed-by: hjk <hjk@qt.io>
2021-07-13 05:36:08 +00:00
hjk
1936006a91 Docker: Force a container restart when mounts have changed
Change-Id: Iaddb52b6c4fb27ff9ccc098d76cc6e333e02c7e4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-12 13:21:44 +00:00
Eike Ziller
e895a0380b Fix lupdate issues
Some tr functions missing, some places where we need full qualification
because lupdate gets confused with namespaces.

Change-Id: Ic1d6ef3b31960dda02bc0788a255857117acdca9
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2021-07-09 13:05:03 +00:00
hjk
97578a4fee Utils: Allow an offset in FilePath::readContents()
Also, change the size limit to take a qint64. Contrary to e.g.
Q(6)Hash::size() there is a realistic chance that 31 bits are not
enough.

Change-Id: Idbe6e765a5cac4336b3d64a8e0adb14966fd18a3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-09 12:48:37 +00:00
hjk
05545adb93 Utils: Change semantics of FilePath::onDeviceSearchInPath()
... and rename it to searchOnDevice().

We need to handle additional search directories anyways, so its more uniform
to always pass a list all of them.

Change-Id: I46c7860b51d11c26db58045ff3ab922148af021f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-08 10:28:49 +00:00
Tim Jenssen
59ac4dbf0d fix msvc Qt6 dev builds
Change-Id: I4264a15c5033b9123c4e97caa86a909e654cef34
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-07-07 17:39:56 +00:00
hjk
d7062b5b92 Utils: Allow additional directories for FilePath::searchInPath
This mimics Environment::searchInPath().

Change-Id: I8c772ed31c31c74b09c7aa0e4912de8586dd2468
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-07 10:43:46 +00:00
hjk
10ca1c711e Docker: Partially split out kit item autodetection
Most of it is independent of the docker device as such, this should be
centralized somehow. This here is a first step.

Change-Id: If32063559a4c7c6c3cecf1973e1ef1f634e5f8f4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-06 06:46:13 +00:00
hjk
fd71cbf135 Docker: Properly map back DockerDevice::directoryEntries() result
Even though the file is accessible in the local path, not mapping
back loses its relation do the docker container used for further
decisions like FilePath::needsDevice().

Change-Id: I7c693d604364b9e42bf7310c072be0f33d149626
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-05 13:00:16 +00:00
Leena Miettinen
67ac04bdce Docker: Fix UI text
Task-number: QTCREATORBUG-25915
Change-Id: I8f0b368f77af39a586963765a63e1618a0ee9bd6
Reviewed-by: hjk <hjk@qt.io>
2021-07-02 13:51:25 +00:00
hjk
4a8c222c18 Utils: Add FilePath::symLinkTarget
And implement it for the docker device.

This replaces the previous unused and not really implemented
FilePath::resolveSymLinkTarget.

Change-Id: I9dcb4f8276dbb88b21959276da0d50135742fba0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-30 11:11:10 +00:00
Christian Stenger
eef0769d7a Docker: Remove unused lambda captures
Avoids warnings.

Change-Id: I9bf836ff24fa6524571d0303e544189340dede32
Reviewed-by: hjk <hjk@qt.io>
2021-06-30 07:18:37 +00:00
Christian Stenger
8e1032b83c Docker: Do not use hard-coded /tmp
Amends 8c7b6a7549.

Change-Id: Ie702c7ccc5ac897920f1b8eda00dd90378a2d80b
Reviewed-by: hjk <hjk@qt.io>
2021-06-30 04:55:15 +00:00
hjk
eb7b5ea34e Docker: Improve logging a bit
Most logged items span more than one line, so be generous with extra
newlines.

Also, complain only about when host-local read access into the
docker device ist not possible, writing is generally done only
in the separately mounted places after re-mapping to host-local paths
in the host file system.

Change-Id: I5525749dfb880d4dc3547f86de43314567e92b4d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-29 13:48:13 +00:00
hjk
1afe21d41e Docker: Make mounted volumes user-configurable
Still use the so-far hardcoded "/opt" and "/data" as default, i.e.
not the intended final setup which should at least pick up
the source and build dirs automatically.

Change-Id: If632f3f5a6e824a952938c97336df8ff58b39d67
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-29 13:48:05 +00:00
hjk
b8e6d05ded Utils: Also pass Sort flag to FilePath::dirEntries
Change-Id: Ic21c2ba3ef59c6bb3e19552904187b3c6a096d80
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-29 13:16:46 +00:00
hjk
1e1c556bc8 Utils: Add a FilePath::ensureExistingFile
Essentially a kind of 'touch', to be used in the CMake file API.

Change-Id: Iaae62b441c0006b39d4bef5f06420e798c28c2a5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-29 12:34:43 +00:00
hjk
4271b3a299 Docker: Bark if there is no container before trying to run on it
Change-Id: I64bee9901a515d46aa18e35d5e4a26f9105519ea
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-29 10:34:12 +00:00
Christian Stenger
75ffccad0b Docker: Make usage of UID and GID configurable
Make it optional to use UID and GID of the current user.

Change-Id: I1a7eeaba0cfae204b05f0ab4d409d965b8fc09ef
Reviewed-by: hjk <hjk@qt.io>
2021-06-29 10:21:36 +00:00
hjk
5ead2afeeb Utils: Implement FilePath::removeRecursively
Sprinkle a few QTC_ASSERT to make sure we are in a known
context.

Cmake's FileApiReader uses this before moving directories
as QFile::rename does not do anything if the target exists.

Change-Id: I555f99e81a9fe7d93ae66145eeebfa9d5880bc51
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-29 09:34:28 +00:00
hjk
b26fb834a8 Docker: Use categorized logging for DockerDeviceOperation
Change-Id: Ib9aa32c65bd38b4b72b356603182e84ce5672e91
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-29 08:35:32 +00:00
Christian Stenger
acec1a3a03 Docker: Pass on working directory only if provided
Change-Id: I9ae62b441c0006b39d4bef5f06420e798c28c2a5
Reviewed-by: hjk <hjk@qt.io>
2021-06-29 07:34:48 +00:00
Christian Stenger
ca1ce3a1ba Docker: Silence assert
We query the device with executables that may or may not exist.
So, expect the call to fail if the image does not contain the
respective executable in PATH.

Change-Id: Iff43879c72155de8a8a9276e26085d03ead61f2f
Reviewed-by: hjk <hjk@qt.io>
2021-06-29 07:34:41 +00:00
Christian Stenger
8c7b6a7549 Docker: Use directory commonly existing
Trying to use /tmp on Windows ends up in a failing process call
as this directory usually does not exist.

Change-Id: I80a5e45c474d3fe6ff6f2ede67837722cb59078a
Reviewed-by: hjk <hjk@qt.io>
2021-06-29 07:34:33 +00:00
hjk
9f29b9e31b Docker: Use id of current user to run the container
This ensures typical files created in the build process are
accessible and removable(!) by the user outside.

Downside is that some commands (e.g. whoami) won't work well
within the container as that user typically is not listed in
/etc/passwd etc. inside the container. Buildsteps requiring
them won't work until the container image is (re-)created with
this data in place.

In general, there seems to be no silver bullet for this problem.
An extensive discussion of pros and cons can be found at
https://jtreminio.com/blog/running-docker-containers-as-current-host-user

Change-Id: I0421e031324ffe3d64b9aeede289a43357c46e3d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-29 07:30:09 +00:00
hjk
54b4022987 Utils: Implement FilePath::rename()
And uses it in CMake's fileapi reader.

Change-Id: I9e719aa4b253eaca17c6b304eab5e7268fcfab29
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-28 13:03:32 +00:00
hjk
6d26f4f5b0 CMake: Allow autodetected tools to associate themselves with kits
Change-Id: I5b48ddf36ba1b9c4eb6476017be63c4d43b60627
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-25 13:57:36 +00:00
hjk
f295021d98 Docker: Give created devices an deterministic id
Change-Id: I451f37065b69da26000cb21ba92b070e6b5698d5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-24 14:07:26 +00:00
hjk
430e81facd All: Replace most SynchronousProcess by QtcProcess
Change-Id: I0bf22fef2cd4a7297ef5a1e9aa9c3e2b9348ba42
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-23 07:55:31 +00:00
David Schulz
6902ddc535 Utils: add FilePath::isWritableFile
Change-Id: Ic6ced87fcee92deadf5a117ea7e987f1c877f83a
Reviewed-by: hjk <hjk@qt.io>
2021-06-23 06:21:46 +00:00
Christian Stenger
0e57baf784 Docker: Raise number of iterations when starting container
On Windows this call takes way longer to write to the cidfile.
Beside this, read only from file if it could be opened to
silence some Qt internal warnings.

Change-Id: Iec5f631aaf871995c1903289d7a0a24abc2f8e05
Reviewed-by: hjk <hjk@qt.io>
2021-06-22 12:07:20 +00:00
hjk
c721242be8 Docker: Automatically remove the container when it exits
Change-Id: I167dfadc79e892807f47332f79f2a5226ffdbe1a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-22 10:34:27 +00:00
hjk
76cf6ce983 Utils: Add a QtcProcess flag to keep stdin open
Needed to run e.g. gdb on-device.

Change-Id: I5a98df575478f18adf1540ced44f6808bdba0b76
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-22 07:48:36 +00:00
David Schulz
6af287fa2d Docker: fix is<Writable/Readable>Directory
Change-Id: I63093a1aeb3bc2b87592f93900f26b44305b5e85
Reviewed-by: hjk <hjk@qt.io>
2021-06-22 04:54:30 +00:00
hjk
aca55dce58 Docker: Auto-detect debugger binaries in docker devices
Change-Id: Iec7c2b16277ea626520372603ae769418e9efd12
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-21 12:14:29 +00:00
hjk
f558323bac Docker: Actually run 'env' on the docker device to get the environment
Change-Id: Ice31b4f7cfd6c699a78da1518405d8d6bb6e3611
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-21 12:14:14 +00:00
hjk
faf1296345 Docker: Be a bit more flexible when searching Qt versions
Change-Id: I8611a0ad05cbbca79589f1defc8c1ed1399615e1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-21 11:05:19 +00:00
hjk
645c7f8379 Docker: Make CMake autodetection a bit more flexible
Search in build device path instead of two hardcoded locations.

Change-Id: I91e047aa48eb6566353e3ba090070c2a00b3dd06
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-21 09:39:57 +00:00
hjk
c533e5c43c Docker: Use a variable to list directories to mount
Baby step on the path from hard coded to user defined.

Change-Id: I2536924c5ba07dadcbe3c94304d55db25f876987
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-18 09:34:18 +00:00