|
|
@ -27,16 +27,21 @@ pub fn generate(verbose: bool) {
|
|
|
|
|
|
|
|
|
|
|
|
info!("Generating repository: {}", name);
|
|
|
|
info!("Generating repository: {}", name);
|
|
|
|
|
|
|
|
|
|
|
|
// If repository exists, delete it
|
|
|
|
// If repository exists, empty it
|
|
|
|
if Path::exists(name.as_ref()) {
|
|
|
|
if Path::exists(name.as_ref()) {
|
|
|
|
log!(verbose, "Deleting {}", name);
|
|
|
|
log!(verbose, "Deleting contents of {}", name);
|
|
|
|
fs::remove_dir_all(&name).unwrap();
|
|
|
|
Command::new("bash")
|
|
|
|
|
|
|
|
.args(&["-c", &format!("rm -rf {}/*", &name)])
|
|
|
|
|
|
|
|
.spawn()
|
|
|
|
|
|
|
|
.unwrap()
|
|
|
|
|
|
|
|
.wait()
|
|
|
|
|
|
|
|
.unwrap(); // Dirty temp hack but oh well
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
|
|
// Create dir if it doesn't exist
|
|
|
|
|
|
|
|
fs::create_dir_all(&name).unwrap();
|
|
|
|
|
|
|
|
log!(verbose, "Created {}", name);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Create or recreate repository directory
|
|
|
|
|
|
|
|
fs::create_dir_all(&name).unwrap();
|
|
|
|
|
|
|
|
log!(verbose, "Created {}", name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Copy out packages to repository directory
|
|
|
|
// Copy out packages to repository directory
|
|
|
|
Command::new("bash")
|
|
|
|
Command::new("bash")
|
|
|
|
.args(&["-c", &format!("cp -v out/* {}/", &name)])
|
|
|
|
.args(&["-c", &format!("cp -v out/* {}/", &name)])
|
|
|
|