From 4304b0f336ddba7b4ec6780795059ff2066d105b Mon Sep 17 00:00:00 2001 From: aur-build Date: Thu, 19 Nov 2026 17:33:17 +0000 Subject: comments: keep only what the code cannot show MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- src/pkginfo.rs | 13 ------------- 1 file changed, 13 deletions(-) (limited to 'src/pkginfo.rs') 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, } -/// 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 { 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 { Err(format!("no {} in package", String::from_utf8_lossy(suffix))) } -/// `.PKGINFO` as raw text. pub fn pkginfo_text(pkg_bytes: &[u8]) -> Result { 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 { 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 { 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 { 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, line: &str) { } } -/// `key = value` pairs, with repeated keys preserved in order. fn fields(text: &str) -> impl Iterator { 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 { fields(text) .filter(|(k, _)| *k == key) -- cgit v1.2.3