From 7cf677e1fc9c0b7139113d078f025104ba7fb4cd Mon Sep 17 00:00:00 2001 From: David Ko Date: Sun, 7 Feb 2021 17:35:35 +0800 Subject: [PATCH] Fix #28 firecracker install failure --- generated/packages/firecracker.yaml | 10 ++++++---- src/common/src/model/package.rs | 7 ++++++- src/generator/src/pkg/firecracker.rs | 14 ++++---------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/generated/packages/firecracker.yaml b/generated/packages/firecracker.yaml index 52110d9..82ad3b7 100644 --- a/generated/packages/firecracker.yaml +++ b/generated/packages/firecracker.yaml @@ -9,10 +9,12 @@ source: targets: - LinuxAmd64: artifact_templates: - - "firecracker-v{version}-x86_64" - - "jailer-v{version}-x86_64" + - "Firecracker-v{version}-x86_64.tgz" + scan_dirs: + - "release-v{version}" - LinuxArm64: artifact_templates: - - "firecracker-v{version}-aarch64" - - "jailer-v{version}-aarch64" + - "Firecracker-v{version}-aarch64.tgz" + scan_dirs: + - "release-v{version}" detail: ~ \ No newline at end of file diff --git a/src/common/src/model/package.rs b/src/common/src/model/package.rs index d80d73d..5c63e88 100644 --- a/src/common/src/model/package.rs +++ b/src/common/src/model/package.rs @@ -254,7 +254,12 @@ impl Package { if let Some(extra_scan_dirs) = self.target()?.scan_dirs { let mut extra_scan_dirs: Vec = extra_scan_dirs .into_iter() - .map(|x| pkg_dir.join(x)) + .map(|x| { + pkg_dir.join(x.replace( + "{version}", + self.version.as_ref().unwrap().trim_start_matches("v"), + )) + }) .collect(); scan_dirs.append(&mut extra_scan_dirs); } diff --git a/src/generator/src/pkg/firecracker.rs b/src/generator/src/pkg/firecracker.rs index c2811c3..e91bc3e 100644 --- a/src/generator/src/pkg/firecracker.rs +++ b/src/generator/src/pkg/firecracker.rs @@ -11,30 +11,24 @@ pub fn release() -> Package { detail: None, targets: vec![ PackageTargetType::LinuxAmd64(PackageManagement { - artifact_templates: vec![ - "firecracker-v{version}-x86_64".to_string(), - "jailer-v{version}-x86_64".to_string(), - ], + artifact_templates: vec!["Firecracker-v{version}-x86_64.tgz".to_string()], executable_templates: None, executable_mappings: None, install_commands: None, uninstall_commands: None, upgrade_commands: None, tag_version_regex_template: None, - scan_dirs: None, + scan_dirs: Some(vec!["release-v{version}".to_string()]), }), PackageTargetType::LinuxArm64(PackageManagement { - artifact_templates: vec![ - "firecracker-v{version}-aarch64".to_string(), - "jailer-v{version}-aarch64".to_string(), - ], + artifact_templates: vec!["Firecracker-v{version}-aarch64.tgz".to_string()], executable_templates: None, executable_mappings: None, install_commands: None, uninstall_commands: None, upgrade_commands: None, tag_version_regex_template: None, - scan_dirs: None, + scan_dirs: Some(vec!["release-v{version}".to_string()]), }), ], version: None,