From 2649758e5431c75109f7e8564587a0f7a965b20f Mon Sep 17 00:00:00 2001 From: Doug Goldstein Date: Thu, 26 Dec 2019 12:26:38 -0600 Subject: split metadata gathering and ebuild writing functions Split the metadata gathering into its own function, separate from the ebuild writing function. --- src/main.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index e0d550b..bc3c520 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ extern crate cargo_ebuild; extern crate structopt; use anyhow::Result; -use cargo_ebuild::run; +use cargo_ebuild::{gen_ebuild_data, write_ebuild}; use std::path::PathBuf; use structopt::clap::AppSettings; use structopt::StructOpt; @@ -48,6 +48,14 @@ enum Opt { fn main() -> Result<()> { let Opt::Ebuild(opt) = Opt::from_args(); - // run the actual code - run(opt.verbose as u32, opt.quiet, opt.manifest_path) + // compute the data from the package that the build needs + let ebuild_data = gen_ebuild_data(opt.verbose as u32, opt.quiet, opt.manifest_path)?; + + let ebuild_path = format!("{}-{}.ebuild", ebuild_data.name, ebuild_data.version); + + write_ebuild(ebuild_data, &ebuild_path)?; + + println!("Wrote: {}", ebuild_path); + + Ok(()) } -- cgit v1.2.3-65-gdbad