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; fn next(&mut self) -> Option { - 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; fn next(&mut self) -> Option { - 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!(), + } } } }