add --keep-result-dir flag

This commit is contained in:
Michael Fellinger 2023-01-20 15:13:15 +01:00
parent 64c46fa016
commit 41551acc28
No known key found for this signature in database
GPG Key ID: 21627A759AC31948
3 changed files with 19 additions and 1 deletions

View File

@ -60,6 +60,12 @@ The built system profiles will be added as GC roots so that they will not be rem
The links will be created under .gcroots in the directory the Hive configuration is located.
"#)
.num_args(0))
.arg(Arg::new("keep-result-dir")
.long("keep-result-dir")
.value_name("DIR")
.help("Path to link gcroots")
.long_help("Path to a directory where the gcroots will be linked")
.default_value(".gcroots"))
.arg(Arg::new("verbose")
.short('v')
.long("verbose")
@ -213,6 +219,9 @@ pub async fn run(_global_args: &ArgMatches, local_args: &ArgMatches) -> Result<(
if local_args.get_flag("keep-result") {
options.set_create_gc_roots(true);
if let Some(dir) = local_args.get_one::<String>("keep-result-dir") {
options.set_create_gc_roots_dir(dir.to_owned());
}
}
if local_args.get_flag("no-build-on-target") {

View File

@ -523,7 +523,9 @@ impl Deployment {
job.run_waiting(|job| async move {
if let Some(dir) = arc_self.hive.context_dir() {
job.state(JobState::Running)?;
let path = dir.join(".gcroots").join(format!("node-{}", &*target.name));
let path = dir
.join(self.options.create_gc_roots_dir.to_owned())
.join(format!("node-{}", &*target.name));
profile_r.create_gc_root(&path).await?;
} else {

View File

@ -25,6 +25,8 @@ pub struct Options {
/// directory if it exists.
pub(super) create_gc_roots: bool,
pub(super) create_gc_roots_dir: String,
/// Whether to override per-node setting to build on the nodes themselves.
pub(super) force_build_on_target: Option<bool>,
@ -63,6 +65,10 @@ impl Options {
self.create_gc_roots = enable;
}
pub fn set_create_gc_roots_dir(&mut self, dir: String) {
self.create_gc_roots_dir = dir;
}
pub fn set_force_build_on_target(&mut self, enable: bool) {
self.force_build_on_target = Some(enable);
}
@ -92,6 +98,7 @@ impl Default for Options {
upload_keys: true,
reboot: false,
create_gc_roots: false,
create_gc_roots_dir: String::from(".gcroots"),
force_build_on_target: None,
force_replace_unknown_profiles: false,
evaluator: EvaluatorType::Chunked,