summaryrefslogtreecommitdiff
path: root/src/resolver.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/resolver.rs')
-rw-r--r--src/resolver.rs32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/resolver.rs b/src/resolver.rs
index 33c67e2..bee1681 100644
--- a/src/resolver.rs
+++ b/src/resolver.rs
@@ -255,6 +255,38 @@ pub fn check_conflicts(required: &HashSet<String>, installed_db: &InstalledDB) -
}
}
+ const STRICT_ROLES: &[&str] = &["init-system", "libc", "core-utils", "udev"];
+ for &role in STRICT_ROLES {
+ let mut providers_in_required = Vec::new();
+ for (name, pkg) in &pkg_map {
+ if pkg.provides.contains(&role.to_string()) {
+ providers_in_required.push(name.clone());
+ }
+ }
+ if providers_in_required.len() > 1 {
+ return Err(format!(
+ "CRITICAL: multiple packages in the transaction provide '{}': {}. Only one '{}' provider is allowed at once.",
+ role, providers_in_required.join(", "), role
+ ));
+ }
+
+ if let Some(cand) = providers_in_required.first() {
+ for (inst_name, _) in &installed_db.packages {
+ if inst_name == cand {
+ continue;
+ }
+ if let Some(inst_pkg) = load_package(inst_name) {
+ if inst_pkg.provides.contains(&role.to_string()) {
+ return Err(format!(
+ "CRITICAL: '{}' provides '{}', but '{}' is already installed and provides it. Multiple '{}' providers violate RorkOS system rules. Use 'ror di {} {}' to replace it atomically.",
+ cand, role, inst_name, role, inst_name, cand
+ ));
+ }
+ }
+ }
+ }
+ }
+
let names: Vec<_> = pkg_map.keys().cloned().collect();
for i in 0..names.len() {
for j in i + 1..names.len() {