summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--examples/packages/example_1/config.toml1
-rw-r--r--src/cli.rs14
-rw-r--r--src/commands/source.rs5
3 files changed, 20 insertions, 0 deletions
diff --git a/examples/packages/example_1/config.toml b/examples/packages/example_1/config.toml
index 29e9465..25d5401 100644
--- a/examples/packages/example_1/config.toml
+++ b/examples/packages/example_1/config.toml
@@ -5,6 +5,7 @@ repository = "/tmp/butido_example_1"
releases = "/tmp/butido-releases"
staging = "/tmp/butido-staging"
+source_cache = "/tmp/butido-sources"
# ####
#
diff --git a/src/cli.rs b/src/cli.rs
index da5efaa..796b921 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -289,6 +289,13 @@ pub fn cli<'a>() -> App<'a> {
.value_name("PKG")
.help("Verify the sources of this package (optional, if left out, all packages are checked)")
)
+ .arg(Arg::with_name("package_version")
+ .required(false)
+ .multiple(false)
+ .index(2)
+ .value_name("VERSION")
+ .help("Verify the sources of this package version (optional, if left out, all packages are checked)")
+ )
)
.subcommand(App::new("list-missing")
.about("List packages where the source is missing")
@@ -302,6 +309,13 @@ pub fn cli<'a>() -> App<'a> {
.value_name("PKG")
.help("Verify the sources of this package (optional, if left out, all packages are checked)")
)
+ .arg(Arg::with_name("package_version")
+ .required(false)
+ .multiple(false)
+ .index(2)
+ .value_name("VERSION")
+ .help("Verify the sources of this package version (optional, if left out, all packages are checked)")
+ )
)
)
diff --git a/src/commands/source.rs b/src/commands/source.rs
index 25efcce..81dd98f 100644
--- a/src/commands/source.rs
+++ b/src/commands/source.rs
@@ -8,6 +8,7 @@ use clap_v3::ArgMatches;
use crate::config::*;
use crate::package::PackageName;
+use crate::package::PackageVersionConstraint;
use crate::repository::Repository;
use crate::source::*;
@@ -26,9 +27,11 @@ pub async fn verify<'a>(matches: &ArgMatches, config: &Configuration<'a>, repo:
let source_cache_root = PathBuf::from(config.source_cache_root());
let sc = SourceCache::new(source_cache_root);
let pname = matches.value_of("package_name").map(String::from).map(PackageName::from);
+ let pvers = matches.value_of("package_version").map(String::from).map(PackageVersionConstraint::new).transpose()?;
repo.packages()
.filter(|p| pname.as_ref().map(|n| p.name() == n).unwrap_or(true))
+ .filter(|p| pvers.as_ref().map(|v| v.matches(p.version())).unwrap_or(true))
.map(|p| {
let source = sc.source_for(p);
async move {
@@ -73,9 +76,11 @@ pub async fn url<'a>(matches: &ArgMatches, config: &Configuration<'a>, repo: Rep
let mut outlock = out.lock();
let pname = matches.value_of("package_name").map(String::from).map(PackageName::from);
+ let pvers = matches.value_of("package_version").map(String::from).map(PackageVersionConstraint::new).transpose()?;
repo.packages()
.filter(|p| pname.as_ref().map(|n| p.name() == n).unwrap_or(true))
+ .filter(|p| pvers.as_ref().map(|v| v.matches(p.version())).unwrap_or(true))
.map(|p| writeln!(outlock, "{} {} -> {}", p.name(), p.version(), p.source().url()).map_err(Error::from))
.collect()
}