Commit Graph

486 Commits

Author SHA1 Message Date
Colin Walters
99c122d219 rust: Switch to 2021 edition
No real changes.

```
$ cargo fix --edition
note: Switching to Edition 2021 will enable the use of the version 2 feature resolver in Cargo.
This may cause some dependencies to be built with fewer features enabled than previously.
More information about the resolver changes may be found at https://doc.rust-lang.org/nightly/edition-guide/rust-2021/default-cargo-resolver.html
When building the following dependencies, the given features will no longer be used:

  libc v0.2.126 removed features: extra_traits

The following differences only apply when building with dev-dependencies:

  getrandom v0.2.6 removed features: std
```

which looks OK to me.
2022-06-09 15:55:41 -04:00
Colin Walters
4806d84f56 rust: Bump semver, add feature for current release
There were some changes to the sys API for introspection fixes.
And add a feature for the current release, which is something
I'll add to the checklist for releases.
2022-06-08 09:37:57 -04:00
Colin Walters
fa3b6c9872 rust-bindings: Update to latest git 2022-06-03 10:13:36 -04:00
Colin Walters
70c8499a38 rust-bindings: Use OSTree-1.0.gir from our own builddir
Now that the projects are unified.
2022-06-03 09:57:12 -04:00
Colin Walters
21901c2d36 rust-bindings: Delete committed gir files
These seem to have been accidentally committed to git; they should
not be here.  The Gir should be derived from source code.
2022-06-03 09:51:50 -04:00
Colin Walters
60404565e5 rust-bindings: Remove some unused CI/test bits
We're not using Vagrant or Gitlab, and our container flow is
different.
2022-05-09 14:53:40 -04:00
Colin Walters
e9141e97c1 ci: Move rust-bindings CI to toplevel
It should replace our stub one.
2022-05-09 14:52:46 -04:00
Colin Walters
252060906b build-sys: Adjust for merge of ostree-rs
Fix up the paths for the crates now that the Rust bindings are in
`rust/`.

We can't today include the test suite because it depends on `ostree-rs-ext`
which would make everything circular.

(Building that now requires a separate `cd tests/inst && cargo build`)
2022-05-06 12:53:57 -04:00
Colin Walters
a5ef4cd5cc Add a repo() accessor to TransactionGuard
I want to write APIs that *require* the caller to have set up
an ostree transaction.  It's natural to require passing a guard
to do so.  But then we want an accessor for the repo.
2022-05-06 12:53:57 -04:00
Colin Walters
1541c5eb2e lib: Run cargo fmt
Prep for merge into ostree, where we want to run `cargo fmt` checks
in CI.
2022-05-06 12:53:57 -04:00
Luca BRUNO
d1fad37d1a ostree: release 0.13.7 2022-05-06 12:53:57 -04:00
Luca BRUNO
04c8e3e9f3 ostree: manually patch generated files
This manually adds a missing `ToGlibPtr` import, which seems to be result
of some bugs in `gir` code-generation.
2022-05-06 12:53:57 -04:00
Luca BRUNO
dd0cfc6d4b ostree: refresh after gir bump 2022-05-06 12:53:57 -04:00
Luca BRUNO
3fc55a524b ostree/cargo: bump to ostree-sys 0.9.2 2022-05-06 12:53:57 -04:00
Luca BRUNO
61b4629b37 ostree-sys: release 0.9.2 2022-05-06 12:53:57 -04:00
Luca BRUNO
cf5462178c ostree-sys: refresh after gir bump 2022-05-06 12:53:57 -04:00
Luca BRUNO
1cb07e0ca5 gir-files: bump to v2022.2 2022-05-06 12:53:57 -04:00
Colin Walters
887f5b09be repo: Add query_file API
The underlying `ostree_repo_load_file()` API has the caller pass
`NULL` for output arguments it doesn't want.  This isn't sanely
bindable in Rust - what the generator does is always request
all values, but maps them all to `Option<T>`.

The main cases are where a user wants either metadata, or both
metadata and content.  This API gives just metadata; it's a
bit more efficient as we don't need to open the file, and doesn't
require the caller to `unwrap()`.
2022-05-06 12:53:57 -04:00
Colin Walters
1199ae9bbc Add manual bindings for MutableTree reading
I'm trying to debug a problem in ostree-rs-ext, and it's
handy to be able to do `dbg!(mtree.copy_files())`.
2022-05-06 12:53:57 -04:00
Colin Walters
46b4a12b23 Release 0.13.6 2022-05-06 12:53:57 -04:00
Colin Walters
ecbe3ba0f8 Fast-track fix for ostree_gpg_verify_result_get_all()
This cherry picks just the changes from
https://github.com/ostreedev/ostree/pull/2537

