Skip to content

Commit

Permalink
Add feature and stubs for Linux VM builders v2
Browse files Browse the repository at this point in the history
  • Loading branch information
aleasims committed Jan 7, 2025
1 parent 5c0fb6c commit bd49d34
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 2 deletions.
2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,5 @@ shadow-rs = { version = "0.36", features = ["metadata"] }
[features]
# This feature should be enabled when building static executable
openssl-vendored = ["openssl/vendored"]
# Use new version of Linux VM builder (unstable)
vm-builder-v2 = []
1 change: 1 addition & 0 deletions src/builders_v2/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//! Builders v2.
11 changes: 9 additions & 2 deletions src/commands/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use crate::builders::skopeo_builder::SkopeoSyslinuxBuilder;
use crate::builders::{BuildOptions, ImageBuilder};
use crate::OutputFormat;
use clap::ValueHint;
use std::path::PathBuf;
Expand Down Expand Up @@ -206,9 +204,18 @@ impl BuildArgs {
}
}

#[cfg(not(feature = "vm-builder-v2"))]
async fn build(build_args: &BuildArgs) -> Result<(), Box<dyn std::error::Error>> {
use crate::builders::skopeo_builder::SkopeoSyslinuxBuilder;
use crate::builders::{BuildOptions, ImageBuilder};

let options = BuildOptions::from(build_args);
let builder = SkopeoSyslinuxBuilder {};
builder.build(&options)?;
Ok(())
}

#[cfg(feature = "vm-builder-v2")]
async fn build(_build_args: &BuildArgs) -> Result<(), Box<dyn std::error::Error>> {
todo!()
}
3 changes: 3 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ use std::fs::File;
use std::io::{self, Write};
use std::path::PathBuf;

#[cfg(not(feature = "vm-builder-v2"))]
mod builders;
#[cfg(feature = "vm-builder-v2")]
mod builders_v2;
mod commands;
mod utils;
mod version;
Expand Down

0 comments on commit bd49d34

Please sign in to comment.