Verified Commit ff820963 authored by Jelle van der Waa's avatar Jelle van der Waa 🚧
Browse files

Add option to specify repositories via cli

To make it easier to test and to be flexible in the future by adding
testing or new repositories via the cli.
parent 5deaaab1
Pipeline #2968 failed with stages
in 27 seconds
......@@ -70,6 +70,7 @@ fn write_dotfile(filename: String, graph: DiGraph<&str, u16>) -> Result<(), Box<
pub fn run(
pkgnames: Vec<String>,
dbpath: Option<String>,
repos: Vec<String>,
dotfile: Option<String>,
) -> Result<String, Box<dyn Error>> {
let pacman = match dbpath {
......@@ -82,10 +83,10 @@ pub fn run(
}
let pacman = pacman?;
let _core = pacman.register_syncdb("core", SigLevel::DATABASE_OPTIONAL);
let _extra = pacman.register_syncdb("extra", SigLevel::DATABASE_OPTIONAL);
let _community = pacman.register_syncdb("community", SigLevel::DATABASE_OPTIONAL);
let _multilib = pacman.register_syncdb("multilib", SigLevel::DATABASE_OPTIONAL);
for repo in repos {
let _repo = pacman.register_syncdb(&repo, SigLevel::DATABASE_OPTIONAL);
}
let reverse_deps_map = get_reverse_deps_map(&pacman)?;
for pkg in &pkgnames {
......
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
#[structopt(name = "rebuilder", about, author)]
struct Args {
......@@ -7,6 +8,10 @@ struct Args {
#[structopt(min_values = 1, required = true)]
pkgnames: Vec<String>,
/// Repositories
#[structopt(default_value = "core,extra,community,multilib", long, use_delimiter = true)]
repos: Vec<String>,
/// The path to the pacman database, default ( /var/lib/pacman )
#[structopt(long)]
dbpath: Option<String>,
......@@ -18,7 +23,7 @@ struct Args {
fn main() {
let args = Args::from_args();
match rebuilder::run(args.pkgnames, args.dbpath, args.dotfile) {
match rebuilder::run(args.pkgnames, args.dbpath, args.repos, args.dotfile) {
Ok(output) => {
println!("{}", output);
std::process::exit(0);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment