Skip to content

Commit

Permalink
buildsys: refactor builder.rs
Browse files Browse the repository at this point in the history
Refactor the code, primarily in builder.rs. The goal of the refactor is
to segregate data collection and docker argument creation from program
flow logic.
  • Loading branch information
webern committed Jan 25, 2024
1 parent f9cfe31 commit 9a89bf5
Show file tree
Hide file tree
Showing 4 changed files with 384 additions and 286 deletions.
23 changes: 21 additions & 2 deletions tools/buildsys/src/args.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ of its input arguments from environment variables.
!*/

use buildsys::manifest::SupportedArch;
use clap::{Parser, Subcommand};
use std::path::PathBuf;

Expand Down Expand Up @@ -54,10 +55,10 @@ impl Command {
#[derive(Debug, Parser)]
pub(crate) struct Common {
#[arg(long, env = "BUILDSYS_ARCH")]
pub(crate) arch: String,
pub(crate) arch: SupportedArch,

#[arg(long, env = "BUILDSYS_OUTPUT_DIR")]
pub(crate) output_dir: PathBuf,
pub(crate) image_arch_variant_dir: PathBuf,

#[arg(long, env = "BUILDSYS_ROOT_DIR")]
pub(crate) root_dir: PathBuf,
Expand All @@ -79,6 +80,9 @@ pub(crate) struct Common {

#[arg(long, env = "TLPRIVATE_TOOLCHAIN")]
pub(crate) toolchain: String,

#[arg(long, env = "TWOLITER_TOOLS_DIR")]
pub(crate) tools_dir: PathBuf,
}

/// Build RPMs from a spec file and sources.
Expand All @@ -90,6 +94,21 @@ pub(crate) struct BuildPackageArgs {
#[arg(long, env = "BUILDSYS_VARIANT")]
pub(crate) variant: String,

#[arg(long, env = "BUILDSYS_VARIANT_PLATFORM")]
pub(crate) variant_platform: String,

#[arg(long, env = "BUILDSYS_VARIANT_RUNTIME")]
pub(crate) variant_runtime: String,

#[arg(long, env = "BUILDSYS_VARIANT_FAMILY")]
pub(crate) variant_family: String,

#[arg(long, env = "BUILDSYS_VARIANT_FLAVOR")]
pub(crate) variant_flavor: String,

#[arg(long, env = "PUBLISH_REPO")]
pub(crate) publish_repo: String,

#[arg(long, env = "BUILDSYS_SOURCES_DIR")]
pub(crate) sources_dir: PathBuf,

Expand Down
Loading

0 comments on commit 9a89bf5

Please sign in to comment.