()
| 308 | } |
| 309 | |
| 310 | fn try_main() -> Result<()> { |
| 311 | // Ensure our working directory is the bootc source toplevel. |
| 312 | // First check if we're already there (e.g. when invoked from extracted |
| 313 | // tarball during RPM build). Only try git if we're not already in the |
| 314 | // right place - this avoids issues when building inside a different |
| 315 | // git repository. |
| 316 | if !in_bootc_source_tree()? { |
| 317 | if let Ok(toplevel_path) = Command::new("git") |
| 318 | .args(["rev-parse", "--show-toplevel"]) |
| 319 | .output() |
| 320 | { |
| 321 | if toplevel_path.status.success() { |
| 322 | let path = String::from_utf8(toplevel_path.stdout)?; |
| 323 | std::env::set_current_dir(path.trim()).context("Changing to toplevel")?; |
| 324 | } |
| 325 | } |
| 326 | // Verify we're now in the toplevel |
| 327 | if !in_bootc_source_tree()? { |
| 328 | anyhow::bail!("Not in toplevel (no {TOPLEVEL_MARKER} found)") |
| 329 | } |
| 330 | } |
| 331 | |
| 332 | let cli = Cli::parse(); |
| 333 | let sh = xshell::Shell::new()?; |
| 334 | |
| 335 | match cli.command { |
| 336 | Commands::Manpages => man::generate_man_pages(&sh), |
| 337 | Commands::UpdateGenerated { command } => match command { |
| 338 | UpdateGeneratedCommands::Direct { check } => { |
| 339 | if check { |
| 340 | tmt::check_integration() |
| 341 | } else { |
| 342 | tmt::update_integration() |
| 343 | } |
| 344 | } |
| 345 | UpdateGeneratedCommands::FromCode { check } => { |
| 346 | if check { |
| 347 | man::check_manpages(&sh)?; |
| 348 | check_json_schemas(&sh) |
| 349 | } else { |
| 350 | man::update_manpages(&sh)?; |
| 351 | update_json_schemas(&sh) |
| 352 | } |
| 353 | } |
| 354 | }, |
| 355 | Commands::Package => package(&sh), |
| 356 | Commands::PackageSrpm => package_srpm(&sh), |
| 357 | Commands::Spec => spec(&sh), |
| 358 | Commands::RunTmt(mut args) => { |
| 359 | args.resolve_composefs(); |
| 360 | tmt::run_tmt(&sh, &args) |
| 361 | } |
| 362 | Commands::TmtProvision(args) => tmt::tmt_provision(&sh, &args), |
| 363 | Commands::CheckBuildsys => buildsys::check_buildsys(&sh, "Dockerfile".into()), |
| 364 | Commands::ValidateComposefsDigest(args) => validate_composefs_digest(&sh, &args), |
| 365 | Commands::LocalRustDeps(args) => local_rust_deps(&sh, &args), |
| 366 | Commands::Bcvk { command } => match command { |
| 367 | BcvkCommands::Vm => sysext::bcvk_vm(&sh), |
no test coverage detected