impl DEPEND parser

This commit is contained in:
John Turner
2025-10-25 02:02:07 -04:00
parent f854e97577
commit f05c1e92ad
5 changed files with 114 additions and 0 deletions

27
tests/depend.rs Normal file
View File

@@ -0,0 +1,27 @@
use gentoo_utils::depend;
use mon::{Parser, eof, input::InputIter, tag};
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}");
depend::parsers::exprs()
.ignore()
.or(eof())
.preceded_by(tag("DEPEND="))
.check_finished(InputIter::new(line))
.unwrap();
}
}
}
}
}