summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name
diff options
context:
space:
mode:
authorSoispha Peetz <soispha@b-peetz.de>2026-11-27 00:52:07 +0100
committerSoispha Peetz <soispha@b-peetz.de>2026-11-28 23:58:38 +0100
commit7642c2214df4735de351151c623c632fe3d6e320 (patch)
treef51dfc7df273d909ba16d11ddd6c8e02d792448b /pkgs/by-name
parent{flake,pkgs/update_pkgs.sh}: Use main devShell for updating the pkgs (diff)
downloadnixos-config-7642c2214df4735de351151c623c632fe3d6e320.zip
pkgs/rollup: Make it easier to add missing .rollup.owner files
Diffstat (limited to 'pkgs/by-name')
-rw-r--r--pkgs/by-name/ro/rollup/src/main.rs39
1 files changed, 32 insertions, 7 deletions
diff --git a/pkgs/by-name/ro/rollup/src/main.rs b/pkgs/by-name/ro/rollup/src/main.rs
index a2b661b1..cd91842a 100644
--- a/pkgs/by-name/ro/rollup/src/main.rs
+++ b/pkgs/by-name/ro/rollup/src/main.rs
@@ -6,6 +6,7 @@ use std::{
io::Write,
path::{Path, PathBuf},
process::{Command, Stdio},
+ sync::RwLock,
};
use anyhow::{Context, Result, bail};
@@ -294,7 +295,7 @@ fn apply_patches(
if applies_to.join(path).try_exists()? {
bail!("A file was added, that already existed. This should be impossible.")
}
- if target_is_owning_path(&config.drop_ins, owner, &root, path)? {
+ if target_is_owning_path(&config.drop_ins, owner, &root, path, dry_run)? {
final_diffs.push(file_diff.to_owned());
}
}
@@ -360,6 +361,16 @@ fn apply_patches(
}
}
+ if dry_run {
+ let ownerless_paths = PATHS_WITHOUT_OWNERSHIP.read().unwrap();
+ if !ownerless_paths.is_empty() {
+ eprintln!("\n\nPaths without ownership information:");
+ for path in &*ownerless_paths {
+ eprintln!(" - {}", path.display());
+ }
+ }
+ }
+
Ok(())
}
@@ -387,11 +398,14 @@ fn check_owner(owner: &Owner) -> Result<()> {
Ok(())
}
+static PATHS_WITHOUT_OWNERSHIP: RwLock<Vec<PathBuf>> = RwLock::new(vec![]);
+
fn target_is_owning_path(
drop_ins: &HashMap<PathBuf, DropInConfig>,
owner: &Owner,
root: &Path,
path: &Path,
+ dry_run: bool,
) -> Result<bool> {
let file_name = path.file_name().expect("All paths are to files");
if file_name == OsStr::new(DROP_IN_NAME) || file_name == OsStr::new(MAIN_CONFIG_NAME) {
@@ -440,10 +454,21 @@ fn target_is_owning_path(
parent = next;
}
- eprintln!(
- "Warning: There was no drop-in config defining path ownership for: `{}`.
- Assuming inclusion.",
- path.display()
- );
- Ok(true)
+ if dry_run {
+ eprintln!(
+ "Warning: There was no drop-in config defining path ownership for: `{}`.
+ Assuming inclusion (only works for --dry-run).",
+ path.display()
+ );
+ PATHS_WITHOUT_OWNERSHIP
+ .write()
+ .unwrap()
+ .push(path.to_owned());
+ Ok(true)
+ } else {
+ bail!(
+ "There was no drop-in config defining path ownership for: `{}`.",
+ path.display()
+ )
+ }
}