indexer: Add file caching + Arch Linux indexing

This commit is contained in:
Yorhel 2016-11-06 13:34:22 +01:00
parent 35fab522d6
commit 1ca43665a1
6 changed files with 295 additions and 39 deletions

View file

@ -9,11 +9,15 @@ extern crate ring;
extern crate encoding;
extern crate postgres;
extern crate hyper;
extern crate url;
extern crate chrono;
mod archive;
mod archread;
mod man;
mod open;
mod pkg;
mod sys_arch;
// Convenience function to get a system id by short-name. Panics if the system doesn't exist.
@ -40,6 +44,12 @@ fn main() {
(@arg date: --date +required +takes_value "Package release date")
(@arg FILE: +required "Package file")
)
(@subcommand arch =>
(about: "Index an Arch Linux repository")
(@arg sys: --sys +required +takes_value "System short-name")
(@arg mirror: --mirror +required +takes_value "Mirror URL")
(@arg repo: --repo +required +takes_value "Repository name")
)
).get_matches();
let verbose = arg.occurrences_of("v");
@ -71,7 +81,15 @@ fn main() {
pkg: matches.value_of("pkg").unwrap(),
ver: matches.value_of("ver").unwrap(),
date: matches.value_of("date").unwrap(),
file: matches.value_of("FILE").unwrap()
file: open::Path{ path: matches.value_of("FILE").unwrap(), cache: false, canbelocal: true},
});
}
if let Some(matches) = arg.subcommand_matches("arch") {
sys_arch::sync(&db,
sysbyshort(&db, matches.value_of("sys").unwrap()),
matches.value_of("mirror").unwrap(),
matches.value_of("repo").unwrap()
);
}
}