MCPcopy Create free account
hub / github.com/bootc-dev/bootc / update_spec

Function update_spec

crates/xtask/src/xtask.rs:499–526  ·  view source on GitHub ↗
(sh: &Shell)

Source from the content-addressed store, hash-verified

497}
498
499fn update_spec(sh: &Shell) -> Result<Utf8PathBuf> {
500 let p = Utf8Path::new("target");
501 let pkg = impl_package(sh)?;
502 let srcpath = pkg.srcpath.file_name().unwrap();
503 let v = pkg.version;
504 let src_vendorpath = pkg.vendorpath.file_name().unwrap();
505 {
506 let specin = File::open(format!("contrib/packaging/{NAME}.spec"))
507 .map(BufReader::new)
508 .context("Opening spec")?;
509 let mut o = File::create(p.join(format!("{NAME}.spec"))).map(BufWriter::new)?;
510 for line in specin.lines() {
511 let line = line?;
512 if line.starts_with("Version:") {
513 writeln!(o, "# Replaced by cargo xtask spec")?;
514 writeln!(o, "Version: {v}")?;
515 } else if line.starts_with("Source0") {
516 writeln!(o, "Source0: {srcpath}")?;
517 } else if line.starts_with("Source1") {
518 writeln!(o, "Source1: {src_vendorpath}")?;
519 } else {
520 writeln!(o, "{line}")?;
521 }
522 }
523 }
524 let spec_path = p.join(format!("{NAME}.spec"));
525 Ok(spec_path)
526}
527
528fn spec(sh: &Shell) -> Result<()> {
529 let s = update_spec(sh)?;

Callers 1

specFunction · 0.85

Calls 1

impl_packageFunction · 0.85

Tested by

no test coverage detected