summaryrefslogtreecommitdiff
path: root/indexer
diff options
context:
space:
mode:
authorYorhel <git@yorhel.nl>2016-11-27 10:48:32 +0100
committerYorhel <git@yorhel.nl>2016-11-27 10:48:35 +0100
commitb79ecfb284d57f18c864b905fa5f96905bec5366 (patch)
treec38dd29c821f700ff77be8c3dc39827a347bd87f /indexer
parenteb15b6e2c7749e90be443816d2deb0f2a645e691 (diff)
indexer: Fix bug in Contents file parsing + decrease cron verbosity
Turns out that not all Contents files heave a header.
Diffstat (limited to 'indexer')
-rw-r--r--indexer/src/sys_deb.rs15
1 files changed, 7 insertions, 8 deletions
diff --git a/indexer/src/sys_deb.rs b/indexer/src/sys_deb.rs
index 4937b5c..82facaf 100644
--- a/indexer/src/sys_deb.rs
+++ b/indexer/src/sys_deb.rs
@@ -18,21 +18,20 @@ fn get_contents(f: Option<open::Path>) -> Result<HashSet<String>> {
let rd = archive::Archive::open_raw(&mut fd)?;
let brd = BufReader::new(rd);
let mut pkgs = HashSet::new();
- let mut filecnt = -1;
+ let mut filecnt = 0;
let mut mancnt = 0;
for line in brd.split(b'\n') {
let line = line?;
let line = match str::from_utf8(&line) { Ok(x) => x, _ => continue };
- if line.starts_with("FILE ") {
- filecnt = 0;
- continue;
- } else if filecnt < 0 {
+ let mut it = line.split(' ');
+
+ let pkg = it.next_back().unwrap();
+ if !pkg.contains('/') || pkg == "LOCATION" {
continue;
}
filecnt += 1;
- let mut it = line.split(' ');
- let pkg = it.next_back().unwrap();
+
let path = it.fold(String::new(), |acc, x| acc + " " + x);
if man::ismanpath(&path.trim()) {
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)
}