diff options
author | sternenseemann <0rpkxez4ksa01gb3typccl0i@systemli.org> | 2021-02-14 22:03:01 +0100 |
---|---|---|
committer | sternenseemann <sternenseemann@systemli.org> | 2021-02-25 19:52:33 +0100 |
commit | 1afdcc045e8118741903616aa51a1b9726a8f909 (patch) | |
tree | a5bf3d6eae8fa104f375e2cd3a5858965e630fa8 /pkgs/profpatsch/nman | |
parent | 2be83b9b99a31fe46528b5d9a2a915c18ac46434 (diff) |
pkgs/profpatsch/nman: repurpose old path field in DrvWithOutput
The path field wasn't used in DrvWithOutput as we only ever needed rendered. rendered however is a bit of a confusing name as it is not in fact fully rendered in all cases. Since we can pass rendered to nix-store --realise without preprocessing in all cases we rename it to path and add a note in the documentation. The old path field is removed for this without replacement.
Diffstat (limited to 'pkgs/profpatsch/nman')
-rw-r--r-- | pkgs/profpatsch/nman/nman.rs | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/pkgs/profpatsch/nman/nman.rs b/pkgs/profpatsch/nman/nman.rs index 0ea99d99..d3f60f7a 100644 --- a/pkgs/profpatsch/nman/nman.rs +++ b/pkgs/profpatsch/nman/nman.rs @@ -109,20 +109,23 @@ impl<'a> DrvOutput<'a> { /// coupled with a parsed [`DrvOutput`] /// for sorting purposes. struct DrvWithOutput<'a> { + /// The original derivation path as printed + /// by `nix-instantiate` _including_ the output + /// indicator if `output` is not [`DrvOutput::Out`] path: &'a [u8], + /// The parsed output of `path` for sorting purposes output: DrvOutput<'a>, - rendered: &'a [u8], } impl DrvWithOutput<'_> { fn render(&self) -> OsString { match self.output { DrvOutput::Out => { - let mut r = OsStr::from_bytes(self.rendered).to_os_string(); + let mut r = OsStr::from_bytes(self.path).to_os_string(); r.push("!out"); r } - _ => OsStr::from_bytes(self.rendered).to_os_string(), + _ => OsStr::from_bytes(self.path).to_os_string(), } } } @@ -133,16 +136,15 @@ impl<'a> DrvWithOutput<'a> { /// structure. fn parse(drv_path: &'a [u8]) -> Option<Self> { let mut split = drv_path.split(|c| char::from(*c) == '!'); - let path = split.next().filter(|s| s.len() > 0)?; + let _ = split.next().filter(|s| s.len() > 0)?; let output = split.next() .map(DrvOutput::parse) .unwrap_or(DrvOutput::Out); match split.next() { None => Some(DrvWithOutput { - path: path, + path: drv_path, output: output, - rendered: drv_path, }), Some(_) => None, } |