Commit Graph

462 Commits

Author SHA1 Message Date
Luca BRUNO
61daa277a1 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-11-21 13:18:51 -05:00
Colin Walters
1a76f45fd7 rust: Update to gio 0.16
This was quite seamless; the only thing I had to tweak was adding
`+ Send` bounds in the `Box<dyn Error>` manual checksum_async API.
2022-11-21 13:18:51 -05:00
Rafael Garcia Ruiz
f6d308f130 Idempotent delete operation for OstreeKernelArgs
ostree_kernel_args_delete_if_present checks if an argument is present
in OstreeKernelArgs and delete it.

Signed-off-by: Rafael Garcia Ruiz <rafael.garcia@collabora.com>
2022-11-18 20:26:28 +01:00
Rafael Garcia Ruiz
c4db171dae ostree_kernel_args_contains for OstreeKernelArgs
Check if an argument is present in OstreeKernelArgs. This is a way to
make easier idempotent append and delete operations.
ostree_kernel_args_append_if_missing uses it to avoid inserting a
duplicate key.

Closes #2329

Signed-off-by: Rafael Garcia Ruiz <rafael.garcia@collabora.com>
2022-11-18 13:52:08 +01:00
Colin Walters
8d08e563b4 rust: Drop openat dependency
We can use cap-std in our tests.
2022-11-13 09:47:53 -05:00
Luca BRUNO
33cf347117
cargo: prepare ostree 0.16.0 and ostree-sys 0.11.0
This prepares for a new release of both crates, now using the
gtk-rs 0.15 stack.
2022-10-27 14:21:23 +00:00
Luca BRUNO
dbb6daf101
rust/ostree: regenerate for gtk-rs 0.15 2022-10-26 13:49:35 +00:00
Luca BRUNO
0b3833bf55
rust/ostree-sys: regenerate for gtk-rs 0.15 2022-10-26 13:49:34 +00:00
Luca BRUNO
1e0e814f38
rust: update pinned gir tool to 0.15 2022-10-26 13:49:33 +00:00
Colin Walters
1258c371d6
Merge pull request #2742 from lucab/ups/rust-regenerate-2022.6
rust: regenerate bindings after latest release (2022.6)
2022-10-26 09:15:14 -04:00
Luca BRUNO
9163665a29
ci/rust: bump linting toolchain to latest stable (1.64)
This bumps the Rust toolchain for clippy/rustfmt to 1.64.
2022-10-26 09:27:50 +00:00
Luca BRUNO
10cecd73f0
rust: update manual helpers 2022-10-26 09:26:56 +00:00
Luca BRUNO
6aa7d6e9f7
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-10-26 09:26:55 +00:00
Luca BRUNO
f689ca098f
rust: regenerate bindings after latest release (2022.6) 2022-10-26 09:26:54 +00:00
Luca BRUNO
ed6678ce5f
rust/tests: fix static delta generation testcase 2022-10-13 16:30:00 +00:00
Manuel Stühn
14f513cf02
Add test for generating static delta to file 2022-10-13 16:29:58 +00:00
Colin Walters
b55054ec24 rust: Bind ostree_repo_list_commits_starting_with
I wanted to use this as a fallback for
30dee81c22
2022-08-24 09:44:34 -04:00
Colin Walters
629d2f5d7e rust: Update to latest git
In the future I may try to add CI that requires this to be
sync'd...
2022-08-22 15:11:51 -04:00
Colin Walters
55292e4007 rust-bindings: Fix cargo fmt 2022-07-22 15:20:05 -04:00
Colin Walters
e0417957ea rust: Add a test case for ed25519
Specifically, I verified that *before* the previous patch to the
ed25519 C code, the last bit of code would fail with a SIGSEGV when
trying to read the empty signature.
2022-07-14 17:13:51 -04:00
Colin Walters
be2075eef0 repo: Metadata return values from load_file are not nullable
The pattern this API uses in C is to allow the input parameters
pointer targets to be `NULL`, and it doesn't return values in that
case.

A further complexity here is that the API will still return `NULL`
for symbolic links.

But Rust can't express this pattern as is, so we were always
returning values but in `Option<T>` wrappers that the caller needed
to unwrap for the metadata.

(We really want an even more efficient API here that avoids the glib
 objects entirely, e.g. no reason not to pass directly back a type
 that lets Rust directly read from the fd for bare repos, but
 that can come later)
2022-06-23 17:43:42 -04:00
Colin Walters
63499747b9 Bump to cap-std 0.25 and io-lifetimes 0.7
Prep for bumping ostree-rs-ext, which will help bump rpm-ostree,
which will get it out of having two copies of rustix.
2022-06-23 14:59:03 -04:00
Colin Walters
37d0ca41b6 Fix clippy lint in cap-std bits 2022-06-23 14:58:00 -04:00
Colin Walters
e65c8e72c8
Merge pull request #2643 from cgwalters/rust-2021
rust: Switch to 2021 edition, bump MSRV, a few `format!` updates
2022-06-13 09:10:36 -04:00
Colin Walters
eee0eea58b rust-bindings: Wire up tests/
Because the source is in a subdirectory, we lose out on cargo target
autodiscovery.

I noticed this when I edited one of the tests in a way that
should have failed, but didn't...
2022-06-12 14:34:02 -04:00
Colin Walters
93e3784b66 rust: Use inline format! variables in a few places
Since our MSRV now supports it.
2022-06-09 17:51:07 -04:00
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