Skip to content

Commit

Permalink
Reflink behind feature
Browse files Browse the repository at this point in the history
  • Loading branch information
passcod committed Jul 30, 2022
1 parent 55ccb1c commit 102ffa2
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 22 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,18 @@ jobs:
include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
debug_features: [ rustls, pkg-config ]
debug_features: [ rustls, pkg-config, reflink ]
release_features: [ reflink ]
- target: x86_64-apple-darwin
os: macos-latest
release_features: [ reflink ]
- target: aarch64-apple-darwin
os: macos-latest
release_features: [ reflink ]
- target: x86_64-pc-windows-msvc
os: windows-latest
debug_features: [ native-tls ]
release_features: [ static, zlib-ng, native-tls, fancy-no-backtrace ]
release_features: [ static, zlib-ng, native-tls, fancy-no-backtrace, reflink ]
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
- target: armv7-unknown-linux-musleabihf
Expand All @@ -51,6 +54,7 @@ jobs:
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
use-cross: true
release_features: [ reflink ]

runs-on: ${{ matrix.os }}
name: ${{ matrix.target }}
Expand Down
14 changes: 13 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ log = "0.4.17"
miette = "5.1.1"
mimalloc = { version = "0.1.29", default-features = false, optional = true }
once_cell = "1.13.0"
reflink = "0.1.3"
reflink = { version = "0.1.3", optional = true }
reqwest = { version = "0.11.11", features = ["stream"], default-features = false }
scopeguard = "1.1.0"
semver = { version = "1.0.12", features = ["serde"] }
Expand Down Expand Up @@ -78,19 +78,31 @@ guess_host_triple = "0.1.3"
[features]
default = ["static", "zlib-ng", "rustls", "fancy-no-backtrace"]

# Use mimalloc as global allocator
mimalloc = ["dep:mimalloc"]

# Use reflink copies when the filesystem supports it
reflink = ["dep:reflink"]

# Build and link libraries statically
static = ["bzip2/static", "xz2/static"]

# Use pkg-config to lookup libraries
pkg-config = ["zstd/pkg-config"]

# Use zlib-ng over zlib
zlib-ng = ["flate2/zlib-ng"]

# Use rustls for TLS
rustls = ["crates_io_api/rustls", "reqwest/rustls-tls"]

# Use native/OS APIs for TLS
native-tls = ["reqwest/native-tls"]

fancy-no-backtrace = ["miette/fancy-no-backtrace"]
fancy-with-backtrace = ["fancy-no-backtrace", "miette/fancy"]

# Make a smaller release build by opting out of logging below info level
log_release_max_level_info = ["log/release_max_level_info"]

[dev-dependencies]
Expand Down
16 changes: 2 additions & 14 deletions src/bins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,12 @@ fn install_copy(src: &Path, dst: &Path) -> Result<(), BinstallError> {
dst.display()
);

#[cfg(any(
target = "x86_64-unknown-linux-gnu",
target = "x86_64-apple-darwin",
target = "aarch64-apple-darwin",
target = "aarch64-unknown-linux-gnu",
target = "x86_64-pc-windows-msvc",
))]
#[cfg(feature = "reflink")]
{
debug!("Reflink copy or fallback");
reflink::reflink_or_copy(src, dst)?;
}
#[cfg(not(any(
target = "x86_64-unknown-linux-gnu",
target = "x86_64-apple-darwin",
target = "aarch64-apple-darwin",
target = "aarch64-unknown-linux-gnu",
target = "x86_64-pc-windows-msvc",
)))]
#[cfg(not(feature = "reflink"))]
{
debug!("Copy file");
fs::copy(src, dst)?;
Expand Down
6 changes: 1 addition & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,7 @@ struct Options {
/// Show logs at this level
///
/// Set to `debug` when submitting a bug report.
#[clap(
help_heading = "Meta",
long,
value_name = "LEVEL"
)]
#[clap(help_heading = "Meta", long, value_name = "LEVEL")]
log_level: Option<LevelFilter>,
}

Expand Down

0 comments on commit 102ffa2

Please sign in to comment.