Commit Graph

146 Commits

Author SHA1 Message Date
Luca BRUNO 51a03e199c sysroot: support create and load actions on builder
This splits the builder completion step into separate actions for
creating/loading a sysroot.
It also introduces a roundtrip test over a freshly-created empty
sysroot.
2022-05-06 12:53:57 -04:00
Luca BRUNO ec572d786e sysroot: add a builder object
This adds a `SysrootBuilder` in order to allow consumers to load
a configured `Sysroot` in an ergonomic way. It tries to prevent
logic bugs coming from handling half-initialized entities.
2022-05-06 12:53:57 -04:00
Colin Walters 440d872f68 repo: Add `require_rev` method
The `resolve_rev` C method should really have been
`resolve_rev_optional` from the start - it is more obviously wrong
in Rust because the input parameter `allows_noent` controls
whether the returned `Option` can ever be `None`.

I debated adding this to the C bindings, and may still do so,
but eh it's faster to write + ship in Rust, and the future of ostree is
Rust anyways.
2022-05-06 12:53:57 -04:00
Colin Walters 99ac68cb31 Update to 2021.5 2022-05-06 12:53:57 -04:00
Colin Walters f8852ca945 repo: Add `auto_transaction` and `TransactionGuard`
This gives auto-cancelling semantics on `Drop`, plus a nicer
`.commit()` method on the transaction.

Matches the currently private `_OstreeRepoAutoTransaction` in the C
library.
2022-05-06 12:53:57 -04:00
Colin Walters 955f0ddb9d repo: Expose dfd_as_file()
The `dfd()` API returns just an integer.  Add a safe API that
makes a copy of the fd.  What we really want here is `BorrowedFd` from
https://github.com/rust-lang/rfcs/blob/master/text/3128-io-safety.md
but that isn't here yet.
2022-05-06 12:53:57 -04:00
Colin Walters e33767cc2a Make `SePolicy` have `Send`
It's safe to send between threads, and I want to do so
in ostree-rs-ext to send to a tokio worker thread.
2022-05-06 12:53:57 -04:00
Colin Walters 7b47de7a14 lib: Reexport libc::AT_FDCWD
Useful with `Repo::open_at()`.

Right now ostree-rs-ext pulls in libc for this and `fgetxattr`,
but the latter should go into nix.
2022-05-06 12:53:57 -04:00
Colin Walters 09ef16fdbf Release 0.13
Just an update to support libostree v2021.4, but bumping semver
because a few APIs (correctly) gained `Option<T>`.
2022-05-06 12:53:57 -04:00
Colin Walters f9a91bfabd lib: Export ffi too
Matching how gtk-rs does it.  Right now rpm-ostree does depend
on interacting with `ostree-sys` via the cxxrs bits.
2022-05-06 12:53:57 -04:00
Colin Walters 9b57bda607 Use glib-sys via re-exported `glib::ffi` (and similar for gio)
In general only `-sys` crates should depend on other `-sys`
crates.  IOW for us, `ostree-sys` depends on `glib-sys`.

By using the re-export, we avoid needing to keep a version lock
between `glib` and `glib-sys` in our main crate.  And similar
is true of our higher level reverse dependencies (e.g. `ostree-rs-ext`).

Also weaken our dependency to `0.14` as that's clearer.
2022-05-06 12:53:57 -04:00
Colin Walters abec2a9e34 Add more documentation for --features=v2021_3
My previous pass was at the default feature level.
2022-05-06 12:53:57 -04:00
Colin Walters 83c829eaad Add new GLib 0.14 variant types for metadata types
This way it's more convenient for downstream crates like ostree-rs-ext
to convert loaded variants.

TODO: Can we add a feature for the `gvariant` crate and expose via
that too?
2022-05-06 12:53:57 -04:00
Colin Walters 48e0d334b8 Deny unused results, warn on missing docs (except auto/)
And add basic docs for our manually implemented functions.
2022-05-06 12:53:57 -04:00
Luca BRUNO 20a025a0eb lib: fix 'dox' feature
This makes sure docs can be properly built when using the 'dox'
feature. It should fix auto-builds on docs.rs.
2022-05-06 12:53:56 -04:00
Colin Walters deedffde06 Re-export glib, gio
Re-export our dependencies.  See https://gtk-rs.org/blog/2021/06/22/new-release.html
"Dependencies are re-exported".  Users will need e.g. `gio::File`, so this avoids
them needing to update matching versions.

Closes: https://github.com/ostreedev/ostree-rs/issues/12
2022-05-06 12:53:56 -04:00
Colin Walters 8a5ac02822 Update to glib 0.14
An intimidating spam of compiler errors at the start, but the
biggest was handling the new convention of `ostree_sys::` => `ffi::`.

