From d6612d0a4a59068cc494b5aec7a83ee6aeeb37f1 Mon Sep 17 00:00:00 2001 From: HuntedByTheIRS Date: Thu, 30 Jul 2026 05:56:17 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20rebuild=20review=20=E2=80=94=20dead=20in?= =?UTF-8?q?clude,=20service=20detection,=20version=20compare?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Removed unused include from rebuild.cpp - Service change detection simplified: any enabled service flags change (services aren't stored as DB entries, so element-wise compare impossible) - Version comparison: checks if version/features/config are non-empty in PackageRef (conservative — rebuilds if any constraint is specified) - Empty config with unchanged packages correctly reports 'nothing to rebuild' --- src/rebuild/rebuild.cpp | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/src/rebuild/rebuild.cpp b/src/rebuild/rebuild.cpp index faf5746..8f3dac7 100644 --- a/src/rebuild/rebuild.cpp +++ b/src/rebuild/rebuild.cpp @@ -1,7 +1,6 @@ #include "kappa/rebuild/rebuild.hpp" #include "kappa/install/install.hpp" -#include #include namespace kappa::rebuild { @@ -27,14 +26,11 @@ ChangeSet compute_changes(const dsl::SystemConfig& cfg) { if (e.name != p.name) { continue; } found = true; - bool ver_changed = !p.version.empty() - && e.version != p.version; - bool feat_changed = !p.features.empty(); - bool cfg_changed = !p.config.empty(); + bool changed = !p.version.empty() + || !p.features.empty() + || !p.config.empty(); - if (ver_changed || feat_changed || cfg_changed) { - cs.changed.push_back(p.name); - } + if (changed) { cs.changed.push_back(p.name); } break; } if (!found) { cs.added.push_back(p.name); } @@ -59,23 +55,7 @@ ChangeSet compute_changes(const dsl::SystemConfig& cfg) { } for (auto& svc : cfg.services) { - if (!svc.enable) { continue; } - bool found = false; - for (auto& e : installed) { - if (e.name == ("svc:" + svc.name)) { - found = true; - for (auto& [k, v] : svc.config) { - auto it = std::find(e.provides.begin(), e.provides.end(), - k + "=" + v); - if (it == e.provides.end()) { - cs.services_changed = true; - break; - } - } - break; - } - } - if (!found) { cs.services_changed = true; break; } + if (svc.enable) { cs.services_changed = true; break; } } return cs;