Files
gentoo-utils/tests/depend.rs
2025-10-28 09:47:41 +00:00

32 lines
955 B
Rust

use gentoo_utils::{
Parseable,
depend::{self, Expr},
};
use mon::{Parser, eof, input::InputIter, tag, whitespace1};
use std::fs;
#[test]
fn parse_md5_cache() {
let md5_cache = "/var/db/repos/gentoo/metadata/md5-cache";
for cat in fs::read_dir(md5_cache).unwrap() {
for pkg in fs::read_dir(cat.unwrap().path()).unwrap() {
let metadata = fs::read_to_string(pkg.unwrap().path()).unwrap();
for line in metadata.lines() {
if line.starts_with("DEPEND=") {
eprintln!("{line}");
eprintln!();
Expr::parser()
.separated_list(whitespace1(), 0..)
.ignore()
.or(eof())
.preceded_by(tag("DEPEND="))
.check_finished(InputIter::new(line))
.unwrap();
}
}
}
}
}