diff mbox series

[5/7] devtool: ide-sdk: move the loopback target helpers to ide_plugins

Message ID 20260917183832.998361-6-adrian.freihofer@siemens.com
State New
Headers show
Series oe-selftest: devtool ide-sdk: make slirp tests port collision proof | expand

Commit Message

AdrianF Sept. 17, 2026, 6:37 p.m. UTC
From: Adrian Freihofer <adrian.freihofer@siemens.com>

The debugger configuration classes in ide_plugins need to know whether
the target loops back to the local machine, which is where the slirp
port forwarding they have to deal with exists. They cannot import
ide_sdk for it, since ide_sdk imports them.

No functional change.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 scripts/lib/devtool/ide_plugins/__init__.py | 14 ++++++++++++++
 scripts/lib/devtool/ide_sdk.py              | 16 +---------------
 2 files changed, 15 insertions(+), 15 deletions(-)
diff mbox series

Patch

diff --git a/scripts/lib/devtool/ide_plugins/__init__.py b/scripts/lib/devtool/ide_plugins/__init__.py
index 333ec9bac8..2cdb2e504a 100644
--- a/scripts/lib/devtool/ide_plugins/__init__.py
+++ b/scripts/lib/devtool/ide_plugins/__init__.py
@@ -15,6 +15,20 @@  from devtool import DevtoolError
 logger = logging.getLogger('devtool')
 
 
+# Hosts a ssh target is considered to loop back to the local machine, e.g. a
+# QEMU instance reached through slirp/hostfwd port forwarding (root@localhost)
+# which has an ephemeral ssh host key that changes on every boot.
+LOOPBACK_HOSTS = ('localhost', '127.0.0.1', '::1')
+
+
+def target_host(target):
+    return target.split('@')[-1]
+
+
+def is_loopback_target(target):
+    return target_host(target) in LOOPBACK_HOSTS
+
+
 class BuildTool(Enum):
     UNDEFINED = auto()
     CMAKE = auto()
diff --git a/scripts/lib/devtool/ide_sdk.py b/scripts/lib/devtool/ide_sdk.py
index a2b15ce440..a987c37f06 100755
--- a/scripts/lib/devtool/ide_sdk.py
+++ b/scripts/lib/devtool/ide_sdk.py
@@ -25,7 +25,7 @@  import bb
 from devtool import exec_build_env_command, setup_tinfoil, check_workspace_recipe, DevtoolError, parse_recipe
 from devtool.standard import get_real_srctree
 from devtool.deploy import parse_packages_arg
-from devtool.ide_plugins import BuildTool, DebuggerCrossConfig
+from devtool.ide_plugins import BuildTool, DebuggerCrossConfig, LOOPBACK_HOSTS, is_loopback_target
 from oe.kernel_module import kernel_module_os_env
 from pseudo_rootfs_utils import PseudoRootfsError, extract_sdk_rootfs, pseudo_state_dir
 
@@ -48,20 +48,6 @@  class DevtoolIdeMode(Enum):
     shared = 'shared'
 
 
-# Hosts a ssh target is considered to loop back to the local machine, e.g. a
-# QEMU instance reached through slirp/hostfwd port forwarding (root@localhost)
-# which has an ephemeral ssh host key that changes on every boot.
-LOOPBACK_HOSTS = ('localhost', '127.0.0.1', '::1')
-
-
-def target_host(target):
-    return target.split('@')[-1]
-
-
-def is_loopback_target(target):
-    return target_host(target) in LOOPBACK_HOSTS
-
-
 class TargetDevice:
     """SSH remote login parameters"""