indexer: Fix bug in Contents file parsing + decrease cron verbosity
Turns out that not all Contents files heave a header.
This commit is contained in:
parent
eb15b6e2c7
commit
b79ecfb284
2 changed files with 9 additions and 10 deletions
|
|
@ -18,21 +18,20 @@ fn get_contents(f: Option<open::Path>) -> Result<HashSet<String>> {
|
||||||
let rd = archive::Archive::open_raw(&mut fd)?;
|
let rd = archive::Archive::open_raw(&mut fd)?;
|
||||||
let brd = BufReader::new(rd);
|
let brd = BufReader::new(rd);
|
||||||
let mut pkgs = HashSet::new();
|
let mut pkgs = HashSet::new();
|
||||||
let mut filecnt = -1;
|
let mut filecnt = 0;
|
||||||
let mut mancnt = 0;
|
let mut mancnt = 0;
|
||||||
|
|
||||||
for line in brd.split(b'\n') {
|
for line in brd.split(b'\n') {
|
||||||
let line = line?;
|
let line = line?;
|
||||||
let line = match str::from_utf8(&line) { Ok(x) => x, _ => continue };
|
let line = match str::from_utf8(&line) { Ok(x) => x, _ => continue };
|
||||||
if line.starts_with("FILE ") {
|
let mut it = line.split(' ');
|
||||||
filecnt = 0;
|
|
||||||
continue;
|
let pkg = it.next_back().unwrap();
|
||||||
} else if filecnt < 0 {
|
if !pkg.contains('/') || pkg == "LOCATION" {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
filecnt += 1;
|
filecnt += 1;
|
||||||
let mut it = line.split(' ');
|
|
||||||
let pkg = it.next_back().unwrap();
|
|
||||||
let path = it.fold(String::new(), |acc, x| acc + " " + x);
|
let path = it.fold(String::new(), |acc, x| acc + " " + x);
|
||||||
if man::ismanpath(&path.trim()) {
|
if man::ismanpath(&path.trim()) {
|
||||||
mancnt += 1;
|
mancnt += 1;
|
||||||
|
|
@ -42,7 +41,7 @@ fn get_contents(f: Option<open::Path>) -> Result<HashSet<String>> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
debug!("Found {}/{} man files in {} relevant packages from {}", mancnt, filecnt, pkgs.len(), f.path);
|
info!("Found {}/{} man files in {} relevant packages from {}", mancnt, filecnt, pkgs.len(), f.path);
|
||||||
Ok(pkgs)
|
Ok(pkgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ test -f .config && source ./.config
|
||||||
|
|
||||||
|
|
||||||
index() {
|
index() {
|
||||||
echo "====> indexer -vv $@"
|
echo "====> indexer -v $@"
|
||||||
./indexer -vv $@ 2>&1
|
./indexer -v $@ 2>&1
|
||||||
echo
|
echo
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue