diff options
| author | aur-build <aur-build@localhost> | 2026-11-19 17:33:17 +0000 |
|---|---|---|
| committer | aur-build <aur-build@localhost> | 2026-11-19 17:33:17 +0000 |
| commit | 4304b0f336ddba7b4ec6780795059ff2066d105b (patch) | |
| tree | 10edea744a1c2bf3fc363b4dc7f64abac8b1a0d3 /src/pkginfo.rs | |
| parent | e757979f1a2afdbe7146066345bb9acd19d3b151 (diff) | |
| download | aur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.tar.gz aur-build-4304b0f336ddba7b4ec6780795059ff2066d105b.zip | |
comments: keep only what the code cannot show
Stripped every comment that described what an item does, documented its
arguments or fields, or cited the design docs (§n, I-n, m-n, decision n).
2247 comments down to 83.
What survives: the section dividers that segment the large modules, the
secret-handling warnings, the agent wire-frame directions, and the few notes
without which the code they attach to reads as redundant, reorderable, or
unsound.
Diffstat (limited to 'src/pkginfo.rs')
| -rw-r--r-- | src/pkginfo.rs | 13 |
1 files changed, 0 insertions, 13 deletions
diff --git a/src/pkginfo.rs b/src/pkginfo.rs index be0aeb6..37646d0 100644 --- a/src/pkginfo.rs +++ b/src/pkginfo.rs @@ -1,6 +1,5 @@ use std::io::Read; -/// A package's own metadata, as `.PKGINFO` states it. #[derive(Debug, Clone, Default, PartialEq, Eq)] pub struct PkgInfo { pub name: String, @@ -19,8 +18,6 @@ pub struct PkgInfo { pub replaces: Vec<String>, } -/// One entry of a `.BUILDINFO` `installed` block: a package that was present in -/// the build root. The signature field is optional in real files. #[derive(Debug, Clone, PartialEq, Eq)] pub struct Installed { pub name: String, @@ -28,7 +25,6 @@ pub struct Installed { pub arch: String, } -/// Extract one named member from a zstd-compressed tar. fn member(bytes: &[u8], suffix: &[u8]) -> Result<String, String> { let dec = zstd::Decoder::new(std::io::Cursor::new(bytes)).map_err(|e| e.to_string())?; let mut ar = tar::Archive::new(dec); @@ -43,19 +39,14 @@ fn member(bytes: &[u8], suffix: &[u8]) -> Result<String, String> { Err(format!("no {} in package", String::from_utf8_lossy(suffix))) } -/// `.PKGINFO` as raw text. pub fn pkginfo_text(pkg_bytes: &[u8]) -> Result<String, String> { member(pkg_bytes, b".PKGINFO") } -/// `.BUILDINFO` as raw text. Absent on some hand-built packages; callers decide -/// whether that is fatal. pub fn buildinfo_text(pkg_bytes: &[u8]) -> Result<String, String> { member(pkg_bytes, b".BUILDINFO") } -/// Parse `.PKGINFO`. Unknown keys are ignored rather than rejected: makepkg adds -/// fields over time and a new one must not stop us publishing. pub fn parse_pkginfo(text: &str) -> PkgInfo { let mut p = PkgInfo::default(); for (k, v) in fields(text) { @@ -90,7 +81,6 @@ pub fn parse_installed(text: &str) -> Vec<Installed> { for line in text.lines() { if line.trim_start().starts_with("installed") { in_block = true; - // Everything after `installed =` on this line is the first entry. if let Some(rest) = line.split_once('=') { push_entry(&mut out, rest.1); } @@ -99,7 +89,6 @@ pub fn parse_installed(text: &str) -> Vec<Installed> { if !in_block { continue; } - // The block is indented; the first unindented line ends it. if !line.starts_with(' ') && !line.starts_with('\t') { in_block = false; continue; @@ -120,12 +109,10 @@ fn push_entry(out: &mut Vec<Installed>, line: &str) { } } -/// `key = value` pairs, with repeated keys preserved in order. fn fields(text: &str) -> impl Iterator<Item = (&str, &str)> { text.lines().filter_map(|l| l.split_once('=')).map(|(k, v)| (k.trim(), v.trim())) } -/// All values of one key. pub fn values_of(text: &str, key: &str) -> Vec<String> { fields(text) .filter(|(k, _)| *k == key) |
