Commit Graph

190 Commits

Author SHA1 Message Date
Marcus Tillmanns
47cdeb779a RemoteLinux: Fix terminal opening
Enforce setting a shell to start based on whether environment variables
might be set.

Fixes: QTCREATORBUG-28738
Change-Id: Ic43f0057bc89410e3146bafa2b109f472e01aa3b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-02-14 14:16:53 +00:00
Jarek Kobus
0d0ce383be RemoteLinux: Reuse StringUtils::joinStrings()
Change-Id: I5be99df99a4b3952374b9f3b719d032d897b691c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-02-03 12:03:59 +00:00
Marcus Tillmanns
7fbb41c10c RemoteLinux: Cache device environment
Change-Id: Ida735b69179b418c21d3875c3906b9449709623a
Reviewed-by: hjk <hjk@qt.io>
2023-02-01 17:24:17 +00:00
Marcus Tillmanns
fb6fc2bde8 Utils: Add combine with device env option
Adds the option Environment::combineWithDeviceEnvironment. This allows
the linuxdevice to set it to false.

Without this option a deadlock would occur when the QtcProcess tries to
get the device environment and the device shell failed to start.
(e.g. because a required command is missing on the device).

Change-Id: I8f7550d0d90e989a339f27e993a836e67e910e33
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-02-01 17:24:07 +00:00
Jarek Kobus
8e3a22329d QtcProcess: Add closeWriteChannel()
Change-Id: I080be230ec420ead2866f9481123125361e57033
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-01-24 08:48:12 +00:00
Jarek Kobus
1dad90ea45 RemoteLinux: Don't call mutable expressions inside QTC_ASSERT
In order to conform to the theory: "Removing all
QTC_ASSERTs and QTC_CHECKs should not change anything".

Change-Id: I3f544f8cdcede99d7efa3ba0ef456180203c45be
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-01-12 09:37:27 +00:00
hjk
4ddd28ae22 Utils: Rename QtcProcess::readAllStandard* to readAllRawStandard*
... and re-use the old QtcProcess::readAllStandard* names for
a QString-returning 'decoded' version.

For now, only use that in 'full Utf8' cases, to stay bug-compatible,
the plan is, however, to employ the QTextCodecs we have already
in the channel buffers. That will be one-by-one, though.

Change-Id: Id209e0671920d4ea4197918e872f441254112d52
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-10 12:08:53 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
hjk
674aad728e RemoteLinux: Hard-code /bin/sh for use in Open Terminal
... when changes to the environment are requested.

Ideally, that should be the user's chosen shell on the device,
but ssh does not support the case of specifying shell variables
without also giving an executable.

Short of playing tricks with /etc/passwd, getent, or env, use
/bin/sh which is guaranteed to exist.

Change-Id: I8d4b87f2a94eb9614d85dcacebd539ac645dc33d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-16 12:50:49 +00:00
hjk
ca6b14cf01 ProjectExplorer: Funnel environment fetching through device access
Easier nowadays. It's synchronous now, so conceptually worse,
but 'env' is not worse than 'ls', and this is used regularly
all over the place also for larger data sets without being a problem.

Change-Id: I2c2b1db8c07ff5c128700d4a1deefd710967568a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-15 14:17:36 +00:00
Eike Ziller
a3fe24d192 Merge remote-tracking branch 'origin/9.0'
Change-Id: I5298a6529921568ec32c0fe0c009c273263b0f5d
2022-12-14 14:25:38 +01:00
Jarek Kobus
218b19fe14 SshProcessInterface: Limit waiting for kill to finish
This is just a workaround for 9.0 and not a proper fix!

It looks like sometimes kill command may freeze. Don't blocking
wait for it for 30 seconds - limit this time to 2 seconds.

Do the same inside SimpleTargetRunner. Pretend the process
finished after 2 seconds, otherwise the SimpleTargetRunner
object gets leaked and we start receiving asserts from
ProcessLauncher about destructing it when still some processes
are being run.

