diff --git a/contrib/packaging/bootc.spec b/contrib/packaging/bootc.spec index 577014824..443c295df 100644 --- a/contrib/packaging/bootc.spec +++ b/contrib/packaging/bootc.spec @@ -7,8 +7,8 @@ Summary: Boot containers License: ASL 2.0 URL: https://github.com/containers/bootc -Source0: https://github.com/containers/bootc/releases/download/v%{version}/bootc-%{version}.tar.zst -Source1: https://github.com/containers/bootc/releases/download/v%{version}/bootc-%{version}-vendor.tar.zst +Source0: https://github.com/containers/bootc/releases/download/v%{version}/bootc-%{version}.tar.zstd +Source1: https://github.com/containers/bootc/releases/download/v%{version}/bootc-%{version}-vendor.tar.zstd BuildRequires: make BuildRequires: openssl-devel diff --git a/xtask/src/xtask.rs b/xtask/src/xtask.rs index cf0126431..a58fa0d81 100644 --- a/xtask/src/xtask.rs +++ b/xtask/src/xtask.rs @@ -8,7 +8,6 @@ use fn_error_context::context; use xshell::{cmd, Shell}; const NAME: &str = "bootc"; -const VENDORPATH: &str = "target/vendor.tar.zstd"; fn main() { if let Err(e) = try_main() { @@ -19,7 +18,6 @@ fn main() { #[allow(clippy::type_complexity)] const TASKS: &[(&str, fn(&Shell) -> Result<()>)] = &[ - ("vendor", vendor), ("manpages", manpages), ("man2markdown", man2markdown), ("package", package), @@ -42,16 +40,6 @@ fn try_main() -> Result<()> { Ok(()) } -fn vendor(sh: &Shell) -> Result<()> { - let target = VENDORPATH; - cmd!( - sh, - "cargo vendor-filterer --prefix=vendor --format=tar.zstd {target}" - ) - .run()?; - Ok(()) -} - fn gitrev_to_version(v: &str) -> String { let v = v.trim().trim_start_matches('v'); v.replace('-', ".") @@ -153,6 +141,7 @@ fn git_timestamp(sh: &Shell) -> Result { struct Package { version: String, srcpath: Utf8PathBuf, + vendorpath: Utf8PathBuf, } /// Return the timestamp of the latest git commit in seconds since the Unix epoch. @@ -211,10 +200,18 @@ fn impl_package(sh: &Shell) -> Result { if !st.success() { anyhow::bail!("Failed to run {st:?}"); } - cmd!(sh, "zstd -f {p}").run()?; + let srcpath: Utf8PathBuf = format!("{p}.zstd").into(); + cmd!(sh, "zstd --rm -f {p} -o {srcpath}").run()?; + let vendorpath = Utf8Path::new("target").join(format!("{namev}-vendor.tar.zstd")); + cmd!( + sh, + "cargo vendor-filterer --prefix=vendor --format=tar.zstd {vendorpath}" + ) + .run()?; Ok(Package { version: v, - srcpath: format!("{p}.zst").into(), + srcpath, + vendorpath, }) } @@ -236,15 +233,14 @@ fn impl_srpm(sh: &Shell) -> Result { } } let pkg = impl_package(sh)?; - vendor(sh)?; let td = tempfile::tempdir_in("target").context("Allocating tmpdir")?; let td = td.into_path(); let td: &Utf8Path = td.as_path().try_into().unwrap(); - let srcpath = td.join(pkg.srcpath.file_name().unwrap()); - std::fs::rename(pkg.srcpath, srcpath)?; + let srcpath = &pkg.srcpath; + cmd!(sh, "mv {srcpath} {td}").run()?; let v = pkg.version; - let vendorpath = td.join(format!("{NAME}-{v}-vendor.tar.zst")); - std::fs::rename(VENDORPATH, vendorpath)?; + let src_vendorpath = &pkg.vendorpath; + cmd!(sh, "mv {src_vendorpath} {td}").run()?; { let specin = File::open(format!("contrib/packaging/{NAME}.spec")) .map(BufReader::new)