indexer: Support for indexing FreeBSD <9.3 repositories

This commit is contained in:
Yorhel 2016-12-11 10:59:54 +01:00
parent 1ca0cd4325
commit defaa032f8
9 changed files with 892 additions and 826 deletions

View file

@ -19,6 +19,7 @@ mod open;
mod pkg;
mod sys_arch;
mod sys_deb;
mod sys_freebsd1;
// Convenience function to get a system id by short-name. Panics if the system doesn't exist.
@ -60,6 +61,12 @@ fn main() {
(@arg contents: --contents +takes_value "Contents file")
(@arg packages: --packages +required +takes_value "Packages file")
)
(@subcommand freebsd1 =>
(about: "Index packages from a FreeBSD <= 9.2 package repo")
(@arg sys: --sys +required +takes_value "System short-name")
(@arg mirror: --mirror +required +takes_value "Mirror URL (should point to the packages/ dir)")
(@arg arch: --arch +required +takes_value "Arch")
)
).get_matches();
unsafe { pkg::DRY_RUN = arg.is_present("dry") };
@ -93,6 +100,7 @@ fn main() {
if let Some(matches) = arg.subcommand_matches("pkg") {
let date = match matches.value_of("date").unwrap() {
"deb" => pkg::Date::Deb,
"desc" => pkg::Date::Desc,
s => pkg::Date::Known(s),
};
pkg::pkg(&db, pkg::PkgOpt {
@ -124,5 +132,13 @@ fn main() {
);
}
if let Some(matches) = arg.subcommand_matches("freebsd1") {
sys_freebsd1::sync(&db,
sysbyshort(&db, matches.value_of("sys").unwrap()),
matches.value_of("arch").unwrap(),
matches.value_of("mirror").unwrap()
).unwrap_or_else(|e| error!("{}", e));
}
trace!("Exiting");
}