Task-number: QTCREATORBUG-28072
Change-Id: I9766e7ff6f0c2abf2010686027702d30d32c4318
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-12-12 10:36:08 +00:00
Jarek Kobus
55ba10be38 RemoteLinux: Pass context object to lambda connections
Change-Id: I025c588e7d32be0f940b74acf9421965073cff5c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-08 13:51:06 +00:00
Eike Ziller
ae67799eb3 Merge remote-tracking branch 'origin/9.0'
Change-Id: I2123e09f75199a63af6e8505fb8889e7f9d025d2
2022-11-16 09:40:34 +01:00
Jarek Kobus
f8a3a4d04e SshProcessInterface: Don't use DeviceShell for control signals
It looks like starting device shell is fragile in some
circumstances.

Fixes: QTCREATORBUG-28072
Change-Id: I1a51d1fb939bd42884a55e1492de808bee89219f
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-11-15 15:49:18 +00:00
Jarek Kobus
adac83367c LinuxDevice: Fix stopping remote app when run in terminal
Before, the SshProcessInterface was trying to run kill
command (on remote host) for the running processId. However,
in case of terminal process the returned processId is an id
of ssh running through creator process stub, not the id of
remote process. The fix is to redirect a call to sendControlSignal
into the internal terminal process.

Change-Id: I57509fd61a54c335ab0a34f8ca0dffb3d75da696
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-11-15 11:11:39 +00:00
Eike Ziller
68388a38dd Merge remote-tracking branch 'origin/9.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp

Change-Id: I154a9ababa9e166cb06e98652d481fe6234f6399
2022-11-03 13:44:37 +01:00
Eike Ziller
d9503cdf89 Fix lupdate error
GenericTransferImpl doesn't have a translation context and RemoteLinux
was changed to Tr::tr anyway.

Amends b323303518

Change-Id: I048cae28684e223ab1547a5e07d1aaf9bb46c73e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-31 15:11:12 +00:00
Tim Jenssen
aa33927651 Merge remote-tracking branch 'origin/9.0'
Conflicts:
	src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
	src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.cpp
	src/plugins/qmldesigner/components/stateseditornew/propertymodel.cpp
	src/plugins/qmldesigner/qmldesignerprojectmanager.cpp
	src/plugins/qmldesigner/qmldesignerprojectmanager.h

Change-Id: Ib029a830ee99190bc4ea2ad75d9300bfa86b42d9
2022-10-25 19:02:15 +02:00
Christian Kandeler
13f40f5471 Utils: Add sorted() function
For simpler calling code.

Change-Id: Ia0a16a28770fd172f74d06a626148248bf5d3c0c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-25 14:29:45 +00:00
Marcus Tillmanns
d46a079744 Utils: Fix copyFile to include permissions
Also adds line breaks to info output.

Change-Id: I314ab87a47d7bd7541acb6a1553238fcfc27099d
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-10-25 13:31:10 +00:00
Jarek Kobus
866a658b42 Get rid of unneeded includes of RunControl
Removed also some other includes that were marked
with yellow triangles. In some cases includes of
runcontrol.h were substituted with other includes,
like qtcassert.h.

Change-Id: Ica40f68198c7f8f70e6047acb2eddc8ef017e43d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-25 09:49:13 +00:00
hjk
ada6989079 RemoteLinux: Allow use as build device unconditionally
Works out-of-the box for plain C++ "Hello World" & CMake.

Change-Id: I696886582ad2db98e40dd31ad5d9bf8f7d30aabb
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-19 06:01:55 +00:00
hjk
b323303518 RemoteLinux: Fix deployment when building remotely
By using a generic file transfer method based of FilePath::copyFile()
that doesn't require either of the transfer end point to be the
local host.

Change-Id: Ia2e4273df52f5ce6533046d96be3f6b521b7f0a5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-18 12:21:44 +00:00
Marcus Tillmanns
a1e960a27c Utils: Fix iterateWithFind
The change of runInShell to take QString + QStringList meant
that the caller was no longer able to fine tune the argument
escaping. This lead to "find -exec ... \;" being escaped incorrectly.

Changing back to CommandLine fixes this.

Change-Id: I55b09bd745c09912a2a0b4e43432824a99c0dd4e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-10-14 12:52:03 +00:00
hjk
1fa3255242 Utils: Split off file access interface from IDevice
The file accessing functions form now a class hierarchy by themselves,
the devices return a suitable point.

