diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index b9c972e233..affeb42b5c 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -11,7 +11,7 @@ on: env: CARGO_TERM_COLOR: always - CARGO_PROJECT_FEATURES: "v2021_5" + CARGO_PROJECT_FEATURES: "v2021_5,cap-std-apis" # TODO: Automatically query this from the C side LATEST_LIBOSTREE: "v2022_5" # Minimum supported Rust version (MSRV) @@ -47,8 +47,19 @@ jobs: default: true - name: Cache Dependencies uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72 - - name: cargo build - run: cargo build --features=${{ env['CARGO_PROJECT_FEATURES'] }} + - name: cargo check + run: cargo check --features=${{ env['CARGO_PROJECT_FEATURES'] }} + build-no-features: + runs-on: ubuntu-latest + container: quay.io/coreos-assembler/fcos-buildroot:testing-devel + steps: + - uses: actions/checkout@v2 + - name: Cache Dependencies + uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72 + - name: Build + run: cargo test --no-run + - name: Run tests + run: cargo test --verbose build-git-libostree: runs-on: ubuntu-latest container: quay.io/coreos-assembler/fcos-buildroot:testing-devel diff --git a/Cargo.toml b/Cargo.toml index 5b6cce6a44..4b865f2e03 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ license = "MIT" name = "ostree" readme = "rust-bindings/README.md" repository = "https://github.com/ostreedev/ostree" -version = "0.14.0" +version = "0.15.0" exclude = [ "/*.am", "/apidoc", "/autogen.sh", "/bash", "/bsdiff", @@ -38,8 +38,8 @@ members = [".", "rust-bindings/sys"] [dependencies] bitflags = "1.2.1" -cap-std = { version = "0.24", optional = true} -io-lifetimes = { version = "0.5", optional = true} +cap-std = { version = "0.25", optional = true} +io-lifetimes = { version = "0.7", optional = true} ffi = { package = "ostree-sys", path = "rust-bindings/sys", version = "0.10.0" } gio = "0.14" glib = "0.14.4" @@ -53,7 +53,7 @@ thiserror = "1.0.20" maplit = "1.0.2" openat = "0.1.19" tempfile = "3" -cap-tempfile = "0.24" +cap-tempfile = "0.25" [features] cap-std-apis = ["cap-std", "io-lifetimes", "v2017_10"] diff --git a/rust-bindings/src/repo.rs b/rust-bindings/src/repo.rs index 5d34f98b44..6947f49b7d 100644 --- a/rust-bindings/src/repo.rs +++ b/rust-bindings/src/repo.rs @@ -153,14 +153,16 @@ impl Repo { /// Borrow the directory file descriptor for this repository. #[cfg(feature = "cap-std-apis")] - pub fn dfd_borrow<'a>(&'a self) -> io_lifetimes::BorrowedFd<'a> { - unsafe { io_lifetimes::BorrowedFd::borrow_raw_fd(self.dfd()) } + pub fn dfd_borrow(&self) -> io_lifetimes::BorrowedFd { + unsafe { io_lifetimes::BorrowedFd::borrow_raw(self.dfd()) } } /// Return a new `cap-std` directory reference for this repository. #[cfg(feature = "cap-std-apis")] pub fn dfd_as_dir(&self) -> std::io::Result { - cap_std::fs::Dir::reopen_dir(&self.dfd_borrow()) + use io_lifetimes::AsFd; + let dfd = self.dfd_borrow(); + cap_std::fs::Dir::reopen_dir(&dfd.as_fd()) } /// Find all objects reachable from a commit.