This will require a semver bump of course.
2022-05-06 12:53:56 -04:00
Colin Walters ae189bec80 Mark src/auto/* as generated 2022-05-06 12:53:56 -04:00
Luca BRUNO 78ca01c4e3 repo_transaction_stats: move to a manual implementation
This moves `RepoTransactionStats` into a manually implemented
source file in order to provide getters to expose relevant
fields.
2022-05-06 12:53:56 -04:00
Colin Walters 7d15179670 Update to 2021.2
Sync to https://github.com/ostreedev/ostree/releases/tag/v2021.2
2022-05-06 12:53:56 -04:00
Colin Walters b5496f70f6 repo: Add concurrency=send
Ultimately a repo is just a file descriptor wrapper with some
cached data, etc.  We can send it between threads, much like how
`gio::File` is `Send`.

Motivated by trying to write to a repo from a separate thread
in https://github.com/cgwalters/ostree-container
2022-05-06 12:53:56 -04:00
Felix Krull 674ad14cce Regenerate 2022-05-06 12:53:56 -04:00
Felix Krull 0e9a16f4c1 Regenerate 2022-05-06 12:53:56 -04:00
Felix Krull 2caf0264c7 src: fix tests 2022-05-06 12:53:56 -04:00
Felix Krull e18919e0ef src: manually implement SysrootDeployTreeOpts 2022-05-06 12:53:56 -04:00
Felix Krull d345ea0110 Switch to patched ostree gir 2022-05-06 12:53:56 -04:00
Felix Krull 75848b26ef Regenerate based on new gir 2022-05-06 12:53:56 -04:00
Felix Krull fe03ad1fee Update gir file to 2020.6 2022-05-06 12:53:56 -04:00
Felix Krull 1ab87e6b97 conf: anchor function name patterns to avoid unexpected exclusions 2022-05-06 12:53:56 -04:00
Felix Krull 5ae1a4005c conf: ignore some more special-cased functions 2022-05-06 12:53:56 -04:00
Felix Krull 86897a520c src: add Checksum::from_bytes 2022-05-06 12:53:56 -04:00
Felix Krull 6f05869713 conf: annotate ignores better 2022-05-06 12:53:56 -04:00
Felix Krull 19076fe6d8 src: reimplement checksum hex and base64 en/decoding
This allows us to provide actually useful error handling
2022-05-06 12:53:56 -04:00
Felix Krull f3b0bbe64c src: add support for write_deployments_with_options 2022-05-06 12:53:56 -04:00
Felix Krull 4e7abb3101 conf: remove some unfixable TODOs 2022-05-06 12:53:56 -04:00
Felix Krull 5b1bc50418 src: add CommitSizesEntry 2022-05-06 12:53:56 -04:00
Felix Krull 3d8d5ce53e Disable some irrelevant functions 2022-05-06 12:53:56 -04:00
Felix Krull e49ee07373 Update to OSTree 2020.5 2022-05-06 12:53:56 -04:00
Felix Krull 26f4170b01 conf: disable internal Sign subtypes 2022-05-06 12:53:56 -04:00
Felix Krull cefbccaee7 gir: fix another out parameter 2022-05-06 12:53:56 -04:00
Felix Krull 24b5148374 gir: fix out parameters not being marked correctly 2022-05-06 12:53:56 -04:00
Felix Krull d900c58148 gir: add missing version tag 2022-05-06 12:53:56 -04:00
Felix Krull be67b37336 gir: start fixing OSTree.Sign
I don't think the SignDummy and SignEd25519 types even need to be
visible. The explicit dummy_* and ed25519_* don't need to be visible
either, I suspect.
2022-05-06 12:53:56 -04:00
Felix Krull e76a6b48ff PATCH: versions on ostree_sign_* functions 2022-05-06 12:53:56 -04:00
Felix Krull 65122a5a97 PATCH: version on OSTREE_SIGN_NAME_ED25519 2022-05-06 12:53:56 -04:00
Felix Krull 7c72d297ef PATCH: version on ostree_repo_commit_modifier_set_sepolicy_from_commit 2022-05-06 12:53:56 -04:00
Felix Krull aee92d14a8 Update to OSTree 2020.4 2022-05-06 12:53:56 -04:00
Felix Krull 2c3c976828 Switch back to upstream gir 2022-05-06 12:53:56 -04:00
Felix Krull 66f928df83 src: use libc::c_char to improve non-x86 compatibility 2022-05-06 12:53:56 -04:00
Felix Krull 990bbe290a Use forked gir with updated shell-words and cleaned-up build.rs 2022-05-06 12:53:56 -04:00