[neon/qt/qtchooser/Neon/release] debian/patches: add support for letting qtchooser fall into command not found

Harald Sitter null at kde.org
Thu Aug 26 14:33:09 BST 2021


Git commit d16b722fa5f364285ad41b8db1d38b289fd76276 by Harald Sitter.
Committed on 26/08/2021 at 13:30.
Pushed by sitter into branch 'Neon/release'.

add support for letting qtchooser fall into command not found

...using the full path of the default sdk

this then allows us to provide cnf data that feeds into the c-n-f
database and gets printed when the backing binary is not present

e.g. qmlscene gets resolved to /usr/lib/qt5/bin/qmlscene and we have
that in our cnf data mapped to qmlscene so then qtchooser tells the user
to install qmlscene, the package

A  +26   -0    debian/patches/neon_01_command_not_found.patch
A  +1    -0    debian/patches/series

https://invent.kde.org/neon/qt/qtchooser/commit/d16b722fa5f364285ad41b8db1d38b289fd76276

diff --git a/debian/patches/neon_01_command_not_found.patch b/debian/patches/neon_01_command_not_found.patch
new file mode 100644
index 0000000..ef20b1e
--- /dev/null
+++ b/debian/patches/neon_01_command_not_found.patch
@@ -0,0 +1,26 @@
+Index: qtchooser-66/src/qtchooser/main.cpp
+===================================================================
+--- qtchooser-66.orig/src/qtchooser/main.cpp
++++ qtchooser-66/src/qtchooser/main.cpp
+@@ -542,11 +542,21 @@ Sdk ToolWrapper::selectSdk(const string
+ {
+     // First, try the requested SDK
+     Sdk matchedSdk = iterateSdks(targetSdk, &ToolWrapper::matchSdk);
++    const Sdk mainSdk = matchedSdk;
+     if (targetSdk.empty() && !matchedSdk.hasTool(targetTool) && fallbackAllowed(targetTool)) {
+         // If a tool was requested, fall back to any SDK that has it
+         matchedSdk = iterateSdks(string(), &ToolWrapper::matchSdk, 0, targetTool);
+     }
+     if (!matchedSdk.isValid()) {
++        if (mainSdk.isValid() && mainSdk.toolsPath.length() > 0) {
++            char cmd[2048];
++            const int printed =
++                snprintf(cmd, 2048, "/usr/lib/command-not-found -- %s/%s",
++                         mainSdk.toolsPath.c_str(), targetTool.c_str());
++            if (printed >= 0 && printed <= 2048) {
++                (void)system(cmd);
++            }
++        }
+         fprintf(stderr, "%s: could not find a Qt installation of '%s'\n", argv0, targetSdk.c_str());
+     }
+     return matchedSdk;
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..3fc21df
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+neon_01_command_not_found.patch


More information about the Neon-commits mailing list