[sdk/kde-builder] kde_builder_lib: ! feat: Do not include dependencies of projects that were blanked-out in branch-group

Andrew Shark <[email protected]>
Newsgroups gmane.comp.kde.cvs
Message-ID <[email protected]>
Git commit 8d200840194c0fee6143eaa4ae2c1fa43cbcb2a9 by Andrew Shark.
Committed on 21/07/2026 at 23:32.
Pushed by ashark into branch 'master'.

! feat: Do not include dependencies of projects that were blanked-out in branch-group

Projects with blanked-out branch group (the empty string in their value)
should be treated as ignored.
So we should also ignore direct dependencies of ignored projects.

Note that some dependencies of such projects may still be pulled
by *other* projects.

Example:
We are going to run `kde-builder kiconthemes --include-dependencies`.
We have such dependency tree:

 ── kiconthemes
    ├── breeze-icons
    │   └── extra-cmake-modules
    ├── extra-cmake-modules
    ├── karchive
    │   └── extra-cmake-modules
    ├── kcolorscheme  # <- Imagine kcolorscheme is blanked-out
    │   ├── extra-cmake-modules
    │   ├── kconfig
    │   │   └── extra-cmake-modules
    │   ├── kguiaddons  # <- No other project in this build require kguiaddons
    │   │   ├── extra-cmake-modules
    │   │   ├── plasma-wayland-protocols
    │   │   │   ├── extra-cmake-modules
    │   │   │   └── wayland
    │   │   ├── wayland-protocols
    │   │   └── wayland
    │   └── ki18n  # <- ki18n as a dependency of kcolorscheme
    │       └── extra-cmake-modules
    ├── kconfig
    │   └── extra-cmake-modules
    ├── ki18n  # <- ki18n as a dependency of kiconthemes
    │   └── extra-cmake-modules
    └── kwidgetsaddons
        └── extra-cmake-modules

Let us imagine that kcolorscheme is blanked-out.

Will ki18n be appeared in the final list of projects?
Yes, but that is because of kiconthemes depends on it directly.

Will kguiaddons be appeared in the final list of projects?
No, because kcolorscheme is blanked-out, and in this build
no any other project depends on kguiaddons.

M  +19   -8    kde_builder_lib/dependency_resolver.py

https://invent.kde.org/sdk/kde-builder/-/commit/8d200840194c0fee6143eaa4ae2c1fa43cbcb2a9

diff --git a/kde_builder_lib/dependency_resolver.py b/kde_builder_lib/dependency_resolver.py
index 7a1a6845..8661f681 100644
--- a/kde_builder_lib/dependency_resolver.py
+++ b/kde_builder_lib/dependency_resolver.py
@@ -400,12 +400,23 @@ class DependencyResolver:
 
             else:
                 dep_module: Module | None = self.module_resolver.resolve_module_if_present(dep_item)
-                if dep_module:
-                    resolved_path = DependencyResolver._get_dependency_path_of(dep_module)
-                    logger_depres.debug(f"\tUsing path: \"b[{resolved_path}]\" for item: b[{item}]")
-                else:
-                    resolved_path = dep_path
-                    logger_depres.debug(f"\tGuessing path: \"b[{resolved_path}]\" for item: b[{item}]")
+                if not dep_module:
+                    # Still, we will place the graph entry, so that --dependency-tree could show the not-built project in tree.
+                    module_graph[dep_item] = {
+                        "votes": {},
+                        "path": "",
+                        "build": False,
+                        "branch": "",
+                        "deps": {},
+                        "all_deps": {},
+                        "module": None,
+                        "traces": {}
+                    }
+
+                    continue
+
+                resolved_path = DependencyResolver._get_dependency_path_of(dep_module)
+                logger_depres.debug(f"\tUsing path: \"b[{resolved_path}]\" for item: b[{item}]")
 
                 dep_lookup_result = self._lookup_direct_dependencies(resolved_path, dep_branch)
 
@@ -415,7 +426,7 @@ class DependencyResolver:
                 module_graph[dep_item] = {
                     "votes": {},
                     "path": resolved_path,
-                    "build": dep_module and True if include_dependencies else False,
+                    "build": include_dependencies,
                     "branch": dep_branch,
                     "deps": dep_lookup_result["dependencies"],
                     "all_deps": {},
@@ -433,7 +444,7 @@ class DependencyResolver:
                 if not module_graph[dep_item]["build"]:
                     logger_depres.debug(f" y[b[*] {item} depends on {dep_item}, but no project builds {dep_item} for this run.]")
 
-                if dep_module and dep_branch and (self._get_branch_of(dep_module) or "") != dep_branch:
+                if dep_branch and (self._get_branch_of(dep_module) or "") != dep_branch:
                     wrong_branch = self._get_branch_of(dep_module) or "?"
                     logger_depres.error(f" r[b[*] {item} needs {dep_item}:{pretty_dep_branch}, not {dep_item}:{wrong_branch}]")
                     errors["branch_errors"] += 1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.