Strip the release binary before tarring it

This commit is contained in:
Colin Woodbury
2020-08-11 13:48:44 -07:00
parent c8892b4189
commit b1383ff6ff
2 changed files with 14 additions and 0 deletions

View File

@@ -1,5 +1,11 @@
# `cargo-aur` Changelog
## Unreleased
#### Changed
- Run `strip` on the release binary before `tar`ring it.
## 1.1.1 (2020-08-11)
#### Fixed

View File

@@ -154,6 +154,7 @@ fn tarball(musl: bool, package: &Package) -> anyhow::Result<()> {
format!("target/release/{}", package.name)
};
strip(&binary)?;
fs::copy(binary, &package.name)?;
Command::new("tar")
.arg("czf")
@@ -165,6 +166,13 @@ fn tarball(musl: bool, package: &Package) -> anyhow::Result<()> {
Ok(())
}
/// Strip the release binary, so that we aren't compressing more bytes than we
/// need to.
fn strip(path: &str) -> anyhow::Result<()> {
Command::new("strip").arg(path).status()?;
Ok(())
}
fn sha256sum(package: &Package) -> anyhow::Result<String> {
let bytes = fs::read(package.tarball())?;
let digest = Hash::hash(&bytes);