The previous implementation was mildly confusing by the special handling
of the DesktopDevice, fallbacks and remote cases in the same function
leading to unnecessary boilerplate when adding new functions and
codepaths that sometimes passed the FilePath API twice.

Implemented are a "DesktopDeviceFileAccess" taking care of the
previous !needsDevice() branches and a "UnixDeviceFileAccess"
covering the current docker and RL uses.

As a side-effect this unifies to a large degree the current docker
and RL code paths with were occasionally deviating from each other
while they shouldn't.

Change-Id: I4ff59d4be2a07d13e2ca5e9ace26a84160a87c9d
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-10-13 10:38:35 +00:00
hjk
b1471fe61f Utils: Combine some of the iterateWithFind overloads
Change-Id: I668447d0049f2e35cd0c76d2c5708779196167ec
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2022-10-12 08:59:32 +00:00
Marcus Tillmanns
d74c5301ff Linuxdevice: Add FilePathInfo functions
::filePathInfo and iterateDirectory(..., IterateDirWithInfoCallback, ...)
allow for faster info retrieval by the fsengine, making the listing
of large directories like /bin a lot faster.

Change-Id: I2a21e019e05f5bb08459483747ba2be4530929f4
Reviewed-by: hjk <hjk@qt.io>
2022-10-11 13:09:26 +00:00
hjk
2e38cb6848 Utils: Add an offset parameter to the content writing FilePath function
Use QFile::seek to implement locally and a dd seek based poor man's
implementation on RL and docker.

Change-Id: I241d1c34c00e991845d132ad8edefa1377ba1311
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-10 16:08:28 +00:00
hjk
5dde520a43 Utils: Return a bit more data from DeviceShell::runInShell
Pass on stderr data and exit code to the caller, it's typically
in a better condition to handle errors.

Use it to notify the user about non-available 'find' arguments
and fix the fallback to ls-based operation.

Change-Id: I535535de2ffa09cad1dd6e9b07eb69f807dbae2f
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-10-10 08:39:55 +00:00
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
hjk
90de29d530 RemoteLinux: Re-enable categorized logging for shell access
Task-number: QTCREATORBUG-28242
Change-Id: Iea56465576ade76b92948766c94e458d45e81191
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-07 13:33:52 +00:00
hjk
cb5815c619 RemoteLinux: Use common FileUtils::iterateUnixDirector function
This now uses 'find' when available.

Change-Id: I5ebf05a808f69559c25cd33eb6d36ab931fb076f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-07 11:40:33 +00:00
hjk
4f2b15679d RemoteLinux: Allow remote linux build devices as opt-in
... by setting QTC_ALLOW_REMOTE_LINUX_BUILD_DEVICES=1

Registering compilers and cmake on such devices already
works manually. [Note: The remote file dialog is extremely
slow when browsing remote directories]

After that, opening a CMakeLists.txt on the device works,
but not much more.

Change-Id: I19025930699f6aec57d26a36b3fb04109fbf03e8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-04 11:42:46 +00:00
Eike Ziller
3011548066 Merge remote-tracking branch 'origin/8.0'
Conflicts:
	src/libs/utils/deviceshell.cpp
	src/plugins/clangcodemodel/clangdclient.cpp
	src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp
	src/plugins/remotelinux/linuxdevice.cpp

Change-Id: Idc2edf428c98e9cbc891f1833b271ce2def9a835
2022-09-21 11:16:29 +02:00
Marcus Tillmanns
5ebb467cc6 Deviceshell: Cleanup shellProcess destruction
Change-Id: I71507d9e74979fca461784575257e7bafd1b4838
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-09-21 08:51:47 +00:00
Eike Ziller
5d55cfdae5 Merge remote-tracking branch 'origin/8.0'
Conflicts:
	share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/HelperWidgets/ColorEditor.qml
	share/qtcreator/qmldesigner/propertyEditorQmlSources/imports/StudioTheme/icons.ttf
	src/libs/utils/fileutils.cpp
	src/plugins/qmldesigner/components/edit3d/edit3dwidget.cpp
	src/plugins/qmldesigner/designercore/include/abstractview.h
	src/plugins/qmldesigner/designercore/include/nodemetainfo.h
	src/plugins/qmldesigner/designercore/metainfo/nodemetainfo.cpp
	src/plugins/qmldesigner/designercore/model/model_p.h
	src/plugins/remotelinux/linuxdevice.cpp
	tests/auto/utils/fileutils/tst_fileutils.cpp