We don't need to wait to respin a new ostree release just
for this.
2022-05-06 12:53:57 -04:00
Colin Walters
dde1a7b43f Release 0.13.5 2022-05-06 12:53:57 -04:00
Colin Walters
9250effa8f Add COMMIT_META_CONTAINER_CMD constant
Today we hardcode `/bin/bash` in
2088d24884/src/cmd-build (L405)

But that breaks the concept of a bidirectional bridge between
container image and ostree commit because this little bit of
knowledge is encoded at the buildsystem side.

This metadata key is intended to be written into an ostree commit,
and then we will use it automatically in `container encapsulate`.

The "source of truth" for this key will hence be able live in the same
place that's generating the ostree commit.

The more "proper" place for this is probably alongside the other
constants in the libostree core C code.  But that's tedious and
slow to release.  And Rust is the future.  And we've been slowly
adding more "core ostree" functionality here.
2022-05-06 12:53:57 -04:00
Colin Walters
19224a411a repo: Add two more cap-std APIs
Followup to the previous PR.  I realized now with `io_lifetimes`
we can offer a safe `dfd_borrow()` that *borrows* the file descriptor
for the repository.  (In contrast to the current `.dfd()` that returns
the raw version)

Building on that, add another API that re-acquires a `Dir` instance.
(In the future in theory we could optimize this more by knowing
 whether or not the repo was constructed via cap-std, and perhaps
 in theory synthesize a `&Dir` reference, but I don't think we
 need that now)
2022-05-06 12:53:57 -04:00
Colin Walters
6940896c4e Add a cap-std-apis feature with open/create
I'm trying to make more use of `cap-std` in our stack, and
this will be a key enabling API.

Actually a notable side benefit of this is that we don't need
to teach the ostree C code itself to use `openat2`, we inherit
cap-std's setup.

All of the internal ostree code using the prior `openat()` should
continue to work.

I only did basic sanity checking of this; there may be bugs
in other APIs.
2022-05-06 12:53:57 -04:00
Colin Walters
4f7eea6aa7 Release 0.13.4 2022-05-06 12:53:57 -04:00
Colin Walters
d1731d0ea8 repo: Add an API to read and parse directory metadata
The fact that the uid/gid/mode are big endian bit me when I was
trying to parse this "by hand" in ostree-rs-ext.

Let's add a footgun-free API for this.

(And yeah, we should probably do the same for the other variant types)
2022-05-06 12:53:57 -04:00
Luca BRUNO
f01c847a68 ci: add jobs for MSRV checks and linting
This adds two jobs in order to check minimum toolchain compatibility,
and for overall linting.
2022-05-06 12:53:57 -04:00
Luca BRUNO
83b03d2996 lib: run rustfmt 2022-05-06 12:53:57 -04:00
Luca BRUNO
810e86d4fb lib: fix new clippy warnings
This fixes the following warnings highlighted by clippy:
 * https://rust-lang.github.io/rust-clippy/master/index.html#needless_question_mark
 * https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
 * https://rust-lang.github.io/rust-clippy/master/index.html#single_component_path_imports
