diff options
| author | John Turner <jturner.usa@gmail.com> | 2025-12-08 22:18:39 +0000 |
|---|---|---|
| committer | John Turner <jturner.usa@gmail.com> | 2025-12-08 22:18:39 +0000 |
| commit | 0366c6234a89c3b6ab43eb899a08519e784f1beb (patch) | |
| tree | ec052adf6b3af5063a847fd45e57e01384f7c6df | |
| parent | 217d80da7f1a24b69d92809b1f279d78a46a1159 (diff) | |
| download | gentoo-utils-0366c6234a89c3b6ab43eb899a08519e784f1beb.tar.gz | |
handle Manifest.gz files in repos
| -rw-r--r-- | src/repo/mod.rs | 31 |
1 files changed, 19 insertions, 12 deletions
diff --git a/src/repo/mod.rs b/src/repo/mod.rs index 46dd895..47ed28b 100644 --- a/src/repo/mod.rs +++ b/src/repo/mod.rs @@ -1,5 +1,6 @@ use std::{ fs, io, + os::unix::ffi::OsStrExt, path::{Path, PathBuf}, }; @@ -77,12 +78,15 @@ impl Iterator for Categories { type Item = Result<Category, Error>; fn next(&mut self) -> Option<Self::Item> { - match self.1.next()? { - Ok(entry) => match read_category(entry.path()) { - Ok(category) => Some(Ok(category)), - Err(e) => Some(Err(e)), - }, - Err(e) => Some(Err(Error::ReadDir(self.0.clone(), e))), + loop { + match self.1.next()? { + Ok(entry) if entry.path().file_name().unwrap().as_bytes() == b"Manifest.gz" => (), + Ok(entry) => match read_category(entry.path()) { + Ok(category) => break Some(Ok(category)), + Err(e) => break Some(Err(e)), + }, + Err(e) => break Some(Err(Error::ReadDir(self.0.clone(), e))), + } } } } @@ -91,12 +95,15 @@ impl Iterator for Ebuilds { type Item = Result<Ebuild, Error>; fn next(&mut self) -> Option<Self::Item> { - match self.1.next()? { - Ok(entry) => match read_ebuild(entry.path()) { - Ok(ebuild) => Some(Ok(ebuild)), - Err(e) => Some(Err(e)), - }, - _ => todo!(), + loop { + match self.1.next()? { + Ok(entry) if entry.path().file_name().unwrap().as_bytes() == b"Manifest.gz" => (), + Ok(entry) => match read_ebuild(entry.path()) { + Ok(ebuild) => break Some(Ok(ebuild)), + Err(e) => break Some(Err(e)), + }, + _ => todo!(), + } } } } |