Change-Id: I26a21e2523d3d725fdb8c548a531cdbdaeaeca20
2022-09-19 09:54:06 +02:00
Eike Ziller
e7ddd8a5b7 FilePath: Return optional bytearray from device hooks
For differentiating between "error" and "empty file".

Change-Id: I1806bb7386f5e7db28489f9f7e685648bfc20110
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-09-15 11:28:18 +00:00
Marcus Tillmanns
ed46f1f002 linuxdevice: Fix ::bytesAvailable
DeviceShell does not support piping commands at the moment.

To continue to support ::bytesAvailable the parsing of the
output from "df" is moved to FileUtils::bytesAvailableFromDFOutput.

Change-Id: Ia229208748aa6c572b99899e6ae042bdd5654f4a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-09-15 05:21:52 +00:00
Jarek Kobus
0b90c6c6f6 SftpFileTransfer: Don't use temporary file for batch file
Use a "-" for a batch file option "-b" what makes sftp
read batch from standard input.

Fixes: QTCREATORBUG-28167
Change-Id: I449c5ba97ea11fca090b748f0a5ee8099140a548
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-09-14 11:08:59 +00:00
Eike Ziller
9c708b79ce Merge remote-tracking branch 'origin/8.0'
Conflicts:
	src/plugins/remotelinux/killappstep.cpp

Change-Id: I4360e7d0f2c2ac258613933de81e8a9c40387379
2022-09-02 10:12:40 +02:00
Marcus Tillmanns
d4e385de06 Deviceshell: Base64 not found fallback
If no base64 is installed on the target, the shell script
cannot work. Previously this would lead to the shell functions
being unavailable.

This change adds a fallback path. In case no base64 is found,
the shell will create a process for each run request instead.

This is much slower than the shell script, but acceptable as
a fallback.

Change-Id: I70591d7e610c4e1c3c258a8e4bef354221d05cb9
Reviewed-by: hjk <hjk@qt.io>
2022-09-01 13:30:46 +00:00
hjk
7cfc3d26bc Utils: Replace FilePath part setters
... by a combined version. This will make it easier to store the parts
in one QString object.

Change-Id: Ie85a77e3957c78a30e49998fe2e617af35a8ad17
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-01 07:59:29 +00:00
Jarek Kobus
41cefa6a2b LinuxDevice: Fix kill command on remote host
Kill all the processes in the process group.
For more info see:
https://man7.org/linux/man-pages/man1/kill.1.html
https://www.baeldung.com/linux/kill-members-process-group

Fixes: QTCREATORBUG-28072
Change-Id: Id574774d16bc7d3386c6c5f80fb1d305065ec3dc
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-08-31 09:20:40 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
hjk
11648298c8 Utils: Port some FilePath part accessors to QStringView
Change-Id: Ib5cc262e44c73880b6538eed714365e3d685870a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-08-22 13:27:56 +00:00
hjk
23d9ef1adb RemoteLinux: Convert to Tr::tr
Change-Id: I1c541d392992fb37acecbb98f331e01d7b73fbc7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-22 11:11:48 +00:00
Marcus Tillmanns
3462bc67be filesystem: Add QFSEngine for filepaths
Change-Id: Ibd0c88c69863c0877138d8cc45541530c359bd9c
Reviewed-by: hjk <hjk@qt.io>
2022-07-21 13:14:01 +00:00
hjk
034acdeeb2 RemoteLinux: Inline genericlinuxdeviceconfigurationwidget.ui
Change-Id: I1f93b7886bb8d0217a9e169990e20361e540aec4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-20 09:06:45 +00:00
Marco Bubke
7dc3ff425a RemoteLinux: Fix warning
Change-Id: I644d3f62d25cb89dc054aba3c97a84f5b9afcdff
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-09 12:40:03 +00:00