2022-05-06 12:53:57 -04:00
Luca BRUNO
86295e3bfe sys/cargo: refresh manifest
This updates stale dependencies and remove leftover settings.
2022-05-06 12:53:57 -04:00
Manuel Stühn
1bd6e2fc06 Update impl Display, omit to_string, change wording 2022-05-06 12:53:57 -04:00
Manuel Stühn
2ab55beb98 add ObjectDetails-struct and use it in list_objects-function 2022-05-06 12:53:57 -04:00
Manuel Stühn
81ea92566f update result type 2022-05-06 12:53:57 -04:00
Manuel Stühn
f6c1e0cb82 switch from if-else to match 2022-05-06 12:53:57 -04:00
Manuel Stühn
16a4dddd90 implement list_objects-function an test 2022-05-06 12:53:57 -04:00
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
faaf0457fd (cargo-release) start next development iteration 0.13.4-alpha.0 2022-05-06 12:53:57 -04:00
Colin Walters
34147475b5 (cargo-release) version 0.13.3 2022-05-06 12:53:57 -04:00
Colin Walters
0432bd48b9 Bump ostree-sys version 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
349933ab16 (cargo-release) version 0.13.3-alpha.1 2022-05-06 12:53:57 -04:00
Colin Walters
c3141df56d (cargo-release) version 0.13.2 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
69950574f7 (cargo-release) start next development iteration 0.13.2-alpha.0 2022-05-06 12:53:57 -04:00
Colin Walters
507787161c (cargo-release) version 0.13.1 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
2bfbfe3c6f sys: Release 0.9.0
Should have been bumped in the previous commit.
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
b17f3b37f0 Release 0.12.3
No major changes, just exporting the `ffi` bits.
2022-05-06 12:53:57 -04:00
Colin Walters
0f7a1d9c0c Cargo.toml: Bump to glib 0.14.4
Not strictly required for this repo, but it has the new variant
bindings we want in ostree-rs-ext.
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
9a5f14ce68 Release 0.12.2
```
Colin Walters (8):
      Add 2021.3 feature
      Re-export glib, gio
      Deny unused results, warn on missing docs (except auto/)
      Add new GLib 0.14 variant types for metadata types
      Fix build with --features=v2021_3, use in CI by default
      Add more documentation for --features=v2021_3
      Use glib-sys via re-exported `glib::ffi` (and similar for gio)
      Release 0.12.2

Luca BRUNO (5):
      cargo: fix version in features chain
      lib: fix 'dox' feature
      cargo: point to docs.rs and clean up
      ostree: release 0.12.1
      cargo: bump ostree-sys to 0.8.1
```
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
709b35bf11 Fix build with --features=v2021_3, use in CI by default
It's a huge trap for us not to build with the latest ostree feature
on, I didn't have my IDE configured for it, and CI didn't have
it on.

The previous bump to glib 0.14 broke the Sign code.
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
f3df1175f8 cargo: bump ostree-sys to 0.8.1 2022-05-06 12:53:57 -04:00
Luca BRUNO
b2c6dd61a1 ostree: release 0.12.1 2022-05-06 12:53:56 -04:00
Luca BRUNO
fdfaea1864 cargo: point to docs.rs and clean up
This removes stale URLs, pointing to the auto-built docpages at
docs.rs and sorting manifest entries.
2022-05-06 12:53:56 -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
Luca BRUNO
712570b9b7 cargo: fix version in features chain
This fixes the definition of the `v2016_4` feature.
It restores the chain of versions so that 2016.3 symbols can be
actually reached from newer features/versions.
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
6303229c4e Add 2021.3 feature
(We should add doing this as a SOP for ostree releases)
2022-05-06 12:53:56 -04:00
Colin Walters
04a42dff1e Bump versions
The glib 0.14 change is semver incompatible.
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
f276c040bd ci: Fix buildroot to use new official image
Which is maintained and has updated rust.
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
bd843b2eae Bump sys version requirement 2022-05-06 12:53:56 -04:00
Colin Walters
42110ce01b Bump versions 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
9bb0dd3c4d ci: Add GH action to build 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
0718f433a2 Update rustdoc-stripper 2022-05-06 12:53:56 -04:00
Felix Krull
6043e5ffc1 Bump all versions 2022-05-06 12:53:56 -04:00
Felix Krull
674ad14cce Regenerate 2022-05-06 12:53:56 -04:00
Felix Krull
a96be52f1d Switch to patched ostree gir 2022-05-06 12:53:56 -04:00
Felix Krull
0e9a16f4c1 Regenerate 2022-05-06 12:53:56 -04:00
Felix Krull
c55459463f Update OSTree-1.0.gir to 2021.1 2022-05-06 12:53:56 -04:00
Felix Krull
be8dbd701b Fix ostree gir file update 2022-05-06 12:53:56 -04:00
Felix Krull
0c33d6331d Update common gir files 2022-05-06 12:53:56 -04:00
Felix Krull
b526f51165 Bump versions 2022-05-06 12:53:56 -04:00
Felix Krull
900973b61f Remove outdated sentence in readme 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
7576363329 ci: fix rawhide stages? 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
4cbbbf2daa gir: update OSTree gir 2022-05-06 12:53:56 -04:00
Felix Krull
e686a0bed6 gir: update misc gir files 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
8ef294b627 Bump versions 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