From b147166d06e8f36e7683659f242fd573ceccadde Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Fri, 7 Oct 2022 07:56:24 +0000 Subject: [PATCH 01/55] configure: post-release version bump --- configure.ac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 83ccbdbd..7d4f5fe9 100644 --- a/configure.ac +++ b/configure.ac @@ -1,10 +1,10 @@ AC_PREREQ([2.63]) dnl To perform a release, follow the instructions in `docs/CONTRIBUTING.md`. m4_define([year_version], [2022]) -m4_define([release_version], [6]) +m4_define([release_version], [7]) m4_define([package_version], [year_version.release_version]) AC_INIT([libostree], [package_version], [walters@verbum.org]) -is_release_build=yes +is_release_build=no AC_CONFIG_HEADER([config.h]) AC_CONFIG_MACRO_DIR([buildutil]) AC_CONFIG_AUX_DIR([build-aux]) From 3bb3546fff84365312b26661d344af8a9de67c82 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 11 Oct 2022 12:29:06 +0000 Subject: [PATCH 02/55] build(deps): bump libglnx from `26375b5` to `e701578` Bumps libglnx from `26375b5` to `e701578`. --- updated-dependencies: - dependency-name: libglnx dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- libglnx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libglnx b/libglnx index 26375b53..e701578c 160000 --- a/libglnx +++ b/libglnx @@ -1 +1 @@ -Subproject commit 26375b5308360764bc6604f292192b88a59ad3ce +Subproject commit e701578c6f4e621c7c3c688b5a04bcbf0a67d930 From 1ea5e8e7d298e700d4d884a7c3fd0cd102626b6e Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Thu, 13 Oct 2022 10:38:11 +0000 Subject: [PATCH 03/55] lib/repo-checkout: fix typo in error message This fixes a typo in an error message, resulting in a GID vs UID mixup. It was detected by RH internal static checks. --- src/libostree/ostree-repo-checkout.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libostree/ostree-repo-checkout.c b/src/libostree/ostree-repo-checkout.c index 7c7d0cc7..a5b01356 100644 --- a/src/libostree/ostree-repo-checkout.c +++ b/src/libostree/ostree-repo-checkout.c @@ -684,7 +684,7 @@ _checkout_overlayfs_whiteout_at (OstreeRepo *repo, if (uid != dest_stbuf.st_uid) return glnx_throw(error, "existing destination file %s does not match uid %d", - destination_name, gid); + destination_name, uid); if ((file_mode & ALLPERMS) != (dest_stbuf.st_mode & ALLPERMS)) return glnx_throw(error, "existing destination file %s does not match mode %o", From 39ef6253e9934994539690e2931afd75b4617c3e Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Thu, 13 Oct 2022 10:48:38 +0000 Subject: [PATCH 04/55] lib/bootloader-zipl: check for errors when opening initrd This adds a missing error check when opening an initrd in s390x Secure Execution (SE) logic. It was detected by RH internal static checks. --- src/libostree/ostree-bootloader-zipl.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libostree/ostree-bootloader-zipl.c b/src/libostree/ostree-bootloader-zipl.c index 05a3b2ac..c9ca4219 100644 --- a/src/libostree/ostree-bootloader-zipl.c +++ b/src/libostree/ostree-bootloader-zipl.c @@ -273,7 +273,8 @@ _ostree_secure_execution_generate_initrd (const gchar *initrd, return glnx_prefix_error (error, "s390x SE: opening new ramdisk"); { glnx_autofd int fd = -1; - glnx_openat_rdonly (AT_FDCWD, initrd, TRUE, &fd, error); + if (!glnx_openat_rdonly (AT_FDCWD, initrd, TRUE, &fd, error)) + return glnx_prefix_error (error, "s390x SE: opening initrd"); if (glnx_regfile_copy_bytes (fd, out_initrd->fd, (off_t) -1) < 0) return glnx_throw_errno_prefix (error, "s390x SE: copying ramdisk"); } From d5129e3766dfc4221355e6c19c5ab0ac2def75ce Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Thu, 13 Oct 2022 09:14:08 -0400 Subject: [PATCH 05/55] ci: Bump memory request, use fcosKolaTestIso More fallout from https://github.com/coreos/coreos-ci-lib/pull/116. We need to be more honest about how much memory we need. While we're here, switch the `kola testiso` invocation to use `fcosKolaTestIso` instead. This will add coverage for UEFI and UEFI SecureBoot testing. --- .cci.jenkinsfile | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index af9faed5..ce292899 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -40,9 +40,10 @@ stage("Build") { } } -// Build FCOS and do a kola basic run +// Build FCOS and run kola tests. +// Both fcosKola and fcosKolaTestIso require 4G max. Add 512M for overhead. stage("FCOS") { - cosaPod(runAsUser: 0, memory: "3072Mi", cpu: "4") { + cosaPod(runAsUser: 0, memory: "4608Mi", cpu: "4") { stage("Build FCOS") { checkout scm unstash 'build' @@ -63,17 +64,7 @@ stage("FCOS") { """) } - stage("Test") { - parallel metal: { - try { - shwrap("kola testiso -S --scenarios pxe-install,iso-offline-install,pxe-offline-install --output-dir tmp/kola-testiso-metal") - } finally { - shwrap("tar -cf - tmp/kola-testiso-metal/ | xz -c9 > ${env.WORKSPACE}/kola-testiso-metal.tar.xz") - archiveArtifacts allowEmptyArchive: true, artifacts: 'kola-testiso*.tar.xz' - } - }, kola: { - fcosKola(cosaDir: "${env.WORKSPACE}") - } - } + fcosKola(cosaDir: "${env.WORKSPACE}") + fcosKolaTestIso(cosaDir: "${env.WORKSPACE}", skipMetal4k: true, skipMultipath: true) } } From 139759dd7e6315c2e186f88ee34bcd016d43b4fe Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Thu, 13 Oct 2022 09:16:19 -0400 Subject: [PATCH 06/55] ci: Drop unnecessary outer stage We define stages inside of this stage, so get rid of the outer `FCOS` stage. This should help rendering the pipeline in BlueOcean more clearly. --- .cci.jenkinsfile | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index ce292899..6ec51c39 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -42,29 +42,27 @@ stage("Build") { // Build FCOS and run kola tests. // Both fcosKola and fcosKolaTestIso require 4G max. Add 512M for overhead. -stage("FCOS") { - cosaPod(runAsUser: 0, memory: "4608Mi", cpu: "4") { - stage("Build FCOS") { - checkout scm - unstash 'build' - shwrap(""" - # Move the bits into the cosa pod - rsync -rlv installed/rootfs/ / - rsync -rlv installed/tests/ / - coreos-assembler init --force https://github.com/coreos/fedora-coreos-config - mkdir -p overrides/rootfs - # And override the on-host bits - mv installed/rootfs/* overrides/rootfs/ - rm installed -rf - coreos-assembler fetch - coreos-assembler build - coreos-assembler buildextend-metal - coreos-assembler buildextend-metal4k - coreos-assembler buildextend-live --fast +cosaPod(runAsUser: 0, memory: "4608Mi", cpu: "4") { + stage("Build FCOS") { + checkout scm + unstash 'build' + shwrap(""" + # Move the bits into the cosa pod + rsync -rlv installed/rootfs/ / + rsync -rlv installed/tests/ / + coreos-assembler init --force https://github.com/coreos/fedora-coreos-config + mkdir -p overrides/rootfs + # And override the on-host bits + mv installed/rootfs/* overrides/rootfs/ + rm installed -rf + coreos-assembler fetch + coreos-assembler build + coreos-assembler buildextend-metal + coreos-assembler buildextend-metal4k + coreos-assembler buildextend-live --fast - """) - } - fcosKola(cosaDir: "${env.WORKSPACE}") - fcosKolaTestIso(cosaDir: "${env.WORKSPACE}", skipMetal4k: true, skipMultipath: true) + """) } + fcosKola(cosaDir: "${env.WORKSPACE}") + fcosKolaTestIso(cosaDir: "${env.WORKSPACE}", skipMetal4k: true, skipMultipath: true) } From c874d4f3f359f5eaebc1d75da070f160c8e8d49e Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Thu, 13 Oct 2022 09:18:08 -0400 Subject: [PATCH 07/55] ci: Use new names for custom kola steps The old `fcos*` versions are deprecated now: https://github.com/coreos/coreos-ci-lib/pull/111 --- .cci.jenkinsfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index 6ec51c39..49564996 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -41,7 +41,7 @@ stage("Build") { } // Build FCOS and run kola tests. -// Both fcosKola and fcosKolaTestIso require 4G max. Add 512M for overhead. +// Both kola and kolaTestIso require 4G max. Add 512M for overhead. cosaPod(runAsUser: 0, memory: "4608Mi", cpu: "4") { stage("Build FCOS") { checkout scm @@ -63,6 +63,6 @@ cosaPod(runAsUser: 0, memory: "4608Mi", cpu: "4") { """) } - fcosKola(cosaDir: "${env.WORKSPACE}") - fcosKolaTestIso(cosaDir: "${env.WORKSPACE}", skipMetal4k: true, skipMultipath: true) + kola(cosaDir: "${env.WORKSPACE}") + kolaTestIso(cosaDir: "${env.WORKSPACE}", skipMetal4k: true, skipMultipath: true) } From 14f513cf022090645929162925952c80e5acf635 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20St=C3=BChn?= Date: Thu, 30 Jun 2022 09:06:30 +0200 Subject: [PATCH 08/55] Add test for generating static delta to file --- rust-bindings/tests/repo/generate_static.rs | 42 +++++++++++++++++++++ rust-bindings/tests/repo/mod.rs | 1 + 2 files changed, 43 insertions(+) create mode 100644 rust-bindings/tests/repo/generate_static.rs diff --git a/rust-bindings/tests/repo/generate_static.rs b/rust-bindings/tests/repo/generate_static.rs new file mode 100644 index 00000000..b2f3cd74 --- /dev/null +++ b/rust-bindings/tests/repo/generate_static.rs @@ -0,0 +1,42 @@ +use crate::util::*; +use gio::NONE_CANCELLABLE; +use ostree::glib::prelude::*; +use ostree::glib::Variant; +use ostree::*; + +use std::collections::HashMap; + +#[test] +fn should_generate_static_delta_at() { + let mut options: HashMap = HashMap::::new(); + + let delta_dir = tempfile::tempdir().expect("static delta dir"); + let delta_path = delta_dir.path().join("static_delta.file"); + let path_var = delta_path + .to_str() + .expect("no valid path") + .as_bytes() + .to_variant(); + + let test_repo = TestRepo::new(); + let from = test_repo.test_commit("commit1"); + let to = test_repo.test_commit("commit2"); + + options.insert(String::from("filename"), path_var); + + let varopts = &options.to_variant(); + + let _result = test_repo + .repo + .static_delta_generate( + ostree::StaticDeltaGenerateOpt::Major, + Some(&from), + &to, + None, + Some(varopts), + NONE_CANCELLABLE, + ) + .expect("static delta generate"); + + assert!(std::fs::File::open(&delta_path).is_err()); +} diff --git a/rust-bindings/tests/repo/mod.rs b/rust-bindings/tests/repo/mod.rs index 0a94eb9f..0f8967a0 100644 --- a/rust-bindings/tests/repo/mod.rs +++ b/rust-bindings/tests/repo/mod.rs @@ -5,6 +5,7 @@ use ostree::{ObjectName, ObjectType}; #[cfg(feature = "v2016_8")] mod checkout_at; +mod generate_static; #[test] fn should_commit_content_to_repo_and_list_refs_again() { From 763d2d2863a26c223080dbe26b6c3dd5f5028812 Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Tue, 11 Oct 2022 08:50:10 +0000 Subject: [PATCH 09/55] lib/static-delta: document and check parameters format This enhances the logic handling GVariant parameters within `ostree_repo_static_delta_generate()`. Several of those entries are expected to be zero-terminated values, and this implicit assumption has been observed to be an hidden trap in languages where strings and arrays may not carry a terminator value (e.g. Rust). In order to improve the situation, this makes the documentation more explicit and actively tries to catch invalid input parameters. --- src/libostree/ostree-repo-static-delta-compilation.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/libostree/ostree-repo-static-delta-compilation.c b/src/libostree/ostree-repo-static-delta-compilation.c index 28b42139..dece876e 100644 --- a/src/libostree/ostree-repo-static-delta-compilation.c +++ b/src/libostree/ostree-repo-static-delta-compilation.c @@ -1334,9 +1334,9 @@ get_fallback_headers (OstreeRepo *self, * - inline-parts: b: Put part data in header, to get a single file delta. Default FALSE. * - verbose: b: Print diagnostic messages. Default FALSE. * - endianness: b: Deltas use host byte order by default; this option allows choosing (G_BIG_ENDIAN or G_LITTLE_ENDIAN) - * - filename: ay: Save delta superblock to this filename, and parts in the same directory. Default saves to repository. - * - sign-name: ay: Signature type to use. - * - sign-key-ids: as: Array of keys used to sign delta superblock. + * - filename: ^ay: Save delta superblock to this filename (bytestring), and parts in the same directory. Default saves to repository. + * - sign-name: ^ay: Signature type to use (bytestring). + * - sign-key-ids: ^as: NULL-terminated array of keys used to sign delta superblock. */ gboolean ostree_repo_static_delta_generate (OstreeRepo *self, @@ -1409,9 +1409,13 @@ ostree_repo_static_delta_generate (OstreeRepo *self, if (!g_variant_lookup (params, "filename", "^&ay", &opt_filename)) opt_filename = NULL; + else if (opt_filename[0] == '\0') + return glnx_throw (error, "Invalid 'filename' parameter"); if (!g_variant_lookup (params, "sign-name", "^&ay", &opt_sign_name)) opt_sign_name = NULL; + else if (opt_sign_name[0] == '\0') + return glnx_throw (error, "Invalid 'sign-name' parameter"); if (!g_variant_lookup (params, "sign-key-ids", "^a&s", &opt_key_ids)) opt_key_ids = NULL; From ed6678ce5f5efc11a9132b5a5f898d319bdba270 Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Tue, 11 Oct 2022 09:03:40 +0000 Subject: [PATCH 10/55] rust/tests: fix static delta generation testcase --- rust-bindings/tests/repo/generate_static.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/rust-bindings/tests/repo/generate_static.rs b/rust-bindings/tests/repo/generate_static.rs index b2f3cd74..297ce95d 100644 --- a/rust-bindings/tests/repo/generate_static.rs +++ b/rust-bindings/tests/repo/generate_static.rs @@ -14,8 +14,10 @@ fn should_generate_static_delta_at() { let delta_path = delta_dir.path().join("static_delta.file"); let path_var = delta_path .to_str() + .map(std::ffi::CString::new) .expect("no valid path") - .as_bytes() + .unwrap() + .as_bytes_with_nul() .to_variant(); let test_repo = TestRepo::new(); @@ -38,5 +40,5 @@ fn should_generate_static_delta_at() { ) .expect("static delta generate"); - assert!(std::fs::File::open(&delta_path).is_err()); + assert!(delta_path.try_exists().unwrap()); } From 52810a41b9bd2e4b49d6e956f725290d29050799 Mon Sep 17 00:00:00 2001 From: Jonathan Lebon Date: Tue, 25 Oct 2022 09:58:01 -0400 Subject: [PATCH 11/55] ci: bump cosaPod memory requirement to 5Gi We're hitting memory limits when running the reprovisioning tests. We should investigate why we need 1Gi of overhead, but for now to get unblocked let's just bump it. --- .cci.jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index 49564996..15d3f531 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -41,8 +41,8 @@ stage("Build") { } // Build FCOS and run kola tests. -// Both kola and kolaTestIso require 4G max. Add 512M for overhead. -cosaPod(runAsUser: 0, memory: "4608Mi", cpu: "4") { +// Both kola and kolaTestIso require 4G max. Add 1G for overhead. +cosaPod(runAsUser: 0, memory: "5Gi", cpu: "4") { stage("Build FCOS") { checkout scm unstash 'build' From 99c2f52a7811fd9cf294f559acecee73c0602564 Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Fri, 21 Oct 2022 08:43:22 +0000 Subject: [PATCH 12/55] lib/sign-ed25519: convert invariant checks to assertions This converts several invariant checks to asserts. Most of the functions in this file were already using assertions, so this aligns the remaining few outliers to the rest. --- src/libostree/ostree-sign-ed25519.c | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/src/libostree/ostree-sign-ed25519.c b/src/libostree/ostree-sign-ed25519.c index f271fd49..820854fb 100644 --- a/src/libostree/ostree-sign-ed25519.c +++ b/src/libostree/ostree-sign-ed25519.c @@ -124,7 +124,7 @@ gboolean ostree_sign_ed25519_data (OstreeSign *self, GError **error) { - g_return_val_if_fail (OSTREE_IS_SIGN (self), FALSE); + g_assert (OSTREE_IS_SIGN (self)); OstreeSignEd25519 *sign = _ostree_sign_ed25519_get_instance_private(OSTREE_SIGN_ED25519(self)); #ifdef HAVE_LIBSODIUM @@ -170,8 +170,10 @@ gboolean ostree_sign_ed25519_data_verify (OstreeSign *self, char **out_success_message, GError **error) { - g_return_val_if_fail (OSTREE_IS_SIGN (self), FALSE); - g_return_val_if_fail (data != NULL, FALSE); + g_assert (OSTREE_IS_SIGN (self)); + + if (data == NULL) + return glnx_throw (error, "ed25519: unable to verify NULL data"); OstreeSignEd25519 *sign = _ostree_sign_ed25519_get_instance_private(OSTREE_SIGN_ED25519(self)); @@ -274,7 +276,7 @@ gboolean ostree_sign_ed25519_data_verify (OstreeSign *self, const gchar * ostree_sign_ed25519_get_name (OstreeSign *self) { - g_return_val_if_fail (OSTREE_IS_SIGN (self), FALSE); + g_assert (OSTREE_IS_SIGN (self)); return OSTREE_SIGN_ED25519_NAME; } @@ -294,7 +296,7 @@ const gchar * ostree_sign_ed25519_metadata_format (OstreeSign *self) gboolean ostree_sign_ed25519_clear_keys (OstreeSign *self, GError **error) { - g_return_val_if_fail (OSTREE_IS_SIGN (self), FALSE); + g_assert (OSTREE_IS_SIGN (self)); OstreeSignEd25519 *sign = _ostree_sign_ed25519_get_instance_private(OSTREE_SIGN_ED25519(self)); @@ -338,8 +340,7 @@ gboolean ostree_sign_ed25519_set_sk (OstreeSign *self, GVariant *secret_key, GError **error) { - g_return_val_if_fail (OSTREE_IS_SIGN (self), FALSE); - + g_assert (OSTREE_IS_SIGN (self)); if (!ostree_sign_ed25519_clear_keys (self, error)) return FALSE; @@ -380,7 +381,7 @@ gboolean ostree_sign_ed25519_set_pk (OstreeSign *self, GVariant *public_key, GError **error) { - g_return_val_if_fail (OSTREE_IS_SIGN (self), FALSE); + g_assert (OSTREE_IS_SIGN (self)); if (!ostree_sign_ed25519_clear_keys (self, error)) return FALSE; @@ -396,7 +397,7 @@ gboolean ostree_sign_ed25519_add_pk (OstreeSign *self, GVariant *public_key, GError **error) { - g_return_val_if_fail (OSTREE_IS_SIGN (self), FALSE); + g_assert (OSTREE_IS_SIGN (self)); OstreeSignEd25519 *sign = _ostree_sign_ed25519_get_instance_private(OSTREE_SIGN_ED25519(self)); @@ -444,7 +445,7 @@ _ed25519_add_revoked (OstreeSign *self, GVariant *revoked_key, GError **error) { - g_return_val_if_fail (OSTREE_IS_SIGN (self), FALSE); + g_assert (OSTREE_IS_SIGN (self)); if (!g_variant_is_of_type (revoked_key, G_VARIANT_TYPE_STRING)) return glnx_throw (error, "Unknown ed25519 revoked key type"); @@ -480,7 +481,9 @@ _load_pk_from_stream (OstreeSign *self, gboolean trusted, GError **error) { - g_return_val_if_fail (key_data_in, FALSE); + if (key_data_in == NULL) + return glnx_throw (error, "ed25519: unable to read from NULL key-data input stream"); + #ifdef HAVE_LIBSODIUM gboolean ret = FALSE; From f689ca098f21c9944bcc4b0e997f32b406cec24e Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Mon, 24 Oct 2022 15:23:47 +0000 Subject: [PATCH 13/55] rust: regenerate bindings after latest release (2022.6) --- Cargo.toml | 1 + rust-bindings/src/auto/repo.rs | 5 ----- rust-bindings/src/auto/repo_finder_result.rs | 1 - rust-bindings/src/auto/sysroot.rs | 2 +- rust-bindings/src/auto/versions.txt | 2 +- rust-bindings/sys/Cargo.toml | 4 ++++ rust-bindings/sys/src/auto/versions.txt | 2 +- rust-bindings/sys/src/lib.rs | 7 ++++++- 8 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 4b865f2e..662de1cd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -101,3 +101,4 @@ v2021_3 = ["v2021_2", "ffi/v2021_3"] v2021_4 = ["v2021_3", "ffi/v2021_4"] v2021_5 = ["v2021_4", "ffi/v2021_5"] v2022_5 = ["v2021_5", "ffi/v2022_5"] +v2022_6 = ["v2022_5", "ffi/v2022_6"] diff --git a/rust-bindings/src/auto/repo.rs b/rust-bindings/src/auto/repo.rs index 4bafe755..56a39c16 100644 --- a/rust-bindings/src/auto/repo.rs +++ b/rust-bindings/src/auto/repo.rs @@ -428,11 +428,6 @@ impl Repo { // unsafe { TODO: call ffi:ostree_repo_list_collection_refs() } //} - //#[doc(alias = "ostree_repo_list_commit_objects_starting_with")] - //pub fn list_commit_objects_starting_with>(&self, start: &str, out_commits: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&P>) -> Result<(), glib::Error> { - // unsafe { TODO: call ffi:ostree_repo_list_commit_objects_starting_with() } - //} - //#[doc(alias = "ostree_repo_list_objects")] //pub fn list_objects>(&self, flags: RepoListObjectsFlags, out_objects: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&P>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_list_objects() } diff --git a/rust-bindings/src/auto/repo_finder_result.rs b/rust-bindings/src/auto/repo_finder_result.rs index 702ec52c..b6850ca7 100644 --- a/rust-bindings/src/auto/repo_finder_result.rs +++ b/rust-bindings/src/auto/repo_finder_result.rs @@ -3,7 +3,6 @@ // DO NOT EDIT use std::cmp; -use glib::translate::*; glib::wrapper! { #[derive(Debug, Hash)] diff --git a/rust-bindings/src/auto/sysroot.rs b/rust-bindings/src/auto/sysroot.rs index a88b3f66..ecec2328 100644 --- a/rust-bindings/src/auto/sysroot.rs +++ b/rust-bindings/src/auto/sysroot.rs @@ -110,7 +110,7 @@ impl Sysroot { } #[doc(alias = "ostree_sysroot_deployment_set_kargs_in_place")] - pub fn deployment_set_kargs_in_place>(&self, deployment: &Deployment, kargs_str: &str, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn deployment_set_kargs_in_place>(&self, deployment: &Deployment, kargs_str: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); let _ = ffi::ostree_sysroot_deployment_set_kargs_in_place(self.to_glib_none().0, deployment.to_glib_none().0, kargs_str.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); diff --git a/rust-bindings/src/auto/versions.txt b/rust-bindings/src/auto/versions.txt index f22d532f..57f26297 100644 --- a/rust-bindings/src/auto/versions.txt +++ b/rust-bindings/src/auto/versions.txt @@ -1,2 +1,2 @@ Generated by gir (https://github.com/gtk-rs/gir @ e8f82cf6) -from gir-files (@ 1d478ced) +from gir-files (@ a19cc348) diff --git a/rust-bindings/sys/Cargo.toml b/rust-bindings/sys/Cargo.toml index 5145ab87..9cae2512 100644 --- a/rust-bindings/sys/Cargo.toml +++ b/rust-bindings/sys/Cargo.toml @@ -57,6 +57,7 @@ v2021_4 = ["v2021_3"] v2021_5 = ["v2021_4"] v2022_2 = ["v2021_5"] v2022_5 = ["v2022_2"] +v2022_6 = ["v2022_5"] [lib] name = "ostree_sys" @@ -211,3 +212,6 @@ version = "2022.2" [package.metadata.system-deps.ostree_1.v2022_5] version = "2022.5" + +[package.metadata.system-deps.ostree_1.v2022_6] +version = "2022.6" diff --git a/rust-bindings/sys/src/auto/versions.txt b/rust-bindings/sys/src/auto/versions.txt index f22d532f..57f26297 100644 --- a/rust-bindings/sys/src/auto/versions.txt +++ b/rust-bindings/sys/src/auto/versions.txt @@ -1,2 +1,2 @@ Generated by gir (https://github.com/gtk-rs/gir @ e8f82cf6) -from gir-files (@ 1d478ced) +from gir-files (@ a19cc348) diff --git a/rust-bindings/sys/src/lib.rs b/rust-bindings/sys/src/lib.rs index 837c60b0..84c91a58 100644 --- a/rust-bindings/sys/src/lib.rs +++ b/rust-bindings/sys/src/lib.rs @@ -525,7 +525,8 @@ pub struct OstreeRepoCheckoutAtOptions { pub force_copy: gboolean, pub bareuseronly_dirs: gboolean, pub force_copy_zerosized: gboolean, - pub unused_bools: [gboolean; 4], + pub process_passthrough_whiteouts: gboolean, + pub unused_bools: [gboolean; 3], pub subpath: *const c_char, pub devino_to_csum_cache: *mut OstreeRepoDevInoCache, pub unused_ints: [c_int; 6], @@ -548,6 +549,10 @@ impl ::std::fmt::Debug for OstreeRepoCheckoutAtOptions { .field("force_copy", &self.force_copy) .field("bareuseronly_dirs", &self.bareuseronly_dirs) .field("force_copy_zerosized", &self.force_copy_zerosized) + .field( + "process_passthrough_whiteouts", + &self.process_passthrough_whiteouts, + ) .field("unused_bools", &self.unused_bools) .field("subpath", &self.subpath) .field("devino_to_csum_cache", &self.devino_to_csum_cache) From 6aa7d6e9f7f50654b6dc39568ad3f3066ebb910e Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Fri, 4 Mar 2022 14:28:35 +0000 Subject: [PATCH 14/55] ostree: manually patch generated files This manually adds a missing `ToGlibPtr` import, which seems to be result of some bugs in `gir` code-generation. --- rust-bindings/src/auto/repo_finder_result.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust-bindings/src/auto/repo_finder_result.rs b/rust-bindings/src/auto/repo_finder_result.rs index b6850ca7..702ec52c 100644 --- a/rust-bindings/src/auto/repo_finder_result.rs +++ b/rust-bindings/src/auto/repo_finder_result.rs @@ -3,6 +3,7 @@ // DO NOT EDIT use std::cmp; +use glib::translate::*; glib::wrapper! { #[derive(Debug, Hash)] From 10cecd73f030b8717e13107063541d8467ebf8cc Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Mon, 24 Oct 2022 16:01:57 +0000 Subject: [PATCH 15/55] rust: update manual helpers --- .../src/repo_checkout_at_options/mod.rs | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/rust-bindings/src/repo_checkout_at_options/mod.rs b/rust-bindings/src/repo_checkout_at_options/mod.rs index 9e47017d..b0ded2c7 100644 --- a/rust-bindings/src/repo_checkout_at_options/mod.rs +++ b/rust-bindings/src/repo_checkout_at_options/mod.rs @@ -31,6 +31,9 @@ pub struct RepoCheckoutAtOptions { /// Copy zero-sized files rather than hardlinking. #[cfg(any(feature = "v2018_9", feature = "dox"))] pub force_copy_zerosized: bool, + /// Enable overlayfs whiteout extraction into char 0:0 devices. + #[cfg(any(feature = "v2022_6", feature = "dox"))] + pub process_passthrough_whiteouts: bool, /// Only check out this subpath. pub subpath: Option, /// A cache from device, inode pairs to checksums. @@ -68,6 +71,8 @@ impl Default for RepoCheckoutAtOptions { bareuseronly_dirs: false, #[cfg(feature = "v2018_9")] force_copy_zerosized: false, + #[cfg(feature = "v2022_6")] + process_passthrough_whiteouts: false, subpath: None, devino_to_csum_cache: None, #[cfg(feature = "v2018_2")] @@ -124,6 +129,11 @@ impl<'a> ToGlibPtr<'a, *const ffi::OstreeRepoCheckoutAtOptions> for RepoCheckout options.force_copy_zerosized = self.force_copy_zerosized.into_glib(); } + #[cfg(feature = "v2022_6")] + { + options.process_passthrough_whiteouts = self.process_passthrough_whiteouts.into_glib(); + } + // We keep these complex values alive by returning them in our Stash. Technically, some of // these are being kept alive by `self` already, but it's better to be consistent here. let subpath = self.subpath.to_glib_none(); @@ -191,7 +201,9 @@ mod tests { assert_eq!((*ptr).bareuseronly_dirs, GFALSE); #[cfg(feature = "v2018_9")] assert_eq!((*ptr).force_copy_zerosized, GFALSE); - assert_eq!((*ptr).unused_bools, [GFALSE; 4]); + #[cfg(feature = "v2022_6")] + assert_eq!((*ptr).process_passthrough_whiteouts, GFALSE); + assert_eq!((*ptr).unused_bools, [GFALSE; 3]); assert_eq!((*ptr).subpath, ptr::null()); assert_eq!((*ptr).devino_to_csum_cache, ptr::null_mut()); assert_eq!((*ptr).unused_ints, [0; 6]); @@ -221,6 +233,8 @@ mod tests { bareuseronly_dirs: true, #[cfg(feature = "v2018_9")] force_copy_zerosized: true, + #[cfg(feature = "v2022_6")] + process_passthrough_whiteouts: true, subpath: Some("sub/path".into()), devino_to_csum_cache: Some(RepoDevInoCache::new()), #[cfg(feature = "v2018_2")] @@ -251,7 +265,9 @@ mod tests { assert_eq!((*ptr).bareuseronly_dirs, GTRUE); #[cfg(feature = "v2018_9")] assert_eq!((*ptr).force_copy_zerosized, GTRUE); - assert_eq!((*ptr).unused_bools, [GFALSE; 4]); + #[cfg(feature = "v2022_6")] + assert_eq!((*ptr).process_passthrough_whiteouts, GTRUE); + assert_eq!((*ptr).unused_bools, [GFALSE; 3]); assert_eq!( CStr::from_ptr((*ptr).subpath), CString::new("sub/path").unwrap().as_c_str() From 9163665a292ded0a26ec4e16167cee454b055dc0 Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Wed, 26 Oct 2022 06:46:09 +0000 Subject: [PATCH 16/55] ci/rust: bump linting toolchain to latest stable (1.64) This bumps the Rust toolchain for clippy/rustfmt to 1.64. --- .github/workflows/rust.yml | 2 +- .../repo_checkout_at_options/repo_checkout_filter.rs | 1 + rust-bindings/src/sysroot_deploy_tree_opts.rs | 10 +--------- rust-bindings/src/sysroot_write_deployments_opts.rs | 9 +-------- 4 files changed, 4 insertions(+), 18 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index affeb42b..bca9b691 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -17,7 +17,7 @@ env: # Minimum supported Rust version (MSRV) ACTION_MSRV_TOOLCHAIN: 1.58.1 # Pinned toolchain for linting - ACTION_LINTS_TOOLCHAIN: 1.56.0 + ACTION_LINTS_TOOLCHAIN: 1.64.0 jobs: build: diff --git a/rust-bindings/src/repo_checkout_at_options/repo_checkout_filter.rs b/rust-bindings/src/repo_checkout_at_options/repo_checkout_filter.rs index 17310e42..755efea2 100644 --- a/rust-bindings/src/repo_checkout_at_options/repo_checkout_filter.rs +++ b/rust-bindings/src/repo_checkout_at_options/repo_checkout_filter.rs @@ -18,6 +18,7 @@ use std::process::abort; /// /// # Return Value /// The return value determines whether the current file is checked out or skipped. +#[allow(clippy::type_complexity)] pub struct RepoCheckoutFilter(Box RepoCheckoutFilterResult>); impl RepoCheckoutFilter { diff --git a/rust-bindings/src/sysroot_deploy_tree_opts.rs b/rust-bindings/src/sysroot_deploy_tree_opts.rs index 62376f76..a2db5c2e 100644 --- a/rust-bindings/src/sysroot_deploy_tree_opts.rs +++ b/rust-bindings/src/sysroot_deploy_tree_opts.rs @@ -3,6 +3,7 @@ use glib::translate::*; use libc::c_char; /// Options for deploying an ostree commit. +#[derive(Default)] pub struct SysrootDeployTreeOpts<'a> { /// Use these kernel arguments. pub override_kernel_argv: Option<&'a [&'a str]>, @@ -10,15 +11,6 @@ pub struct SysrootDeployTreeOpts<'a> { pub overlay_initrds: Option<&'a [&'a str]>, } -impl<'a> Default for SysrootDeployTreeOpts<'a> { - fn default() -> Self { - SysrootDeployTreeOpts { - override_kernel_argv: None, - overlay_initrds: None, - } - } -} - type OptionStrSliceStorage<'a> = as ToGlibPtr<'a, *mut *mut c_char>>::Storage; diff --git a/rust-bindings/src/sysroot_write_deployments_opts.rs b/rust-bindings/src/sysroot_write_deployments_opts.rs index 81c436c3..0c68e764 100644 --- a/rust-bindings/src/sysroot_write_deployments_opts.rs +++ b/rust-bindings/src/sysroot_write_deployments_opts.rs @@ -2,19 +2,12 @@ use ffi::OstreeSysrootWriteDeploymentsOpts; use glib::translate::*; /// Options for writing a deployment. +#[derive(Default)] pub struct SysrootWriteDeploymentsOpts { /// Perform cleanup after writing the deployment. pub do_postclean: bool, } -impl Default for SysrootWriteDeploymentsOpts { - fn default() -> Self { - SysrootWriteDeploymentsOpts { - do_postclean: false, - } - } -} - impl<'a> ToGlibPtr<'a, *const OstreeSysrootWriteDeploymentsOpts> for SysrootWriteDeploymentsOpts { type Storage = Box; From a118410b85a5b4ff333813da21768df3f4b9e911 Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Wed, 26 Oct 2022 11:12:37 +0000 Subject: [PATCH 17/55] lib/repo-refs: properly return an error value This tweaks a logic check in order to return a proper error value when the related condition is not satisfied. --- src/libostree/ostree-repo-refs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/libostree/ostree-repo-refs.c b/src/libostree/ostree-repo-refs.c index 86bd27c5..9ac2cc09 100644 --- a/src/libostree/ostree-repo-refs.c +++ b/src/libostree/ostree-repo-refs.c @@ -36,7 +36,8 @@ add_ref_to_set (const char *remote, GCancellable *cancellable, GError **error) { - g_return_val_if_fail (remote == NULL || collection_id == NULL, FALSE); + if (remote != NULL && collection_id != NULL) + return glnx_throw (error, "Cannot process both a remote and a collection ID"); gsize len; char *contents = glnx_file_get_contents_utf8_at (base_fd, path, &len, cancellable, error); From 1e0e814f385a334929ec908b1affbc6fe1e09820 Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Tue, 25 Oct 2022 08:46:34 +0000 Subject: [PATCH 18/55] rust: update pinned gir tool to 0.15 --- rust-bindings/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rust-bindings/Makefile b/rust-bindings/Makefile index 1630d179..eccaacb3 100644 --- a/rust-bindings/Makefile +++ b/rust-bindings/Makefile @@ -1,5 +1,5 @@ GIR_REPO := https://github.com/gtk-rs/gir.git -GIR_VERSION := e8f82cf63f2b2fba7af9440248510c4b7e5ab787 +GIR_VERSION := c8a7a13d2c4d3a57ae646e38a821d57243cf7983 OSTREE_REPO := ../ostree OSTREE_VERSION := patch-v2022.2 RUSTDOC_STRIPPER_VERSION := 0.1.17 From 0b3833bf55e5557e0c22fc5cf88a7e7b237fb50c Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Tue, 25 Oct 2022 09:19:51 +0000 Subject: [PATCH 19/55] rust/ostree-sys: regenerate for gtk-rs 0.15 --- rust-bindings/sys/Cargo.toml | 17 +- rust-bindings/sys/src/auto/versions.txt | 4 +- rust-bindings/sys/src/lib.rs | 215 +++++++++++++++++------- rust-bindings/sys/tests/abi.rs | 2 + 4 files changed, 172 insertions(+), 66 deletions(-) diff --git a/rust-bindings/sys/Cargo.toml b/rust-bindings/sys/Cargo.toml index 9cae2512..497cb4e9 100644 --- a/rust-bindings/sys/Cargo.toml +++ b/rust-bindings/sys/Cargo.toml @@ -1,12 +1,21 @@ [build-dependencies] -system-deps = "3" +system-deps = "6" [dependencies] -glib-sys = "0.14" -gobject-sys = "0.14" -gio-sys = "0.14" libc = "0.2" +[dependencies.gio] +package = "gio-sys" +version = "0.15" + +[dependencies.glib] +package = "glib-sys" +version = "0.15" + +[dependencies.gobject] +package = "gobject-sys" +version = "0.15" + [dev-dependencies] shell-words = "1.0.0" tempfile = "3" diff --git a/rust-bindings/sys/src/auto/versions.txt b/rust-bindings/sys/src/auto/versions.txt index 57f26297..6a5d9bd6 100644 --- a/rust-bindings/sys/src/auto/versions.txt +++ b/rust-bindings/sys/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e8f82cf6) -from gir-files (@ a19cc348) +Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d) +from gir-files (@ b19a13a583ef) diff --git a/rust-bindings/sys/src/lib.rs b/rust-bindings/sys/src/lib.rs index 84c91a58..1d28759a 100644 --- a/rust-bindings/sys/src/lib.rs +++ b/rust-bindings/sys/src/lib.rs @@ -11,10 +11,6 @@ )] #![cfg_attr(feature = "dox", feature(doc_cfg))] -use gio_sys as gio; -use glib_sys as glib; -use gobject_sys as gobject; - mod manual; pub use manual::*; @@ -22,7 +18,7 @@ pub use manual::*; #[allow(unused_imports)] use libc::{ c_char, c_double, c_float, c_int, c_long, c_short, c_uchar, c_uint, c_ulong, c_ushort, c_void, - intptr_t, size_t, ssize_t, time_t, uintptr_t, FILE, + intptr_t, size_t, ssize_t, uintptr_t, FILE, }; #[allow(unused_imports)] @@ -297,8 +293,8 @@ pub type OstreeRepoImportArchiveTranslatePathname = Option< >; // Records -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeAsyncProgressClass { pub parent_class: gobject::GObjectClass, pub changed: Option, @@ -314,37 +310,55 @@ impl ::std::fmt::Debug for OstreeAsyncProgressClass { } #[repr(C)] -pub struct _OstreeBootloader(c_void); +pub struct _OstreeBootloader { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} pub type OstreeBootloader = *mut _OstreeBootloader; #[repr(C)] -pub struct _OstreeBootloaderGrub2(c_void); +pub struct _OstreeBootloaderGrub2 { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} pub type OstreeBootloaderGrub2 = *mut _OstreeBootloaderGrub2; #[repr(C)] -pub struct _OstreeBootloaderSyslinux(c_void); +pub struct _OstreeBootloaderSyslinux { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} pub type OstreeBootloaderSyslinux = *mut _OstreeBootloaderSyslinux; #[repr(C)] -pub struct _OstreeBootloaderUboot(c_void); +pub struct _OstreeBootloaderUboot { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} pub type OstreeBootloaderUboot = *mut _OstreeBootloaderUboot; #[repr(C)] -pub struct _OstreeBootloaderZipl(c_void); +pub struct _OstreeBootloaderZipl { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} pub type OstreeBootloaderZipl = *mut _OstreeBootloaderZipl; #[repr(C)] -pub struct _OstreeChecksumInputStreamPrivate(c_void); +pub struct _OstreeChecksumInputStreamPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} pub type OstreeChecksumInputStreamPrivate = *mut _OstreeChecksumInputStreamPrivate; -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeCollectionRef { pub collection_id: *mut c_char, pub ref_name: *mut c_char, @@ -359,8 +373,8 @@ impl ::std::fmt::Debug for OstreeCollectionRef { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeCommitSizesEntry { pub checksum: *mut c_char, pub objtype: OstreeObjectType, @@ -379,8 +393,8 @@ impl ::std::fmt::Debug for OstreeCommitSizesEntry { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeContentWriterClass { pub parent_class: gio::GOutputStreamClass, } @@ -393,8 +407,8 @@ impl ::std::fmt::Debug for OstreeContentWriterClass { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeDiffDirsOptions { pub owner_uid: c_int, pub owner_gid: c_int, @@ -417,8 +431,8 @@ impl ::std::fmt::Debug for OstreeDiffDirsOptions { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeDiffItem { pub refcount: c_int, pub src: *mut gio::GFile, @@ -444,37 +458,55 @@ impl ::std::fmt::Debug for OstreeDiffItem { } #[repr(C)] -pub struct _OstreeGpgVerifier(c_void); +pub struct _OstreeGpgVerifier { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} pub type OstreeGpgVerifier = *mut _OstreeGpgVerifier; #[repr(C)] -pub struct _OstreeKernelArgs(c_void); +pub struct _OstreeKernelArgs { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} pub type OstreeKernelArgs = *mut _OstreeKernelArgs; #[repr(C)] -pub struct _OstreeKernelArgsEntry(c_void); +pub struct _OstreeKernelArgsEntry { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} pub type OstreeKernelArgsEntry = *mut _OstreeKernelArgsEntry; #[repr(C)] -pub struct _OstreeLibarchiveInputStreamPrivate(c_void); +pub struct _OstreeLibarchiveInputStreamPrivate { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} pub type OstreeLibarchiveInputStreamPrivate = *mut _OstreeLibarchiveInputStreamPrivate; #[repr(C)] -pub struct _OstreeLzmaCompressor(c_void); +pub struct _OstreeLzmaCompressor { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} pub type OstreeLzmaCompressor = *mut _OstreeLzmaCompressor; #[repr(C)] -pub struct _OstreeLzmaDecompressor(c_void); +pub struct _OstreeLzmaDecompressor { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} pub type OstreeLzmaDecompressor = *mut _OstreeLzmaDecompressor; -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeMutableTreeClass { pub parent_class: gobject::GObjectClass, } @@ -487,8 +519,8 @@ impl ::std::fmt::Debug for OstreeMutableTreeClass { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeMutableTreeIter { pub in_files: gboolean, pub iter: glib::GHashTableIter, @@ -504,7 +536,10 @@ impl ::std::fmt::Debug for OstreeMutableTreeIter { } #[repr(C)] -pub struct OstreeRemote(c_void); +pub struct OstreeRemote { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeRemote { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -513,8 +548,8 @@ impl ::std::fmt::Debug for OstreeRemote { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeRepoCheckoutAtOptions { pub mode: OstreeRepoCheckoutMode, pub overwrite_mode: OstreeRepoCheckoutOverwriteMode, @@ -586,7 +621,10 @@ impl ::std::fmt::Debug for OstreeRepoCheckoutOptions { } #[repr(C)] -pub struct OstreeRepoCommitModifier(c_void); +pub struct OstreeRepoCommitModifier { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeRepoCommitModifier { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -595,8 +633,8 @@ impl ::std::fmt::Debug for OstreeRepoCommitModifier { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeRepoCommitTraverseIter { pub initialized: gboolean, pub dummy: [gpointer; 10], @@ -613,7 +651,10 @@ impl ::std::fmt::Debug for OstreeRepoCommitTraverseIter { } #[repr(C)] -pub struct OstreeRepoDevInoCache(c_void); +pub struct OstreeRepoDevInoCache { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeRepoDevInoCache { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -637,8 +678,8 @@ impl ::std::fmt::Debug for OstreeRepoExportArchiveOptions { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeRepoFileClass { pub parent_class: gobject::GObjectClass, } @@ -652,12 +693,15 @@ impl ::std::fmt::Debug for OstreeRepoFileClass { } #[repr(C)] -pub struct _OstreeRepoFileEnumerator(c_void); +pub struct _OstreeRepoFileEnumerator { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} pub type OstreeRepoFileEnumerator = *mut _OstreeRepoFileEnumerator; -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeRepoFinderAvahiClass { pub parent_class: gobject::GObjectClass, } @@ -670,8 +714,8 @@ impl ::std::fmt::Debug for OstreeRepoFinderAvahiClass { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeRepoFinderConfigClass { pub parent_class: gobject::GObjectClass, } @@ -684,8 +728,8 @@ impl ::std::fmt::Debug for OstreeRepoFinderConfigClass { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeRepoFinderInterface { pub g_iface: gobject::GTypeInterface, pub resolve_async: Option< @@ -717,8 +761,8 @@ impl ::std::fmt::Debug for OstreeRepoFinderInterface { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeRepoFinderMountClass { pub parent_class: gobject::GObjectClass, } @@ -731,8 +775,8 @@ impl ::std::fmt::Debug for OstreeRepoFinderMountClass { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeRepoFinderOverrideClass { pub parent_class: gobject::GObjectClass, } @@ -745,8 +789,8 @@ impl ::std::fmt::Debug for OstreeRepoFinderOverrideClass { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeRepoFinderResult { pub remote: *mut OstreeRemote, pub finder: *mut OstreeRepoFinder, @@ -788,8 +832,8 @@ impl ::std::fmt::Debug for OstreeRepoImportArchiveOptions { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeRepoPruneOptions { pub flags: OstreeRepoPruneFlags, pub reachable: *mut glib::GHashTable, @@ -810,8 +854,8 @@ impl ::std::fmt::Debug for OstreeRepoPruneOptions { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeRepoTransactionStats { pub metadata_objects_total: c_uint, pub metadata_objects_written: c_uint, @@ -842,8 +886,8 @@ impl ::std::fmt::Debug for OstreeRepoTransactionStats { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeSignInterface { pub g_iface: gobject::GTypeInterface, pub get_name: Option *const c_char>, @@ -917,8 +961,8 @@ impl ::std::fmt::Debug for OstreeSignInterface { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeSysrootDeployTreeOpts { pub unused_bools: [gboolean; 8], pub unused_ints: [c_int; 8], @@ -939,8 +983,8 @@ impl ::std::fmt::Debug for OstreeSysrootDeployTreeOpts { } } -#[repr(C)] #[derive(Copy, Clone)] +#[repr(C)] pub struct OstreeSysrootWriteDeploymentsOpts { pub do_postclean: gboolean, pub unused_bools: [gboolean; 7], @@ -961,7 +1005,10 @@ impl ::std::fmt::Debug for OstreeSysrootWriteDeploymentsOpts { // Classes #[repr(C)] -pub struct OstreeAsyncProgress(c_void); +pub struct OstreeAsyncProgress { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeAsyncProgress { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -971,7 +1018,10 @@ impl ::std::fmt::Debug for OstreeAsyncProgress { } #[repr(C)] -pub struct OstreeBootconfigParser(c_void); +pub struct OstreeBootconfigParser { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeBootconfigParser { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -981,7 +1031,10 @@ impl ::std::fmt::Debug for OstreeBootconfigParser { } #[repr(C)] -pub struct OstreeContentWriter(c_void); +pub struct OstreeContentWriter { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeContentWriter { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -991,7 +1044,10 @@ impl ::std::fmt::Debug for OstreeContentWriter { } #[repr(C)] -pub struct OstreeDeployment(c_void); +pub struct OstreeDeployment { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeDeployment { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -1001,7 +1057,10 @@ impl ::std::fmt::Debug for OstreeDeployment { } #[repr(C)] -pub struct OstreeGpgVerifyResult(c_void); +pub struct OstreeGpgVerifyResult { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeGpgVerifyResult { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -1011,7 +1070,10 @@ impl ::std::fmt::Debug for OstreeGpgVerifyResult { } #[repr(C)] -pub struct OstreeMutableTree(c_void); +pub struct OstreeMutableTree { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeMutableTree { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -1021,7 +1083,10 @@ impl ::std::fmt::Debug for OstreeMutableTree { } #[repr(C)] -pub struct OstreeRepo(c_void); +pub struct OstreeRepo { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeRepo { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -1030,7 +1095,10 @@ impl ::std::fmt::Debug for OstreeRepo { } #[repr(C)] -pub struct OstreeRepoFile(c_void); +pub struct OstreeRepoFile { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeRepoFile { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -1040,7 +1108,10 @@ impl ::std::fmt::Debug for OstreeRepoFile { } #[repr(C)] -pub struct OstreeRepoFinderAvahi(c_void); +pub struct OstreeRepoFinderAvahi { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeRepoFinderAvahi { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -1050,7 +1121,10 @@ impl ::std::fmt::Debug for OstreeRepoFinderAvahi { } #[repr(C)] -pub struct OstreeRepoFinderConfig(c_void); +pub struct OstreeRepoFinderConfig { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeRepoFinderConfig { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -1060,7 +1134,10 @@ impl ::std::fmt::Debug for OstreeRepoFinderConfig { } #[repr(C)] -pub struct OstreeRepoFinderMount(c_void); +pub struct OstreeRepoFinderMount { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeRepoFinderMount { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -1070,7 +1147,10 @@ impl ::std::fmt::Debug for OstreeRepoFinderMount { } #[repr(C)] -pub struct OstreeRepoFinderOverride(c_void); +pub struct OstreeRepoFinderOverride { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeRepoFinderOverride { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -1080,7 +1160,10 @@ impl ::std::fmt::Debug for OstreeRepoFinderOverride { } #[repr(C)] -pub struct OstreeSePolicy(c_void); +pub struct OstreeSePolicy { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeSePolicy { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -1090,7 +1173,10 @@ impl ::std::fmt::Debug for OstreeSePolicy { } #[repr(C)] -pub struct OstreeSysroot(c_void); +pub struct OstreeSysroot { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeSysroot { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -1100,7 +1186,10 @@ impl ::std::fmt::Debug for OstreeSysroot { } #[repr(C)] -pub struct OstreeSysrootUpgrader(c_void); +pub struct OstreeSysrootUpgrader { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeSysrootUpgrader { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -1111,7 +1200,10 @@ impl ::std::fmt::Debug for OstreeSysrootUpgrader { // Interfaces #[repr(C)] -pub struct OstreeRepoFinder(c_void); +pub struct OstreeRepoFinder { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeRepoFinder { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { @@ -1120,7 +1212,10 @@ impl ::std::fmt::Debug for OstreeRepoFinder { } #[repr(C)] -pub struct OstreeSign(c_void); +pub struct OstreeSign { + _data: [u8; 0], + _marker: core::marker::PhantomData<(*mut u8, core::marker::PhantomPinned)>, +} impl ::std::fmt::Debug for OstreeSign { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { diff --git a/rust-bindings/sys/tests/abi.rs b/rust-bindings/sys/tests/abi.rs index 19dd4c62..3adba9ff 100644 --- a/rust-bindings/sys/tests/abi.rs +++ b/rust-bindings/sys/tests/abi.rs @@ -110,6 +110,7 @@ impl Results { } #[test] +#[cfg(target_os = "linux")] fn cross_validate_constants_with_c() { let mut c_constants: Vec<(String, String)> = Vec::new(); @@ -150,6 +151,7 @@ fn cross_validate_constants_with_c() { } #[test] +#[cfg(target_os = "linux")] fn cross_validate_layout_with_c() { let mut c_layouts = Vec::new(); From dbb6daf1015d7d82ae6b8a0986706ad8b330e1ca Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Tue, 25 Oct 2022 13:03:52 +0000 Subject: [PATCH 20/55] rust/ostree: regenerate for gtk-rs 0.15 --- Cargo.toml | 4 +- rust-bindings/conf/ostree.toml | 18 +- rust-bindings/src/auto/async_progress.rs | 44 +- rust-bindings/src/auto/bootconfig_parser.rs | 113 +- rust-bindings/src/auto/collection_ref.rs | 22 +- rust-bindings/src/auto/commit_sizes_entry.rs | 14 +- rust-bindings/src/auto/constants.rs | 145 +- rust-bindings/src/auto/content_writer.rs | 17 +- rust-bindings/src/auto/deployment.rs | 92 +- rust-bindings/src/auto/diff_item.rs | 1 - rust-bindings/src/auto/enums.rs | 326 +-- rust-bindings/src/auto/flags.rs | 7 +- rust-bindings/src/auto/functions.rs | 473 +++- rust-bindings/src/auto/gpg_verify_result.rs | 52 +- rust-bindings/src/auto/mod.rs | 62 +- rust-bindings/src/auto/mutable_tree.rs | 170 +- rust-bindings/src/auto/remote.rs | 8 +- rust-bindings/src/auto/repo.rs | 2146 ++++++++++++++--- .../src/auto/repo_commit_modifier.rs | 104 +- rust-bindings/src/auto/repo_dev_ino_cache.rs | 4 +- rust-bindings/src/auto/repo_file.rs | 95 +- rust-bindings/src/auto/repo_finder.rs | 12 +- rust-bindings/src/auto/repo_finder_avahi.rs | 20 +- rust-bindings/src/auto/repo_finder_config.rs | 8 +- rust-bindings/src/auto/repo_finder_mount.rs | 22 +- .../src/auto/repo_finder_override.rs | 10 +- rust-bindings/src/auto/repo_finder_result.rs | 6 +- rust-bindings/src/auto/se_policy.rs | 135 +- rust-bindings/src/auto/sign.rs | 291 ++- rust-bindings/src/auto/sysroot.rs | 652 ++++- rust-bindings/src/auto/sysroot_upgrader.rs | 191 +- rust-bindings/src/auto/versions.txt | 4 +- rust-bindings/src/repo.rs | 6 +- .../src/repo_checkout_at_options/mod.rs | 2 +- rust-bindings/src/repo_transaction_stats.rs | 24 +- rust-bindings/src/sysroot.rs | 8 +- rust-bindings/sys/src/auto/versions.txt | 2 +- rust-bindings/tests/functions/mod.rs | 9 +- rust-bindings/tests/repo/checkout_at.rs | 9 +- rust-bindings/tests/repo/generate_static.rs | 3 +- rust-bindings/tests/repo/mod.rs | 27 +- rust-bindings/tests/sign/mod.rs | 4 +- rust-bindings/tests/util/mod.rs | 14 +- 43 files changed, 4208 insertions(+), 1168 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 662de1cd..ddda1a88 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -41,8 +41,8 @@ bitflags = "1.2.1" 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" +gio = "0.15" +glib = "0.15" hex = "0.4.2" libc = "0.2" once_cell = "1.4.0" diff --git a/rust-bindings/conf/ostree.toml b/rust-bindings/conf/ostree.toml index ec2b594d..b0f0f60f 100644 --- a/rust-bindings/conf/ostree.toml +++ b/rust-bindings/conf/ostree.toml @@ -27,7 +27,6 @@ generate = [ "OSTree.DiffItem", "OSTree.GpgSignatureAttr", "OSTree.GpgSignatureFormatFlags", - "OSTree.GpgVerifyResult", "OSTree.MutableTree", "OSTree.ObjectType", "OSTree.Remote", @@ -43,7 +42,6 @@ generate = [ "OSTree.RepoCommitState", "OSTree.RepoDevInoCache", "OSTree.RepoFile", - "OSTree.RepoFinderAvahi", "OSTree.RepoFinderConfig", "OSTree.RepoFinderMount", "OSTree.RepoFinderOverride", @@ -242,6 +240,22 @@ status = "generate" name = "get_repo" ignore = true +[[object]] +name = "OSTree.RepoFinderAvahi" +status = "generate" + [[object.function]] + # [FAIL] this fails because it should return a boolean, but it doesn't + name = "start" + ignore = true + +[[object]] +name = "OSTree.GpgVerifyResult" +status = "generate" + [[object.function]] + # [FAIL] these fail because of some issues with GString + pattern = "^describe(|_variant)$" + ignore = true + [[object]] name = "OSTree.*" status = "generate" diff --git a/rust-bindings/src/auto/async_progress.rs b/rust-bindings/src/auto/async_progress.rs index f6040441..3f779c76 100644 --- a/rust-bindings/src/auto/async_progress.rs +++ b/rust-bindings/src/auto/async_progress.rs @@ -22,9 +22,7 @@ glib::wrapper! { impl AsyncProgress { #[doc(alias = "ostree_async_progress_new")] pub fn new() -> AsyncProgress { - unsafe { - from_glib_full(ffi::ostree_async_progress_new()) - } + unsafe { from_glib_full(ffi::ostree_async_progress_new()) } } //#[doc(alias = "ostree_async_progress_new_and_connect")] @@ -60,17 +58,13 @@ impl AsyncProgress { #[doc(alias = "ostree_async_progress_get_status")] #[doc(alias = "get_status")] pub fn status(&self) -> Option { - unsafe { - from_glib_full(ffi::ostree_async_progress_get_status(self.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::ostree_async_progress_get_status(self.to_glib_none().0)) } } #[doc(alias = "ostree_async_progress_get_uint")] #[doc(alias = "get_uint")] pub fn uint(&self, key: &str) -> u32 { - unsafe { - ffi::ostree_async_progress_get_uint(self.to_glib_none().0, key.to_glib_none().0) - } + unsafe { ffi::ostree_async_progress_get_uint(self.to_glib_none().0, key.to_glib_none().0) } } #[doc(alias = "ostree_async_progress_get_uint64")] @@ -87,7 +81,10 @@ impl AsyncProgress { #[doc(alias = "get_variant")] pub fn variant(&self, key: &str) -> Option { unsafe { - from_glib_full(ffi::ostree_async_progress_get_variant(self.to_glib_none().0, key.to_glib_none().0)) + from_glib_full(ffi::ostree_async_progress_get_variant( + self.to_glib_none().0, + key.to_glib_none().0, + )) } } @@ -117,7 +114,11 @@ impl AsyncProgress { #[doc(alias = "ostree_async_progress_set_uint64")] pub fn set_uint64(&self, key: &str, value: u64) { unsafe { - ffi::ostree_async_progress_set_uint64(self.to_glib_none().0, key.to_glib_none().0, value); + ffi::ostree_async_progress_set_uint64( + self.to_glib_none().0, + key.to_glib_none().0, + value, + ); } } @@ -126,20 +127,33 @@ impl AsyncProgress { #[doc(alias = "ostree_async_progress_set_variant")] pub fn set_variant(&self, key: &str, value: &glib::Variant) { unsafe { - ffi::ostree_async_progress_set_variant(self.to_glib_none().0, key.to_glib_none().0, value.to_glib_none().0); + ffi::ostree_async_progress_set_variant( + self.to_glib_none().0, + key.to_glib_none().0, + value.to_glib_none().0, + ); } } #[doc(alias = "changed")] pub fn connect_changed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn changed_trampoline(this: *mut ffi::OstreeAsyncProgress, f: glib::ffi::gpointer) { + unsafe extern "C" fn changed_trampoline( + this: *mut ffi::OstreeAsyncProgress, + f: glib::ffi::gpointer, + ) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"changed\0".as_ptr() as *const _, - Some(transmute::<_, unsafe extern "C" fn()>(changed_trampoline:: as *const ())), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"changed\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + changed_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) } } } diff --git a/rust-bindings/src/auto/bootconfig_parser.rs b/rust-bindings/src/auto/bootconfig_parser.rs index a19a4127..2116dd56 100644 --- a/rust-bindings/src/auto/bootconfig_parser.rs +++ b/rust-bindings/src/auto/bootconfig_parser.rs @@ -19,22 +19,22 @@ glib::wrapper! { impl BootconfigParser { #[doc(alias = "ostree_bootconfig_parser_new")] pub fn new() -> BootconfigParser { - unsafe { - from_glib_full(ffi::ostree_bootconfig_parser_new()) - } + unsafe { from_glib_full(ffi::ostree_bootconfig_parser_new()) } } #[doc(alias = "ostree_bootconfig_parser_clone")] + #[must_use] pub fn clone(&self) -> Option { - unsafe { - from_glib_full(ffi::ostree_bootconfig_parser_clone(self.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::ostree_bootconfig_parser_clone(self.to_glib_none().0)) } } #[doc(alias = "ostree_bootconfig_parser_get")] pub fn get(&self, key: &str) -> Option { unsafe { - from_glib_none(ffi::ostree_bootconfig_parser_get(self.to_glib_none().0, key.to_glib_none().0)) + from_glib_none(ffi::ostree_bootconfig_parser_get( + self.to_glib_none().0, + key.to_glib_none().0, + )) } } @@ -44,32 +44,68 @@ impl BootconfigParser { #[doc(alias = "get_overlay_initrds")] pub fn overlay_initrds(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::ostree_bootconfig_parser_get_overlay_initrds(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::ostree_bootconfig_parser_get_overlay_initrds( + self.to_glib_none().0, + )) } } #[doc(alias = "ostree_bootconfig_parser_parse")] - pub fn parse, Q: IsA>(&self, path: &P, cancellable: Option<&Q>) -> Result<(), glib::Error> { + pub fn parse( + &self, + path: &impl IsA, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_bootconfig_parser_parse(self.to_glib_none().0, path.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_bootconfig_parser_parse( + self.to_glib_none().0, + path.as_ref().to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_bootconfig_parser_parse_at")] - pub fn parse_at>(&self, dfd: i32, path: &str, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn parse_at( + &self, + dfd: i32, + path: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_bootconfig_parser_parse_at(self.to_glib_none().0, dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_bootconfig_parser_parse_at( + self.to_glib_none().0, + dfd, + path.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_bootconfig_parser_set")] pub fn set(&self, key: &str, value: &str) { unsafe { - ffi::ostree_bootconfig_parser_set(self.to_glib_none().0, key.to_glib_none().0, value.to_glib_none().0); + ffi::ostree_bootconfig_parser_set( + self.to_glib_none().0, + key.to_glib_none().0, + value.to_glib_none().0, + ); } } @@ -78,25 +114,58 @@ impl BootconfigParser { #[doc(alias = "ostree_bootconfig_parser_set_overlay_initrds")] pub fn set_overlay_initrds(&self, initrds: &[&str]) { unsafe { - ffi::ostree_bootconfig_parser_set_overlay_initrds(self.to_glib_none().0, initrds.to_glib_none().0); + ffi::ostree_bootconfig_parser_set_overlay_initrds( + self.to_glib_none().0, + initrds.to_glib_none().0, + ); } } #[doc(alias = "ostree_bootconfig_parser_write")] - pub fn write, Q: IsA>(&self, output: &P, cancellable: Option<&Q>) -> Result<(), glib::Error> { + pub fn write( + &self, + output: &impl IsA, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_bootconfig_parser_write(self.to_glib_none().0, output.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_bootconfig_parser_write( + self.to_glib_none().0, + output.as_ref().to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_bootconfig_parser_write_at")] - pub fn write_at>(&self, dfd: i32, path: &str, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn write_at( + &self, + dfd: i32, + path: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_bootconfig_parser_write_at(self.to_glib_none().0, dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_bootconfig_parser_write_at( + self.to_glib_none().0, + dfd, + path.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } } diff --git a/rust-bindings/src/auto/collection_ref.rs b/rust-bindings/src/auto/collection_ref.rs index c6f8cd4c..611ec9bb 100644 --- a/rust-bindings/src/auto/collection_ref.rs +++ b/rust-bindings/src/auto/collection_ref.rs @@ -20,21 +20,32 @@ impl CollectionRef { #[doc(alias = "ostree_collection_ref_new")] pub fn new(collection_id: Option<&str>, ref_name: &str) -> Option { unsafe { - from_glib_full(ffi::ostree_collection_ref_new(collection_id.to_glib_none().0, ref_name.to_glib_none().0)) + from_glib_full(ffi::ostree_collection_ref_new( + collection_id.to_glib_none().0, + ref_name.to_glib_none().0, + )) } } #[doc(alias = "ostree_collection_ref_equal")] fn equal(&self, ref2: &CollectionRef) -> bool { unsafe { - from_glib(ffi::ostree_collection_ref_equal(ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(self).0 as glib::ffi::gconstpointer, ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(ref2).0 as glib::ffi::gconstpointer)) + from_glib(ffi::ostree_collection_ref_equal( + ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(self).0 + as glib::ffi::gconstpointer, + ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(ref2).0 + as glib::ffi::gconstpointer, + )) } } #[doc(alias = "ostree_collection_ref_hash")] fn hash(&self) -> u32 { unsafe { - ffi::ostree_collection_ref_hash(ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(self).0 as glib::ffi::gconstpointer) + ffi::ostree_collection_ref_hash( + ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(self).0 + as glib::ffi::gconstpointer, + ) } } } @@ -50,7 +61,10 @@ impl Eq for CollectionRef {} impl hash::Hash for CollectionRef { #[inline] - fn hash(&self, state: &mut H) where H: hash::Hasher { + fn hash(&self, state: &mut H) + where + H: hash::Hasher, + { hash::Hash::hash(&self.hash(), state) } } diff --git a/rust-bindings/src/auto/commit_sizes_entry.rs b/rust-bindings/src/auto/commit_sizes_entry.rs index c52ecc5c..ecb0c210 100644 --- a/rust-bindings/src/auto/commit_sizes_entry.rs +++ b/rust-bindings/src/auto/commit_sizes_entry.rs @@ -18,9 +18,19 @@ glib::wrapper! { impl CommitSizesEntry { #[doc(alias = "ostree_commit_sizes_entry_new")] - pub fn new(checksum: &str, objtype: ObjectType, unpacked: u64, archived: u64) -> Option { + pub fn new( + checksum: &str, + objtype: ObjectType, + unpacked: u64, + archived: u64, + ) -> Option { unsafe { - from_glib_full(ffi::ostree_commit_sizes_entry_new(checksum.to_glib_none().0, objtype.into_glib(), unpacked, archived)) + from_glib_full(ffi::ostree_commit_sizes_entry_new( + checksum.to_glib_none().0, + objtype.into_glib(), + unpacked, + archived, + )) } } } diff --git a/rust-bindings/src/auto/constants.rs b/rust-bindings/src/auto/constants.rs index 396d5c85..768bce81 100644 --- a/rust-bindings/src/auto/constants.rs +++ b/rust-bindings/src/auto/constants.rs @@ -5,72 +5,175 @@ use std::ffi::CStr; #[doc(alias = "OSTREE_COMMIT_GVARIANT_STRING")] -pub static COMMIT_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_GVARIANT_STRING).to_str().unwrap()}); +pub static COMMIT_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_COMMIT_GVARIANT_STRING) + .to_str() + .unwrap() + }); #[cfg(any(feature = "v2020_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_4")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_ARCHITECTURE")] -pub static COMMIT_META_KEY_ARCHITECTURE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ARCHITECTURE).to_str().unwrap()}); +pub static COMMIT_META_KEY_ARCHITECTURE: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ARCHITECTURE) + .to_str() + .unwrap() + }); #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_COLLECTION_BINDING")] -pub static COMMIT_META_KEY_COLLECTION_BINDING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_COLLECTION_BINDING).to_str().unwrap()}); +pub static COMMIT_META_KEY_COLLECTION_BINDING: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_COLLECTION_BINDING) + .to_str() + .unwrap() + }); #[cfg(any(feature = "v2017_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_7")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_ENDOFLIFE")] -pub static COMMIT_META_KEY_ENDOFLIFE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE).to_str().unwrap()}); +pub static COMMIT_META_KEY_ENDOFLIFE: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE) + .to_str() + .unwrap() + }); #[cfg(any(feature = "v2017_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_7")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE")] -pub static COMMIT_META_KEY_ENDOFLIFE_REBASE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE).to_str().unwrap()}); +pub static COMMIT_META_KEY_ENDOFLIFE_REBASE: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE) + .to_str() + .unwrap() + }); #[cfg(any(feature = "v2017_9", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_9")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_REF_BINDING")] -pub static COMMIT_META_KEY_REF_BINDING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_REF_BINDING).to_str().unwrap()}); +pub static COMMIT_META_KEY_REF_BINDING: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_REF_BINDING) + .to_str() + .unwrap() + }); #[cfg(any(feature = "v2017_13", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_13")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_SOURCE_TITLE")] -pub static COMMIT_META_KEY_SOURCE_TITLE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_SOURCE_TITLE).to_str().unwrap()}); +pub static COMMIT_META_KEY_SOURCE_TITLE: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_SOURCE_TITLE) + .to_str() + .unwrap() + }); #[cfg(any(feature = "v2014_9", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2014_9")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_VERSION")] -pub static COMMIT_META_KEY_VERSION: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_VERSION).to_str().unwrap()}); +pub static COMMIT_META_KEY_VERSION: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_VERSION) + .to_str() + .unwrap() + }); #[doc(alias = "OSTREE_DIRMETA_GVARIANT_STRING")] -pub static DIRMETA_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_DIRMETA_GVARIANT_STRING).to_str().unwrap()}); +pub static DIRMETA_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_DIRMETA_GVARIANT_STRING) + .to_str() + .unwrap() + }); #[doc(alias = "OSTREE_FILEMETA_GVARIANT_STRING")] -pub static FILEMETA_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_FILEMETA_GVARIANT_STRING).to_str().unwrap()}); +pub static FILEMETA_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_FILEMETA_GVARIANT_STRING) + .to_str() + .unwrap() + }); #[doc(alias = "OSTREE_GPG_KEY_GVARIANT_STRING")] -pub static GPG_KEY_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_GPG_KEY_GVARIANT_STRING).to_str().unwrap()}); +pub static GPG_KEY_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_GPG_KEY_GVARIANT_STRING) + .to_str() + .unwrap() + }); #[cfg(any(feature = "v2021_1", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_1")))] #[doc(alias = "OSTREE_METADATA_KEY_BOOTABLE")] -pub static METADATA_KEY_BOOTABLE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_METADATA_KEY_BOOTABLE).to_str().unwrap()}); +pub static METADATA_KEY_BOOTABLE: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_METADATA_KEY_BOOTABLE) + .to_str() + .unwrap() + }); #[cfg(any(feature = "v2021_1", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_1")))] #[doc(alias = "OSTREE_METADATA_KEY_LINUX")] -pub static METADATA_KEY_LINUX: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_METADATA_KEY_LINUX).to_str().unwrap()}); +pub static METADATA_KEY_LINUX: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_METADATA_KEY_LINUX) + .to_str() + .unwrap() + }); #[cfg(any(feature = "v2018_9", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_9")))] #[doc(alias = "OSTREE_META_KEY_DEPLOY_COLLECTION_ID")] -pub static META_KEY_DEPLOY_COLLECTION_ID: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_META_KEY_DEPLOY_COLLECTION_ID).to_str().unwrap()}); +pub static META_KEY_DEPLOY_COLLECTION_ID: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_META_KEY_DEPLOY_COLLECTION_ID) + .to_str() + .unwrap() + }); #[cfg(any(feature = "v2018_3", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_3")))] #[doc(alias = "OSTREE_ORIGIN_TRANSIENT_GROUP")] -pub static ORIGIN_TRANSIENT_GROUP: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_ORIGIN_TRANSIENT_GROUP).to_str().unwrap()}); +pub static ORIGIN_TRANSIENT_GROUP: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_ORIGIN_TRANSIENT_GROUP) + .to_str() + .unwrap() + }); #[cfg(any(feature = "v2022_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2022_2")))] #[doc(alias = "OSTREE_PATH_BOOTED")] -pub static PATH_BOOTED: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_PATH_BOOTED).to_str().unwrap()}); +pub static PATH_BOOTED: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_PATH_BOOTED).to_str().unwrap() + }); #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "OSTREE_REPO_METADATA_REF")] -pub static REPO_METADATA_REF: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_REPO_METADATA_REF).to_str().unwrap()}); +pub static REPO_METADATA_REF: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_REPO_METADATA_REF) + .to_str() + .unwrap() + }); #[cfg(any(feature = "v2020_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_4")))] #[doc(alias = "OSTREE_SIGN_NAME_ED25519")] -pub static SIGN_NAME_ED25519: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_SIGN_NAME_ED25519).to_str().unwrap()}); +pub static SIGN_NAME_ED25519: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_SIGN_NAME_ED25519) + .to_str() + .unwrap() + }); #[doc(alias = "OSTREE_SUMMARY_GVARIANT_STRING")] -pub static SUMMARY_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_SUMMARY_GVARIANT_STRING).to_str().unwrap()}); +pub static SUMMARY_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_SUMMARY_GVARIANT_STRING) + .to_str() + .unwrap() + }); #[doc(alias = "OSTREE_SUMMARY_SIG_GVARIANT_STRING")] -pub static SUMMARY_SIG_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_SUMMARY_SIG_GVARIANT_STRING).to_str().unwrap()}); +pub static SUMMARY_SIG_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_SUMMARY_SIG_GVARIANT_STRING) + .to_str() + .unwrap() + }); #[doc(alias = "OSTREE_TREE_GVARIANT_STRING")] -pub static TREE_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_TREE_GVARIANT_STRING).to_str().unwrap()}); +pub static TREE_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = + once_cell::sync::Lazy::new(|| unsafe { + CStr::from_ptr(ffi::OSTREE_TREE_GVARIANT_STRING) + .to_str() + .unwrap() + }); diff --git a/rust-bindings/src/auto/content_writer.rs b/rust-bindings/src/auto/content_writer.rs index 5631e002..86e3e847 100644 --- a/rust-bindings/src/auto/content_writer.rs +++ b/rust-bindings/src/auto/content_writer.rs @@ -18,11 +18,22 @@ glib::wrapper! { impl ContentWriter { #[doc(alias = "ostree_content_writer_finish")] - pub fn finish>(&self, cancellable: Option<&P>) -> Result { + pub fn finish( + &self, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_content_writer_finish(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_content_writer_finish( + self.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } } diff --git a/rust-bindings/src/auto/deployment.rs b/rust-bindings/src/auto/deployment.rs index 3dddaf53..00af6cff 100644 --- a/rust-bindings/src/auto/deployment.rs +++ b/rust-bindings/src/auto/deployment.rs @@ -20,96 +20,100 @@ glib::wrapper! { impl Deployment { #[doc(alias = "ostree_deployment_new")] - pub fn new(index: i32, osname: &str, csum: &str, deployserial: i32, bootcsum: Option<&str>, bootserial: i32) -> Deployment { + pub fn new( + index: i32, + osname: &str, + csum: &str, + deployserial: i32, + bootcsum: Option<&str>, + bootserial: i32, + ) -> Deployment { unsafe { - from_glib_full(ffi::ostree_deployment_new(index, osname.to_glib_none().0, csum.to_glib_none().0, deployserial, bootcsum.to_glib_none().0, bootserial)) + from_glib_full(ffi::ostree_deployment_new( + index, + osname.to_glib_none().0, + csum.to_glib_none().0, + deployserial, + bootcsum.to_glib_none().0, + bootserial, + )) } } #[doc(alias = "ostree_deployment_clone")] + #[must_use] pub fn clone(&self) -> Option { - unsafe { - from_glib_full(ffi::ostree_deployment_clone(self.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::ostree_deployment_clone(self.to_glib_none().0)) } } #[doc(alias = "ostree_deployment_equal")] pub fn equal(&self, bp: &Deployment) -> bool { unsafe { - from_glib(ffi::ostree_deployment_equal(ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(self).0 as glib::ffi::gconstpointer, ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(bp).0 as glib::ffi::gconstpointer)) + from_glib(ffi::ostree_deployment_equal( + ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(self).0 + as glib::ffi::gconstpointer, + ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(bp).0 + as glib::ffi::gconstpointer, + )) } } #[doc(alias = "ostree_deployment_get_bootconfig")] #[doc(alias = "get_bootconfig")] pub fn bootconfig(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_deployment_get_bootconfig(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_deployment_get_bootconfig(self.to_glib_none().0)) } } #[doc(alias = "ostree_deployment_get_bootcsum")] #[doc(alias = "get_bootcsum")] pub fn bootcsum(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_deployment_get_bootcsum(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_deployment_get_bootcsum(self.to_glib_none().0)) } } #[doc(alias = "ostree_deployment_get_bootserial")] #[doc(alias = "get_bootserial")] pub fn bootserial(&self) -> i32 { - unsafe { - ffi::ostree_deployment_get_bootserial(self.to_glib_none().0) - } + unsafe { ffi::ostree_deployment_get_bootserial(self.to_glib_none().0) } } #[doc(alias = "ostree_deployment_get_csum")] #[doc(alias = "get_csum")] pub fn csum(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_deployment_get_csum(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_deployment_get_csum(self.to_glib_none().0)) } } #[doc(alias = "ostree_deployment_get_deployserial")] #[doc(alias = "get_deployserial")] pub fn deployserial(&self) -> i32 { - unsafe { - ffi::ostree_deployment_get_deployserial(self.to_glib_none().0) - } + unsafe { ffi::ostree_deployment_get_deployserial(self.to_glib_none().0) } } #[doc(alias = "ostree_deployment_get_index")] #[doc(alias = "get_index")] pub fn index(&self) -> i32 { - unsafe { - ffi::ostree_deployment_get_index(self.to_glib_none().0) - } + unsafe { ffi::ostree_deployment_get_index(self.to_glib_none().0) } } #[doc(alias = "ostree_deployment_get_origin")] #[doc(alias = "get_origin")] pub fn origin(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_deployment_get_origin(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_deployment_get_origin(self.to_glib_none().0)) } } #[doc(alias = "ostree_deployment_get_origin_relpath")] #[doc(alias = "get_origin_relpath")] pub fn origin_relpath(&self) -> Option { unsafe { - from_glib_full(ffi::ostree_deployment_get_origin_relpath(self.to_glib_none().0)) + from_glib_full(ffi::ostree_deployment_get_origin_relpath( + self.to_glib_none().0, + )) } } #[doc(alias = "ostree_deployment_get_osname")] #[doc(alias = "get_osname")] pub fn osname(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_deployment_get_osname(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_deployment_get_osname(self.to_glib_none().0)) } } #[cfg(any(feature = "v2016_4", feature = "dox"))] @@ -117,15 +121,16 @@ impl Deployment { #[doc(alias = "ostree_deployment_get_unlocked")] #[doc(alias = "get_unlocked")] pub fn unlocked(&self) -> DeploymentUnlockedState { - unsafe { - from_glib(ffi::ostree_deployment_get_unlocked(self.to_glib_none().0)) - } + unsafe { from_glib(ffi::ostree_deployment_get_unlocked(self.to_glib_none().0)) } } #[doc(alias = "ostree_deployment_hash")] pub fn hash(&self) -> u32 { unsafe { - ffi::ostree_deployment_hash(ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(self).0 as glib::ffi::gconstpointer) + ffi::ostree_deployment_hash( + ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(self).0 + as glib::ffi::gconstpointer, + ) } } @@ -133,24 +138,23 @@ impl Deployment { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_3")))] #[doc(alias = "ostree_deployment_is_pinned")] pub fn is_pinned(&self) -> bool { - unsafe { - from_glib(ffi::ostree_deployment_is_pinned(self.to_glib_none().0)) - } + unsafe { from_glib(ffi::ostree_deployment_is_pinned(self.to_glib_none().0)) } } #[cfg(any(feature = "v2018_3", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_3")))] #[doc(alias = "ostree_deployment_is_staged")] pub fn is_staged(&self) -> bool { - unsafe { - from_glib(ffi::ostree_deployment_is_staged(self.to_glib_none().0)) - } + unsafe { from_glib(ffi::ostree_deployment_is_staged(self.to_glib_none().0)) } } #[doc(alias = "ostree_deployment_set_bootconfig")] pub fn set_bootconfig(&self, bootconfig: Option<&BootconfigParser>) { unsafe { - ffi::ostree_deployment_set_bootconfig(self.to_glib_none().0, bootconfig.to_glib_none().0); + ffi::ostree_deployment_set_bootconfig( + self.to_glib_none().0, + bootconfig.to_glib_none().0, + ); } } @@ -189,7 +193,9 @@ impl Deployment { #[doc(alias = "ostree_deployment_unlocked_state_to_string")] pub fn unlocked_state_to_string(state: DeploymentUnlockedState) -> Option { unsafe { - from_glib_none(ffi::ostree_deployment_unlocked_state_to_string(state.into_glib())) + from_glib_none(ffi::ostree_deployment_unlocked_state_to_string( + state.into_glib(), + )) } } } diff --git a/rust-bindings/src/auto/diff_item.rs b/rust-bindings/src/auto/diff_item.rs index 7320367f..a7330acc 100644 --- a/rust-bindings/src/auto/diff_item.rs +++ b/rust-bindings/src/auto/diff_item.rs @@ -2,7 +2,6 @@ // from gir-files // DO NOT EDIT - glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct DiffItem(Shared); diff --git a/rust-bindings/src/auto/enums.rs b/rust-bindings/src/auto/enums.rs index 2eecdb97..573c5d98 100644 --- a/rust-bindings/src/auto/enums.rs +++ b/rust-bindings/src/auto/enums.rs @@ -5,8 +5,7 @@ use glib::translate::*; use std::fmt; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeDeploymentUnlockedState")] pub enum DeploymentUnlockedState { @@ -18,19 +17,23 @@ pub enum DeploymentUnlockedState { Hotfix, #[doc(alias = "OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT")] Transient, -#[doc(hidden)] + #[doc(hidden)] __Unknown(i32), } impl fmt::Display for DeploymentUnlockedState { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "DeploymentUnlockedState::{}", match *self { - Self::None => "None", - Self::Development => "Development", - Self::Hotfix => "Hotfix", - Self::Transient => "Transient", - _ => "Unknown", - }) + write!( + f, + "DeploymentUnlockedState::{}", + match *self { + Self::None => "None", + Self::Development => "Development", + Self::Hotfix => "Hotfix", + Self::Transient => "Transient", + _ => "Unknown", + } + ) } } @@ -45,7 +48,7 @@ impl IntoGlib for DeploymentUnlockedState { Self::Hotfix => ffi::OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX, Self::Transient => ffi::OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT, Self::__Unknown(value) => value, -} + } } } @@ -58,12 +61,11 @@ impl FromGlib for DeploymentUnlockedState { ffi::OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX => Self::Hotfix, ffi::OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT => Self::Transient, value => Self::__Unknown(value), -} + } } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeGpgSignatureAttr")] pub enum GpgSignatureAttr { @@ -97,30 +99,34 @@ pub enum GpgSignatureAttr { KeyExpTimestamp, #[doc(alias = "OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY")] KeyExpTimestampPrimary, -#[doc(hidden)] + #[doc(hidden)] __Unknown(i32), } impl fmt::Display for GpgSignatureAttr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "GpgSignatureAttr::{}", match *self { - Self::Valid => "Valid", - Self::SigExpired => "SigExpired", - Self::KeyExpired => "KeyExpired", - Self::KeyRevoked => "KeyRevoked", - Self::KeyMissing => "KeyMissing", - Self::Fingerprint => "Fingerprint", - Self::Timestamp => "Timestamp", - Self::ExpTimestamp => "ExpTimestamp", - Self::PubkeyAlgoName => "PubkeyAlgoName", - Self::HashAlgoName => "HashAlgoName", - Self::UserName => "UserName", - Self::UserEmail => "UserEmail", - Self::FingerprintPrimary => "FingerprintPrimary", - Self::KeyExpTimestamp => "KeyExpTimestamp", - Self::KeyExpTimestampPrimary => "KeyExpTimestampPrimary", - _ => "Unknown", - }) + write!( + f, + "GpgSignatureAttr::{}", + match *self { + Self::Valid => "Valid", + Self::SigExpired => "SigExpired", + Self::KeyExpired => "KeyExpired", + Self::KeyRevoked => "KeyRevoked", + Self::KeyMissing => "KeyMissing", + Self::Fingerprint => "Fingerprint", + Self::Timestamp => "Timestamp", + Self::ExpTimestamp => "ExpTimestamp", + Self::PubkeyAlgoName => "PubkeyAlgoName", + Self::HashAlgoName => "HashAlgoName", + Self::UserName => "UserName", + Self::UserEmail => "UserEmail", + Self::FingerprintPrimary => "FingerprintPrimary", + Self::KeyExpTimestamp => "KeyExpTimestamp", + Self::KeyExpTimestampPrimary => "KeyExpTimestampPrimary", + _ => "Unknown", + } + ) } } @@ -144,9 +150,11 @@ impl IntoGlib for GpgSignatureAttr { Self::UserEmail => ffi::OSTREE_GPG_SIGNATURE_ATTR_USER_EMAIL, Self::FingerprintPrimary => ffi::OSTREE_GPG_SIGNATURE_ATTR_FINGERPRINT_PRIMARY, Self::KeyExpTimestamp => ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP, - Self::KeyExpTimestampPrimary => ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY, + Self::KeyExpTimestampPrimary => { + ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY + } Self::__Unknown(value) => value, -} + } } } @@ -168,14 +176,15 @@ impl FromGlib for GpgSignatureAttr { ffi::OSTREE_GPG_SIGNATURE_ATTR_USER_EMAIL => Self::UserEmail, ffi::OSTREE_GPG_SIGNATURE_ATTR_FINGERPRINT_PRIMARY => Self::FingerprintPrimary, ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP => Self::KeyExpTimestamp, - ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY => Self::KeyExpTimestampPrimary, + ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY => { + Self::KeyExpTimestampPrimary + } value => Self::__Unknown(value), -} + } } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeObjectType")] pub enum ObjectType { @@ -197,24 +206,28 @@ pub enum ObjectType { FileXattrs, #[doc(alias = "OSTREE_OBJECT_TYPE_FILE_XATTRS_LINK")] FileXattrsLink, -#[doc(hidden)] + #[doc(hidden)] __Unknown(i32), } impl fmt::Display for ObjectType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "ObjectType::{}", match *self { - Self::File => "File", - Self::DirTree => "DirTree", - Self::DirMeta => "DirMeta", - Self::Commit => "Commit", - Self::TombstoneCommit => "TombstoneCommit", - Self::CommitMeta => "CommitMeta", - Self::PayloadLink => "PayloadLink", - Self::FileXattrs => "FileXattrs", - Self::FileXattrsLink => "FileXattrsLink", - _ => "Unknown", - }) + write!( + f, + "ObjectType::{}", + match *self { + Self::File => "File", + Self::DirTree => "DirTree", + Self::DirMeta => "DirMeta", + Self::Commit => "Commit", + Self::TombstoneCommit => "TombstoneCommit", + Self::CommitMeta => "CommitMeta", + Self::PayloadLink => "PayloadLink", + Self::FileXattrs => "FileXattrs", + Self::FileXattrsLink => "FileXattrsLink", + _ => "Unknown", + } + ) } } @@ -234,7 +247,7 @@ impl IntoGlib for ObjectType { Self::FileXattrs => ffi::OSTREE_OBJECT_TYPE_FILE_XATTRS, Self::FileXattrsLink => ffi::OSTREE_OBJECT_TYPE_FILE_XATTRS_LINK, Self::__Unknown(value) => value, -} + } } } @@ -252,14 +265,13 @@ impl FromGlib for ObjectType { ffi::OSTREE_OBJECT_TYPE_FILE_XATTRS => Self::FileXattrs, ffi::OSTREE_OBJECT_TYPE_FILE_XATTRS_LINK => Self::FileXattrsLink, value => Self::__Unknown(value), -} + } } } #[cfg(any(feature = "v2018_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_2")))] -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoCheckoutFilterResult")] pub enum RepoCheckoutFilterResult { @@ -267,7 +279,7 @@ pub enum RepoCheckoutFilterResult { Allow, #[doc(alias = "OSTREE_REPO_CHECKOUT_FILTER_SKIP")] Skip, -#[doc(hidden)] + #[doc(hidden)] __Unknown(i32), } @@ -275,11 +287,15 @@ pub enum RepoCheckoutFilterResult { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_2")))] impl fmt::Display for RepoCheckoutFilterResult { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "RepoCheckoutFilterResult::{}", match *self { - Self::Allow => "Allow", - Self::Skip => "Skip", - _ => "Unknown", - }) + write!( + f, + "RepoCheckoutFilterResult::{}", + match *self { + Self::Allow => "Allow", + Self::Skip => "Skip", + _ => "Unknown", + } + ) } } @@ -294,7 +310,7 @@ impl IntoGlib for RepoCheckoutFilterResult { Self::Allow => ffi::OSTREE_REPO_CHECKOUT_FILTER_ALLOW, Self::Skip => ffi::OSTREE_REPO_CHECKOUT_FILTER_SKIP, Self::__Unknown(value) => value, -} + } } } @@ -307,12 +323,11 @@ impl FromGlib for RepoCheckoutFilterResult ffi::OSTREE_REPO_CHECKOUT_FILTER_ALLOW => Self::Allow, ffi::OSTREE_REPO_CHECKOUT_FILTER_SKIP => Self::Skip, value => Self::__Unknown(value), -} + } } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoCheckoutMode")] pub enum RepoCheckoutMode { @@ -320,17 +335,21 @@ pub enum RepoCheckoutMode { None, #[doc(alias = "OSTREE_REPO_CHECKOUT_MODE_USER")] User, -#[doc(hidden)] + #[doc(hidden)] __Unknown(i32), } impl fmt::Display for RepoCheckoutMode { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "RepoCheckoutMode::{}", match *self { - Self::None => "None", - Self::User => "User", - _ => "Unknown", - }) + write!( + f, + "RepoCheckoutMode::{}", + match *self { + Self::None => "None", + Self::User => "User", + _ => "Unknown", + } + ) } } @@ -343,7 +362,7 @@ impl IntoGlib for RepoCheckoutMode { Self::None => ffi::OSTREE_REPO_CHECKOUT_MODE_NONE, Self::User => ffi::OSTREE_REPO_CHECKOUT_MODE_USER, Self::__Unknown(value) => value, -} + } } } @@ -354,12 +373,11 @@ impl FromGlib for RepoCheckoutMode { ffi::OSTREE_REPO_CHECKOUT_MODE_NONE => Self::None, ffi::OSTREE_REPO_CHECKOUT_MODE_USER => Self::User, value => Self::__Unknown(value), -} + } } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoCheckoutOverwriteMode")] pub enum RepoCheckoutOverwriteMode { @@ -371,19 +389,23 @@ pub enum RepoCheckoutOverwriteMode { AddFiles, #[doc(alias = "OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL")] UnionIdentical, -#[doc(hidden)] + #[doc(hidden)] __Unknown(i32), } impl fmt::Display for RepoCheckoutOverwriteMode { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "RepoCheckoutOverwriteMode::{}", match *self { - Self::None => "None", - Self::UnionFiles => "UnionFiles", - Self::AddFiles => "AddFiles", - Self::UnionIdentical => "UnionIdentical", - _ => "Unknown", - }) + write!( + f, + "RepoCheckoutOverwriteMode::{}", + match *self { + Self::None => "None", + Self::UnionFiles => "UnionFiles", + Self::AddFiles => "AddFiles", + Self::UnionIdentical => "UnionIdentical", + _ => "Unknown", + } + ) } } @@ -398,7 +420,7 @@ impl IntoGlib for RepoCheckoutOverwriteMode { Self::AddFiles => ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES, Self::UnionIdentical => ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL, Self::__Unknown(value) => value, -} + } } } @@ -411,12 +433,11 @@ impl FromGlib for RepoCheckoutOverwriteMod ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES => Self::AddFiles, ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL => Self::UnionIdentical, value => Self::__Unknown(value), -} + } } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoCommitFilterResult")] pub enum RepoCommitFilterResult { @@ -424,17 +445,21 @@ pub enum RepoCommitFilterResult { Allow, #[doc(alias = "OSTREE_REPO_COMMIT_FILTER_SKIP")] Skip, -#[doc(hidden)] + #[doc(hidden)] __Unknown(i32), } impl fmt::Display for RepoCommitFilterResult { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "RepoCommitFilterResult::{}", match *self { - Self::Allow => "Allow", - Self::Skip => "Skip", - _ => "Unknown", - }) + write!( + f, + "RepoCommitFilterResult::{}", + match *self { + Self::Allow => "Allow", + Self::Skip => "Skip", + _ => "Unknown", + } + ) } } @@ -447,7 +472,7 @@ impl IntoGlib for RepoCommitFilterResult { Self::Allow => ffi::OSTREE_REPO_COMMIT_FILTER_ALLOW, Self::Skip => ffi::OSTREE_REPO_COMMIT_FILTER_SKIP, Self::__Unknown(value) => value, -} + } } } @@ -458,12 +483,11 @@ impl FromGlib for RepoCommitFilterResult { ffi::OSTREE_REPO_COMMIT_FILTER_ALLOW => Self::Allow, ffi::OSTREE_REPO_COMMIT_FILTER_SKIP => Self::Skip, value => Self::__Unknown(value), -} + } } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoCommitIterResult")] pub enum RepoCommitIterResult { @@ -475,19 +499,23 @@ pub enum RepoCommitIterResult { File, #[doc(alias = "OSTREE_REPO_COMMIT_ITER_RESULT_DIR")] Dir, -#[doc(hidden)] + #[doc(hidden)] __Unknown(i32), } impl fmt::Display for RepoCommitIterResult { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "RepoCommitIterResult::{}", match *self { - Self::Error => "Error", - Self::End => "End", - Self::File => "File", - Self::Dir => "Dir", - _ => "Unknown", - }) + write!( + f, + "RepoCommitIterResult::{}", + match *self { + Self::Error => "Error", + Self::End => "End", + Self::File => "File", + Self::Dir => "Dir", + _ => "Unknown", + } + ) } } @@ -502,7 +530,7 @@ impl IntoGlib for RepoCommitIterResult { Self::File => ffi::OSTREE_REPO_COMMIT_ITER_RESULT_FILE, Self::Dir => ffi::OSTREE_REPO_COMMIT_ITER_RESULT_DIR, Self::__Unknown(value) => value, -} + } } } @@ -515,12 +543,11 @@ impl FromGlib for RepoCommitIterResult { ffi::OSTREE_REPO_COMMIT_ITER_RESULT_FILE => Self::File, ffi::OSTREE_REPO_COMMIT_ITER_RESULT_DIR => Self::Dir, value => Self::__Unknown(value), -} + } } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoMode")] pub enum RepoMode { @@ -534,20 +561,24 @@ pub enum RepoMode { BareUserOnly, #[doc(alias = "OSTREE_REPO_MODE_BARE_SPLIT_XATTRS")] BareSplitXattrs, -#[doc(hidden)] + #[doc(hidden)] __Unknown(i32), } impl fmt::Display for RepoMode { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "RepoMode::{}", match *self { - Self::Bare => "Bare", - Self::Archive => "Archive", - Self::BareUser => "BareUser", - Self::BareUserOnly => "BareUserOnly", - Self::BareSplitXattrs => "BareSplitXattrs", - _ => "Unknown", - }) + write!( + f, + "RepoMode::{}", + match *self { + Self::Bare => "Bare", + Self::Archive => "Archive", + Self::BareUser => "BareUser", + Self::BareUserOnly => "BareUserOnly", + Self::BareSplitXattrs => "BareSplitXattrs", + _ => "Unknown", + } + ) } } @@ -563,7 +594,7 @@ impl IntoGlib for RepoMode { Self::BareUserOnly => ffi::OSTREE_REPO_MODE_BARE_USER_ONLY, Self::BareSplitXattrs => ffi::OSTREE_REPO_MODE_BARE_SPLIT_XATTRS, Self::__Unknown(value) => value, -} + } } } @@ -577,12 +608,11 @@ impl FromGlib for RepoMode { ffi::OSTREE_REPO_MODE_BARE_USER_ONLY => Self::BareUserOnly, ffi::OSTREE_REPO_MODE_BARE_SPLIT_XATTRS => Self::BareSplitXattrs, value => Self::__Unknown(value), -} + } } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoRemoteChange")] pub enum RepoRemoteChange { @@ -596,20 +626,24 @@ pub enum RepoRemoteChange { DeleteIfExists, #[doc(alias = "OSTREE_REPO_REMOTE_CHANGE_REPLACE")] Replace, -#[doc(hidden)] + #[doc(hidden)] __Unknown(i32), } impl fmt::Display for RepoRemoteChange { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "RepoRemoteChange::{}", match *self { - Self::Add => "Add", - Self::AddIfNotExists => "AddIfNotExists", - Self::Delete => "Delete", - Self::DeleteIfExists => "DeleteIfExists", - Self::Replace => "Replace", - _ => "Unknown", - }) + write!( + f, + "RepoRemoteChange::{}", + match *self { + Self::Add => "Add", + Self::AddIfNotExists => "AddIfNotExists", + Self::Delete => "Delete", + Self::DeleteIfExists => "DeleteIfExists", + Self::Replace => "Replace", + _ => "Unknown", + } + ) } } @@ -625,7 +659,7 @@ impl IntoGlib for RepoRemoteChange { Self::DeleteIfExists => ffi::OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS, Self::Replace => ffi::OSTREE_REPO_REMOTE_CHANGE_REPLACE, Self::__Unknown(value) => value, -} + } } } @@ -639,12 +673,11 @@ impl FromGlib for RepoRemoteChange { ffi::OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS => Self::DeleteIfExists, ffi::OSTREE_REPO_REMOTE_CHANGE_REPLACE => Self::Replace, value => Self::__Unknown(value), -} + } } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] -#[derive(Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeStaticDeltaGenerateOpt")] pub enum StaticDeltaGenerateOpt { @@ -652,17 +685,21 @@ pub enum StaticDeltaGenerateOpt { Lowlatency, #[doc(alias = "OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR")] Major, -#[doc(hidden)] + #[doc(hidden)] __Unknown(i32), } impl fmt::Display for StaticDeltaGenerateOpt { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "StaticDeltaGenerateOpt::{}", match *self { - Self::Lowlatency => "Lowlatency", - Self::Major => "Major", - _ => "Unknown", - }) + write!( + f, + "StaticDeltaGenerateOpt::{}", + match *self { + Self::Lowlatency => "Lowlatency", + Self::Major => "Major", + _ => "Unknown", + } + ) } } @@ -675,7 +712,7 @@ impl IntoGlib for StaticDeltaGenerateOpt { Self::Lowlatency => ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_LOWLATENCY, Self::Major => ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR, Self::__Unknown(value) => value, -} + } } } @@ -686,7 +723,6 @@ impl FromGlib for StaticDeltaGenerateOpt { ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_LOWLATENCY => Self::Lowlatency, ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR => Self::Major, value => Self::__Unknown(value), -} + } } } - diff --git a/rust-bindings/src/auto/flags.rs b/rust-bindings/src/auto/flags.rs index 0a08e5f7..76ec18f2 100644 --- a/rust-bindings/src/auto/flags.rs +++ b/rust-bindings/src/auto/flags.rs @@ -11,8 +11,8 @@ use glib::Type; use std::fmt; #[cfg(any(feature = "v2017_13", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_13")))] bitflags! { + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_13")))] #[doc(alias = "OstreeChecksumFlags")] pub struct ChecksumFlags: u32 { #[doc(alias = "OSTREE_CHECKSUM_FLAGS_NONE")] @@ -157,8 +157,8 @@ impl FromGlib for RepoCommitModifierFlags { } #[cfg(any(feature = "v2015_7", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2015_7")))] bitflags! { + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2015_7")))] #[doc(alias = "OstreeRepoCommitState")] pub struct RepoCommitState: u32 { #[doc(alias = "OSTREE_REPO_COMMIT_STATE_NORMAL")] @@ -411,8 +411,8 @@ impl FromGlib for RepoResolveRevExtFlags { } #[cfg(any(feature = "v2021_4", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_4")))] bitflags! { + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_4")))] #[doc(alias = "OstreeRepoVerifyFlags")] pub struct RepoVerifyFlags: u32 { #[doc(alias = "OSTREE_REPO_VERIFY_FLAGS_NONE")] @@ -623,4 +623,3 @@ impl FromGlib for SysrootUpgraderPullFlags Self::from_bits_truncate(value) } } - diff --git a/rust-bindings/src/auto/functions.rs b/rust-bindings/src/auto/functions.rs index 2b5fa27d..e9be0c04 100644 --- a/rust-bindings/src/auto/functions.rs +++ b/rust-bindings/src/auto/functions.rs @@ -13,15 +13,30 @@ use glib::translate::*; use std::mem; use std::ptr; - #[cfg(any(feature = "v2017_15", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_15")))] #[doc(alias = "ostree_break_hardlink")] -pub fn break_hardlink>(dfd: i32, path: &str, skip_xattrs: bool, cancellable: Option<&P>) -> Result<(), glib::Error> { +pub fn break_hardlink( + dfd: i32, + path: &str, + skip_xattrs: bool, + cancellable: Option<&impl IsA>, +) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_break_hardlink(dfd, path.to_glib_none().0, skip_xattrs.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_break_hardlink( + dfd, + path.to_glib_none().0, + skip_xattrs.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -29,9 +44,7 @@ pub fn break_hardlink>(dfd: i32, path: &str, skip_xattr #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_4")))] #[doc(alias = "ostree_check_version")] pub fn check_version(required_year: u32, required_release: u32) -> bool { - unsafe { - from_glib(ffi::ostree_check_version(required_year, required_release)) - } + unsafe { from_glib(ffi::ostree_check_version(required_year, required_release)) } } //#[doc(alias = "ostree_checksum_bytes_peek")] @@ -46,16 +59,12 @@ pub fn check_version(required_year: u32, required_release: u32) -> bool { #[doc(alias = "ostree_checksum_from_bytes_v")] pub fn checksum_from_bytes_v(csum_v: &glib::Variant) -> Option { - unsafe { - from_glib_full(ffi::ostree_checksum_from_bytes_v(csum_v.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::ostree_checksum_from_bytes_v(csum_v.to_glib_none().0)) } } #[doc(alias = "ostree_checksum_to_bytes_v")] pub fn checksum_to_bytes_v(checksum: &str) -> Option { - unsafe { - from_glib_full(ffi::ostree_checksum_to_bytes_v(checksum.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::ostree_checksum_to_bytes_v(checksum.to_glib_none().0)) } } #[cfg(any(feature = "v2018_2", feature = "dox"))] @@ -63,26 +72,41 @@ pub fn checksum_to_bytes_v(checksum: &str) -> Option { #[doc(alias = "ostree_commit_get_content_checksum")] pub fn commit_get_content_checksum(commit_variant: &glib::Variant) -> Option { unsafe { - from_glib_full(ffi::ostree_commit_get_content_checksum(commit_variant.to_glib_none().0)) + from_glib_full(ffi::ostree_commit_get_content_checksum( + commit_variant.to_glib_none().0, + )) } } #[cfg(any(feature = "v2020_1", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_1")))] #[doc(alias = "ostree_commit_get_object_sizes")] -pub fn commit_get_object_sizes(commit_variant: &glib::Variant) -> Result, glib::Error> { +pub fn commit_get_object_sizes( + commit_variant: &glib::Variant, +) -> Result, glib::Error> { unsafe { let mut out_sizes_entries = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_commit_get_object_sizes(commit_variant.to_glib_none().0, &mut out_sizes_entries, &mut error); - if error.is_null() { Ok(FromGlibPtrContainer::from_glib_container(out_sizes_entries)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_commit_get_object_sizes( + commit_variant.to_glib_none().0, + &mut out_sizes_entries, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(FromGlibPtrContainer::from_glib_container(out_sizes_entries)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_commit_get_parent")] pub fn commit_get_parent(commit_variant: &glib::Variant) -> Option { unsafe { - from_glib_full(ffi::ostree_commit_get_parent(commit_variant.to_glib_none().0)) + from_glib_full(ffi::ostree_commit_get_parent( + commit_variant.to_glib_none().0, + )) } } @@ -90,99 +114,234 @@ pub fn commit_get_parent(commit_variant: &glib::Variant) -> Option u64 { - unsafe { - ffi::ostree_commit_get_timestamp(commit_variant.to_glib_none().0) - } + unsafe { ffi::ostree_commit_get_timestamp(commit_variant.to_glib_none().0) } } //#[cfg(any(feature = "v2021_1", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_1")))] //#[doc(alias = "ostree_commit_metadata_for_bootable")] -//pub fn commit_metadata_for_bootable, Q: IsA>(root: &P, dict: /*Ignored*/&glib::VariantDict, cancellable: Option<&Q>) -> Result<(), glib::Error> { +//pub fn commit_metadata_for_bootable(root: &impl IsA, dict: /*Ignored*/&glib::VariantDict, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_commit_metadata_for_bootable() } //} #[doc(alias = "ostree_content_file_parse")] -pub fn content_file_parse, Q: IsA>(compressed: bool, content_path: &P, trusted: bool, cancellable: Option<&Q>) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> { +pub fn content_file_parse( + compressed: bool, + content_path: &impl IsA, + trusted: bool, + cancellable: Option<&impl IsA>, +) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> { unsafe { let mut out_input = ptr::null_mut(); let mut out_file_info = ptr::null_mut(); let mut out_xattrs = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_content_file_parse(compressed.into_glib(), content_path.as_ref().to_glib_none().0, trusted.into_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok((from_glib_full(out_input), from_glib_full(out_file_info), from_glib_full(out_xattrs))) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_content_file_parse( + compressed.into_glib(), + content_path.as_ref().to_glib_none().0, + trusted.into_glib(), + &mut out_input, + &mut out_file_info, + &mut out_xattrs, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(( + from_glib_full(out_input), + from_glib_full(out_file_info), + from_glib_full(out_xattrs), + )) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_content_file_parse_at")] -pub fn content_file_parse_at>(compressed: bool, parent_dfd: i32, path: &str, trusted: bool, cancellable: Option<&P>) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> { +pub fn content_file_parse_at( + compressed: bool, + parent_dfd: i32, + path: &str, + trusted: bool, + cancellable: Option<&impl IsA>, +) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> { unsafe { let mut out_input = ptr::null_mut(); let mut out_file_info = ptr::null_mut(); let mut out_xattrs = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_content_file_parse_at(compressed.into_glib(), parent_dfd, path.to_glib_none().0, trusted.into_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok((from_glib_full(out_input), from_glib_full(out_file_info), from_glib_full(out_xattrs))) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_content_file_parse_at( + compressed.into_glib(), + parent_dfd, + path.to_glib_none().0, + trusted.into_glib(), + &mut out_input, + &mut out_file_info, + &mut out_xattrs, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(( + from_glib_full(out_input), + from_glib_full(out_file_info), + from_glib_full(out_xattrs), + )) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_content_stream_parse")] -pub fn content_stream_parse, Q: IsA>(compressed: bool, input: &P, input_length: u64, trusted: bool, cancellable: Option<&Q>) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> { +pub fn content_stream_parse( + compressed: bool, + input: &impl IsA, + input_length: u64, + trusted: bool, + cancellable: Option<&impl IsA>, +) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> { unsafe { let mut out_input = ptr::null_mut(); let mut out_file_info = ptr::null_mut(); let mut out_xattrs = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_content_stream_parse(compressed.into_glib(), input.as_ref().to_glib_none().0, input_length, trusted.into_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok((from_glib_full(out_input), from_glib_full(out_file_info), from_glib_full(out_xattrs))) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_content_stream_parse( + compressed.into_glib(), + input.as_ref().to_glib_none().0, + input_length, + trusted.into_glib(), + &mut out_input, + &mut out_file_info, + &mut out_xattrs, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(( + from_glib_full(out_input), + from_glib_full(out_file_info), + from_glib_full(out_xattrs), + )) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_create_directory_metadata")] -pub fn create_directory_metadata(dir_info: &gio::FileInfo, xattrs: Option<&glib::Variant>) -> Option { +pub fn create_directory_metadata( + dir_info: &gio::FileInfo, + xattrs: Option<&glib::Variant>, +) -> Option { unsafe { - from_glib_full(ffi::ostree_create_directory_metadata(dir_info.to_glib_none().0, xattrs.to_glib_none().0)) + from_glib_full(ffi::ostree_create_directory_metadata( + dir_info.to_glib_none().0, + xattrs.to_glib_none().0, + )) } } #[doc(alias = "ostree_diff_dirs")] -pub fn diff_dirs, Q: IsA, R: IsA>(flags: DiffFlags, a: &P, b: &Q, modified: &[&DiffItem], removed: &[gio::File], added: &[gio::File], cancellable: Option<&R>) -> Result<(), glib::Error> { +pub fn diff_dirs( + flags: DiffFlags, + a: &impl IsA, + b: &impl IsA, + modified: &[&DiffItem], + removed: &[gio::File], + added: &[gio::File], + cancellable: Option<&impl IsA>, +) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_diff_dirs(flags.into_glib(), a.as_ref().to_glib_none().0, b.as_ref().to_glib_none().0, modified.to_glib_none().0, removed.to_glib_none().0, added.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_diff_dirs( + flags.into_glib(), + a.as_ref().to_glib_none().0, + b.as_ref().to_glib_none().0, + modified.to_glib_none().0, + removed.to_glib_none().0, + added.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } //#[cfg(any(feature = "v2017_4", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_4")))] //#[doc(alias = "ostree_diff_dirs_with_options")] -//pub fn diff_dirs_with_options, Q: IsA, R: IsA>(flags: DiffFlags, a: &P, b: &Q, modified: &[&DiffItem], removed: &[gio::File], added: &[gio::File], options: /*Ignored*/Option<&mut DiffDirsOptions>, cancellable: Option<&R>) -> Result<(), glib::Error> { +//pub fn diff_dirs_with_options(flags: DiffFlags, a: &impl IsA, b: &impl IsA, modified: &[&DiffItem], removed: &[gio::File], added: &[gio::File], options: /*Ignored*/Option<&mut DiffDirsOptions>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_diff_dirs_with_options() } //} #[doc(alias = "ostree_diff_print")] -pub fn diff_print, Q: IsA>(a: &P, b: &Q, modified: &[&DiffItem], removed: &[gio::File], added: &[gio::File]) { +pub fn diff_print( + a: &impl IsA, + b: &impl IsA, + modified: &[&DiffItem], + removed: &[gio::File], + added: &[gio::File], +) { unsafe { - ffi::ostree_diff_print(a.as_ref().to_glib_none().0, b.as_ref().to_glib_none().0, modified.to_glib_none().0, removed.to_glib_none().0, added.to_glib_none().0); + ffi::ostree_diff_print( + a.as_ref().to_glib_none().0, + b.as_ref().to_glib_none().0, + modified.to_glib_none().0, + removed.to_glib_none().0, + added.to_glib_none().0, + ); } } #[doc(alias = "ostree_fs_get_all_xattrs")] -pub fn fs_get_all_xattrs>(fd: i32, cancellable: Option<&P>) -> Result { +pub fn fs_get_all_xattrs( + fd: i32, + cancellable: Option<&impl IsA>, +) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_fs_get_all_xattrs(fd, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_fs_get_all_xattrs( + fd, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_fs_get_all_xattrs_at")] -pub fn fs_get_all_xattrs_at>(dfd: i32, path: &str, cancellable: Option<&P>) -> Result { +pub fn fs_get_all_xattrs_at( + dfd: i32, + path: &str, + cancellable: Option<&impl IsA>, +) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_fs_get_all_xattrs_at(dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_fs_get_all_xattrs_at( + dfd, + path.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } @@ -190,16 +349,12 @@ pub fn fs_get_all_xattrs_at>(dfd: i32, path: &str, canc #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))] #[doc(alias = "ostree_gpg_error_quark")] pub fn gpg_error_quark() -> glib::Quark { - unsafe { - from_glib(ffi::ostree_gpg_error_quark()) - } + unsafe { from_glib(ffi::ostree_gpg_error_quark()) } } #[doc(alias = "ostree_metadata_variant_type")] pub fn metadata_variant_type(objtype: ObjectType) -> Option { - unsafe { - from_glib_none(ffi::ostree_metadata_variant_type(objtype.into_glib())) - } + unsafe { from_glib_none(ffi::ostree_metadata_variant_type(objtype.into_glib())) } } #[doc(alias = "ostree_object_from_string")] @@ -207,7 +362,11 @@ pub fn object_from_string(str: &str) -> (glib::GString, ObjectType) { unsafe { let mut out_checksum = ptr::null_mut(); let mut out_objtype = mem::MaybeUninit::uninit(); - ffi::ostree_object_from_string(str.to_glib_none().0, &mut out_checksum, out_objtype.as_mut_ptr()); + ffi::ostree_object_from_string( + str.to_glib_none().0, + &mut out_checksum, + out_objtype.as_mut_ptr(), + ); let out_objtype = out_objtype.assume_init(); (from_glib_full(out_checksum), from_glib(out_objtype)) } @@ -218,7 +377,11 @@ pub fn object_name_deserialize(variant: &glib::Variant) -> (glib::GString, Objec unsafe { let mut out_checksum = ptr::null(); let mut out_objtype = mem::MaybeUninit::uninit(); - ffi::ostree_object_name_deserialize(variant.to_glib_none().0, &mut out_checksum, out_objtype.as_mut_ptr()); + ffi::ostree_object_name_deserialize( + variant.to_glib_none().0, + &mut out_checksum, + out_objtype.as_mut_ptr(), + ); let out_objtype = out_objtype.assume_init(); (from_glib_none(out_checksum), from_glib(out_objtype)) } @@ -227,29 +390,31 @@ pub fn object_name_deserialize(variant: &glib::Variant) -> (glib::GString, Objec #[doc(alias = "ostree_object_name_serialize")] pub fn object_name_serialize(checksum: &str, objtype: ObjectType) -> Option { unsafe { - from_glib_none(ffi::ostree_object_name_serialize(checksum.to_glib_none().0, objtype.into_glib())) + from_glib_none(ffi::ostree_object_name_serialize( + checksum.to_glib_none().0, + objtype.into_glib(), + )) } } #[doc(alias = "ostree_object_to_string")] pub fn object_to_string(checksum: &str, objtype: ObjectType) -> Option { unsafe { - from_glib_full(ffi::ostree_object_to_string(checksum.to_glib_none().0, objtype.into_glib())) + from_glib_full(ffi::ostree_object_to_string( + checksum.to_glib_none().0, + objtype.into_glib(), + )) } } #[doc(alias = "ostree_object_type_from_string")] pub fn object_type_from_string(str: &str) -> ObjectType { - unsafe { - from_glib(ffi::ostree_object_type_from_string(str.to_glib_none().0)) - } + unsafe { from_glib(ffi::ostree_object_type_from_string(str.to_glib_none().0)) } } #[doc(alias = "ostree_object_type_to_string")] pub fn object_type_to_string(objtype: ObjectType) -> Option { - unsafe { - from_glib_none(ffi::ostree_object_type_to_string(objtype.into_glib())) - } + unsafe { from_glib_none(ffi::ostree_object_type_to_string(objtype.into_glib())) } } #[doc(alias = "ostree_parse_refspec")] @@ -258,44 +423,108 @@ pub fn parse_refspec(refspec: &str) -> Result<(Option, glib::GStr let mut out_remote = ptr::null_mut(); let mut out_ref = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_parse_refspec(refspec.to_glib_none().0, &mut out_remote, &mut out_ref, &mut error); - if error.is_null() { Ok((from_glib_full(out_remote), from_glib_full(out_ref))) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_parse_refspec( + refspec.to_glib_none().0, + &mut out_remote, + &mut out_ref, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok((from_glib_full(out_remote), from_glib_full(out_ref))) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2016_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_6")))] #[doc(alias = "ostree_raw_file_to_archive_z2_stream")] -pub fn raw_file_to_archive_z2_stream, Q: IsA>(input: &P, file_info: &gio::FileInfo, xattrs: Option<&glib::Variant>, cancellable: Option<&Q>) -> Result { +pub fn raw_file_to_archive_z2_stream( + input: &impl IsA, + file_info: &gio::FileInfo, + xattrs: Option<&glib::Variant>, + cancellable: Option<&impl IsA>, +) -> Result { unsafe { let mut out_input = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_raw_file_to_archive_z2_stream(input.as_ref().to_glib_none().0, file_info.to_glib_none().0, xattrs.to_glib_none().0, &mut out_input, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_input)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_raw_file_to_archive_z2_stream( + input.as_ref().to_glib_none().0, + file_info.to_glib_none().0, + xattrs.to_glib_none().0, + &mut out_input, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_input)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2017_3", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_3")))] #[doc(alias = "ostree_raw_file_to_archive_z2_stream_with_options")] -pub fn raw_file_to_archive_z2_stream_with_options, Q: IsA>(input: &P, file_info: &gio::FileInfo, xattrs: Option<&glib::Variant>, options: Option<&glib::Variant>, cancellable: Option<&Q>) -> Result { +pub fn raw_file_to_archive_z2_stream_with_options( + input: &impl IsA, + file_info: &gio::FileInfo, + xattrs: Option<&glib::Variant>, + options: Option<&glib::Variant>, + cancellable: Option<&impl IsA>, +) -> Result { unsafe { let mut out_input = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_raw_file_to_archive_z2_stream_with_options(input.as_ref().to_glib_none().0, file_info.to_glib_none().0, xattrs.to_glib_none().0, options.to_glib_none().0, &mut out_input, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_input)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_raw_file_to_archive_z2_stream_with_options( + input.as_ref().to_glib_none().0, + file_info.to_glib_none().0, + xattrs.to_glib_none().0, + options.to_glib_none().0, + &mut out_input, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_input)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_raw_file_to_content_stream")] -pub fn raw_file_to_content_stream, Q: IsA>(input: &P, file_info: &gio::FileInfo, xattrs: Option<&glib::Variant>, cancellable: Option<&Q>) -> Result<(gio::InputStream, u64), glib::Error> { +pub fn raw_file_to_content_stream( + input: &impl IsA, + file_info: &gio::FileInfo, + xattrs: Option<&glib::Variant>, + cancellable: Option<&impl IsA>, +) -> Result<(gio::InputStream, u64), glib::Error> { unsafe { let mut out_input = ptr::null_mut(); let mut out_length = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_raw_file_to_content_stream(input.as_ref().to_glib_none().0, file_info.to_glib_none().0, xattrs.to_glib_none().0, &mut out_input, out_length.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + let is_ok = ffi::ostree_raw_file_to_content_stream( + input.as_ref().to_glib_none().0, + file_info.to_glib_none().0, + xattrs.to_glib_none().0, + &mut out_input, + out_length.as_mut_ptr(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); let out_length = out_length.assume_init(); - if error.is_null() { Ok((from_glib_full(out_input), out_length)) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok((from_glib_full(out_input), out_length)) + } else { + Err(from_glib_full(error)) + } } } @@ -303,8 +532,13 @@ pub fn raw_file_to_content_stream, Q: IsA Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_validate_checksum_string(sha256.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_validate_checksum_string(sha256.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -314,8 +548,13 @@ pub fn validate_checksum_string(sha256: &str) -> Result<(), glib::Error> { pub fn validate_collection_id(collection_id: Option<&str>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_validate_collection_id(collection_id.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_validate_collection_id(collection_id.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -325,8 +564,13 @@ pub fn validate_collection_id(collection_id: Option<&str>) -> Result<(), glib::E pub fn validate_remote_name(remote_name: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_validate_remote_name(remote_name.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_validate_remote_name(remote_name.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -334,8 +578,13 @@ pub fn validate_remote_name(remote_name: &str) -> Result<(), glib::Error> { pub fn validate_rev(rev: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_validate_rev(rev.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_validate_rev(rev.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -343,8 +592,14 @@ pub fn validate_rev(rev: &str) -> Result<(), glib::Error> { pub fn validate_structureof_checksum_string(checksum: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_validate_structureof_checksum_string(checksum.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = + ffi::ostree_validate_structureof_checksum_string(checksum.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -352,8 +607,13 @@ pub fn validate_structureof_checksum_string(checksum: &str) -> Result<(), glib:: pub fn validate_structureof_commit(commit: &glib::Variant) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_validate_structureof_commit(commit.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_validate_structureof_commit(commit.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -361,8 +621,13 @@ pub fn validate_structureof_commit(commit: &glib::Variant) -> Result<(), glib::E pub fn validate_structureof_csum_v(checksum: &glib::Variant) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_validate_structureof_csum_v(checksum.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_validate_structureof_csum_v(checksum.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -370,8 +635,13 @@ pub fn validate_structureof_csum_v(checksum: &glib::Variant) -> Result<(), glib: pub fn validate_structureof_dirmeta(dirmeta: &glib::Variant) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_validate_structureof_dirmeta(dirmeta.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_validate_structureof_dirmeta(dirmeta.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -379,8 +649,13 @@ pub fn validate_structureof_dirmeta(dirmeta: &glib::Variant) -> Result<(), glib: pub fn validate_structureof_dirtree(dirtree: &glib::Variant) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_validate_structureof_dirtree(dirtree.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_validate_structureof_dirtree(dirtree.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -388,8 +663,13 @@ pub fn validate_structureof_dirtree(dirtree: &glib::Variant) -> Result<(), glib: pub fn validate_structureof_file_mode(mode: u32) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_validate_structureof_file_mode(mode, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_validate_structureof_file_mode(mode, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -397,7 +677,12 @@ pub fn validate_structureof_file_mode(mode: u32) -> Result<(), glib::Error> { pub fn validate_structureof_objtype(objtype: u8) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_validate_structureof_objtype(objtype, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_validate_structureof_objtype(objtype, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } diff --git a/rust-bindings/src/auto/gpg_verify_result.rs b/rust-bindings/src/auto/gpg_verify_result.rs index 3986b375..9eb16494 100644 --- a/rust-bindings/src/auto/gpg_verify_result.rs +++ b/rust-bindings/src/auto/gpg_verify_result.rs @@ -2,7 +2,6 @@ // from gir-files // DO NOT EDIT -use crate::GpgSignatureFormatFlags; use glib::translate::*; use std::fmt; use std::mem; @@ -22,23 +21,12 @@ glib::wrapper! { impl GpgVerifyResult { #[doc(alias = "ostree_gpg_verify_result_count_all")] pub fn count_all(&self) -> u32 { - unsafe { - ffi::ostree_gpg_verify_result_count_all(self.to_glib_none().0) - } + unsafe { ffi::ostree_gpg_verify_result_count_all(self.to_glib_none().0) } } #[doc(alias = "ostree_gpg_verify_result_count_valid")] pub fn count_valid(&self) -> u32 { - unsafe { - ffi::ostree_gpg_verify_result_count_valid(self.to_glib_none().0) - } - } - - #[doc(alias = "ostree_gpg_verify_result_describe")] - pub fn describe(&self, signature_index: u32, output_buffer: &mut glib::String, line_prefix: Option<&str>, flags: GpgSignatureFormatFlags) { - unsafe { - ffi::ostree_gpg_verify_result_describe(self.to_glib_none().0, signature_index, output_buffer.to_glib_none_mut().0, line_prefix.to_glib_none().0, flags.into_glib()); - } + unsafe { ffi::ostree_gpg_verify_result_count_valid(self.to_glib_none().0) } } //#[doc(alias = "ostree_gpg_verify_result_get")] @@ -50,7 +38,10 @@ impl GpgVerifyResult { #[doc(alias = "get_all")] pub fn all(&self, signature_index: u32) -> Option { unsafe { - from_glib_none(ffi::ostree_gpg_verify_result_get_all(self.to_glib_none().0, signature_index)) + from_glib_none(ffi::ostree_gpg_verify_result_get_all( + self.to_glib_none().0, + signature_index, + )) } } @@ -58,9 +49,17 @@ impl GpgVerifyResult { pub fn lookup(&self, key_id: &str) -> Option { unsafe { let mut out_signature_index = mem::MaybeUninit::uninit(); - let ret = from_glib(ffi::ostree_gpg_verify_result_lookup(self.to_glib_none().0, key_id.to_glib_none().0, out_signature_index.as_mut_ptr())); + let ret = from_glib(ffi::ostree_gpg_verify_result_lookup( + self.to_glib_none().0, + key_id.to_glib_none().0, + out_signature_index.as_mut_ptr(), + )); let out_signature_index = out_signature_index.assume_init(); - if ret { Some(out_signature_index) } else { None } + if ret { + Some(out_signature_index) + } else { + None + } } } @@ -70,15 +69,16 @@ impl GpgVerifyResult { pub fn require_valid_signature(&self) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_gpg_verify_result_require_valid_signature(self.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } - } - } - - #[doc(alias = "ostree_gpg_verify_result_describe_variant")] - pub fn describe_variant(variant: &glib::Variant, output_buffer: &mut glib::String, line_prefix: Option<&str>, flags: GpgSignatureFormatFlags) { - unsafe { - ffi::ostree_gpg_verify_result_describe_variant(variant.to_glib_none().0, output_buffer.to_glib_none_mut().0, line_prefix.to_glib_none().0, flags.into_glib()); + let is_ok = ffi::ostree_gpg_verify_result_require_valid_signature( + self.to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } } diff --git a/rust-bindings/src/auto/mod.rs b/rust-bindings/src/auto/mod.rs index c6618214..39b6448c 100644 --- a/rust-bindings/src/auto/mod.rs +++ b/rust-bindings/src/auto/mod.rs @@ -3,79 +3,55 @@ // DO NOT EDIT mod async_progress; -pub use self::async_progress::{AsyncProgress}; +pub use self::async_progress::AsyncProgress; mod bootconfig_parser; -pub use self::bootconfig_parser::{BootconfigParser}; +pub use self::bootconfig_parser::BootconfigParser; mod content_writer; -pub use self::content_writer::{ContentWriter}; +pub use self::content_writer::ContentWriter; mod deployment; -pub use self::deployment::{Deployment}; +pub use self::deployment::Deployment; mod gpg_verify_result; -pub use self::gpg_verify_result::{GpgVerifyResult}; +pub use self::gpg_verify_result::GpgVerifyResult; mod mutable_tree; -pub use self::mutable_tree::{MutableTree}; +pub use self::mutable_tree::MutableTree; mod repo; -pub use self::repo::{Repo}; +pub use self::repo::Repo; mod repo_file; -pub use self::repo_file::{RepoFile}; +pub use self::repo_file::RepoFile; -#[cfg(any(feature = "v2018_6", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] mod repo_finder; -#[cfg(any(feature = "v2018_6", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] -pub use self::repo_finder::{RepoFinder, NONE_REPO_FINDER}; +pub use self::repo_finder::RepoFinder; -#[cfg(any(feature = "v2018_6", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] mod repo_finder_avahi; -#[cfg(any(feature = "v2018_6", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] -pub use self::repo_finder_avahi::{RepoFinderAvahi}; +pub use self::repo_finder_avahi::RepoFinderAvahi; -#[cfg(any(feature = "v2018_6", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] mod repo_finder_config; -#[cfg(any(feature = "v2018_6", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] -pub use self::repo_finder_config::{RepoFinderConfig}; +pub use self::repo_finder_config::RepoFinderConfig; -#[cfg(any(feature = "v2018_6", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] mod repo_finder_mount; -#[cfg(any(feature = "v2018_6", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] -pub use self::repo_finder_mount::{RepoFinderMount}; +pub use self::repo_finder_mount::RepoFinderMount; -#[cfg(any(feature = "v2018_6", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] mod repo_finder_override; -#[cfg(any(feature = "v2018_6", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] -pub use self::repo_finder_override::{RepoFinderOverride}; +pub use self::repo_finder_override::RepoFinderOverride; mod se_policy; -pub use self::se_policy::{SePolicy}; +pub use self::se_policy::SePolicy; -#[cfg(any(feature = "v2020_2", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] mod sign; -#[cfg(any(feature = "v2020_2", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] -pub use self::sign::{Sign, NONE_SIGN}; +pub use self::sign::Sign; mod sysroot; -pub use self::sysroot::{Sysroot}; +pub use self::sysroot::Sysroot; mod sysroot_upgrader; -pub use self::sysroot_upgrader::{SysrootUpgrader}; +pub use self::sysroot_upgrader::SysrootUpgrader; #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] @@ -208,10 +184,6 @@ pub use self::constants::TREE_GVARIANT_STRING; #[doc(hidden)] pub mod traits { - #[cfg(any(feature = "v2018_6", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] pub use super::repo_finder::RepoFinderExt; - #[cfg(any(feature = "v2020_2", feature = "dox"))] -#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] pub use super::sign::SignExt; } diff --git a/rust-bindings/src/auto/mutable_tree.rs b/rust-bindings/src/auto/mutable_tree.rs index 1b581fb8..9322775f 100644 --- a/rust-bindings/src/auto/mutable_tree.rs +++ b/rust-bindings/src/auto/mutable_tree.rs @@ -21,18 +21,24 @@ glib::wrapper! { impl MutableTree { #[doc(alias = "ostree_mutable_tree_new")] pub fn new() -> MutableTree { - unsafe { - from_glib_full(ffi::ostree_mutable_tree_new()) - } + unsafe { from_glib_full(ffi::ostree_mutable_tree_new()) } } #[cfg(any(feature = "v2018_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_7")))] #[doc(alias = "ostree_mutable_tree_new_from_checksum")] #[doc(alias = "new_from_checksum")] - pub fn from_checksum(repo: &Repo, contents_checksum: &str, metadata_checksum: &str) -> MutableTree { + pub fn from_checksum( + repo: &Repo, + contents_checksum: &str, + metadata_checksum: &str, + ) -> MutableTree { unsafe { - from_glib_full(ffi::ostree_mutable_tree_new_from_checksum(repo.to_glib_none().0, contents_checksum.to_glib_none().0, metadata_checksum.to_glib_none().0)) + from_glib_full(ffi::ostree_mutable_tree_new_from_checksum( + repo.to_glib_none().0, + contents_checksum.to_glib_none().0, + metadata_checksum.to_glib_none().0, + )) } } @@ -43,8 +49,16 @@ impl MutableTree { pub fn from_commit(repo: &Repo, rev: &str) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_mutable_tree_new_from_commit(repo.to_glib_none().0, rev.to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_mutable_tree_new_from_commit( + repo.to_glib_none().0, + rev.to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } @@ -54,8 +68,13 @@ impl MutableTree { pub fn check_error(&self) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_mutable_tree_check_error(self.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_mutable_tree_check_error(self.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -64,27 +83,62 @@ impl MutableTree { unsafe { let mut out_subdir = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_mutable_tree_ensure_dir(self.to_glib_none().0, name.to_glib_none().0, &mut out_subdir, &mut error); - if error.is_null() { Ok(from_glib_full(out_subdir)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_mutable_tree_ensure_dir( + self.to_glib_none().0, + name.to_glib_none().0, + &mut out_subdir, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_subdir)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_mutable_tree_ensure_parent_dirs")] - pub fn ensure_parent_dirs(&self, split_path: &[&str], metadata_checksum: &str) -> Result { + pub fn ensure_parent_dirs( + &self, + split_path: &[&str], + metadata_checksum: &str, + ) -> Result { unsafe { let mut out_parent = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_mutable_tree_ensure_parent_dirs(self.to_glib_none().0, split_path.to_glib_none().0, metadata_checksum.to_glib_none().0, &mut out_parent, &mut error); - if error.is_null() { Ok(from_glib_full(out_parent)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_mutable_tree_ensure_parent_dirs( + self.to_glib_none().0, + split_path.to_glib_none().0, + metadata_checksum.to_glib_none().0, + &mut out_parent, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_parent)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2018_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_7")))] #[doc(alias = "ostree_mutable_tree_fill_empty_from_dirtree")] - pub fn fill_empty_from_dirtree(&self, repo: &Repo, contents_checksum: &str, metadata_checksum: &str) -> bool { + pub fn fill_empty_from_dirtree( + &self, + repo: &Repo, + contents_checksum: &str, + metadata_checksum: &str, + ) -> bool { unsafe { - from_glib(ffi::ostree_mutable_tree_fill_empty_from_dirtree(self.to_glib_none().0, repo.to_glib_none().0, contents_checksum.to_glib_none().0, metadata_checksum.to_glib_none().0)) + from_glib(ffi::ostree_mutable_tree_fill_empty_from_dirtree( + self.to_glib_none().0, + repo.to_glib_none().0, + contents_checksum.to_glib_none().0, + metadata_checksum.to_glib_none().0, + )) } } @@ -92,7 +146,9 @@ impl MutableTree { #[doc(alias = "get_contents_checksum")] pub fn contents_checksum(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_mutable_tree_get_contents_checksum(self.to_glib_none().0)) + from_glib_none(ffi::ostree_mutable_tree_get_contents_checksum( + self.to_glib_none().0, + )) } } @@ -106,7 +162,9 @@ impl MutableTree { #[doc(alias = "get_metadata_checksum")] pub fn metadata_checksum(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_mutable_tree_get_metadata_checksum(self.to_glib_none().0)) + from_glib_none(ffi::ostree_mutable_tree_get_metadata_checksum( + self.to_glib_none().0, + )) } } @@ -117,13 +175,30 @@ impl MutableTree { //} #[doc(alias = "ostree_mutable_tree_lookup")] - pub fn lookup(&self, name: &str) -> Result<(Option, Option), glib::Error> { + pub fn lookup( + &self, + name: &str, + ) -> Result<(Option, Option), glib::Error> { unsafe { let mut out_file_checksum = ptr::null_mut(); let mut out_subdir = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_mutable_tree_lookup(self.to_glib_none().0, name.to_glib_none().0, &mut out_file_checksum, &mut out_subdir, &mut error); - if error.is_null() { Ok((from_glib_full(out_file_checksum), from_glib_full(out_subdir))) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_mutable_tree_lookup( + self.to_glib_none().0, + name.to_glib_none().0, + &mut out_file_checksum, + &mut out_subdir, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(( + from_glib_full(out_file_checksum), + from_glib_full(out_subdir), + )) + } else { + Err(from_glib_full(error)) + } } } @@ -133,8 +208,18 @@ impl MutableTree { pub fn remove(&self, name: &str, allow_noent: bool) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_mutable_tree_remove(self.to_glib_none().0, name.to_glib_none().0, allow_noent.into_glib(), &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_mutable_tree_remove( + self.to_glib_none().0, + name.to_glib_none().0, + allow_noent.into_glib(), + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -142,22 +227,38 @@ impl MutableTree { pub fn replace_file(&self, name: &str, checksum: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_mutable_tree_replace_file(self.to_glib_none().0, name.to_glib_none().0, checksum.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_mutable_tree_replace_file( + self.to_glib_none().0, + name.to_glib_none().0, + checksum.to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_mutable_tree_set_contents_checksum")] pub fn set_contents_checksum(&self, checksum: &str) { unsafe { - ffi::ostree_mutable_tree_set_contents_checksum(self.to_glib_none().0, checksum.to_glib_none().0); + ffi::ostree_mutable_tree_set_contents_checksum( + self.to_glib_none().0, + checksum.to_glib_none().0, + ); } } #[doc(alias = "ostree_mutable_tree_set_metadata_checksum")] pub fn set_metadata_checksum(&self, checksum: &str) { unsafe { - ffi::ostree_mutable_tree_set_metadata_checksum(self.to_glib_none().0, checksum.to_glib_none().0); + ffi::ostree_mutable_tree_set_metadata_checksum( + self.to_glib_none().0, + checksum.to_glib_none().0, + ); } } @@ -166,8 +267,19 @@ impl MutableTree { unsafe { let mut out_subdir = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_mutable_tree_walk(self.to_glib_none().0, split_path.to_glib_none().0, start, &mut out_subdir, &mut error); - if error.is_null() { Ok(from_glib_full(out_subdir)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_mutable_tree_walk( + self.to_glib_none().0, + split_path.to_glib_none().0, + start, + &mut out_subdir, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_subdir)) + } else { + Err(from_glib_full(error)) + } } } } diff --git a/rust-bindings/src/auto/remote.rs b/rust-bindings/src/auto/remote.rs index 95939f25..f9b1698d 100644 --- a/rust-bindings/src/auto/remote.rs +++ b/rust-bindings/src/auto/remote.rs @@ -19,16 +19,12 @@ impl Remote { #[doc(alias = "ostree_remote_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_remote_get_name(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_remote_get_name(self.to_glib_none().0)) } } #[doc(alias = "ostree_remote_get_url")] #[doc(alias = "get_url")] pub fn url(&self) -> Option { - unsafe { - from_glib_full(ffi::ostree_remote_get_url(self.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::ostree_remote_get_url(self.to_glib_none().0)) } } } diff --git a/rust-bindings/src/auto/repo.rs b/rust-bindings/src/auto/repo.rs index 56a39c16..7864f2f6 100644 --- a/rust-bindings/src/auto/repo.rs +++ b/rust-bindings/src/auto/repo.rs @@ -66,115 +66,256 @@ glib::wrapper! { impl Repo { #[doc(alias = "ostree_repo_new")] - pub fn new>(path: &P) -> Repo { - unsafe { - from_glib_full(ffi::ostree_repo_new(path.as_ref().to_glib_none().0)) - } + pub fn new(path: &impl IsA) -> Repo { + unsafe { from_glib_full(ffi::ostree_repo_new(path.as_ref().to_glib_none().0)) } } #[doc(alias = "ostree_repo_new_default")] pub fn new_default() -> Repo { - unsafe { - from_glib_full(ffi::ostree_repo_new_default()) - } + unsafe { from_glib_full(ffi::ostree_repo_new_default()) } } #[doc(alias = "ostree_repo_new_for_sysroot_path")] #[doc(alias = "new_for_sysroot_path")] - pub fn for_sysroot_path, Q: IsA>(repo_path: &P, sysroot_path: &Q) -> Repo { + pub fn for_sysroot_path( + repo_path: &impl IsA, + sysroot_path: &impl IsA, + ) -> Repo { unsafe { - from_glib_full(ffi::ostree_repo_new_for_sysroot_path(repo_path.as_ref().to_glib_none().0, sysroot_path.as_ref().to_glib_none().0)) + from_glib_full(ffi::ostree_repo_new_for_sysroot_path( + repo_path.as_ref().to_glib_none().0, + sysroot_path.as_ref().to_glib_none().0, + )) } } #[doc(alias = "ostree_repo_abort_transaction")] - pub fn abort_transaction>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn abort_transaction( + &self, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_abort_transaction(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_abort_transaction( + self.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_add_gpg_signature_summary")] - pub fn add_gpg_signature_summary>(&self, key_id: &[&str], homedir: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn add_gpg_signature_summary( + &self, + key_id: &[&str], + homedir: Option<&str>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_add_gpg_signature_summary(self.to_glib_none().0, key_id.to_glib_none().0, homedir.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_add_gpg_signature_summary( + self.to_glib_none().0, + key_id.to_glib_none().0, + homedir.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_append_gpg_signature")] - pub fn append_gpg_signature>(&self, commit_checksum: &str, signature_bytes: &glib::Bytes, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn append_gpg_signature( + &self, + commit_checksum: &str, + signature_bytes: &glib::Bytes, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_append_gpg_signature(self.to_glib_none().0, commit_checksum.to_glib_none().0, signature_bytes.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_append_gpg_signature( + self.to_glib_none().0, + commit_checksum.to_glib_none().0, + signature_bytes.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2016_8", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_8")))] #[doc(alias = "ostree_repo_checkout_at")] - pub fn checkout_at, Q: IsA>(&self, options: Option<&RepoCheckoutAtOptions>, destination_dfd: i32, destination_path: P, commit: &str, cancellable: Option<&Q>) -> Result<(), glib::Error> { + pub fn checkout_at( + &self, + options: Option<&RepoCheckoutAtOptions>, + destination_dfd: i32, + destination_path: impl AsRef, + commit: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_checkout_at(self.to_glib_none().0, mut_override(options.to_glib_none().0), destination_dfd, destination_path.as_ref().to_glib_none().0, commit.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_checkout_at( + self.to_glib_none().0, + mut_override(options.to_glib_none().0), + destination_dfd, + destination_path.as_ref().to_glib_none().0, + commit.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_checkout_gc")] - pub fn checkout_gc>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn checkout_gc( + &self, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_checkout_gc(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_checkout_gc( + self.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_checkout_tree")] - pub fn checkout_tree, Q: IsA>(&self, mode: RepoCheckoutMode, overwrite_mode: RepoCheckoutOverwriteMode, destination: &P, source: &RepoFile, source_info: &gio::FileInfo, cancellable: Option<&Q>) -> Result<(), glib::Error> { + pub fn checkout_tree( + &self, + mode: RepoCheckoutMode, + overwrite_mode: RepoCheckoutOverwriteMode, + destination: &impl IsA, + source: &RepoFile, + source_info: &gio::FileInfo, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_checkout_tree(self.to_glib_none().0, mode.into_glib(), overwrite_mode.into_glib(), destination.as_ref().to_glib_none().0, source.to_glib_none().0, source_info.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_checkout_tree( + self.to_glib_none().0, + mode.into_glib(), + overwrite_mode.into_glib(), + destination.as_ref().to_glib_none().0, + source.to_glib_none().0, + source_info.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_commit_transaction")] - pub fn commit_transaction>(&self, cancellable: Option<&P>) -> Result { + pub fn commit_transaction( + &self, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_stats = RepoTransactionStats::uninitialized(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_commit_transaction(self.to_glib_none().0, out_stats.to_glib_none_mut().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(out_stats) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_commit_transaction( + self.to_glib_none().0, + out_stats.to_glib_none_mut().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(out_stats) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_copy_config")] pub fn copy_config(&self) -> Option { - unsafe { - from_glib_full(ffi::ostree_repo_copy_config(self.to_glib_none().0)) - } + unsafe { from_glib_full(ffi::ostree_repo_copy_config(self.to_glib_none().0)) } } #[doc(alias = "ostree_repo_create")] - pub fn create>(&self, mode: RepoMode, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn create( + &self, + mode: RepoMode, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_create(self.to_glib_none().0, mode.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_create( + self.to_glib_none().0, + mode.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_delete_object")] - pub fn delete_object>(&self, objtype: ObjectType, sha256: &str, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn delete_object( + &self, + objtype: ObjectType, + sha256: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_delete_object(self.to_glib_none().0, objtype.into_glib(), sha256.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_delete_object( + self.to_glib_none().0, + objtype.into_glib(), + sha256.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -183,23 +324,42 @@ impl Repo { #[doc(alias = "ostree_repo_equal")] pub fn equal(&self, b: &Repo) -> bool { unsafe { - from_glib(ffi::ostree_repo_equal(self.to_glib_none().0, b.to_glib_none().0)) + from_glib(ffi::ostree_repo_equal( + self.to_glib_none().0, + b.to_glib_none().0, + )) } } //#[doc(alias = "ostree_repo_export_tree_to_archive")] - //pub fn export_tree_to_archive>(&self, opts: /*Ignored*/&mut RepoExportArchiveOptions, root: &RepoFile, archive: /*Unimplemented*/Option, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn export_tree_to_archive(&self, opts: /*Ignored*/&mut RepoExportArchiveOptions, root: &RepoFile, archive: /*Unimplemented*/Option, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_export_tree_to_archive() } //} #[cfg(any(feature = "v2017_15", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_15")))] #[doc(alias = "ostree_repo_fsck_object")] - pub fn fsck_object>(&self, objtype: ObjectType, sha256: &str, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn fsck_object( + &self, + objtype: ObjectType, + sha256: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_fsck_object(self.to_glib_none().0, objtype.into_glib(), sha256.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_fsck_object( + self.to_glib_none().0, + objtype.into_glib(), + sha256.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -208,9 +368,7 @@ impl Repo { #[doc(alias = "ostree_repo_get_bootloader")] #[doc(alias = "get_bootloader")] pub fn bootloader(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_repo_get_bootloader(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_repo_get_bootloader(self.to_glib_none().0)) } } #[cfg(any(feature = "v2018_6", feature = "dox"))] @@ -218,17 +376,13 @@ impl Repo { #[doc(alias = "ostree_repo_get_collection_id")] #[doc(alias = "get_collection_id")] pub fn collection_id(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_repo_get_collection_id(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_repo_get_collection_id(self.to_glib_none().0)) } } #[doc(alias = "ostree_repo_get_config")] #[doc(alias = "get_config")] pub fn config(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_repo_get_config(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_repo_get_config(self.to_glib_none().0)) } } #[cfg(any(feature = "v2018_9", feature = "dox"))] @@ -237,7 +391,9 @@ impl Repo { #[doc(alias = "get_default_repo_finders")] pub fn default_repo_finders(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::ostree_repo_get_default_repo_finders(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_none(ffi::ostree_repo_get_default_repo_finders( + self.to_glib_none().0, + )) } } @@ -246,17 +402,13 @@ impl Repo { #[doc(alias = "ostree_repo_get_dfd")] #[doc(alias = "get_dfd")] pub fn dfd(&self) -> i32 { - unsafe { - ffi::ostree_repo_get_dfd(self.to_glib_none().0) - } + unsafe { ffi::ostree_repo_get_dfd(self.to_glib_none().0) } } #[doc(alias = "ostree_repo_get_disable_fsync")] #[doc(alias = "get_disable_fsync")] pub fn is_disable_fsync(&self) -> bool { - unsafe { - from_glib(ffi::ostree_repo_get_disable_fsync(self.to_glib_none().0)) - } + unsafe { from_glib(ffi::ostree_repo_get_disable_fsync(self.to_glib_none().0)) } } #[cfg(any(feature = "v2018_9", feature = "dox"))] @@ -267,47 +419,68 @@ impl Repo { unsafe { let mut out_reserved_bytes = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_get_min_free_space_bytes(self.to_glib_none().0, out_reserved_bytes.as_mut_ptr(), &mut error); + let is_ok = ffi::ostree_repo_get_min_free_space_bytes( + self.to_glib_none().0, + out_reserved_bytes.as_mut_ptr(), + &mut error, + ); let out_reserved_bytes = out_reserved_bytes.assume_init(); - if error.is_null() { Ok(out_reserved_bytes) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(out_reserved_bytes) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_get_mode")] #[doc(alias = "get_mode")] pub fn mode(&self) -> RepoMode { - unsafe { - from_glib(ffi::ostree_repo_get_mode(self.to_glib_none().0)) - } + unsafe { from_glib(ffi::ostree_repo_get_mode(self.to_glib_none().0)) } } #[doc(alias = "ostree_repo_get_parent")] #[doc(alias = "get_parent")] + #[must_use] pub fn parent(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_repo_get_parent(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_repo_get_parent(self.to_glib_none().0)) } } #[doc(alias = "ostree_repo_get_path")] #[doc(alias = "get_path")] pub fn path(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_repo_get_path(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_repo_get_path(self.to_glib_none().0)) } } #[cfg(any(feature = "v2016_5", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))] #[doc(alias = "ostree_repo_get_remote_boolean_option")] #[doc(alias = "get_remote_boolean_option")] - pub fn remote_boolean_option(&self, remote_name: &str, option_name: &str, default_value: bool) -> Result { + pub fn remote_boolean_option( + &self, + remote_name: &str, + option_name: &str, + default_value: bool, + ) -> Result { unsafe { let mut out_value = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_get_remote_boolean_option(self.to_glib_none().0, remote_name.to_glib_none().0, option_name.to_glib_none().0, default_value.into_glib(), out_value.as_mut_ptr(), &mut error); + let is_ok = ffi::ostree_repo_get_remote_boolean_option( + self.to_glib_none().0, + remote_name.to_glib_none().0, + option_name.to_glib_none().0, + default_value.into_glib(), + out_value.as_mut_ptr(), + &mut error, + ); let out_value = out_value.assume_init(); - if error.is_null() { Ok(from_glib(out_value)) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib(out_value)) + } else { + Err(from_glib_full(error)) + } } } @@ -315,12 +488,27 @@ impl Repo { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))] #[doc(alias = "ostree_repo_get_remote_list_option")] #[doc(alias = "get_remote_list_option")] - pub fn remote_list_option(&self, remote_name: &str, option_name: &str) -> Result, glib::Error> { + pub fn remote_list_option( + &self, + remote_name: &str, + option_name: &str, + ) -> Result, glib::Error> { unsafe { let mut out_value = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_get_remote_list_option(self.to_glib_none().0, remote_name.to_glib_none().0, option_name.to_glib_none().0, &mut out_value, &mut error); - if error.is_null() { Ok(FromGlibPtrContainer::from_glib_full(out_value)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_get_remote_list_option( + self.to_glib_none().0, + remote_name.to_glib_none().0, + option_name.to_glib_none().0, + &mut out_value, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(FromGlibPtrContainer::from_glib_full(out_value)) + } else { + Err(from_glib_full(error)) + } } } @@ -328,46 +516,122 @@ impl Repo { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))] #[doc(alias = "ostree_repo_get_remote_option")] #[doc(alias = "get_remote_option")] - pub fn remote_option(&self, remote_name: &str, option_name: &str, default_value: Option<&str>) -> Result { + pub fn remote_option( + &self, + remote_name: &str, + option_name: &str, + default_value: Option<&str>, + ) -> Result { unsafe { let mut out_value = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_get_remote_option(self.to_glib_none().0, remote_name.to_glib_none().0, option_name.to_glib_none().0, default_value.to_glib_none().0, &mut out_value, &mut error); - if error.is_null() { Ok(from_glib_full(out_value)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_get_remote_option( + self.to_glib_none().0, + remote_name.to_glib_none().0, + option_name.to_glib_none().0, + default_value.to_glib_none().0, + &mut out_value, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_value)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2020_8", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_8")))] #[doc(alias = "ostree_repo_gpg_sign_data")] - pub fn gpg_sign_data>(&self, data: &glib::Bytes, old_signatures: &glib::Bytes, key_id: &[&str], homedir: Option<&str>, cancellable: Option<&P>) -> Result { + pub fn gpg_sign_data( + &self, + data: &glib::Bytes, + old_signatures: &glib::Bytes, + key_id: &[&str], + homedir: Option<&str>, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_signatures = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_gpg_sign_data(self.to_glib_none().0, data.to_glib_none().0, old_signatures.to_glib_none().0, key_id.to_glib_none().0, homedir.to_glib_none().0, &mut out_signatures, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_signatures)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_gpg_sign_data( + self.to_glib_none().0, + data.to_glib_none().0, + old_signatures.to_glib_none().0, + key_id.to_glib_none().0, + homedir.to_glib_none().0, + &mut out_signatures, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_signatures)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2016_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_6")))] #[doc(alias = "ostree_repo_gpg_verify_data")] - pub fn gpg_verify_data, Q: IsA, R: IsA>(&self, remote_name: Option<&str>, data: &glib::Bytes, signatures: &glib::Bytes, keyringdir: Option<&P>, extra_keyring: Option<&Q>, cancellable: Option<&R>) -> Result { + pub fn gpg_verify_data( + &self, + remote_name: Option<&str>, + data: &glib::Bytes, + signatures: &glib::Bytes, + keyringdir: Option<&impl IsA>, + extra_keyring: Option<&impl IsA>, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_gpg_verify_data(self.to_glib_none().0, remote_name.to_glib_none().0, data.to_glib_none().0, signatures.to_glib_none().0, keyringdir.map(|p| p.as_ref()).to_glib_none().0, extra_keyring.map(|p| p.as_ref()).to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_repo_gpg_verify_data( + self.to_glib_none().0, + remote_name.to_glib_none().0, + data.to_glib_none().0, + signatures.to_glib_none().0, + keyringdir.map(|p| p.as_ref()).to_glib_none().0, + extra_keyring.map(|p| p.as_ref()).to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_has_object")] - pub fn has_object>(&self, objtype: ObjectType, checksum: &str, cancellable: Option<&P>) -> Result { + pub fn has_object( + &self, + objtype: ObjectType, + checksum: &str, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_have_object = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_has_object(self.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, out_have_object.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + let is_ok = ffi::ostree_repo_has_object( + self.to_glib_none().0, + objtype.into_glib(), + checksum.to_glib_none().0, + out_have_object.as_mut_ptr(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); let out_have_object = out_have_object.assume_init(); - if error.is_null() { Ok(from_glib(out_have_object)) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib(out_have_object)) + } else { + Err(from_glib_full(error)) + } } } @@ -375,155 +639,282 @@ impl Repo { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_12")))] #[doc(alias = "ostree_repo_hash")] pub fn hash(&self) -> u32 { - unsafe { - ffi::ostree_repo_hash(self.to_glib_none().0) - } + unsafe { ffi::ostree_repo_hash(self.to_glib_none().0) } } //#[doc(alias = "ostree_repo_import_archive_to_mtree")] - //pub fn import_archive_to_mtree>(&self, opts: /*Ignored*/&mut RepoImportArchiveOptions, archive: /*Unimplemented*/Option, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn import_archive_to_mtree(&self, opts: /*Ignored*/&mut RepoImportArchiveOptions, archive: /*Unimplemented*/Option, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_import_archive_to_mtree() } //} #[doc(alias = "ostree_repo_import_object_from")] - pub fn import_object_from>(&self, source: &Repo, objtype: ObjectType, checksum: &str, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn import_object_from( + &self, + source: &Repo, + objtype: ObjectType, + checksum: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_import_object_from(self.to_glib_none().0, source.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_import_object_from( + self.to_glib_none().0, + source.to_glib_none().0, + objtype.into_glib(), + checksum.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2016_5", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))] #[doc(alias = "ostree_repo_import_object_from_with_trust")] - pub fn import_object_from_with_trust>(&self, source: &Repo, objtype: ObjectType, checksum: &str, trusted: bool, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn import_object_from_with_trust( + &self, + source: &Repo, + objtype: ObjectType, + checksum: &str, + trusted: bool, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_import_object_from_with_trust(self.to_glib_none().0, source.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, trusted.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_import_object_from_with_trust( + self.to_glib_none().0, + source.to_glib_none().0, + objtype.into_glib(), + checksum.to_glib_none().0, + trusted.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_is_system")] pub fn is_system(&self) -> bool { - unsafe { - from_glib(ffi::ostree_repo_is_system(self.to_glib_none().0)) - } + unsafe { from_glib(ffi::ostree_repo_is_system(self.to_glib_none().0)) } } #[doc(alias = "ostree_repo_is_writable")] pub fn is_writable(&self) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_is_writable(self.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_is_writable(self.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } //#[cfg(any(feature = "v2018_6", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] //#[doc(alias = "ostree_repo_list_collection_refs")] - //pub fn list_collection_refs>(&self, match_collection_id: Option<&str>, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 28 }, flags: RepoListRefsExtFlags, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn list_collection_refs(&self, match_collection_id: Option<&str>, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 28 }, flags: RepoListRefsExtFlags, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_list_collection_refs() } //} //#[doc(alias = "ostree_repo_list_objects")] - //pub fn list_objects>(&self, flags: RepoListObjectsFlags, out_objects: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn list_objects(&self, flags: RepoListObjectsFlags, out_objects: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_list_objects() } //} //#[doc(alias = "ostree_repo_list_refs")] - //pub fn list_refs>(&self, refspec_prefix: Option<&str>, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn list_refs(&self, refspec_prefix: Option<&str>, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_list_refs() } //} //#[cfg(any(feature = "v2016_4", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_4")))] //#[doc(alias = "ostree_repo_list_refs_ext")] - //pub fn list_refs_ext>(&self, refspec_prefix: Option<&str>, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, flags: RepoListRefsExtFlags, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn list_refs_ext(&self, refspec_prefix: Option<&str>, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, flags: RepoListRefsExtFlags, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_list_refs_ext() } //} #[cfg(any(feature = "v2020_8", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_8")))] #[doc(alias = "ostree_repo_list_static_delta_indexes")] - pub fn list_static_delta_indexes>(&self, cancellable: Option<&P>) -> Result, glib::Error> { + pub fn list_static_delta_indexes( + &self, + cancellable: Option<&impl IsA>, + ) -> Result, glib::Error> { unsafe { let mut out_indexes = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_list_static_delta_indexes(self.to_glib_none().0, &mut out_indexes, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(FromGlibPtrContainer::from_glib_container(out_indexes)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_list_static_delta_indexes( + self.to_glib_none().0, + &mut out_indexes, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(FromGlibPtrContainer::from_glib_container(out_indexes)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_list_static_delta_names")] - pub fn list_static_delta_names>(&self, cancellable: Option<&P>) -> Result, glib::Error> { + pub fn list_static_delta_names( + &self, + cancellable: Option<&impl IsA>, + ) -> Result, glib::Error> { unsafe { let mut out_deltas = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_list_static_delta_names(self.to_glib_none().0, &mut out_deltas, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(FromGlibPtrContainer::from_glib_container(out_deltas)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_list_static_delta_names( + self.to_glib_none().0, + &mut out_deltas, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(FromGlibPtrContainer::from_glib_container(out_deltas)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2015_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2015_7")))] #[doc(alias = "ostree_repo_load_commit")] - pub fn load_commit(&self, checksum: &str) -> Result<(glib::Variant, RepoCommitState), glib::Error> { + pub fn load_commit( + &self, + checksum: &str, + ) -> Result<(glib::Variant, RepoCommitState), glib::Error> { unsafe { let mut out_commit = ptr::null_mut(); let mut out_state = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_load_commit(self.to_glib_none().0, checksum.to_glib_none().0, &mut out_commit, out_state.as_mut_ptr(), &mut error); + let is_ok = ffi::ostree_repo_load_commit( + self.to_glib_none().0, + checksum.to_glib_none().0, + &mut out_commit, + out_state.as_mut_ptr(), + &mut error, + ); let out_state = out_state.assume_init(); - if error.is_null() { Ok((from_glib_full(out_commit), from_glib(out_state))) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok((from_glib_full(out_commit), from_glib(out_state))) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_load_object_stream")] - pub fn load_object_stream>(&self, objtype: ObjectType, checksum: &str, cancellable: Option<&P>) -> Result<(gio::InputStream, u64), glib::Error> { + pub fn load_object_stream( + &self, + objtype: ObjectType, + checksum: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(gio::InputStream, u64), glib::Error> { unsafe { let mut out_input = ptr::null_mut(); let mut out_size = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_load_object_stream(self.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, &mut out_input, out_size.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + let is_ok = ffi::ostree_repo_load_object_stream( + self.to_glib_none().0, + objtype.into_glib(), + checksum.to_glib_none().0, + &mut out_input, + out_size.as_mut_ptr(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); let out_size = out_size.assume_init(); - if error.is_null() { Ok((from_glib_full(out_input), out_size)) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok((from_glib_full(out_input), out_size)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_load_variant")] - pub fn load_variant(&self, objtype: ObjectType, sha256: &str) -> Result { + pub fn load_variant( + &self, + objtype: ObjectType, + sha256: &str, + ) -> Result { unsafe { let mut out_variant = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_load_variant(self.to_glib_none().0, objtype.into_glib(), sha256.to_glib_none().0, &mut out_variant, &mut error); - if error.is_null() { Ok(from_glib_full(out_variant)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_load_variant( + self.to_glib_none().0, + objtype.into_glib(), + sha256.to_glib_none().0, + &mut out_variant, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_variant)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_load_variant_if_exists")] - pub fn load_variant_if_exists(&self, objtype: ObjectType, sha256: &str) -> Result, glib::Error> { + pub fn load_variant_if_exists( + &self, + objtype: ObjectType, + sha256: &str, + ) -> Result, glib::Error> { unsafe { let mut out_variant = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_load_variant_if_exists(self.to_glib_none().0, objtype.into_glib(), sha256.to_glib_none().0, &mut out_variant, &mut error); - if error.is_null() { Ok(from_glib_full(out_variant)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_load_variant_if_exists( + self.to_glib_none().0, + objtype.into_glib(), + sha256.to_glib_none().0, + &mut out_variant, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_variant)) + } else { + Err(from_glib_full(error)) + } } } //#[cfg(any(feature = "v2021_3", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_3")))] //#[doc(alias = "ostree_repo_lock_pop")] - //pub fn lock_pop>(&self, lock_type: /*Ignored*/RepoLockType, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn lock_pop(&self, lock_type: /*Ignored*/RepoLockType, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_lock_pop() } //} //#[cfg(any(feature = "v2021_3", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_3")))] //#[doc(alias = "ostree_repo_lock_push")] - //pub fn lock_push>(&self, lock_type: /*Ignored*/RepoLockType, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn lock_push(&self, lock_type: /*Ignored*/RepoLockType, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_lock_push() } //} @@ -533,212 +924,539 @@ impl Repo { pub fn mark_commit_partial(&self, checksum: &str, is_partial: bool) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_mark_commit_partial(self.to_glib_none().0, checksum.to_glib_none().0, is_partial.into_glib(), &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_mark_commit_partial( + self.to_glib_none().0, + checksum.to_glib_none().0, + is_partial.into_glib(), + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2019_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2019_4")))] #[doc(alias = "ostree_repo_mark_commit_partial_reason")] - pub fn mark_commit_partial_reason(&self, checksum: &str, is_partial: bool, in_state: RepoCommitState) -> Result<(), glib::Error> { + pub fn mark_commit_partial_reason( + &self, + checksum: &str, + is_partial: bool, + in_state: RepoCommitState, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_mark_commit_partial_reason(self.to_glib_none().0, checksum.to_glib_none().0, is_partial.into_glib(), in_state.into_glib(), &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_mark_commit_partial_reason( + self.to_glib_none().0, + checksum.to_glib_none().0, + is_partial.into_glib(), + in_state.into_glib(), + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_open")] - pub fn open>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn open( + &self, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_open(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_open( + self.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_prepare_transaction")] - pub fn prepare_transaction>(&self, cancellable: Option<&P>) -> Result { + pub fn prepare_transaction( + &self, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_transaction_resume = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_prepare_transaction(self.to_glib_none().0, out_transaction_resume.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + let is_ok = ffi::ostree_repo_prepare_transaction( + self.to_glib_none().0, + out_transaction_resume.as_mut_ptr(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); let out_transaction_resume = out_transaction_resume.assume_init(); - if error.is_null() { Ok(from_glib(out_transaction_resume)) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib(out_transaction_resume)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_prune")] - pub fn prune>(&self, flags: RepoPruneFlags, depth: i32, cancellable: Option<&P>) -> Result<(i32, i32, u64), glib::Error> { + pub fn prune( + &self, + flags: RepoPruneFlags, + depth: i32, + cancellable: Option<&impl IsA>, + ) -> Result<(i32, i32, u64), glib::Error> { unsafe { let mut out_objects_total = mem::MaybeUninit::uninit(); let mut out_objects_pruned = mem::MaybeUninit::uninit(); let mut out_pruned_object_size_total = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_prune(self.to_glib_none().0, flags.into_glib(), depth, out_objects_total.as_mut_ptr(), out_objects_pruned.as_mut_ptr(), out_pruned_object_size_total.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + let is_ok = ffi::ostree_repo_prune( + self.to_glib_none().0, + flags.into_glib(), + depth, + out_objects_total.as_mut_ptr(), + out_objects_pruned.as_mut_ptr(), + out_pruned_object_size_total.as_mut_ptr(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); let out_objects_total = out_objects_total.assume_init(); let out_objects_pruned = out_objects_pruned.assume_init(); let out_pruned_object_size_total = out_pruned_object_size_total.assume_init(); - if error.is_null() { Ok((out_objects_total, out_objects_pruned, out_pruned_object_size_total)) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(( + out_objects_total, + out_objects_pruned, + out_pruned_object_size_total, + )) + } else { + Err(from_glib_full(error)) + } } } //#[cfg(any(feature = "v2017_1", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_1")))] //#[doc(alias = "ostree_repo_prune_from_reachable")] - //pub fn prune_from_reachable>(&self, options: /*Ignored*/&mut RepoPruneOptions, cancellable: Option<&P>) -> Result<(i32, i32, u64), glib::Error> { + //pub fn prune_from_reachable(&self, options: /*Ignored*/&mut RepoPruneOptions, cancellable: Option<&impl IsA>) -> Result<(i32, i32, u64), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_prune_from_reachable() } //} #[doc(alias = "ostree_repo_prune_static_deltas")] - pub fn prune_static_deltas>(&self, commit: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn prune_static_deltas( + &self, + commit: Option<&str>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_prune_static_deltas(self.to_glib_none().0, commit.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_prune_static_deltas( + self.to_glib_none().0, + commit.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_pull")] - pub fn pull>(&self, remote_name: &str, refs_to_fetch: &[&str], flags: RepoPullFlags, progress: Option<&AsyncProgress>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn pull( + &self, + remote_name: &str, + refs_to_fetch: &[&str], + flags: RepoPullFlags, + progress: Option<&AsyncProgress>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_pull(self.to_glib_none().0, remote_name.to_glib_none().0, refs_to_fetch.to_glib_none().0, flags.into_glib(), progress.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_pull( + self.to_glib_none().0, + remote_name.to_glib_none().0, + refs_to_fetch.to_glib_none().0, + flags.into_glib(), + progress.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_pull_one_dir")] - pub fn pull_one_dir>(&self, remote_name: &str, dir_to_pull: &str, refs_to_fetch: &[&str], flags: RepoPullFlags, progress: Option<&AsyncProgress>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn pull_one_dir( + &self, + remote_name: &str, + dir_to_pull: &str, + refs_to_fetch: &[&str], + flags: RepoPullFlags, + progress: Option<&AsyncProgress>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_pull_one_dir(self.to_glib_none().0, remote_name.to_glib_none().0, dir_to_pull.to_glib_none().0, refs_to_fetch.to_glib_none().0, flags.into_glib(), progress.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_pull_one_dir( + self.to_glib_none().0, + remote_name.to_glib_none().0, + dir_to_pull.to_glib_none().0, + refs_to_fetch.to_glib_none().0, + flags.into_glib(), + progress.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_pull_with_options")] - pub fn pull_with_options>(&self, remote_name_or_baseurl: &str, options: &glib::Variant, progress: Option<&AsyncProgress>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn pull_with_options( + &self, + remote_name_or_baseurl: &str, + options: &glib::Variant, + progress: Option<&AsyncProgress>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_pull_with_options(self.to_glib_none().0, remote_name_or_baseurl.to_glib_none().0, options.to_glib_none().0, progress.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_pull_with_options( + self.to_glib_none().0, + remote_name_or_baseurl.to_glib_none().0, + options.to_glib_none().0, + progress.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_query_object_storage_size")] - pub fn query_object_storage_size>(&self, objtype: ObjectType, sha256: &str, cancellable: Option<&P>) -> Result { + pub fn query_object_storage_size( + &self, + objtype: ObjectType, + sha256: &str, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_size = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_query_object_storage_size(self.to_glib_none().0, objtype.into_glib(), sha256.to_glib_none().0, out_size.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + let is_ok = ffi::ostree_repo_query_object_storage_size( + self.to_glib_none().0, + objtype.into_glib(), + sha256.to_glib_none().0, + out_size.as_mut_ptr(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); let out_size = out_size.assume_init(); - if error.is_null() { Ok(out_size) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(out_size) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_read_commit")] - pub fn read_commit>(&self, ref_: &str, cancellable: Option<&P>) -> Result<(gio::File, glib::GString), glib::Error> { + pub fn read_commit( + &self, + ref_: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(gio::File, glib::GString), glib::Error> { unsafe { let mut out_root = ptr::null_mut(); let mut out_commit = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_read_commit(self.to_glib_none().0, ref_.to_glib_none().0, &mut out_root, &mut out_commit, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok((from_glib_full(out_root), from_glib_full(out_commit))) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_read_commit( + self.to_glib_none().0, + ref_.to_glib_none().0, + &mut out_root, + &mut out_commit, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok((from_glib_full(out_root), from_glib_full(out_commit))) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_read_commit_detached_metadata")] - pub fn read_commit_detached_metadata>(&self, checksum: &str, cancellable: Option<&P>) -> Result, glib::Error> { + pub fn read_commit_detached_metadata( + &self, + checksum: &str, + cancellable: Option<&impl IsA>, + ) -> Result, glib::Error> { unsafe { let mut out_metadata = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_read_commit_detached_metadata(self.to_glib_none().0, checksum.to_glib_none().0, &mut out_metadata, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_metadata)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_read_commit_detached_metadata( + self.to_glib_none().0, + checksum.to_glib_none().0, + &mut out_metadata, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_metadata)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_regenerate_summary")] - pub fn regenerate_summary>(&self, additional_metadata: Option<&glib::Variant>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn regenerate_summary( + &self, + additional_metadata: Option<&glib::Variant>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_regenerate_summary(self.to_glib_none().0, additional_metadata.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_regenerate_summary( + self.to_glib_none().0, + additional_metadata.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2017_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_2")))] #[doc(alias = "ostree_repo_reload_config")] - pub fn reload_config>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn reload_config( + &self, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_reload_config(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_reload_config( + self.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_remote_add")] - pub fn remote_add>(&self, name: &str, url: Option<&str>, options: Option<&glib::Variant>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn remote_add( + &self, + name: &str, + url: Option<&str>, + options: Option<&glib::Variant>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_remote_add(self.to_glib_none().0, name.to_glib_none().0, url.to_glib_none().0, options.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_remote_add( + self.to_glib_none().0, + name.to_glib_none().0, + url.to_glib_none().0, + options.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_remote_change")] - pub fn remote_change, Q: IsA>(&self, sysroot: Option<&P>, changeop: RepoRemoteChange, name: &str, url: Option<&str>, options: Option<&glib::Variant>, cancellable: Option<&Q>) -> Result<(), glib::Error> { + pub fn remote_change( + &self, + sysroot: Option<&impl IsA>, + changeop: RepoRemoteChange, + name: &str, + url: Option<&str>, + options: Option<&glib::Variant>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_remote_change(self.to_glib_none().0, sysroot.map(|p| p.as_ref()).to_glib_none().0, changeop.into_glib(), name.to_glib_none().0, url.to_glib_none().0, options.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_remote_change( + self.to_glib_none().0, + sysroot.map(|p| p.as_ref()).to_glib_none().0, + changeop.into_glib(), + name.to_glib_none().0, + url.to_glib_none().0, + options.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_remote_delete")] - pub fn remote_delete>(&self, name: &str, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn remote_delete( + &self, + name: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_remote_delete(self.to_glib_none().0, name.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_remote_delete( + self.to_glib_none().0, + name.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_remote_fetch_summary")] - pub fn remote_fetch_summary>(&self, name: &str, cancellable: Option<&P>) -> Result<(glib::Bytes, glib::Bytes), glib::Error> { + pub fn remote_fetch_summary( + &self, + name: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(glib::Bytes, glib::Bytes), glib::Error> { unsafe { let mut out_summary = ptr::null_mut(); let mut out_signatures = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_remote_fetch_summary(self.to_glib_none().0, name.to_glib_none().0, &mut out_summary, &mut out_signatures, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok((from_glib_full(out_summary), from_glib_full(out_signatures))) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_remote_fetch_summary( + self.to_glib_none().0, + name.to_glib_none().0, + &mut out_summary, + &mut out_signatures, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok((from_glib_full(out_summary), from_glib_full(out_signatures))) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2016_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_6")))] #[doc(alias = "ostree_repo_remote_fetch_summary_with_options")] - pub fn remote_fetch_summary_with_options>(&self, name: &str, options: Option<&glib::Variant>, cancellable: Option<&P>) -> Result<(glib::Bytes, glib::Bytes), glib::Error> { + pub fn remote_fetch_summary_with_options( + &self, + name: &str, + options: Option<&glib::Variant>, + cancellable: Option<&impl IsA>, + ) -> Result<(glib::Bytes, glib::Bytes), glib::Error> { unsafe { let mut out_summary = ptr::null_mut(); let mut out_signatures = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_remote_fetch_summary_with_options(self.to_glib_none().0, name.to_glib_none().0, options.to_glib_none().0, &mut out_summary, &mut out_signatures, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok((from_glib_full(out_summary), from_glib_full(out_signatures))) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_remote_fetch_summary_with_options( + self.to_glib_none().0, + name.to_glib_none().0, + options.to_glib_none().0, + &mut out_summary, + &mut out_signatures, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok((from_glib_full(out_summary), from_glib_full(out_signatures))) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2021_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_4")))] #[doc(alias = "ostree_repo_remote_get_gpg_keys")] - pub fn remote_get_gpg_keys>(&self, name: Option<&str>, key_ids: &[&str], cancellable: Option<&P>) -> Result, glib::Error> { + pub fn remote_get_gpg_keys( + &self, + name: Option<&str>, + key_ids: &[&str], + cancellable: Option<&impl IsA>, + ) -> Result, glib::Error> { unsafe { let mut out_keys = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_remote_get_gpg_keys(self.to_glib_none().0, name.to_glib_none().0, key_ids.to_glib_none().0, &mut out_keys, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(FromGlibPtrContainer::from_glib_container(out_keys)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_remote_get_gpg_keys( + self.to_glib_none().0, + name.to_glib_none().0, + key_ids.to_glib_none().0, + &mut out_keys, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(FromGlibPtrContainer::from_glib_container(out_keys)) + } else { + Err(from_glib_full(error)) + } } } @@ -747,9 +1465,19 @@ impl Repo { unsafe { let mut out_gpg_verify = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_remote_get_gpg_verify(self.to_glib_none().0, name.to_glib_none().0, out_gpg_verify.as_mut_ptr(), &mut error); + let is_ok = ffi::ostree_repo_remote_get_gpg_verify( + self.to_glib_none().0, + name.to_glib_none().0, + out_gpg_verify.as_mut_ptr(), + &mut error, + ); let out_gpg_verify = out_gpg_verify.assume_init(); - if error.is_null() { Ok(from_glib(out_gpg_verify)) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib(out_gpg_verify)) + } else { + Err(from_glib_full(error)) + } } } @@ -758,9 +1486,19 @@ impl Repo { unsafe { let mut out_gpg_verify_summary = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_remote_get_gpg_verify_summary(self.to_glib_none().0, name.to_glib_none().0, out_gpg_verify_summary.as_mut_ptr(), &mut error); + let is_ok = ffi::ostree_repo_remote_get_gpg_verify_summary( + self.to_glib_none().0, + name.to_glib_none().0, + out_gpg_verify_summary.as_mut_ptr(), + &mut error, + ); let out_gpg_verify_summary = out_gpg_verify_summary.assume_init(); - if error.is_null() { Ok(from_glib(out_gpg_verify_summary)) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib(out_gpg_verify_summary)) + } else { + Err(from_glib_full(error)) + } } } @@ -769,19 +1507,48 @@ impl Repo { unsafe { let mut out_url = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_remote_get_url(self.to_glib_none().0, name.to_glib_none().0, &mut out_url, &mut error); - if error.is_null() { Ok(from_glib_full(out_url)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_remote_get_url( + self.to_glib_none().0, + name.to_glib_none().0, + &mut out_url, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_url)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_remote_gpg_import")] - pub fn remote_gpg_import, Q: IsA>(&self, name: &str, source_stream: Option<&P>, key_ids: &[&str], cancellable: Option<&Q>) -> Result { + pub fn remote_gpg_import( + &self, + name: &str, + source_stream: Option<&impl IsA>, + key_ids: &[&str], + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_imported = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_remote_gpg_import(self.to_glib_none().0, name.to_glib_none().0, source_stream.map(|p| p.as_ref()).to_glib_none().0, key_ids.to_glib_none().0, out_imported.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + let is_ok = ffi::ostree_repo_remote_gpg_import( + self.to_glib_none().0, + name.to_glib_none().0, + source_stream.map(|p| p.as_ref()).to_glib_none().0, + key_ids.to_glib_none().0, + out_imported.as_mut_ptr(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); let out_imported = out_imported.assume_init(); - if error.is_null() { Ok(out_imported) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(out_imported) + } else { + Err(from_glib_full(error)) + } } } @@ -789,7 +1556,10 @@ impl Repo { pub fn remote_list(&self) -> Vec { unsafe { let mut out_n_remotes = mem::MaybeUninit::uninit(); - let ret = FromGlibContainer::from_glib_full_num(ffi::ostree_repo_remote_list(self.to_glib_none().0, out_n_remotes.as_mut_ptr()), out_n_remotes.assume_init() as usize); + let ret = FromGlibContainer::from_glib_full_num( + ffi::ostree_repo_remote_list(self.to_glib_none().0, out_n_remotes.as_mut_ptr()), + out_n_remotes.assume_init() as usize, + ); ret } } @@ -797,88 +1567,198 @@ impl Repo { //#[cfg(any(feature = "v2018_6", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] //#[doc(alias = "ostree_repo_remote_list_collection_refs")] - //pub fn remote_list_collection_refs>(&self, remote_name: &str, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn remote_list_collection_refs(&self, remote_name: &str, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_remote_list_collection_refs() } //} //#[doc(alias = "ostree_repo_remote_list_refs")] - //pub fn remote_list_refs>(&self, remote_name: &str, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn remote_list_refs(&self, remote_name: &str, out_all_refs: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 28 }/TypeId { ns_id: 0, id: 28 }, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_remote_list_refs() } //} #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_resolve_collection_ref")] - pub fn resolve_collection_ref>(&self, ref_: &CollectionRef, allow_noent: bool, flags: RepoResolveRevExtFlags, cancellable: Option<&P>) -> Result, glib::Error> { + pub fn resolve_collection_ref( + &self, + ref_: &CollectionRef, + allow_noent: bool, + flags: RepoResolveRevExtFlags, + cancellable: Option<&impl IsA>, + ) -> Result, glib::Error> { unsafe { let mut out_rev = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_resolve_collection_ref(self.to_glib_none().0, ref_.to_glib_none().0, allow_noent.into_glib(), flags.into_glib(), &mut out_rev, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_rev)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_resolve_collection_ref( + self.to_glib_none().0, + ref_.to_glib_none().0, + allow_noent.into_glib(), + flags.into_glib(), + &mut out_rev, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_rev)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_resolve_keyring_for_collection")] - pub fn resolve_keyring_for_collection>(&self, collection_id: &str, cancellable: Option<&P>) -> Result { + pub fn resolve_keyring_for_collection( + &self, + collection_id: &str, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_resolve_keyring_for_collection(self.to_glib_none().0, collection_id.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_repo_resolve_keyring_for_collection( + self.to_glib_none().0, + collection_id.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_resolve_rev")] - pub fn resolve_rev(&self, refspec: &str, allow_noent: bool) -> Result, glib::Error> { + pub fn resolve_rev( + &self, + refspec: &str, + allow_noent: bool, + ) -> Result, glib::Error> { unsafe { let mut out_rev = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_resolve_rev(self.to_glib_none().0, refspec.to_glib_none().0, allow_noent.into_glib(), &mut out_rev, &mut error); - if error.is_null() { Ok(from_glib_full(out_rev)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_resolve_rev( + self.to_glib_none().0, + refspec.to_glib_none().0, + allow_noent.into_glib(), + &mut out_rev, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_rev)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2016_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_7")))] #[doc(alias = "ostree_repo_resolve_rev_ext")] - pub fn resolve_rev_ext(&self, refspec: &str, allow_noent: bool, flags: RepoResolveRevExtFlags) -> Result, glib::Error> { + pub fn resolve_rev_ext( + &self, + refspec: &str, + allow_noent: bool, + flags: RepoResolveRevExtFlags, + ) -> Result, glib::Error> { unsafe { let mut out_rev = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_resolve_rev_ext(self.to_glib_none().0, refspec.to_glib_none().0, allow_noent.into_glib(), flags.into_glib(), &mut out_rev, &mut error); - if error.is_null() { Ok(from_glib_full(out_rev)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_resolve_rev_ext( + self.to_glib_none().0, + refspec.to_glib_none().0, + allow_noent.into_glib(), + flags.into_glib(), + &mut out_rev, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_rev)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_scan_hardlinks")] - pub fn scan_hardlinks>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn scan_hardlinks( + &self, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_scan_hardlinks(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_scan_hardlinks( + self.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2017_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))] #[doc(alias = "ostree_repo_set_alias_ref_immediate")] - pub fn set_alias_ref_immediate>(&self, remote: Option<&str>, ref_: &str, target: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn set_alias_ref_immediate( + &self, + remote: Option<&str>, + ref_: &str, + target: Option<&str>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_set_alias_ref_immediate(self.to_glib_none().0, remote.to_glib_none().0, ref_.to_glib_none().0, target.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_set_alias_ref_immediate( + self.to_glib_none().0, + remote.to_glib_none().0, + ref_.to_glib_none().0, + target.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2016_5", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))] #[doc(alias = "ostree_repo_set_cache_dir")] - pub fn set_cache_dir>(&self, dfd: i32, path: &str, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn set_cache_dir( + &self, + dfd: i32, + path: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_set_cache_dir(self.to_glib_none().0, dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_set_cache_dir( + self.to_glib_none().0, + dfd, + path.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -888,19 +1768,44 @@ impl Repo { pub fn set_collection_id(&self, collection_id: Option<&str>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_set_collection_id(self.to_glib_none().0, collection_id.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_set_collection_id( + self.to_glib_none().0, + collection_id.to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_set_collection_ref_immediate")] - pub fn set_collection_ref_immediate>(&self, ref_: &CollectionRef, checksum: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn set_collection_ref_immediate( + &self, + ref_: &CollectionRef, + checksum: Option<&str>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_set_collection_ref_immediate(self.to_glib_none().0, ref_.to_glib_none().0, checksum.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_set_collection_ref_immediate( + self.to_glib_none().0, + ref_.to_glib_none().0, + checksum.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -912,89 +1817,235 @@ impl Repo { } #[doc(alias = "ostree_repo_set_ref_immediate")] - pub fn set_ref_immediate>(&self, remote: Option<&str>, ref_: &str, checksum: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn set_ref_immediate( + &self, + remote: Option<&str>, + ref_: &str, + checksum: Option<&str>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_set_ref_immediate(self.to_glib_none().0, remote.to_glib_none().0, ref_.to_glib_none().0, checksum.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_set_ref_immediate( + self.to_glib_none().0, + remote.to_glib_none().0, + ref_.to_glib_none().0, + checksum.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_sign_commit")] - pub fn sign_commit>(&self, commit_checksum: &str, key_id: &str, homedir: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn sign_commit( + &self, + commit_checksum: &str, + key_id: &str, + homedir: Option<&str>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_sign_commit(self.to_glib_none().0, commit_checksum.to_glib_none().0, key_id.to_glib_none().0, homedir.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_sign_commit( + self.to_glib_none().0, + commit_checksum.to_glib_none().0, + key_id.to_glib_none().0, + homedir.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_sign_delta")] - pub fn sign_delta>(&self, from_commit: &str, to_commit: &str, key_id: &str, homedir: &str, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn sign_delta( + &self, + from_commit: &str, + to_commit: &str, + key_id: &str, + homedir: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_sign_delta(self.to_glib_none().0, from_commit.to_glib_none().0, to_commit.to_glib_none().0, key_id.to_glib_none().0, homedir.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_sign_delta( + self.to_glib_none().0, + from_commit.to_glib_none().0, + to_commit.to_glib_none().0, + key_id.to_glib_none().0, + homedir.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2021_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_4")))] #[doc(alias = "ostree_repo_signature_verify_commit_data")] - pub fn signature_verify_commit_data(&self, remote_name: &str, commit_data: &glib::Bytes, commit_metadata: &glib::Bytes, flags: RepoVerifyFlags) -> Result, glib::Error> { + pub fn signature_verify_commit_data( + &self, + remote_name: &str, + commit_data: &glib::Bytes, + commit_metadata: &glib::Bytes, + flags: RepoVerifyFlags, + ) -> Result, glib::Error> { unsafe { let mut out_results = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_signature_verify_commit_data(self.to_glib_none().0, remote_name.to_glib_none().0, commit_data.to_glib_none().0, commit_metadata.to_glib_none().0, flags.into_glib(), &mut out_results, &mut error); - if error.is_null() { Ok(from_glib_full(out_results)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_signature_verify_commit_data( + self.to_glib_none().0, + remote_name.to_glib_none().0, + commit_data.to_glib_none().0, + commit_metadata.to_glib_none().0, + flags.into_glib(), + &mut out_results, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_results)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_static_delta_execute_offline")] - pub fn static_delta_execute_offline, Q: IsA>(&self, dir_or_file: &P, skip_validation: bool, cancellable: Option<&Q>) -> Result<(), glib::Error> { + pub fn static_delta_execute_offline( + &self, + dir_or_file: &impl IsA, + skip_validation: bool, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_static_delta_execute_offline(self.to_glib_none().0, dir_or_file.as_ref().to_glib_none().0, skip_validation.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_static_delta_execute_offline( + self.to_glib_none().0, + dir_or_file.as_ref().to_glib_none().0, + skip_validation.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2020_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))] #[doc(alias = "ostree_repo_static_delta_execute_offline_with_signature")] - pub fn static_delta_execute_offline_with_signature, Q: IsA, R: IsA>(&self, dir_or_file: &P, sign: &Q, skip_validation: bool, cancellable: Option<&R>) -> Result<(), glib::Error> { + pub fn static_delta_execute_offline_with_signature( + &self, + dir_or_file: &impl IsA, + sign: &impl IsA, + skip_validation: bool, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_static_delta_execute_offline_with_signature(self.to_glib_none().0, dir_or_file.as_ref().to_glib_none().0, sign.as_ref().to_glib_none().0, skip_validation.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_static_delta_execute_offline_with_signature( + self.to_glib_none().0, + dir_or_file.as_ref().to_glib_none().0, + sign.as_ref().to_glib_none().0, + skip_validation.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_static_delta_generate")] - pub fn static_delta_generate>(&self, opt: StaticDeltaGenerateOpt, from: Option<&str>, to: &str, metadata: Option<&glib::Variant>, params: Option<&glib::Variant>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn static_delta_generate( + &self, + opt: StaticDeltaGenerateOpt, + from: Option<&str>, + to: &str, + metadata: Option<&glib::Variant>, + params: Option<&glib::Variant>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_static_delta_generate(self.to_glib_none().0, opt.into_glib(), from.to_glib_none().0, to.to_glib_none().0, metadata.to_glib_none().0, params.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_static_delta_generate( + self.to_glib_none().0, + opt.into_glib(), + from.to_glib_none().0, + to.to_glib_none().0, + metadata.to_glib_none().0, + params.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } //#[cfg(any(feature = "v2020_8", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_8")))] //#[doc(alias = "ostree_repo_static_delta_reindex")] - //pub fn static_delta_reindex>(&self, flags: /*Ignored*/StaticDeltaIndexFlags, opt_to_commit: &str, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn static_delta_reindex(&self, flags: /*Ignored*/StaticDeltaIndexFlags, opt_to_commit: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_static_delta_reindex() } //} #[cfg(any(feature = "v2020_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))] #[doc(alias = "ostree_repo_static_delta_verify_signature")] - pub fn static_delta_verify_signature>(&self, delta_id: &str, sign: &P) -> Result, glib::Error> { + pub fn static_delta_verify_signature( + &self, + delta_id: &str, + sign: &impl IsA, + ) -> Result, glib::Error> { unsafe { let mut out_success_message = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_static_delta_verify_signature(self.to_glib_none().0, delta_id.to_glib_none().0, sign.as_ref().to_glib_none().0, &mut out_success_message, &mut error); - if error.is_null() { Ok(from_glib_full(out_success_message)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_static_delta_verify_signature( + self.to_glib_none().0, + delta_id.to_glib_none().0, + sign.as_ref().to_glib_none().0, + &mut out_success_message, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_success_message)) + } else { + Err(from_glib_full(error)) + } } } @@ -1003,137 +2054,321 @@ impl Repo { #[doc(alias = "ostree_repo_transaction_set_collection_ref")] pub fn transaction_set_collection_ref(&self, ref_: &CollectionRef, checksum: Option<&str>) { unsafe { - ffi::ostree_repo_transaction_set_collection_ref(self.to_glib_none().0, ref_.to_glib_none().0, checksum.to_glib_none().0); + ffi::ostree_repo_transaction_set_collection_ref( + self.to_glib_none().0, + ref_.to_glib_none().0, + checksum.to_glib_none().0, + ); } } #[doc(alias = "ostree_repo_transaction_set_ref")] pub fn transaction_set_ref(&self, remote: Option<&str>, ref_: &str, checksum: Option<&str>) { unsafe { - ffi::ostree_repo_transaction_set_ref(self.to_glib_none().0, remote.to_glib_none().0, ref_.to_glib_none().0, checksum.to_glib_none().0); + ffi::ostree_repo_transaction_set_ref( + self.to_glib_none().0, + remote.to_glib_none().0, + ref_.to_glib_none().0, + checksum.to_glib_none().0, + ); } } #[doc(alias = "ostree_repo_transaction_set_refspec")] pub fn transaction_set_refspec(&self, refspec: &str, checksum: Option<&str>) { unsafe { - ffi::ostree_repo_transaction_set_refspec(self.to_glib_none().0, refspec.to_glib_none().0, checksum.to_glib_none().0); + ffi::ostree_repo_transaction_set_refspec( + self.to_glib_none().0, + refspec.to_glib_none().0, + checksum.to_glib_none().0, + ); } } //#[doc(alias = "ostree_repo_traverse_commit")] - //pub fn traverse_commit>(&self, commit_checksum: &str, maxdepth: i32, out_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn traverse_commit(&self, commit_checksum: &str, maxdepth: i32, out_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_traverse_commit() } //} //#[doc(alias = "ostree_repo_traverse_commit_union")] - //pub fn traverse_commit_union>(&self, commit_checksum: &str, maxdepth: i32, inout_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn traverse_commit_union(&self, commit_checksum: &str, maxdepth: i32, inout_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_traverse_commit_union() } //} //#[cfg(any(feature = "v2018_5", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_5")))] //#[doc(alias = "ostree_repo_traverse_commit_union_with_parents")] - //pub fn traverse_commit_union_with_parents>(&self, commit_checksum: &str, maxdepth: i32, inout_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, inout_parents: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn traverse_commit_union_with_parents(&self, commit_checksum: &str, maxdepth: i32, inout_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, inout_parents: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_traverse_commit_union_with_parents() } //} //#[cfg(any(feature = "v2018_5", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_5")))] //#[doc(alias = "ostree_repo_traverse_commit_with_flags")] - //pub fn traverse_commit_with_flags>(&self, flags: RepoCommitTraverseFlags, commit_checksum: &str, maxdepth: i32, inout_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, inout_parents: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn traverse_commit_with_flags(&self, flags: RepoCommitTraverseFlags, commit_checksum: &str, maxdepth: i32, inout_reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, inout_parents: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 0, id: 25 }/TypeId { ns_id: 0, id: 25 }, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_traverse_commit_with_flags() } //} //#[cfg(any(feature = "v2018_6", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] //#[doc(alias = "ostree_repo_traverse_reachable_refs")] - //pub fn traverse_reachable_refs>(&self, depth: u32, reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&P>) -> Result<(), glib::Error> { + //pub fn traverse_reachable_refs(&self, depth: u32, reachable: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 2, id: 203 }/TypeId { ns_id: 2, id: 203 }, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_traverse_reachable_refs() } //} #[doc(alias = "ostree_repo_verify_commit")] - pub fn verify_commit, Q: IsA, R: IsA>(&self, commit_checksum: &str, keyringdir: Option<&P>, extra_keyring: Option<&Q>, cancellable: Option<&R>) -> Result<(), glib::Error> { + pub fn verify_commit( + &self, + commit_checksum: &str, + keyringdir: Option<&impl IsA>, + extra_keyring: Option<&impl IsA>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_verify_commit(self.to_glib_none().0, commit_checksum.to_glib_none().0, keyringdir.map(|p| p.as_ref()).to_glib_none().0, extra_keyring.map(|p| p.as_ref()).to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_verify_commit( + self.to_glib_none().0, + commit_checksum.to_glib_none().0, + keyringdir.map(|p| p.as_ref()).to_glib_none().0, + extra_keyring.map(|p| p.as_ref()).to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_verify_commit_ext")] - pub fn verify_commit_ext, Q: IsA, R: IsA>(&self, commit_checksum: &str, keyringdir: Option<&P>, extra_keyring: Option<&Q>, cancellable: Option<&R>) -> Result { + pub fn verify_commit_ext( + &self, + commit_checksum: &str, + keyringdir: Option<&impl IsA>, + extra_keyring: Option<&impl IsA>, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_verify_commit_ext(self.to_glib_none().0, commit_checksum.to_glib_none().0, keyringdir.map(|p| p.as_ref()).to_glib_none().0, extra_keyring.map(|p| p.as_ref()).to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_repo_verify_commit_ext( + self.to_glib_none().0, + commit_checksum.to_glib_none().0, + keyringdir.map(|p| p.as_ref()).to_glib_none().0, + extra_keyring.map(|p| p.as_ref()).to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2016_14", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_14")))] #[doc(alias = "ostree_repo_verify_commit_for_remote")] - pub fn verify_commit_for_remote>(&self, commit_checksum: &str, remote_name: &str, cancellable: Option<&P>) -> Result { + pub fn verify_commit_for_remote( + &self, + commit_checksum: &str, + remote_name: &str, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_verify_commit_for_remote(self.to_glib_none().0, commit_checksum.to_glib_none().0, remote_name.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_repo_verify_commit_for_remote( + self.to_glib_none().0, + commit_checksum.to_glib_none().0, + remote_name.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_verify_summary")] - pub fn verify_summary>(&self, remote_name: &str, summary: &glib::Bytes, signatures: &glib::Bytes, cancellable: Option<&P>) -> Result { + pub fn verify_summary( + &self, + remote_name: &str, + summary: &glib::Bytes, + signatures: &glib::Bytes, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_verify_summary(self.to_glib_none().0, remote_name.to_glib_none().0, summary.to_glib_none().0, signatures.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_repo_verify_summary( + self.to_glib_none().0, + remote_name.to_glib_none().0, + summary.to_glib_none().0, + signatures.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_write_archive_to_mtree")] - pub fn write_archive_to_mtree, Q: IsA>(&self, archive: &P, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, autocreate_parents: bool, cancellable: Option<&Q>) -> Result<(), glib::Error> { + pub fn write_archive_to_mtree( + &self, + archive: &impl IsA, + mtree: &MutableTree, + modifier: Option<&RepoCommitModifier>, + autocreate_parents: bool, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_write_archive_to_mtree(self.to_glib_none().0, archive.as_ref().to_glib_none().0, mtree.to_glib_none().0, modifier.to_glib_none().0, autocreate_parents.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_write_archive_to_mtree( + self.to_glib_none().0, + archive.as_ref().to_glib_none().0, + mtree.to_glib_none().0, + modifier.to_glib_none().0, + autocreate_parents.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_write_archive_to_mtree_from_fd")] - pub fn write_archive_to_mtree_from_fd>(&self, fd: i32, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, autocreate_parents: bool, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn write_archive_to_mtree_from_fd( + &self, + fd: i32, + mtree: &MutableTree, + modifier: Option<&RepoCommitModifier>, + autocreate_parents: bool, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_write_archive_to_mtree_from_fd(self.to_glib_none().0, fd, mtree.to_glib_none().0, modifier.to_glib_none().0, autocreate_parents.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_write_archive_to_mtree_from_fd( + self.to_glib_none().0, + fd, + mtree.to_glib_none().0, + modifier.to_glib_none().0, + autocreate_parents.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_write_commit")] - pub fn write_commit>(&self, parent: Option<&str>, subject: Option<&str>, body: Option<&str>, metadata: Option<&glib::Variant>, root: &RepoFile, cancellable: Option<&P>) -> Result { + pub fn write_commit( + &self, + parent: Option<&str>, + subject: Option<&str>, + body: Option<&str>, + metadata: Option<&glib::Variant>, + root: &RepoFile, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_commit = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_write_commit(self.to_glib_none().0, parent.to_glib_none().0, subject.to_glib_none().0, body.to_glib_none().0, metadata.to_glib_none().0, root.to_glib_none().0, &mut out_commit, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_commit)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_write_commit( + self.to_glib_none().0, + parent.to_glib_none().0, + subject.to_glib_none().0, + body.to_glib_none().0, + metadata.to_glib_none().0, + root.to_glib_none().0, + &mut out_commit, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_commit)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_write_commit_detached_metadata")] - pub fn write_commit_detached_metadata>(&self, checksum: &str, metadata: Option<&glib::Variant>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn write_commit_detached_metadata( + &self, + checksum: &str, + metadata: Option<&glib::Variant>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_write_commit_detached_metadata(self.to_glib_none().0, checksum.to_glib_none().0, metadata.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_write_commit_detached_metadata( + self.to_glib_none().0, + checksum.to_glib_none().0, + metadata.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_write_commit_with_time")] - pub fn write_commit_with_time>(&self, parent: Option<&str>, subject: Option<&str>, body: Option<&str>, metadata: Option<&glib::Variant>, root: &RepoFile, time: u64, cancellable: Option<&P>) -> Result { + pub fn write_commit_with_time( + &self, + parent: Option<&str>, + subject: Option<&str>, + body: Option<&str>, + metadata: Option<&glib::Variant>, + root: &RepoFile, + time: u64, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_commit = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_write_commit_with_time(self.to_glib_none().0, parent.to_glib_none().0, subject.to_glib_none().0, body.to_glib_none().0, metadata.to_glib_none().0, root.to_glib_none().0, time, &mut out_commit, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_commit)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_write_commit_with_time( + self.to_glib_none().0, + parent.to_glib_none().0, + subject.to_glib_none().0, + body.to_glib_none().0, + metadata.to_glib_none().0, + root.to_glib_none().0, + time, + &mut out_commit, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_commit)) + } else { + Err(from_glib_full(error)) + } } } @@ -1141,126 +2376,319 @@ impl Repo { pub fn write_config(&self, new_config: &glib::KeyFile) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_write_config(self.to_glib_none().0, new_config.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_write_config( + self.to_glib_none().0, + new_config.to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_write_content_trusted")] - pub fn write_content_trusted, Q: IsA>(&self, checksum: &str, object_input: &P, length: u64, cancellable: Option<&Q>) -> Result<(), glib::Error> { + pub fn write_content_trusted( + &self, + checksum: &str, + object_input: &impl IsA, + length: u64, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_write_content_trusted(self.to_glib_none().0, checksum.to_glib_none().0, object_input.as_ref().to_glib_none().0, length, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_write_content_trusted( + self.to_glib_none().0, + checksum.to_glib_none().0, + object_input.as_ref().to_glib_none().0, + length, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_write_dfd_to_mtree")] - pub fn write_dfd_to_mtree>(&self, dfd: i32, path: &str, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn write_dfd_to_mtree( + &self, + dfd: i32, + path: &str, + mtree: &MutableTree, + modifier: Option<&RepoCommitModifier>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_write_dfd_to_mtree(self.to_glib_none().0, dfd, path.to_glib_none().0, mtree.to_glib_none().0, modifier.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_write_dfd_to_mtree( + self.to_glib_none().0, + dfd, + path.to_glib_none().0, + mtree.to_glib_none().0, + modifier.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_write_directory_to_mtree")] - pub fn write_directory_to_mtree, Q: IsA>(&self, dir: &P, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, cancellable: Option<&Q>) -> Result<(), glib::Error> { + pub fn write_directory_to_mtree( + &self, + dir: &impl IsA, + mtree: &MutableTree, + modifier: Option<&RepoCommitModifier>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_write_directory_to_mtree(self.to_glib_none().0, dir.as_ref().to_glib_none().0, mtree.to_glib_none().0, modifier.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_write_directory_to_mtree( + self.to_glib_none().0, + dir.as_ref().to_glib_none().0, + mtree.to_glib_none().0, + modifier.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_write_metadata_stream_trusted")] - pub fn write_metadata_stream_trusted, Q: IsA>(&self, objtype: ObjectType, checksum: &str, object_input: &P, length: u64, cancellable: Option<&Q>) -> Result<(), glib::Error> { + pub fn write_metadata_stream_trusted( + &self, + objtype: ObjectType, + checksum: &str, + object_input: &impl IsA, + length: u64, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_write_metadata_stream_trusted(self.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, object_input.as_ref().to_glib_none().0, length, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_write_metadata_stream_trusted( + self.to_glib_none().0, + objtype.into_glib(), + checksum.to_glib_none().0, + object_input.as_ref().to_glib_none().0, + length, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_write_metadata_trusted")] - pub fn write_metadata_trusted>(&self, objtype: ObjectType, checksum: &str, variant: &glib::Variant, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn write_metadata_trusted( + &self, + objtype: ObjectType, + checksum: &str, + variant: &glib::Variant, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_write_metadata_trusted(self.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, variant.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_write_metadata_trusted( + self.to_glib_none().0, + objtype.into_glib(), + checksum.to_glib_none().0, + variant.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_write_mtree")] - pub fn write_mtree>(&self, mtree: &MutableTree, cancellable: Option<&P>) -> Result { + pub fn write_mtree( + &self, + mtree: &MutableTree, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_file = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_write_mtree(self.to_glib_none().0, mtree.to_glib_none().0, &mut out_file, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_file)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_write_mtree( + self.to_glib_none().0, + mtree.to_glib_none().0, + &mut out_file, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_file)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2021_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_2")))] #[doc(alias = "ostree_repo_write_regfile")] - pub fn write_regfile(&self, expected_checksum: Option<&str>, uid: u32, gid: u32, mode: u32, content_len: u64, xattrs: Option<&glib::Variant>) -> Result { + pub fn write_regfile( + &self, + expected_checksum: Option<&str>, + uid: u32, + gid: u32, + mode: u32, + content_len: u64, + xattrs: Option<&glib::Variant>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_write_regfile(self.to_glib_none().0, expected_checksum.to_glib_none().0, uid, gid, mode, content_len, xattrs.to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_repo_write_regfile( + self.to_glib_none().0, + expected_checksum.to_glib_none().0, + uid, + gid, + mode, + content_len, + xattrs.to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2021_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_2")))] #[doc(alias = "ostree_repo_write_regfile_inline")] - pub fn write_regfile_inline>(&self, expected_checksum: Option<&str>, uid: u32, gid: u32, mode: u32, xattrs: Option<&glib::Variant>, buf: &[u8], cancellable: Option<&P>) -> Result { + pub fn write_regfile_inline( + &self, + expected_checksum: Option<&str>, + uid: u32, + gid: u32, + mode: u32, + xattrs: Option<&glib::Variant>, + buf: &[u8], + cancellable: Option<&impl IsA>, + ) -> Result { let len = buf.len() as usize; unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_write_regfile_inline(self.to_glib_none().0, expected_checksum.to_glib_none().0, uid, gid, mode, xattrs.to_glib_none().0, buf.to_glib_none().0, len, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_repo_write_regfile_inline( + self.to_glib_none().0, + expected_checksum.to_glib_none().0, + uid, + gid, + mode, + xattrs.to_glib_none().0, + buf.to_glib_none().0, + len, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2021_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_2")))] #[doc(alias = "ostree_repo_write_symlink")] - pub fn write_symlink>(&self, expected_checksum: Option<&str>, uid: u32, gid: u32, xattrs: Option<&glib::Variant>, symlink_target: &str, cancellable: Option<&P>) -> Result { + pub fn write_symlink( + &self, + expected_checksum: Option<&str>, + uid: u32, + gid: u32, + xattrs: Option<&glib::Variant>, + symlink_target: &str, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_write_symlink(self.to_glib_none().0, expected_checksum.to_glib_none().0, uid, gid, xattrs.to_glib_none().0, symlink_target.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_repo_write_symlink( + self.to_glib_none().0, + expected_checksum.to_glib_none().0, + uid, + gid, + xattrs.to_glib_none().0, + symlink_target.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "remotes-config-dir")] pub fn remotes_config_dir(&self) -> Option { - unsafe { - let mut value = glib::Value::from_type(::static_type()); - glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"remotes-config-dir\0".as_ptr() as *const _, value.to_glib_none_mut().0); - value.get().expect("Return Value for property `remotes-config-dir` getter") - } + glib::ObjectExt::property(self, "remotes-config-dir") } #[doc(alias = "sysroot-path")] pub fn sysroot_path(&self) -> Option { - unsafe { - let mut value = glib::Value::from_type(::static_type()); - glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"sysroot-path\0".as_ptr() as *const _, value.to_glib_none_mut().0); - value.get().expect("Return Value for property `sysroot-path` getter") - } + glib::ObjectExt::property(self, "sysroot-path") } #[cfg(any(feature = "v2017_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))] #[doc(alias = "ostree_repo_create_at")] - pub fn create_at>(dfd: i32, path: &str, mode: RepoMode, options: Option<&glib::Variant>, cancellable: Option<&P>) -> Result { + pub fn create_at( + dfd: i32, + path: &str, + mode: RepoMode, + options: Option<&glib::Variant>, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_create_at(dfd, path.to_glib_none().0, mode.into_glib(), options.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_repo_create_at( + dfd, + path.to_glib_none().0, + mode.into_glib(), + options.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } @@ -1269,20 +2697,42 @@ impl Repo { unsafe { let mut out_mode = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_mode_from_string(mode.to_glib_none().0, out_mode.as_mut_ptr(), &mut error); + let is_ok = ffi::ostree_repo_mode_from_string( + mode.to_glib_none().0, + out_mode.as_mut_ptr(), + &mut error, + ); let out_mode = out_mode.assume_init(); - if error.is_null() { Ok(from_glib(out_mode)) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib(out_mode)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2017_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))] #[doc(alias = "ostree_repo_open_at")] - pub fn open_at>(dfd: i32, path: &str, cancellable: Option<&P>) -> Result { + pub fn open_at( + dfd: i32, + path: &str, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_open_at(dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_repo_open_at( + dfd, + path.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } @@ -1311,15 +2761,35 @@ impl Repo { //} #[doc(alias = "gpg-verify-result")] - pub fn connect_gpg_verify_result(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn gpg_verify_result_trampoline(this: *mut ffi::OstreeRepo, checksum: *mut libc::c_char, result: *mut ffi::OstreeGpgVerifyResult, f: glib::ffi::gpointer) { + pub fn connect_gpg_verify_result( + &self, + f: F, + ) -> SignalHandlerId { + unsafe extern "C" fn gpg_verify_result_trampoline< + F: Fn(&Repo, &str, &GpgVerifyResult) + Send + 'static, + >( + this: *mut ffi::OstreeRepo, + checksum: *mut libc::c_char, + result: *mut ffi::OstreeGpgVerifyResult, + f: glib::ffi::gpointer, + ) { let f: &F = &*(f as *const F); - f(&from_glib_borrow(this), &glib::GString::from_glib_borrow(checksum), &from_glib_borrow(result)) + f( + &from_glib_borrow(this), + &glib::GString::from_glib_borrow(checksum), + &from_glib_borrow(result), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"gpg-verify-result\0".as_ptr() as *const _, - Some(transmute::<_, unsafe extern "C" fn()>(gpg_verify_result_trampoline:: as *const ())), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"gpg-verify-result\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + gpg_verify_result_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) } } } diff --git a/rust-bindings/src/auto/repo_commit_modifier.rs b/rust-bindings/src/auto/repo_commit_modifier.rs index eea16a82..75504434 100644 --- a/rust-bindings/src/auto/repo_commit_modifier.rs +++ b/rust-bindings/src/auto/repo_commit_modifier.rs @@ -31,13 +31,27 @@ glib::wrapper! { impl RepoCommitModifier { #[doc(alias = "ostree_repo_commit_modifier_new")] - pub fn new(flags: RepoCommitModifierFlags, commit_filter: Option RepoCommitFilterResult + 'static>>) -> RepoCommitModifier { - let commit_filter_data: Box_ RepoCommitFilterResult + 'static>>> = Box_::new(commit_filter); - unsafe extern "C" fn commit_filter_func(repo: *mut ffi::OstreeRepo, path: *const libc::c_char, file_info: *mut gio::ffi::GFileInfo, user_data: glib::ffi::gpointer) -> ffi::OstreeRepoCommitFilterResult { + pub fn new( + flags: RepoCommitModifierFlags, + commit_filter: Option< + Box_ RepoCommitFilterResult + 'static>, + >, + ) -> RepoCommitModifier { + let commit_filter_data: Box_< + Option RepoCommitFilterResult + 'static>>, + > = Box_::new(commit_filter); + unsafe extern "C" fn commit_filter_func( + repo: *mut ffi::OstreeRepo, + path: *const libc::c_char, + file_info: *mut gio::ffi::GFileInfo, + user_data: glib::ffi::gpointer, + ) -> ffi::OstreeRepoCommitFilterResult { let repo = from_glib_borrow(repo); let path: Borrowed = from_glib_borrow(path); let file_info = from_glib_borrow(file_info); - let callback: &Option RepoCommitFilterResult + 'static>> = &*(user_data as *mut _); + let callback: &Option< + Box_ RepoCommitFilterResult + 'static>, + > = &*(user_data as *mut _); let res = if let Some(ref callback) = *callback { callback(&repo, path.as_str(), &file_info) } else { @@ -45,14 +59,29 @@ impl RepoCommitModifier { }; res.into_glib() } - let commit_filter = if commit_filter_data.is_some() { Some(commit_filter_func as _) } else { None }; + let commit_filter = if commit_filter_data.is_some() { + Some(commit_filter_func as _) + } else { + None + }; unsafe extern "C" fn destroy_notify_func(data: glib::ffi::gpointer) { - let _callback: Box_ RepoCommitFilterResult + 'static>>> = Box_::from_raw(data as *mut _); + let _callback: Box_< + Option< + Box_ RepoCommitFilterResult + 'static>, + >, + > = Box_::from_raw(data as *mut _); } let destroy_call3 = Some(destroy_notify_func as _); - let super_callback0: Box_ RepoCommitFilterResult + 'static>>> = commit_filter_data; + let super_callback0: Box_< + Option RepoCommitFilterResult + 'static>>, + > = commit_filter_data; unsafe { - from_glib_full(ffi::ostree_repo_commit_modifier_new(flags.into_glib(), commit_filter, Box_::into_raw(super_callback0) as *mut _, destroy_call3)) + from_glib_full(ffi::ostree_repo_commit_modifier_new( + flags.into_glib(), + commit_filter, + Box_::into_raw(super_callback0) as *mut _, + destroy_call3, + )) } } @@ -61,32 +90,64 @@ impl RepoCommitModifier { #[doc(alias = "ostree_repo_commit_modifier_set_devino_cache")] pub fn set_devino_cache(&self, cache: &RepoDevInoCache) { unsafe { - ffi::ostree_repo_commit_modifier_set_devino_cache(self.to_glib_none().0, cache.to_glib_none().0); + ffi::ostree_repo_commit_modifier_set_devino_cache( + self.to_glib_none().0, + cache.to_glib_none().0, + ); } } #[doc(alias = "ostree_repo_commit_modifier_set_sepolicy")] pub fn set_sepolicy(&self, sepolicy: Option<&SePolicy>) { unsafe { - ffi::ostree_repo_commit_modifier_set_sepolicy(self.to_glib_none().0, sepolicy.to_glib_none().0); + ffi::ostree_repo_commit_modifier_set_sepolicy( + self.to_glib_none().0, + sepolicy.to_glib_none().0, + ); } } #[cfg(any(feature = "v2020_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_4")))] #[doc(alias = "ostree_repo_commit_modifier_set_sepolicy_from_commit")] - pub fn set_sepolicy_from_commit>(&self, repo: &Repo, rev: &str, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn set_sepolicy_from_commit( + &self, + repo: &Repo, + rev: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_commit_modifier_set_sepolicy_from_commit(self.to_glib_none().0, repo.to_glib_none().0, rev.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_commit_modifier_set_sepolicy_from_commit( + self.to_glib_none().0, + repo.to_glib_none().0, + rev.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_commit_modifier_set_xattr_callback")] - pub fn set_xattr_callback glib::Variant + 'static>(&self, callback: P) { + pub fn set_xattr_callback glib::Variant + 'static>( + &self, + callback: P, + ) { let callback_data: Box_

= Box_::new(callback); - unsafe extern "C" fn callback_func glib::Variant + 'static>(repo: *mut ffi::OstreeRepo, path: *const libc::c_char, file_info: *mut gio::ffi::GFileInfo, user_data: glib::ffi::gpointer) -> *mut glib::ffi::GVariant { + unsafe extern "C" fn callback_func< + P: Fn(&Repo, &str, &gio::FileInfo) -> glib::Variant + 'static, + >( + repo: *mut ffi::OstreeRepo, + path: *const libc::c_char, + file_info: *mut gio::ffi::GFileInfo, + user_data: glib::ffi::gpointer, + ) -> *mut glib::ffi::GVariant { let repo = from_glib_borrow(repo); let path: Borrowed = from_glib_borrow(path); let file_info = from_glib_borrow(file_info); @@ -95,13 +156,22 @@ impl RepoCommitModifier { res.to_glib_full() } let callback = Some(callback_func::

as _); - unsafe extern "C" fn destroy_func glib::Variant + 'static>(data: glib::ffi::gpointer) { + unsafe extern "C" fn destroy_func< + P: Fn(&Repo, &str, &gio::FileInfo) -> glib::Variant + 'static, + >( + data: glib::ffi::gpointer, + ) { let _callback: Box_

= Box_::from_raw(data as *mut _); } let destroy_call2 = Some(destroy_func::

as _); let super_callback0: Box_

= callback_data; unsafe { - ffi::ostree_repo_commit_modifier_set_xattr_callback(self.to_glib_none().0, callback, destroy_call2, Box_::into_raw(super_callback0) as *mut _); + ffi::ostree_repo_commit_modifier_set_xattr_callback( + self.to_glib_none().0, + callback, + destroy_call2, + Box_::into_raw(super_callback0) as *mut _, + ); } } } diff --git a/rust-bindings/src/auto/repo_dev_ino_cache.rs b/rust-bindings/src/auto/repo_dev_ino_cache.rs index 1cc7cd43..fbba9189 100644 --- a/rust-bindings/src/auto/repo_dev_ino_cache.rs +++ b/rust-bindings/src/auto/repo_dev_ino_cache.rs @@ -18,9 +18,7 @@ glib::wrapper! { impl RepoDevInoCache { #[doc(alias = "ostree_repo_devino_cache_new")] pub fn new() -> RepoDevInoCache { - unsafe { - from_glib_full(ffi::ostree_repo_devino_cache_new()) - } + unsafe { from_glib_full(ffi::ostree_repo_devino_cache_new()) } } } diff --git a/rust-bindings/src/auto/repo_file.rs b/rust-bindings/src/auto/repo_file.rs index 07c17ee7..29796933 100644 --- a/rust-bindings/src/auto/repo_file.rs +++ b/rust-bindings/src/auto/repo_file.rs @@ -23,43 +23,56 @@ impl RepoFile { pub fn ensure_resolved(&self) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_file_ensure_resolved(self.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_file_ensure_resolved(self.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_file_get_checksum")] #[doc(alias = "get_checksum")] pub fn checksum(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_repo_file_get_checksum(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_repo_file_get_checksum(self.to_glib_none().0)) } } #[doc(alias = "ostree_repo_file_get_repo")] #[doc(alias = "get_repo")] pub fn repo(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_repo_file_get_repo(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_repo_file_get_repo(self.to_glib_none().0)) } } #[doc(alias = "ostree_repo_file_get_root")] #[doc(alias = "get_root")] + #[must_use] pub fn root(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_repo_file_get_root(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_repo_file_get_root(self.to_glib_none().0)) } } #[doc(alias = "ostree_repo_file_get_xattrs")] #[doc(alias = "get_xattrs")] - pub fn xattrs>(&self, cancellable: Option<&P>) -> Result { + pub fn xattrs( + &self, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_xattrs = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_file_get_xattrs(self.to_glib_none().0, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_xattrs)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_file_get_xattrs( + self.to_glib_none().0, + &mut out_xattrs, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_xattrs)) + } else { + Err(from_glib_full(error)) + } } } @@ -68,7 +81,12 @@ impl RepoFile { unsafe { let mut is_dir = mem::MaybeUninit::uninit(); let mut out_container = ptr::null_mut(); - let ret = ffi::ostree_repo_file_tree_find_child(self.to_glib_none().0, name.to_glib_none().0, is_dir.as_mut_ptr(), &mut out_container); + let ret = ffi::ostree_repo_file_tree_find_child( + self.to_glib_none().0, + name.to_glib_none().0, + is_dir.as_mut_ptr(), + &mut out_container, + ); let is_dir = is_dir.assume_init(); (ret, from_glib(is_dir), from_glib_full(out_container)) } @@ -77,45 +95,76 @@ impl RepoFile { #[doc(alias = "ostree_repo_file_tree_get_contents")] pub fn tree_get_contents(&self) -> Option { unsafe { - from_glib_full(ffi::ostree_repo_file_tree_get_contents(self.to_glib_none().0)) + from_glib_full(ffi::ostree_repo_file_tree_get_contents( + self.to_glib_none().0, + )) } } #[doc(alias = "ostree_repo_file_tree_get_contents_checksum")] pub fn tree_get_contents_checksum(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_repo_file_tree_get_contents_checksum(self.to_glib_none().0)) + from_glib_none(ffi::ostree_repo_file_tree_get_contents_checksum( + self.to_glib_none().0, + )) } } #[doc(alias = "ostree_repo_file_tree_get_metadata")] pub fn tree_get_metadata(&self) -> Option { unsafe { - from_glib_full(ffi::ostree_repo_file_tree_get_metadata(self.to_glib_none().0)) + from_glib_full(ffi::ostree_repo_file_tree_get_metadata( + self.to_glib_none().0, + )) } } #[doc(alias = "ostree_repo_file_tree_get_metadata_checksum")] pub fn tree_get_metadata_checksum(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_repo_file_tree_get_metadata_checksum(self.to_glib_none().0)) + from_glib_none(ffi::ostree_repo_file_tree_get_metadata_checksum( + self.to_glib_none().0, + )) } } #[doc(alias = "ostree_repo_file_tree_query_child")] - pub fn tree_query_child>(&self, n: i32, attributes: &str, flags: gio::FileQueryInfoFlags, cancellable: Option<&P>) -> Result { + pub fn tree_query_child( + &self, + n: i32, + attributes: &str, + flags: gio::FileQueryInfoFlags, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_info = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_file_tree_query_child(self.to_glib_none().0, n, attributes.to_glib_none().0, flags.into_glib(), &mut out_info, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_info)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_repo_file_tree_query_child( + self.to_glib_none().0, + n, + attributes.to_glib_none().0, + flags.into_glib(), + &mut out_info, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_info)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_repo_file_tree_set_metadata")] pub fn tree_set_metadata(&self, checksum: &str, metadata: &glib::Variant) { unsafe { - ffi::ostree_repo_file_tree_set_metadata(self.to_glib_none().0, checksum.to_glib_none().0, metadata.to_glib_none().0); + ffi::ostree_repo_file_tree_set_metadata( + self.to_glib_none().0, + checksum.to_glib_none().0, + metadata.to_glib_none().0, + ); } } } diff --git a/rust-bindings/src/auto/repo_finder.rs b/rust-bindings/src/auto/repo_finder.rs index ed5e1f86..1252c2be 100644 --- a/rust-bindings/src/auto/repo_finder.rs +++ b/rust-bindings/src/auto/repo_finder.rs @@ -2,10 +2,16 @@ // from gir-files // DO NOT EDIT +#[cfg(any(feature = "v2018_6", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] use crate::RepoFinderResult; use glib::object::IsA; +#[cfg(any(feature = "v2018_6", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] use glib::translate::*; use std::fmt; +#[cfg(any(feature = "v2018_6", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] use std::ptr; glib::wrapper! { @@ -17,9 +23,9 @@ glib::wrapper! { } } -impl RepoFinder {} - -pub const NONE_REPO_FINDER: Option<&RepoFinder> = None; +impl RepoFinder { + pub const NONE: Option<&'static RepoFinder> = None; +} pub trait RepoFinderExt: 'static {} diff --git a/rust-bindings/src/auto/repo_finder_avahi.rs b/rust-bindings/src/auto/repo_finder_avahi.rs index 8910a437..c86a3878 100644 --- a/rust-bindings/src/auto/repo_finder_avahi.rs +++ b/rust-bindings/src/auto/repo_finder_avahi.rs @@ -3,9 +3,10 @@ // DO NOT EDIT use crate::RepoFinder; +#[cfg(any(feature = "v2018_6", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] use glib::translate::*; use std::fmt; -use std::ptr; glib::wrapper! { #[doc(alias = "OstreeRepoFinderAvahi")] @@ -17,22 +18,15 @@ glib::wrapper! { } impl RepoFinderAvahi { + #[cfg(any(feature = "v2018_6", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_finder_avahi_new")] pub fn new(context: Option<&glib::MainContext>) -> RepoFinderAvahi { - unsafe { - from_glib_full(ffi::ostree_repo_finder_avahi_new(context.to_glib_none().0)) - } - } - - #[doc(alias = "ostree_repo_finder_avahi_start")] - pub fn start(&self) -> Result<(), glib::Error> { - unsafe { - let mut error = ptr::null_mut(); - let _ = ffi::ostree_repo_finder_avahi_start(self.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } - } + unsafe { from_glib_full(ffi::ostree_repo_finder_avahi_new(context.to_glib_none().0)) } } + #[cfg(any(feature = "v2018_6", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_finder_avahi_stop")] pub fn stop(&self) { unsafe { diff --git a/rust-bindings/src/auto/repo_finder_config.rs b/rust-bindings/src/auto/repo_finder_config.rs index 2b76d99b..74c6c035 100644 --- a/rust-bindings/src/auto/repo_finder_config.rs +++ b/rust-bindings/src/auto/repo_finder_config.rs @@ -3,6 +3,8 @@ // DO NOT EDIT use crate::RepoFinder; +#[cfg(any(feature = "v2018_6", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] use glib::translate::*; use std::fmt; @@ -16,11 +18,11 @@ glib::wrapper! { } impl RepoFinderConfig { + #[cfg(any(feature = "v2018_6", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_finder_config_new")] pub fn new() -> RepoFinderConfig { - unsafe { - from_glib_full(ffi::ostree_repo_finder_config_new()) - } + unsafe { from_glib_full(ffi::ostree_repo_finder_config_new()) } } } diff --git a/rust-bindings/src/auto/repo_finder_mount.rs b/rust-bindings/src/auto/repo_finder_mount.rs index eda91f38..b34713b6 100644 --- a/rust-bindings/src/auto/repo_finder_mount.rs +++ b/rust-bindings/src/auto/repo_finder_mount.rs @@ -3,9 +3,17 @@ // DO NOT EDIT use crate::RepoFinder; +#[cfg(any(feature = "v2018_6", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] use glib::object::IsA; +#[cfg(any(feature = "v2018_6", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] use glib::object::ObjectType as ObjectType_; +#[cfg(any(feature = "v2018_6", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] use glib::translate::*; +#[cfg(any(feature = "v2018_6", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] use glib::StaticType; use std::fmt; @@ -19,21 +27,21 @@ glib::wrapper! { } impl RepoFinderMount { + #[cfg(any(feature = "v2018_6", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_finder_mount_new")] - pub fn new>(monitor: Option<&P>) -> RepoFinderMount { + pub fn new(monitor: Option<&impl IsA>) -> RepoFinderMount { unsafe { - from_glib_full(ffi::ostree_repo_finder_mount_new(monitor.map(|p| p.as_ref()).to_glib_none().0)) + from_glib_full(ffi::ostree_repo_finder_mount_new( + monitor.map(|p| p.as_ref()).to_glib_none().0, + )) } } #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] pub fn monitor(&self) -> Option { - unsafe { - let mut value = glib::Value::from_type(::static_type()); - glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"monitor\0".as_ptr() as *const _, value.to_glib_none_mut().0); - value.get().expect("Return Value for property `monitor` getter") - } + glib::ObjectExt::property(self, "monitor") } } diff --git a/rust-bindings/src/auto/repo_finder_override.rs b/rust-bindings/src/auto/repo_finder_override.rs index d504c180..1c1522b9 100644 --- a/rust-bindings/src/auto/repo_finder_override.rs +++ b/rust-bindings/src/auto/repo_finder_override.rs @@ -3,6 +3,8 @@ // DO NOT EDIT use crate::RepoFinder; +#[cfg(any(feature = "v2018_6", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] use glib::translate::*; use std::fmt; @@ -16,13 +18,15 @@ glib::wrapper! { } impl RepoFinderOverride { + #[cfg(any(feature = "v2018_6", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_finder_override_new")] pub fn new() -> RepoFinderOverride { - unsafe { - from_glib_full(ffi::ostree_repo_finder_override_new()) - } + unsafe { from_glib_full(ffi::ostree_repo_finder_override_new()) } } + #[cfg(any(feature = "v2018_6", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_finder_override_add_uri")] pub fn add_uri(&self, uri: &str) { unsafe { diff --git a/rust-bindings/src/auto/repo_finder_result.rs b/rust-bindings/src/auto/repo_finder_result.rs index 702ec52c..80bf2575 100644 --- a/rust-bindings/src/auto/repo_finder_result.rs +++ b/rust-bindings/src/auto/repo_finder_result.rs @@ -18,15 +18,13 @@ glib::wrapper! { impl RepoFinderResult { //#[doc(alias = "ostree_repo_finder_result_new")] - //pub fn new>(remote: &Remote, finder: &P, priority: i32, ref_to_checksum: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 28 }, ref_to_timestamp: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 9 }, summary_last_modified: u64) -> RepoFinderResult { + //pub fn new(remote: &Remote, finder: &impl IsA, priority: i32, ref_to_checksum: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 28 }, ref_to_timestamp: /*Unknown conversion*//*Unimplemented*/HashTable TypeId { ns_id: 1, id: 0 }/TypeId { ns_id: 0, id: 9 }, summary_last_modified: u64) -> RepoFinderResult { // unsafe { TODO: call ffi:ostree_repo_finder_result_new() } //} #[doc(alias = "ostree_repo_finder_result_compare")] fn compare(&self, b: &RepoFinderResult) -> i32 { - unsafe { - ffi::ostree_repo_finder_result_compare(self.to_glib_none().0, b.to_glib_none().0) - } + unsafe { ffi::ostree_repo_finder_result_compare(self.to_glib_none().0, b.to_glib_none().0) } } } diff --git a/rust-bindings/src/auto/se_policy.rs b/rust-bindings/src/auto/se_policy.rs index 91148ac7..99590929 100644 --- a/rust-bindings/src/auto/se_policy.rs +++ b/rust-bindings/src/auto/se_policy.rs @@ -22,32 +22,67 @@ glib::wrapper! { impl SePolicy { #[doc(alias = "ostree_sepolicy_new")] - pub fn new, Q: IsA>(path: &P, cancellable: Option<&Q>) -> Result { + pub fn new( + path: &impl IsA, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_sepolicy_new(path.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_sepolicy_new( + path.as_ref().to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2017_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_4")))] #[doc(alias = "ostree_sepolicy_new_at")] - pub fn new_at>(rootfs_dfd: i32, cancellable: Option<&P>) -> Result { + pub fn new_at( + rootfs_dfd: i32, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_sepolicy_new_at(rootfs_dfd, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_sepolicy_new_at( + rootfs_dfd, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sepolicy_new_from_commit")] #[doc(alias = "new_from_commit")] - pub fn from_commit>(repo: &Repo, rev: &str, cancellable: Option<&P>) -> Result { + pub fn from_commit( + repo: &Repo, + rev: &str, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_sepolicy_new_from_commit(repo.to_glib_none().0, rev.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_sepolicy_new_from_commit( + repo.to_glib_none().0, + rev.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } @@ -56,45 +91,77 @@ impl SePolicy { #[doc(alias = "ostree_sepolicy_get_csum")] #[doc(alias = "get_csum")] pub fn csum(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_sepolicy_get_csum(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_sepolicy_get_csum(self.to_glib_none().0)) } } #[doc(alias = "ostree_sepolicy_get_label")] #[doc(alias = "get_label")] - pub fn label>(&self, relpath: &str, unix_mode: u32, cancellable: Option<&P>) -> Result { + pub fn label( + &self, + relpath: &str, + unix_mode: u32, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_label = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sepolicy_get_label(self.to_glib_none().0, relpath.to_glib_none().0, unix_mode, &mut out_label, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_label)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sepolicy_get_label( + self.to_glib_none().0, + relpath.to_glib_none().0, + unix_mode, + &mut out_label, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_label)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sepolicy_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_sepolicy_get_name(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_sepolicy_get_name(self.to_glib_none().0)) } } #[doc(alias = "ostree_sepolicy_get_path")] #[doc(alias = "get_path")] pub fn path(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_sepolicy_get_path(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_sepolicy_get_path(self.to_glib_none().0)) } } #[doc(alias = "ostree_sepolicy_restorecon")] - pub fn restorecon, Q: IsA>(&self, path: &str, info: Option<&gio::FileInfo>, target: &P, flags: SePolicyRestoreconFlags, cancellable: Option<&Q>) -> Result { + pub fn restorecon( + &self, + path: &str, + info: Option<&gio::FileInfo>, + target: &impl IsA, + flags: SePolicyRestoreconFlags, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_new_label = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sepolicy_restorecon(self.to_glib_none().0, path.to_glib_none().0, info.to_glib_none().0, target.as_ref().to_glib_none().0, flags.into_glib(), &mut out_new_label, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_new_label)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sepolicy_restorecon( + self.to_glib_none().0, + path.to_glib_none().0, + info.to_glib_none().0, + target.as_ref().to_glib_none().0, + flags.into_glib(), + &mut out_new_label, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_new_label)) + } else { + Err(from_glib_full(error)) + } } } @@ -102,18 +169,24 @@ impl SePolicy { pub fn setfscreatecon(&self, path: &str, mode: u32) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sepolicy_setfscreatecon(self.to_glib_none().0, path.to_glib_none().0, mode, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sepolicy_setfscreatecon( + self.to_glib_none().0, + path.to_glib_none().0, + mode, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "rootfs-dfd")] pub fn rootfs_dfd(&self) -> i32 { - unsafe { - let mut value = glib::Value::from_type(::static_type()); - glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"rootfs-dfd\0".as_ptr() as *const _, value.to_glib_none_mut().0); - value.get().expect("Return Value for property `rootfs-dfd` getter") - } + glib::ObjectExt::property(self, "rootfs-dfd") } } diff --git a/rust-bindings/src/auto/sign.rs b/rust-bindings/src/auto/sign.rs index 7a449245..577697c9 100644 --- a/rust-bindings/src/auto/sign.rs +++ b/rust-bindings/src/auto/sign.rs @@ -2,10 +2,16 @@ // from gir-files // DO NOT EDIT +#[cfg(any(feature = "v2020_2", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] use crate::Repo; use glib::object::IsA; +#[cfg(any(feature = "v2020_2", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] use glib::translate::*; use std::fmt; +#[cfg(any(feature = "v2020_2", feature = "dox"))] +#[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] use std::ptr; glib::wrapper! { @@ -18,168 +24,371 @@ glib::wrapper! { } impl Sign { + pub const NONE: Option<&'static Sign> = None; + + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_get_all")] #[doc(alias = "get_all")] pub fn all() -> Vec { - unsafe { - FromGlibPtrContainer::from_glib_full(ffi::ostree_sign_get_all()) - } + unsafe { FromGlibPtrContainer::from_glib_full(ffi::ostree_sign_get_all()) } } + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_get_by_name")] #[doc(alias = "get_by_name")] pub fn by_name(name: &str) -> Result { unsafe { let mut error = ptr::null_mut(); let ret = ffi::ostree_sign_get_by_name(name.to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } } -pub const NONE_SIGN: Option<&Sign> = None; - pub trait SignExt: 'static { + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_add_pk")] fn add_pk(&self, public_key: &glib::Variant) -> Result<(), glib::Error>; + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_clear_keys")] fn clear_keys(&self) -> Result<(), glib::Error>; + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_commit")] - fn commit>(&self, repo: &Repo, commit_checksum: &str, cancellable: Option<&P>) -> Result<(), glib::Error>; + fn commit( + &self, + repo: &Repo, + commit_checksum: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error>; + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_commit_verify")] - fn commit_verify>(&self, repo: &Repo, commit_checksum: &str, cancellable: Option<&P>) -> Result, glib::Error>; + fn commit_verify( + &self, + repo: &Repo, + commit_checksum: &str, + cancellable: Option<&impl IsA>, + ) -> Result, glib::Error>; + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_data")] - fn data>(&self, data: &glib::Bytes, cancellable: Option<&P>) -> Result; + fn data( + &self, + data: &glib::Bytes, + cancellable: Option<&impl IsA>, + ) -> Result; + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_data_verify")] - fn data_verify(&self, data: &glib::Bytes, signatures: &glib::Variant) -> Result, glib::Error>; + fn data_verify( + &self, + data: &glib::Bytes, + signatures: &glib::Variant, + ) -> Result, glib::Error>; + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_get_name")] #[doc(alias = "get_name")] fn name(&self) -> Option; + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_load_pk")] fn load_pk(&self, options: &glib::Variant) -> Result<(), glib::Error>; + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_metadata_format")] fn metadata_format(&self) -> Option; + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_metadata_key")] fn metadata_key(&self) -> Option; + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_set_pk")] fn set_pk(&self, public_key: &glib::Variant) -> Result<(), glib::Error>; + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_set_sk")] fn set_sk(&self, secret_key: &glib::Variant) -> Result<(), glib::Error>; + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_summary")] - fn summary>(&self, repo: &Repo, keys: &glib::Variant, cancellable: Option<&P>) -> Result<(), glib::Error>; + fn summary( + &self, + repo: &Repo, + keys: &glib::Variant, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error>; } impl> SignExt for O { + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] fn add_pk(&self, public_key: &glib::Variant) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sign_add_pk(self.as_ref().to_glib_none().0, public_key.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sign_add_pk( + self.as_ref().to_glib_none().0, + public_key.to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] fn clear_keys(&self) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sign_clear_keys(self.as_ref().to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sign_clear_keys(self.as_ref().to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } - fn commit>(&self, repo: &Repo, commit_checksum: &str, cancellable: Option<&P>) -> Result<(), glib::Error> { + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] + fn commit( + &self, + repo: &Repo, + commit_checksum: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sign_commit(self.as_ref().to_glib_none().0, repo.to_glib_none().0, commit_checksum.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sign_commit( + self.as_ref().to_glib_none().0, + repo.to_glib_none().0, + commit_checksum.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } - fn commit_verify>(&self, repo: &Repo, commit_checksum: &str, cancellable: Option<&P>) -> Result, glib::Error> { + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] + fn commit_verify( + &self, + repo: &Repo, + commit_checksum: &str, + cancellable: Option<&impl IsA>, + ) -> Result, glib::Error> { unsafe { let mut out_success_message = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sign_commit_verify(self.as_ref().to_glib_none().0, repo.to_glib_none().0, commit_checksum.to_glib_none().0, &mut out_success_message, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_success_message)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sign_commit_verify( + self.as_ref().to_glib_none().0, + repo.to_glib_none().0, + commit_checksum.to_glib_none().0, + &mut out_success_message, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_success_message)) + } else { + Err(from_glib_full(error)) + } } } - fn data>(&self, data: &glib::Bytes, cancellable: Option<&P>) -> Result { + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] + fn data( + &self, + data: &glib::Bytes, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut signature = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sign_data(self.as_ref().to_glib_none().0, data.to_glib_none().0, &mut signature, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(signature)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sign_data( + self.as_ref().to_glib_none().0, + data.to_glib_none().0, + &mut signature, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(signature)) + } else { + Err(from_glib_full(error)) + } } } - fn data_verify(&self, data: &glib::Bytes, signatures: &glib::Variant) -> Result, glib::Error> { + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] + fn data_verify( + &self, + data: &glib::Bytes, + signatures: &glib::Variant, + ) -> Result, glib::Error> { unsafe { let mut out_success_message = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sign_data_verify(self.as_ref().to_glib_none().0, data.to_glib_none().0, signatures.to_glib_none().0, &mut out_success_message, &mut error); - if error.is_null() { Ok(from_glib_full(out_success_message)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sign_data_verify( + self.as_ref().to_glib_none().0, + data.to_glib_none().0, + signatures.to_glib_none().0, + &mut out_success_message, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_success_message)) + } else { + Err(from_glib_full(error)) + } } } + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] fn name(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_sign_get_name(self.as_ref().to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_sign_get_name(self.as_ref().to_glib_none().0)) } } + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] fn load_pk(&self, options: &glib::Variant) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sign_load_pk(self.as_ref().to_glib_none().0, options.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sign_load_pk( + self.as_ref().to_glib_none().0, + options.to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] fn metadata_format(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_sign_metadata_format(self.as_ref().to_glib_none().0)) + from_glib_none(ffi::ostree_sign_metadata_format( + self.as_ref().to_glib_none().0, + )) } } + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] fn metadata_key(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_sign_metadata_key(self.as_ref().to_glib_none().0)) + from_glib_none(ffi::ostree_sign_metadata_key( + self.as_ref().to_glib_none().0, + )) } } + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] fn set_pk(&self, public_key: &glib::Variant) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sign_set_pk(self.as_ref().to_glib_none().0, public_key.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sign_set_pk( + self.as_ref().to_glib_none().0, + public_key.to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] fn set_sk(&self, secret_key: &glib::Variant) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sign_set_sk(self.as_ref().to_glib_none().0, secret_key.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sign_set_sk( + self.as_ref().to_glib_none().0, + secret_key.to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } - fn summary>(&self, repo: &Repo, keys: &glib::Variant, cancellable: Option<&P>) -> Result<(), glib::Error> { + #[cfg(any(feature = "v2020_2", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] + fn summary( + &self, + repo: &Repo, + keys: &glib::Variant, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sign_summary(self.as_ref().to_glib_none().0, repo.to_glib_none().0, keys.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sign_summary( + self.as_ref().to_glib_none().0, + repo.to_glib_none().0, + keys.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } } diff --git a/rust-bindings/src/auto/sysroot.rs b/rust-bindings/src/auto/sysroot.rs index ecec2328..134bf7ed 100644 --- a/rust-bindings/src/auto/sysroot.rs +++ b/rust-bindings/src/auto/sysroot.rs @@ -47,114 +47,262 @@ glib::wrapper! { impl Sysroot { #[doc(alias = "ostree_sysroot_new")] - pub fn new>(path: Option<&P>) -> Sysroot { + pub fn new(path: Option<&impl IsA>) -> Sysroot { unsafe { - from_glib_full(ffi::ostree_sysroot_new(path.map(|p| p.as_ref()).to_glib_none().0)) + from_glib_full(ffi::ostree_sysroot_new( + path.map(|p| p.as_ref()).to_glib_none().0, + )) } } #[doc(alias = "ostree_sysroot_new_default")] pub fn new_default() -> Sysroot { - unsafe { - from_glib_full(ffi::ostree_sysroot_new_default()) - } + unsafe { from_glib_full(ffi::ostree_sysroot_new_default()) } } #[doc(alias = "ostree_sysroot_cleanup")] - pub fn cleanup>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn cleanup( + &self, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_cleanup(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_cleanup( + self.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } //#[cfg(any(feature = "v2018_6", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] //#[doc(alias = "ostree_sysroot_cleanup_prune_repo")] - //pub fn cleanup_prune_repo>(&self, options: /*Ignored*/&mut RepoPruneOptions, cancellable: Option<&P>) -> Result<(i32, i32, u64), glib::Error> { + //pub fn cleanup_prune_repo(&self, options: /*Ignored*/&mut RepoPruneOptions, cancellable: Option<&impl IsA>) -> Result<(i32, i32, u64), glib::Error> { // unsafe { TODO: call ffi:ostree_sysroot_cleanup_prune_repo() } //} #[cfg(any(feature = "v2018_5", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_5")))] #[doc(alias = "ostree_sysroot_deploy_tree")] - pub fn deploy_tree>(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, provided_merge_deployment: Option<&Deployment>, override_kernel_argv: &[&str], cancellable: Option<&P>) -> Result { + pub fn deploy_tree( + &self, + osname: Option<&str>, + revision: &str, + origin: Option<&glib::KeyFile>, + provided_merge_deployment: Option<&Deployment>, + override_kernel_argv: &[&str], + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_new_deployment = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_deploy_tree(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, provided_merge_deployment.to_glib_none().0, override_kernel_argv.to_glib_none().0, &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_deploy_tree( + self.to_glib_none().0, + osname.to_glib_none().0, + revision.to_glib_none().0, + origin.to_glib_none().0, + provided_merge_deployment.to_glib_none().0, + override_kernel_argv.to_glib_none().0, + &mut out_new_deployment, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_new_deployment)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2020_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))] #[doc(alias = "ostree_sysroot_deploy_tree_with_options")] - pub fn deploy_tree_with_options>(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, provided_merge_deployment: Option<&Deployment>, opts: Option<&SysrootDeployTreeOpts>, cancellable: Option<&P>) -> Result { + pub fn deploy_tree_with_options( + &self, + osname: Option<&str>, + revision: &str, + origin: Option<&glib::KeyFile>, + provided_merge_deployment: Option<&Deployment>, + opts: Option<&SysrootDeployTreeOpts>, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_new_deployment = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_deploy_tree_with_options(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, provided_merge_deployment.to_glib_none().0, mut_override(opts.to_glib_none().0), &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_deploy_tree_with_options( + self.to_glib_none().0, + osname.to_glib_none().0, + revision.to_glib_none().0, + origin.to_glib_none().0, + provided_merge_deployment.to_glib_none().0, + mut_override(opts.to_glib_none().0), + &mut out_new_deployment, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_new_deployment)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sysroot_deployment_set_kargs")] - pub fn deployment_set_kargs>(&self, deployment: &Deployment, new_kargs: &[&str], cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn deployment_set_kargs( + &self, + deployment: &Deployment, + new_kargs: &[&str], + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_deployment_set_kargs(self.to_glib_none().0, deployment.to_glib_none().0, new_kargs.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_deployment_set_kargs( + self.to_glib_none().0, + deployment.to_glib_none().0, + new_kargs.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sysroot_deployment_set_kargs_in_place")] - pub fn deployment_set_kargs_in_place>(&self, deployment: &Deployment, kargs_str: Option<&str>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn deployment_set_kargs_in_place( + &self, + deployment: &Deployment, + kargs_str: Option<&str>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_deployment_set_kargs_in_place(self.to_glib_none().0, deployment.to_glib_none().0, kargs_str.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_deployment_set_kargs_in_place( + self.to_glib_none().0, + deployment.to_glib_none().0, + kargs_str.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sysroot_deployment_set_mutable")] - pub fn deployment_set_mutable>(&self, deployment: &Deployment, is_mutable: bool, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn deployment_set_mutable( + &self, + deployment: &Deployment, + is_mutable: bool, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_deployment_set_mutable(self.to_glib_none().0, deployment.to_glib_none().0, is_mutable.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_deployment_set_mutable( + self.to_glib_none().0, + deployment.to_glib_none().0, + is_mutable.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2018_3", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_3")))] #[doc(alias = "ostree_sysroot_deployment_set_pinned")] - pub fn deployment_set_pinned(&self, deployment: &Deployment, is_pinned: bool) -> Result<(), glib::Error> { + pub fn deployment_set_pinned( + &self, + deployment: &Deployment, + is_pinned: bool, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_deployment_set_pinned(self.to_glib_none().0, deployment.to_glib_none().0, is_pinned.into_glib(), &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_deployment_set_pinned( + self.to_glib_none().0, + deployment.to_glib_none().0, + is_pinned.into_glib(), + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2016_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_4")))] #[doc(alias = "ostree_sysroot_deployment_unlock")] - pub fn deployment_unlock>(&self, deployment: &Deployment, unlocked_state: DeploymentUnlockedState, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn deployment_unlock( + &self, + deployment: &Deployment, + unlocked_state: DeploymentUnlockedState, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_deployment_unlock(self.to_glib_none().0, deployment.to_glib_none().0, unlocked_state.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_deployment_unlock( + self.to_glib_none().0, + deployment.to_glib_none().0, + unlocked_state.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sysroot_ensure_initialized")] - pub fn ensure_initialized>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn ensure_initialized( + &self, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_ensure_initialized(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_ensure_initialized( + self.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -162,23 +310,26 @@ impl Sysroot { #[doc(alias = "get_booted_deployment")] pub fn booted_deployment(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_sysroot_get_booted_deployment(self.to_glib_none().0)) + from_glib_none(ffi::ostree_sysroot_get_booted_deployment( + self.to_glib_none().0, + )) } } #[doc(alias = "ostree_sysroot_get_bootversion")] #[doc(alias = "get_bootversion")] pub fn bootversion(&self) -> i32 { - unsafe { - ffi::ostree_sysroot_get_bootversion(self.to_glib_none().0) - } + unsafe { ffi::ostree_sysroot_get_bootversion(self.to_glib_none().0) } } #[doc(alias = "ostree_sysroot_get_deployment_directory")] #[doc(alias = "get_deployment_directory")] pub fn deployment_directory(&self, deployment: &Deployment) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_get_deployment_directory(self.to_glib_none().0, deployment.to_glib_none().0)) + from_glib_full(ffi::ostree_sysroot_get_deployment_directory( + self.to_glib_none().0, + deployment.to_glib_none().0, + )) } } @@ -186,7 +337,10 @@ impl Sysroot { #[doc(alias = "get_deployment_dirpath")] pub fn deployment_dirpath(&self, deployment: &Deployment) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_get_deployment_dirpath(self.to_glib_none().0, deployment.to_glib_none().0)) + from_glib_full(ffi::ostree_sysroot_get_deployment_dirpath( + self.to_glib_none().0, + deployment.to_glib_none().0, + )) } } @@ -194,32 +348,33 @@ impl Sysroot { #[doc(alias = "get_deployments")] pub fn deployments(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_container(ffi::ostree_sysroot_get_deployments(self.to_glib_none().0)) + FromGlibPtrContainer::from_glib_container(ffi::ostree_sysroot_get_deployments( + self.to_glib_none().0, + )) } } #[doc(alias = "ostree_sysroot_get_fd")] #[doc(alias = "get_fd")] pub fn fd(&self) -> i32 { - unsafe { - ffi::ostree_sysroot_get_fd(self.to_glib_none().0) - } + unsafe { ffi::ostree_sysroot_get_fd(self.to_glib_none().0) } } #[doc(alias = "ostree_sysroot_get_merge_deployment")] #[doc(alias = "get_merge_deployment")] pub fn merge_deployment(&self, osname: Option<&str>) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_get_merge_deployment(self.to_glib_none().0, osname.to_glib_none().0)) + from_glib_full(ffi::ostree_sysroot_get_merge_deployment( + self.to_glib_none().0, + osname.to_glib_none().0, + )) } } #[doc(alias = "ostree_sysroot_get_path")] #[doc(alias = "get_path")] pub fn path(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_sysroot_get_path(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_sysroot_get_path(self.to_glib_none().0)) } } #[cfg(any(feature = "v2018_5", feature = "dox"))] @@ -228,26 +383,40 @@ impl Sysroot { #[doc(alias = "get_staged_deployment")] pub fn staged_deployment(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_sysroot_get_staged_deployment(self.to_glib_none().0)) + from_glib_none(ffi::ostree_sysroot_get_staged_deployment( + self.to_glib_none().0, + )) } } #[doc(alias = "ostree_sysroot_get_subbootversion")] #[doc(alias = "get_subbootversion")] pub fn subbootversion(&self) -> i32 { - unsafe { - ffi::ostree_sysroot_get_subbootversion(self.to_glib_none().0) - } + unsafe { ffi::ostree_sysroot_get_subbootversion(self.to_glib_none().0) } } #[cfg(any(feature = "v2016_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_4")))] #[doc(alias = "ostree_sysroot_init_osname")] - pub fn init_osname>(&self, osname: &str, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn init_osname( + &self, + osname: &str, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_init_osname(self.to_glib_none().0, osname.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_init_osname( + self.to_glib_none().0, + osname.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -257,8 +426,13 @@ impl Sysroot { pub fn initialize(&self) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_initialize(self.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_initialize(self.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } @@ -266,30 +440,53 @@ impl Sysroot { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_1")))] #[doc(alias = "ostree_sysroot_is_booted")] pub fn is_booted(&self) -> bool { - unsafe { - from_glib(ffi::ostree_sysroot_is_booted(self.to_glib_none().0)) - } + unsafe { from_glib(ffi::ostree_sysroot_is_booted(self.to_glib_none().0)) } } #[doc(alias = "ostree_sysroot_load")] - pub fn load>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn load( + &self, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_load(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_load( + self.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2016_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_4")))] #[doc(alias = "ostree_sysroot_load_if_changed")] - pub fn load_if_changed>(&self, cancellable: Option<&P>) -> Result { + pub fn load_if_changed( + &self, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_changed = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_load_if_changed(self.to_glib_none().0, out_changed.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + let is_ok = ffi::ostree_sysroot_load_if_changed( + self.to_glib_none().0, + out_changed.as_mut_ptr(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); let out_changed = out_changed.assume_init(); - if error.is_null() { Ok(from_glib(out_changed)) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib(out_changed)) + } else { + Err(from_glib_full(error)) + } } } @@ -297,64 +494,119 @@ impl Sysroot { pub fn lock(&self) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_lock(self.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_lock(self.to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sysroot_lock_async")] - pub fn lock_async, Q: FnOnce(Result<(), glib::Error>) + Send + 'static>(&self, cancellable: Option<&P>, callback: Q) { - let user_data: Box_ = Box_::new(callback); - unsafe extern "C" fn lock_async_trampoline) + Send + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) { + pub fn lock_async) + 'static>( + &self, + cancellable: Option<&impl IsA>, + callback: P, + ) { + let main_context = glib::MainContext::ref_thread_default(); + let is_main_context_owner = main_context.is_owner(); + let has_acquired_main_context = (!is_main_context_owner) + .then(|| main_context.acquire().ok()) + .flatten(); + assert!( + is_main_context_owner || has_acquired_main_context.is_some(), + "Async operations only allowed if the thread is owning the MainContext" + ); + + let user_data: Box_> = + Box_::new(glib::thread_guard::ThreadGuard::new(callback)); + unsafe extern "C" fn lock_async_trampoline) + 'static>( + _source_object: *mut glib::gobject_ffi::GObject, + res: *mut gio::ffi::GAsyncResult, + user_data: glib::ffi::gpointer, + ) { let mut error = ptr::null_mut(); let _ = ffi::ostree_sysroot_lock_finish(_source_object as *mut _, res, &mut error); - let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }; - let callback: Box_ = Box_::from_raw(user_data as *mut _); + let result = if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + }; + let callback: Box_> = + Box_::from_raw(user_data as *mut _); + let callback: P = callback.into_inner(); callback(result); } - let callback = lock_async_trampoline::; + let callback = lock_async_trampoline::

; unsafe { - ffi::ostree_sysroot_lock_async(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _); + ffi::ostree_sysroot_lock_async( + self.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + Some(callback), + Box_::into_raw(user_data) as *mut _, + ); } } - - pub fn lock_async_future(&self) -> Pin> + 'static>> { - + pub fn lock_future( + &self, + ) -> Pin> + 'static>> { Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.lock_async( - Some(cancellable), - move |res| { - send.resolve(res); - }, - ); + obj.lock_async(Some(cancellable), move |res| { + send.resolve(res); + }); })) } #[doc(alias = "ostree_sysroot_origin_new_from_refspec")] pub fn origin_new_from_refspec(&self, refspec: &str) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_origin_new_from_refspec(self.to_glib_none().0, refspec.to_glib_none().0)) + from_glib_full(ffi::ostree_sysroot_origin_new_from_refspec( + self.to_glib_none().0, + refspec.to_glib_none().0, + )) } } #[doc(alias = "ostree_sysroot_prepare_cleanup")] - pub fn prepare_cleanup>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn prepare_cleanup( + &self, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_prepare_cleanup(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_prepare_cleanup( + self.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2017_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_7")))] #[doc(alias = "ostree_sysroot_query_deployments_for")] - pub fn query_deployments_for(&self, osname: Option<&str>) -> (Option, Option) { + pub fn query_deployments_for( + &self, + osname: Option<&str>, + ) -> (Option, Option) { unsafe { let mut out_pending = ptr::null_mut(); let mut out_rollback = ptr::null_mut(); - ffi::ostree_sysroot_query_deployments_for(self.to_glib_none().0, osname.to_glib_none().0, &mut out_pending, &mut out_rollback); + ffi::ostree_sysroot_query_deployments_for( + self.to_glib_none().0, + osname.to_glib_none().0, + &mut out_pending, + &mut out_rollback, + ); (from_glib_full(out_pending), from_glib_full(out_rollback)) } } @@ -363,9 +615,7 @@ impl Sysroot { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_7")))] #[doc(alias = "ostree_sysroot_repo")] pub fn repo(&self) -> Option { - unsafe { - from_glib_none(ffi::ostree_sysroot_repo(self.to_glib_none().0)) - } + unsafe { from_glib_none(ffi::ostree_sysroot_repo(self.to_glib_none().0)) } } #[cfg(any(feature = "v2021_1", feature = "dox"))] @@ -374,8 +624,13 @@ impl Sysroot { pub fn require_booted_deployment(&self) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_sysroot_require_booted_deployment(self.to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } + let ret = + ffi::ostree_sysroot_require_booted_deployment(self.to_glib_none().0, &mut error); + if error.is_null() { + Ok(from_glib_none(ret)) + } else { + Err(from_glib_full(error)) + } } } @@ -389,47 +644,128 @@ impl Sysroot { } #[doc(alias = "ostree_sysroot_simple_write_deployment")] - pub fn simple_write_deployment>(&self, osname: Option<&str>, new_deployment: &Deployment, merge_deployment: Option<&Deployment>, flags: SysrootSimpleWriteDeploymentFlags, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn simple_write_deployment( + &self, + osname: Option<&str>, + new_deployment: &Deployment, + merge_deployment: Option<&Deployment>, + flags: SysrootSimpleWriteDeploymentFlags, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_simple_write_deployment(self.to_glib_none().0, osname.to_glib_none().0, new_deployment.to_glib_none().0, merge_deployment.to_glib_none().0, flags.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_simple_write_deployment( + self.to_glib_none().0, + osname.to_glib_none().0, + new_deployment.to_glib_none().0, + merge_deployment.to_glib_none().0, + flags.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2020_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))] #[doc(alias = "ostree_sysroot_stage_overlay_initrd")] - pub fn stage_overlay_initrd>(&self, fd: i32, cancellable: Option<&P>) -> Result { + pub fn stage_overlay_initrd( + &self, + fd: i32, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_checksum = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_stage_overlay_initrd(self.to_glib_none().0, fd, &mut out_checksum, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_checksum)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_stage_overlay_initrd( + self.to_glib_none().0, + fd, + &mut out_checksum, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_checksum)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2018_5", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_5")))] #[doc(alias = "ostree_sysroot_stage_tree")] - pub fn stage_tree>(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, merge_deployment: Option<&Deployment>, override_kernel_argv: &[&str], cancellable: Option<&P>) -> Result { + pub fn stage_tree( + &self, + osname: Option<&str>, + revision: &str, + origin: Option<&glib::KeyFile>, + merge_deployment: Option<&Deployment>, + override_kernel_argv: &[&str], + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_new_deployment = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_stage_tree(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, merge_deployment.to_glib_none().0, override_kernel_argv.to_glib_none().0, &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_stage_tree( + self.to_glib_none().0, + osname.to_glib_none().0, + revision.to_glib_none().0, + origin.to_glib_none().0, + merge_deployment.to_glib_none().0, + override_kernel_argv.to_glib_none().0, + &mut out_new_deployment, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_new_deployment)) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2020_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))] #[doc(alias = "ostree_sysroot_stage_tree_with_options")] - pub fn stage_tree_with_options>(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, merge_deployment: Option<&Deployment>, opts: &SysrootDeployTreeOpts, cancellable: Option<&P>) -> Result { + pub fn stage_tree_with_options( + &self, + osname: Option<&str>, + revision: &str, + origin: Option<&glib::KeyFile>, + merge_deployment: Option<&Deployment>, + opts: &SysrootDeployTreeOpts, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_new_deployment = ptr::null_mut(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_stage_tree_with_options(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, merge_deployment.to_glib_none().0, mut_override(opts.to_glib_none().0), &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_stage_tree_with_options( + self.to_glib_none().0, + osname.to_glib_none().0, + revision.to_glib_none().0, + origin.to_glib_none().0, + merge_deployment.to_glib_none().0, + mut_override(opts.to_glib_none().0), + &mut out_new_deployment, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib_full(out_new_deployment)) + } else { + Err(from_glib_full(error)) + } } } @@ -438,9 +774,18 @@ impl Sysroot { unsafe { let mut out_acquired = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_try_lock(self.to_glib_none().0, out_acquired.as_mut_ptr(), &mut error); + let is_ok = ffi::ostree_sysroot_try_lock( + self.to_glib_none().0, + out_acquired.as_mut_ptr(), + &mut error, + ); let out_acquired = out_acquired.assume_init(); - if error.is_null() { Ok(from_glib(out_acquired)) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib(out_acquired)) + } else { + Err(from_glib_full(error)) + } } } @@ -459,39 +804,87 @@ impl Sysroot { } #[doc(alias = "ostree_sysroot_write_deployments")] - pub fn write_deployments>(&self, new_deployments: &[Deployment], cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn write_deployments( + &self, + new_deployments: &[Deployment], + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_write_deployments(self.to_glib_none().0, new_deployments.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_write_deployments( + self.to_glib_none().0, + new_deployments.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[cfg(any(feature = "v2017_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_4")))] #[doc(alias = "ostree_sysroot_write_deployments_with_options")] - pub fn write_deployments_with_options>(&self, new_deployments: &[Deployment], opts: &SysrootWriteDeploymentsOpts, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn write_deployments_with_options( + &self, + new_deployments: &[Deployment], + opts: &SysrootWriteDeploymentsOpts, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_write_deployments_with_options(self.to_glib_none().0, new_deployments.to_glib_none().0, mut_override(opts.to_glib_none().0), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_write_deployments_with_options( + self.to_glib_none().0, + new_deployments.to_glib_none().0, + mut_override(opts.to_glib_none().0), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sysroot_write_origin_file")] - pub fn write_origin_file>(&self, deployment: &Deployment, new_origin: Option<&glib::KeyFile>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn write_origin_file( + &self, + deployment: &Deployment, + new_origin: Option<&glib::KeyFile>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_write_origin_file(self.to_glib_none().0, deployment.to_glib_none().0, new_origin.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_write_origin_file( + self.to_glib_none().0, + deployment.to_glib_none().0, + new_origin.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sysroot_get_deployment_origin_path")] #[doc(alias = "get_deployment_origin_path")] - pub fn deployment_origin_path>(deployment_path: &P) -> Option { + pub fn deployment_origin_path(deployment_path: &impl IsA) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_get_deployment_origin_path(deployment_path.as_ref().to_glib_none().0)) + from_glib_full(ffi::ostree_sysroot_get_deployment_origin_path( + deployment_path.as_ref().to_glib_none().0, + )) } } @@ -499,14 +892,27 @@ impl Sysroot { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))] #[doc(alias = "journal-msg")] pub fn connect_journal_msg(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn journal_msg_trampoline(this: *mut ffi::OstreeSysroot, msg: *mut libc::c_char, f: glib::ffi::gpointer) { + unsafe extern "C" fn journal_msg_trampoline( + this: *mut ffi::OstreeSysroot, + msg: *mut libc::c_char, + f: glib::ffi::gpointer, + ) { let f: &F = &*(f as *const F); - f(&from_glib_borrow(this), &glib::GString::from_glib_borrow(msg)) + f( + &from_glib_borrow(this), + &glib::GString::from_glib_borrow(msg), + ) } unsafe { let f: Box_ = Box_::new(f); - connect_raw(self.as_ptr() as *mut _, b"journal-msg\0".as_ptr() as *const _, - Some(transmute::<_, unsafe extern "C" fn()>(journal_msg_trampoline:: as *const ())), Box_::into_raw(f)) + connect_raw( + self.as_ptr() as *mut _, + b"journal-msg\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>( + journal_msg_trampoline:: as *const (), + )), + Box_::into_raw(f), + ) } } } diff --git a/rust-bindings/src/auto/sysroot_upgrader.rs b/rust-bindings/src/auto/sysroot_upgrader.rs index 0e932534..f16e3900 100644 --- a/rust-bindings/src/auto/sysroot_upgrader.rs +++ b/rust-bindings/src/auto/sysroot_upgrader.rs @@ -27,47 +27,100 @@ glib::wrapper! { impl SysrootUpgrader { #[doc(alias = "ostree_sysroot_upgrader_new")] - pub fn new>(sysroot: &Sysroot, cancellable: Option<&P>) -> Result { + pub fn new( + sysroot: &Sysroot, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_sysroot_upgrader_new(sysroot.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_sysroot_upgrader_new( + sysroot.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sysroot_upgrader_new_for_os")] #[doc(alias = "new_for_os")] - pub fn for_os>(sysroot: &Sysroot, osname: Option<&str>, cancellable: Option<&P>) -> Result { + pub fn for_os( + sysroot: &Sysroot, + osname: Option<&str>, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_sysroot_upgrader_new_for_os(sysroot.to_glib_none().0, osname.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_sysroot_upgrader_new_for_os( + sysroot.to_glib_none().0, + osname.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sysroot_upgrader_new_for_os_with_flags")] #[doc(alias = "new_for_os_with_flags")] - pub fn for_os_with_flags>(sysroot: &Sysroot, osname: Option<&str>, flags: SysrootUpgraderFlags, cancellable: Option<&P>) -> Result { + pub fn for_os_with_flags( + sysroot: &Sysroot, + osname: Option<&str>, + flags: SysrootUpgraderFlags, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_sysroot_upgrader_new_for_os_with_flags(sysroot.to_glib_none().0, osname.to_glib_none().0, flags.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } + let ret = ffi::ostree_sysroot_upgrader_new_for_os_with_flags( + sysroot.to_glib_none().0, + osname.to_glib_none().0, + flags.into_glib(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + if error.is_null() { + Ok(from_glib_full(ret)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sysroot_upgrader_deploy")] - pub fn deploy>(&self, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn deploy( + &self, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_upgrader_deploy(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_upgrader_deploy( + self.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sysroot_upgrader_dup_origin")] pub fn dup_origin(&self) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_upgrader_dup_origin(self.to_glib_none().0)) + from_glib_full(ffi::ostree_sysroot_upgrader_dup_origin( + self.to_glib_none().0, + )) } } @@ -75,7 +128,9 @@ impl SysrootUpgrader { #[doc(alias = "get_origin")] pub fn origin(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_sysroot_upgrader_get_origin(self.to_glib_none().0)) + from_glib_none(ffi::ostree_sysroot_upgrader_get_origin( + self.to_glib_none().0, + )) } } @@ -83,71 +138,125 @@ impl SysrootUpgrader { #[doc(alias = "get_origin_description")] pub fn origin_description(&self) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_upgrader_get_origin_description(self.to_glib_none().0)) + from_glib_full(ffi::ostree_sysroot_upgrader_get_origin_description( + self.to_glib_none().0, + )) } } #[doc(alias = "ostree_sysroot_upgrader_pull")] - pub fn pull>(&self, flags: RepoPullFlags, upgrader_flags: SysrootUpgraderPullFlags, progress: Option<&AsyncProgress>, cancellable: Option<&P>) -> Result { + pub fn pull( + &self, + flags: RepoPullFlags, + upgrader_flags: SysrootUpgraderPullFlags, + progress: Option<&AsyncProgress>, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_changed = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_upgrader_pull(self.to_glib_none().0, flags.into_glib(), upgrader_flags.into_glib(), progress.to_glib_none().0, out_changed.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + let is_ok = ffi::ostree_sysroot_upgrader_pull( + self.to_glib_none().0, + flags.into_glib(), + upgrader_flags.into_glib(), + progress.to_glib_none().0, + out_changed.as_mut_ptr(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); let out_changed = out_changed.assume_init(); - if error.is_null() { Ok(from_glib(out_changed)) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib(out_changed)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sysroot_upgrader_pull_one_dir")] - pub fn pull_one_dir>(&self, dir_to_pull: &str, flags: RepoPullFlags, upgrader_flags: SysrootUpgraderPullFlags, progress: Option<&AsyncProgress>, cancellable: Option<&P>) -> Result { + pub fn pull_one_dir( + &self, + dir_to_pull: &str, + flags: RepoPullFlags, + upgrader_flags: SysrootUpgraderPullFlags, + progress: Option<&AsyncProgress>, + cancellable: Option<&impl IsA>, + ) -> Result { unsafe { let mut out_changed = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_upgrader_pull_one_dir(self.to_glib_none().0, dir_to_pull.to_glib_none().0, flags.into_glib(), upgrader_flags.into_glib(), progress.to_glib_none().0, out_changed.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + let is_ok = ffi::ostree_sysroot_upgrader_pull_one_dir( + self.to_glib_none().0, + dir_to_pull.to_glib_none().0, + flags.into_glib(), + upgrader_flags.into_glib(), + progress.to_glib_none().0, + out_changed.as_mut_ptr(), + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); let out_changed = out_changed.assume_init(); - if error.is_null() { Ok(from_glib(out_changed)) } else { Err(from_glib_full(error)) } + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(from_glib(out_changed)) + } else { + Err(from_glib_full(error)) + } } } #[doc(alias = "ostree_sysroot_upgrader_set_origin")] - pub fn set_origin>(&self, origin: Option<&glib::KeyFile>, cancellable: Option<&P>) -> Result<(), glib::Error> { + pub fn set_origin( + &self, + origin: Option<&glib::KeyFile>, + cancellable: Option<&impl IsA>, + ) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_upgrader_set_origin(self.to_glib_none().0, origin.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_upgrader_set_origin( + self.to_glib_none().0, + origin.to_glib_none().0, + cancellable.map(|p| p.as_ref()).to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } pub fn flags(&self) -> SysrootUpgraderFlags { - unsafe { - let mut value = glib::Value::from_type(::static_type()); - glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"flags\0".as_ptr() as *const _, value.to_glib_none_mut().0); - value.get().expect("Return Value for property `flags` getter") - } + glib::ObjectExt::property(self, "flags") } pub fn osname(&self) -> Option { - unsafe { - let mut value = glib::Value::from_type(::static_type()); - glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"osname\0".as_ptr() as *const _, value.to_glib_none_mut().0); - value.get().expect("Return Value for property `osname` getter") - } + glib::ObjectExt::property(self, "osname") } pub fn sysroot(&self) -> Option { - unsafe { - let mut value = glib::Value::from_type(::static_type()); - glib::gobject_ffi::g_object_get_property(self.as_ptr() as *mut glib::gobject_ffi::GObject, b"sysroot\0".as_ptr() as *const _, value.to_glib_none_mut().0); - value.get().expect("Return Value for property `sysroot` getter") - } + glib::ObjectExt::property(self, "sysroot") } #[doc(alias = "ostree_sysroot_upgrader_check_timestamps")] pub fn check_timestamps(repo: &Repo, from_rev: &str, to_rev: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let _ = ffi::ostree_sysroot_upgrader_check_timestamps(repo.to_glib_none().0, from_rev.to_glib_none().0, to_rev.to_glib_none().0, &mut error); - if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + let is_ok = ffi::ostree_sysroot_upgrader_check_timestamps( + repo.to_glib_none().0, + from_rev.to_glib_none().0, + to_rev.to_glib_none().0, + &mut error, + ); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { + Ok(()) + } else { + Err(from_glib_full(error)) + } } } } diff --git a/rust-bindings/src/auto/versions.txt b/rust-bindings/src/auto/versions.txt index 57f26297..15372ec6 100644 --- a/rust-bindings/src/auto/versions.txt +++ b/rust-bindings/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e8f82cf6) -from gir-files (@ a19cc348) +Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d) +from gir-files (@ 94f67628d6ed) diff --git a/rust-bindings/src/repo.rs b/rust-bindings/src/repo.rs index 1e3e90bc..1333fd5f 100644 --- a/rust-bindings/src/repo.rs +++ b/rust-bindings/src/repo.rs @@ -94,7 +94,7 @@ impl<'a> Drop for TransactionGuard<'a> { if let Some(repo) = self.repo { // TODO: better logging in ostree? // See also https://github.com/ostreedev/ostree/issues/2413 - let _ = repo.abort_transaction(gio::NONE_CANCELLABLE); + let _ = repo.abort_transaction(gio::Cancellable::NONE); } } } @@ -109,7 +109,7 @@ impl Repo { /// A version of [`open_at`] which uses cap-std. pub fn open_at_dir(dir: &cap_std::fs::Dir, path: &str) -> Result { use std::os::unix::io::AsRawFd; - crate::Repo::open_at(dir.as_raw_fd(), path, gio::NONE_CANCELLABLE) + crate::Repo::open_at(dir.as_raw_fd(), path, gio::Cancellable::NONE) } #[cfg(feature = "cap-std-apis")] @@ -121,7 +121,7 @@ impl Repo { options: Option<&glib::Variant>, ) -> Result { use std::os::unix::io::AsRawFd; - crate::Repo::create_at(dir.as_raw_fd(), path, mode, options, gio::NONE_CANCELLABLE)?; + crate::Repo::create_at(dir.as_raw_fd(), path, mode, options, gio::Cancellable::NONE)?; Repo::open_at_dir(dir, path) } diff --git a/rust-bindings/src/repo_checkout_at_options/mod.rs b/rust-bindings/src/repo_checkout_at_options/mod.rs index b0ded2c7..099bd229 100644 --- a/rust-bindings/src/repo_checkout_at_options/mod.rs +++ b/rust-bindings/src/repo_checkout_at_options/mod.rs @@ -243,7 +243,7 @@ mod tests { }), #[cfg(feature = "v2017_6")] sepolicy: Some( - SePolicy::new(&gio::File::for_path("a/b"), gio::NONE_CANCELLABLE).unwrap(), + SePolicy::new(&gio::File::for_path("a/b"), gio::Cancellable::NONE).unwrap(), ), sepolicy_prefix: Some("prefix".into()), }; diff --git a/rust-bindings/src/repo_transaction_stats.rs b/rust-bindings/src/repo_transaction_stats.rs index 1d12531b..fef985c2 100644 --- a/rust-bindings/src/repo_transaction_stats.rs +++ b/rust-bindings/src/repo_transaction_stats.rs @@ -1,3 +1,5 @@ +use glib::translate::FromGlibPtrFull; + glib::wrapper! { /// A list of statistics for each transaction that may be interesting for reporting purposes. #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] @@ -6,8 +8,6 @@ glib::wrapper! { match fn { copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::ostree_repo_transaction_stats_get_type(), ptr as *mut _) as *mut ffi::OstreeRepoTransactionStats, free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::ostree_repo_transaction_stats_get_type(), ptr as *mut _), - init => |_ptr| (), - clear => |_ptr| (), type_ => || ffi::ostree_repo_transaction_stats_get_type(), } } @@ -15,31 +15,39 @@ glib::wrapper! { impl RepoTransactionStats { /// The total number of metadata objects in the repository after this transaction has completed. pub fn get_metadata_objects_total(&self) -> usize { - self.0.metadata_objects_total as usize + self.inner.metadata_objects_total as usize } /// The number of metadata objects that were written to the repository in this transaction. pub fn get_metadata_objects_written(&self) -> usize { - self.0.metadata_objects_written as usize + self.inner.metadata_objects_written as usize } /// The total number of content objects in the repository after this transaction has completed. pub fn get_content_objects_total(&self) -> usize { - self.0.content_objects_total as usize + self.inner.content_objects_total as usize } /// The number of content objects that were written to the repository in this transaction. pub fn get_content_objects_written(&self) -> usize { - self.0.content_objects_written as usize + self.inner.content_objects_written as usize } /// The amount of data added to the repository, in bytes, counting only content objects. pub fn get_content_bytes_written(&self) -> u64 { - self.0.content_bytes_written + self.inner.content_bytes_written } /// The amount of cache hits during this transaction. pub fn get_devino_cache_hits(&self) -> usize { - self.0.devino_cache_hits as usize + self.inner.devino_cache_hits as usize + } + + /// Create new uninitialized stats. + pub(crate) fn uninitialized() -> Self { + unsafe { + let stats: ffi::OstreeRepoTransactionStats = std::mem::zeroed(); + Self::from_glib_full(Box::into_raw(Box::new(stats))) + } } } diff --git a/rust-bindings/src/sysroot.rs b/rust-bindings/src/sysroot.rs index 5255c286..d7b2b767 100644 --- a/rust-bindings/src/sysroot.rs +++ b/rust-bindings/src/sysroot.rs @@ -76,14 +76,14 @@ mod tests { let tmp_path = Some(tmpdir.path().to_path_buf()); let builder = SysrootBuilder::new().path(tmp_path); - let sysroot = builder.create(gio::NONE_CANCELLABLE).unwrap(); + let sysroot = builder.create(gio::Cancellable::NONE).unwrap(); assert!(sysroot.fd() >= 0); assert_eq!(sysroot.deployments().len(), 0); assert_eq!(sysroot.booted_deployment(), None); assert_eq!(sysroot.bootversion(), 0); assert_eq!(sysroot.subbootversion(), 0); - sysroot.cleanup(gio::NONE_CANCELLABLE).unwrap(); + sysroot.cleanup(gio::Cancellable::NONE).unwrap(); sysroot.path().unwrap() }; @@ -91,14 +91,14 @@ mod tests { let tmp_path = Some(tmpdir.path().to_path_buf()); let builder = SysrootBuilder::new().path(tmp_path); - let sysroot = builder.create(gio::NONE_CANCELLABLE).unwrap(); + let sysroot = builder.create(gio::Cancellable::NONE).unwrap(); assert!(sysroot.fd() >= 0); assert_eq!(sysroot.deployments().len(), 0); assert_eq!(sysroot.booted_deployment(), None); assert_eq!(sysroot.bootversion(), 0); assert_eq!(sysroot.subbootversion(), 0); - sysroot.cleanup(gio::NONE_CANCELLABLE).unwrap(); + sysroot.cleanup(gio::Cancellable::NONE).unwrap(); sysroot.path().unwrap() }; diff --git a/rust-bindings/sys/src/auto/versions.txt b/rust-bindings/sys/src/auto/versions.txt index 6a5d9bd6..15372ec6 100644 --- a/rust-bindings/sys/src/auto/versions.txt +++ b/rust-bindings/sys/src/auto/versions.txt @@ -1,2 +1,2 @@ Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d) -from gir-files (@ b19a13a583ef) +from gir-files (@ 94f67628d6ed) diff --git a/rust-bindings/tests/functions/mod.rs b/rust-bindings/tests/functions/mod.rs index e041ddfb..610ff780 100644 --- a/rust-bindings/tests/functions/mod.rs +++ b/rust-bindings/tests/functions/mod.rs @@ -1,5 +1,4 @@ use crate::util::TestRepo; -use gio::NONE_CANCELLABLE; use ostree::{checksum_file_from_input, ObjectType}; #[test] @@ -13,7 +12,7 @@ fn list_repo_objects() { let objects = repo .repo - .list_objects(ffi::OSTREE_REPO_LIST_OBJECTS_ALL, NONE_CANCELLABLE) + .list_objects(ffi::OSTREE_REPO_LIST_OBJECTS_ALL, gio::Cancellable::NONE) .expect("List Objects"); for (object, _items) in objects { match object.object_type() { @@ -48,7 +47,7 @@ fn should_checksum_file_from_input() { let objects = repo .repo - .traverse_commit(&commit_checksum, -1, NONE_CANCELLABLE) + .traverse_commit(&commit_checksum, -1, gio::Cancellable::NONE) .expect("traverse commit"); for obj in objects { if obj.object_type() != ObjectType::File { @@ -56,14 +55,14 @@ fn should_checksum_file_from_input() { } let (stream, file_info, xattrs) = repo .repo - .load_file(obj.checksum(), NONE_CANCELLABLE) + .load_file(obj.checksum(), gio::Cancellable::NONE) .expect("load file"); let result = checksum_file_from_input( &file_info, Some(&xattrs), stream.as_ref(), ObjectType::File, - NONE_CANCELLABLE, + gio::Cancellable::NONE, ) .expect("checksum file from input"); assert_eq!(result.to_string(), obj.checksum()); diff --git a/rust-bindings/tests/repo/checkout_at.rs b/rust-bindings/tests/repo/checkout_at.rs index 94028642..7cc6b114 100644 --- a/rust-bindings/tests/repo/checkout_at.rs +++ b/rust-bindings/tests/repo/checkout_at.rs @@ -1,5 +1,4 @@ use crate::util::*; -use gio::NONE_CANCELLABLE; use ostree::*; use std::os::unix::io::AsRawFd; @@ -17,7 +16,7 @@ fn should_checkout_at_with_none_options() { dirfd.as_raw_fd(), "test-checkout", &checksum, - NONE_CANCELLABLE, + gio::Cancellable::NONE, ) .expect("checkout at"); @@ -38,7 +37,7 @@ fn should_checkout_at_with_default_options() { dirfd.as_raw_fd(), "test-checkout", &checksum, - NONE_CANCELLABLE, + gio::Cancellable::NONE, ) .expect("checkout at"); @@ -65,7 +64,7 @@ fn should_checkout_at_with_options() { dirfd.as_raw_fd(), "test-checkout", &checksum, - NONE_CANCELLABLE, + gio::Cancellable::NONE, ) .expect("checkout at"); @@ -98,7 +97,7 @@ fn should_checkout_at_with_filter() { dirfd.as_raw_fd(), "test-checkout", &checksum, - NONE_CANCELLABLE, + gio::Cancellable::NONE, ) .expect("checkout at"); diff --git a/rust-bindings/tests/repo/generate_static.rs b/rust-bindings/tests/repo/generate_static.rs index 297ce95d..f6b74028 100644 --- a/rust-bindings/tests/repo/generate_static.rs +++ b/rust-bindings/tests/repo/generate_static.rs @@ -1,5 +1,4 @@ use crate::util::*; -use gio::NONE_CANCELLABLE; use ostree::glib::prelude::*; use ostree::glib::Variant; use ostree::*; @@ -36,7 +35,7 @@ fn should_generate_static_delta_at() { &to, None, Some(varopts), - NONE_CANCELLABLE, + gio::Cancellable::NONE, ) .expect("static delta generate"); diff --git a/rust-bindings/tests/repo/mod.rs b/rust-bindings/tests/repo/mod.rs index 0f8967a0..54ee7ac0 100644 --- a/rust-bindings/tests/repo/mod.rs +++ b/rust-bindings/tests/repo/mod.rs @@ -1,5 +1,4 @@ use crate::util::*; -use ostree::gio::NONE_CANCELLABLE; use ostree::prelude::*; use ostree::{ObjectName, ObjectType}; @@ -19,9 +18,9 @@ fn should_commit_content_to_repo_and_list_refs_again() { assert_eq!(test_repo.repo.require_rev("test").unwrap(), checksum); let repo = ostree::Repo::new_for_path(test_repo.dir.path()); - repo.open(NONE_CANCELLABLE).expect("OSTree test_repo"); + repo.open(gio::Cancellable::NONE).expect("OSTree test_repo"); let refs = repo - .list_refs(None, NONE_CANCELLABLE) + .list_refs(None, gio::Cancellable::NONE) .expect("failed to list refs"); assert_eq!(1, refs.len()); assert_eq!(checksum, refs["test"]); @@ -29,7 +28,7 @@ fn should_commit_content_to_repo_and_list_refs_again() { #[test] fn list_commits() { - let cancellable = gio::NONE_CANCELLABLE; + let cancellable = ostree::gio::Cancellable::NONE; let test_repo = TestRepo::new(); for prefix in [None, Some("a"), Some("0abcde")] { @@ -72,7 +71,7 @@ fn cap_std_commit() { let repo2 = ostree::Repo::open_at_dir(&test_repo.dir, ".").unwrap(); let refs = repo2 - .list_refs(None, NONE_CANCELLABLE) + .list_refs(None, gio::Cancellable::NONE) .expect("failed to list refs"); assert_eq!(1, refs.len()); assert_eq!(checksum, refs["test"]); @@ -85,7 +84,7 @@ fn repo_traverse_and_read() { let objects = test_repo .repo - .traverse_commit(&checksum, -1, NONE_CANCELLABLE) + .traverse_commit(&checksum, -1, gio::Cancellable::NONE) .expect("traverse commit"); assert_eq!( @@ -122,7 +121,7 @@ fn repo_traverse_and_read() { .repo .query_file( "89f84ca9854a80e85b583e46a115ba4985254437027bad34f0b113219323d3f8", - NONE_CANCELLABLE, + gio::Cancellable::NONE, ) .unwrap(); assert_eq!(finfo.size(), 5); @@ -136,13 +135,13 @@ fn should_checkout_tree() { let checkout_dir = tempfile::tempdir().expect("checkout dir"); let file = test_repo .repo - .read_commit("test", NONE_CANCELLABLE) + .read_commit("test", gio::Cancellable::NONE) .expect("read commit") .0 .downcast::() .expect("RepoFile"); let info = file - .query_info("*", gio::FileQueryInfoFlags::NONE, NONE_CANCELLABLE) + .query_info("*", gio::FileQueryInfoFlags::NONE, gio::Cancellable::NONE) .expect("file info"); test_repo .repo @@ -152,7 +151,7 @@ fn should_checkout_tree() { &gio::File::for_path(checkout_dir.path().join("test-checkout")), &file, &info, - NONE_CANCELLABLE, + gio::Cancellable::NONE, ) .expect("checkout tree"); @@ -168,7 +167,7 @@ fn should_write_content_to_repo() { let dest = TestRepo::new(); let objects = src .repo - .traverse_commit(&checksum, -1, NONE_CANCELLABLE) + .traverse_commit(&checksum, -1, gio::Cancellable::NONE) .expect("traverse"); for obj in objects { match obj.object_type() { @@ -192,11 +191,11 @@ fn repo_file() { fn copy_file(src: &TestRepo, dest: &TestRepo, obj: &ObjectName) { let (stream, len) = src .repo - .load_object_stream(obj.object_type(), obj.checksum(), NONE_CANCELLABLE) + .load_object_stream(obj.object_type(), obj.checksum(), gio::Cancellable::NONE) .expect("load object stream"); let out_csum = dest .repo - .write_content(None, &stream, len, NONE_CANCELLABLE) + .write_content(None, &stream, len, gio::Cancellable::NONE) .expect("write content"); assert_eq!(out_csum.to_string(), obj.checksum()); } @@ -208,7 +207,7 @@ fn copy_metadata(src: &TestRepo, dest: &TestRepo, obj: &ObjectName) { .expect("load variant"); let out_csum = dest .repo - .write_metadata(obj.object_type(), None, &data, NONE_CANCELLABLE) + .write_metadata(obj.object_type(), None, &data, gio::Cancellable::NONE) .expect("write metadata"); assert_eq!(out_csum.to_string(), obj.checksum()); } diff --git a/rust-bindings/tests/sign/mod.rs b/rust-bindings/tests/sign/mod.rs index 300beedf..aa2a59a0 100644 --- a/rust-bindings/tests/sign/mod.rs +++ b/rust-bindings/tests/sign/mod.rs @@ -13,7 +13,7 @@ fn sign_api_should_work() { let result = ostree::prelude::SignExt::data( &dummy_sign, &glib::Bytes::from_static(b"1234"), - gio::NONE_CANCELLABLE, + gio::Cancellable::NONE, ); assert!(result.is_err()); @@ -61,7 +61,7 @@ echo $ED25519SECRET > ed25519.secret let payload = &glib::Bytes::from_static(b"1234"); - let signature = signer.data(payload, gio::NONE_CANCELLABLE).unwrap(); + let signature = signer.data(payload, gio::Cancellable::NONE).unwrap(); let signatures = [&*signature].to_variant(); let msg = signer.data_verify(payload, &signatures).unwrap().unwrap(); diff --git a/rust-bindings/tests/util/mod.rs b/rust-bindings/tests/util/mod.rs index c38daeec..80886910 100644 --- a/rust-bindings/tests/util/mod.rs +++ b/rust-bindings/tests/util/mod.rs @@ -1,4 +1,3 @@ -use gio::NONE_CANCELLABLE; use glib::prelude::*; use glib::GString; use std::path::Path; @@ -17,7 +16,7 @@ impl TestRepo { pub fn new_with_mode(repo_mode: ostree::RepoMode) -> TestRepo { let dir = tempfile::tempdir().expect("temp repo dir"); let repo = ostree::Repo::new_for_path(dir.path()); - repo.create(repo_mode, NONE_CANCELLABLE) + repo.create(repo_mode, gio::Cancellable::NONE) .expect("OSTree repo"); TestRepo { dir, repo } } @@ -55,18 +54,18 @@ pub fn create_mtree(repo: &ostree::Repo) -> ostree::MutableTree { let file = gio::File::for_path( Path::new(env!("CARGO_MANIFEST_DIR")).join("rust-bindings/tests/data/test.tar"), ); - repo.write_archive_to_mtree(&file, &mtree, None, true, NONE_CANCELLABLE) + repo.write_archive_to_mtree(&file, &mtree, None, true, gio::Cancellable::NONE) .expect("test mtree"); mtree } pub fn commit(repo: &ostree::Repo, mtree: &ostree::MutableTree, ref_: &str) -> GString { let txn = repo - .auto_transaction(NONE_CANCELLABLE) + .auto_transaction(gio::Cancellable::NONE) .expect("prepare transaction"); let repo_file = txn .repo() - .write_mtree(mtree, NONE_CANCELLABLE) + .write_mtree(mtree, gio::Cancellable::NONE) .expect("write mtree") .downcast::() .unwrap(); @@ -77,11 +76,12 @@ pub fn commit(repo: &ostree::Repo, mtree: &ostree::MutableTree, ref_: &str) -> G None, None, &repo_file, - NONE_CANCELLABLE, + gio::Cancellable::NONE, ) .expect("write commit"); repo.transaction_set_ref(None, ref_, checksum.as_str().into()); - txn.commit(NONE_CANCELLABLE).expect("commit transaction"); + txn.commit(gio::Cancellable::NONE) + .expect("commit transaction"); checksum } From 6b2d0067f0ef84d6a179043c2219f3d20281db2d Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Thu, 27 Oct 2022 12:58:43 +0000 Subject: [PATCH 21/55] ci/rust: test from git using latest feature --- .github/workflows/rust.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index bca9b691..6e468fd6 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -13,7 +13,7 @@ env: CARGO_TERM_COLOR: always CARGO_PROJECT_FEATURES: "v2021_5,cap-std-apis" # TODO: Automatically query this from the C side - LATEST_LIBOSTREE: "v2022_5" + LATEST_LIBOSTREE: "v2022_6" # Minimum supported Rust version (MSRV) ACTION_MSRV_TOOLCHAIN: 1.58.1 # Pinned toolchain for linting From 33cf347117cebd40fd1de1d6077944d4451239c7 Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Thu, 27 Oct 2022 13:26:17 +0000 Subject: [PATCH 22/55] 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. --- Cargo.toml | 4 ++-- rust-bindings/sys/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ddda1a88..a681ab4c 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.15.0" +version = "0.16.0" exclude = [ "/*.am", "/apidoc", "/autogen.sh", "/bash", "/bsdiff", @@ -40,7 +40,7 @@ members = [".", "rust-bindings/sys"] bitflags = "1.2.1" 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" } +ffi = { package = "ostree-sys", path = "rust-bindings/sys", version = "0.11.0" } gio = "0.15" glib = "0.15" hex = "0.4.2" diff --git a/rust-bindings/sys/Cargo.toml b/rust-bindings/sys/Cargo.toml index 497cb4e9..f2cc5fbd 100644 --- a/rust-bindings/sys/Cargo.toml +++ b/rust-bindings/sys/Cargo.toml @@ -82,7 +82,7 @@ license = "MIT" links = "ostree-1" name = "ostree-sys" repository = "https://github.com/ostreedev/ostree-rs" -version = "0.10.0" +version = "0.11.0" edition = "2021" [package.metadata.docs.rs] features = ["dox"] From 3f3a817375f8fbfc965c1357ec45a58e3ba469a0 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 28 Oct 2022 12:21:29 +0100 Subject: [PATCH 23/55] readdir-rand: Copy full size of struct dirent As noted in readdir(3), in the presence of long filenames it is possible for a directory entry to be larger than `sizeof (struct dirent)`. Copy the full length instead. Signed-off-by: Simon McVittie --- tests/readdir-rand.c | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/tests/readdir-rand.c b/tests/readdir-rand.c index f5d31ffb..cd3b3b09 100644 --- a/tests/readdir-rand.c +++ b/tests/readdir-rand.c @@ -40,6 +40,33 @@ # define READDIR_R "readdir_r" #endif +/* + * copy_dirent: + * @other: Another struct dirent + * + * Returns: a copy of @other. Free with g_free(). + */ +static struct dirent * +copy_dirent (const struct dirent *other) +{ + struct dirent *self; + size_t len; + + /* We can't just use sizeof (struct dirent) for the length to copy, + * because filenames are allowed to be longer than NAME_MAX bytes. */ + len = G_STRUCT_OFFSET (struct dirent, d_name) + strlen (other->d_name) + 1; + + if (len < other->d_reclen) + len = other->d_reclen; + + if (len < sizeof (struct dirent)) + len = sizeof (struct dirent); + + self = g_malloc0 (len); + memcpy (self, other, len); + return self; +} + static GHashTable *direntcache; static GMutex direntcache_lock; static gsize initialized; @@ -114,7 +141,7 @@ readdir (DIR *dirp) de = dir_entries_new (); g_hash_table_insert (direntcache, dirp, de); } - copy = g_memdup (ret, sizeof (struct dirent)); + copy = copy_dirent (ret); g_ptr_array_add (de->entries, copy); } else From 23446a0218d4d3997a184448cd6708bdbb5e74ac Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 31 Oct 2022 09:00:28 -0400 Subject: [PATCH 24/55] Remove readdir-rand This was only there to reproduce a bug we hit long ago with bootloader file ordering. We're extremely unlikely to reintroduce such a bug, and it's not worth carrying around this code. --- Makefile-tests.am | 18 +-- tests/libtest.sh | 10 +- tests/readdir-rand.c | 235 --------------------------------- tests/test-commit-timestamp.sh | 6 +- 4 files changed, 5 insertions(+), 264 deletions(-) delete mode 100644 tests/readdir-rand.c diff --git a/Makefile-tests.am b/Makefile-tests.am index 1ad660bf..470eec25 100644 --- a/Makefile-tests.am +++ b/Makefile-tests.am @@ -255,18 +255,6 @@ else EXTRA_DIST += $(js_installed_tests) endif -test_ltlibraries = libreaddir-rand.la -libreaddir_rand_la_SOURCES = tests/readdir-rand.c -libreaddir_rand_la_CFLAGS = $(AM_CFLAGS) $(OT_INTERNAL_GIO_UNIX_CFLAGS) -libreaddir_rand_la_LIBADD = \ - -ldl \ - $(OT_INTERNAL_GIO_UNIX_LIBS) \ - $(NULL) -libreaddir_rand_la_LDFLAGS = $(AM_LDFLAGS) -avoid-version -if !ENABLE_INSTALLED_TESTS -libreaddir_rand_la_LDFLAGS += -rpath $(abs_builddir) -endif - _installed_or_uninstalled_test_programs = tests/test-varint tests/test-ot-unix-utils tests/test-bsdiff tests/test-mutable-tree \ tests/test-keyfile-utils tests/test-ot-opt-utils tests/test-ot-tool-util \ tests/test-checksum tests/test-lzma tests/test-rollsum \ @@ -415,11 +403,7 @@ EXTRA_DIST += \ tests/libtest.sh \ $(NULL) -tests/libreaddir-rand.so: Makefile - mkdir -p tests/ - $(AM_V_GEN) ln -fns ../.libs/libreaddir-rand.so tests/ -ALL_LOCAL_RULES += tests/libreaddir-rand.so -CLEANFILES += tests/libreaddir-rand.so tests/ostree-symlink-stamp \ +CLEANFILES += tests/ostree-symlink-stamp \ tests/ostree-prepare-root-symlink-stamp tests/ostree-remount-symlink-stamp \ tests/rofiles-fuse-symlink-stamp tests/ostree CLEANFILES += tests/ostree-prepare-root tests/ostree-remount tests/rofiles-fuse diff --git a/tests/libtest.sh b/tests/libtest.sh index 5830f210..af000363 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -172,17 +172,9 @@ if test -n "${ASAN_OPTIONS:-}"; then BUILT_WITH_ASAN=1 fi +CMD_PREFIX="" if test -n "${OT_TESTS_VALGRIND:-}"; then CMD_PREFIX="env G_SLICE=always-malloc OSTREE_SUPPRESS_SYNCFS=1 valgrind -q --error-exitcode=1 --leak-check=full --num-callers=30 --suppressions=${test_srcdir}/glib.supp --suppressions=${test_srcdir}/ostree.supp" -else - # In some cases the LD_PRELOAD may cause obscure problems, - # e.g. right now it breaks for me with -fsanitize=address, so - # let's allow users to skip it. - if test -z "${OT_SKIP_READDIR_RAND:-}" && test -z "${BUILT_WITH_ASAN:-}"; then - CMD_PREFIX="env LD_PRELOAD=${test_builddir}/libreaddir-rand.so" - else - CMD_PREFIX="" - fi fi if test -n "${OSTREE_UNINSTALLED:-}"; then diff --git a/tests/readdir-rand.c b/tests/readdir-rand.c deleted file mode 100644 index cd3b3b09..00000000 --- a/tests/readdir-rand.c +++ /dev/null @@ -1,235 +0,0 @@ -/* - * Copyright (C) 2015 Colin Walters . - * - * SPDX-License-Identifier: LGPL-2.0+ - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library. If not, see . - */ - -#include "config.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -/* Glibc uses readdir64 when _FILE_OFFSET_BITS == 64 as set by - * AC_SYS_LARGEFILE on 32 bit systems. - */ -#if defined(_FILE_OFFSET_BITS) && (_FILE_OFFSET_BITS == 64) -# define READDIR "readdir64" -# define READDIR_R "readdir64_r" -#else -# define READDIR "readdir" -# define READDIR_R "readdir_r" -#endif - -/* - * copy_dirent: - * @other: Another struct dirent - * - * Returns: a copy of @other. Free with g_free(). - */ -static struct dirent * -copy_dirent (const struct dirent *other) -{ - struct dirent *self; - size_t len; - - /* We can't just use sizeof (struct dirent) for the length to copy, - * because filenames are allowed to be longer than NAME_MAX bytes. */ - len = G_STRUCT_OFFSET (struct dirent, d_name) + strlen (other->d_name) + 1; - - if (len < other->d_reclen) - len = other->d_reclen; - - if (len < sizeof (struct dirent)) - len = sizeof (struct dirent); - - self = g_malloc0 (len); - memcpy (self, other, len); - return self; -} - -static GHashTable *direntcache; -static GMutex direntcache_lock; -static gsize initialized; - -typedef struct { - GPtrArray *entries; - guint offset; -} DirEntries; - -static void -dir_entries_free (gpointer data) -{ - DirEntries *d = data; - g_ptr_array_unref (d->entries); - g_free (d); -} - -static DirEntries * -dir_entries_new (void) -{ - DirEntries *d = g_new0 (DirEntries, 1); - d->entries = g_ptr_array_new_with_free_func (g_free); - return d; -} - -static void -ensure_initialized (void) -{ - if (g_once_init_enter (&initialized)) - { - direntcache = g_hash_table_new_full (NULL, NULL, NULL, dir_entries_free); - g_mutex_init (&direntcache_lock); - g_once_init_leave (&initialized, 1); - } -} - -struct dirent * -readdir (DIR *dirp) -{ - struct dirent *(*real_readdir)(DIR *dirp) = dlsym (RTLD_NEXT, READDIR); - struct dirent *ret; - gboolean cache_another = TRUE; - - ensure_initialized (); - - /* The core idea here is that each time through the loop, we read a - * directory entry. If there is one, we choose whether to cache it - * or to return it. Because multiple entries can be cached, - * ordering is randomized. Statistically, the order will still be - * *weighted* towards the ordering returned from the - * kernel/filesystem, but the goal here is just to provide some - * randomness in order to trigger bugs, not to be perfectly random. - */ - while (cache_another) - { - DirEntries *de; - - errno = 0; - ret = real_readdir (dirp); - if (ret == NULL && errno != 0) - goto out; - - g_mutex_lock (&direntcache_lock); - de = g_hash_table_lookup (direntcache, dirp); - if (ret) - { - if (g_random_boolean ()) - { - struct dirent *copy; - if (!de) - { - de = dir_entries_new (); - g_hash_table_insert (direntcache, dirp, de); - } - copy = copy_dirent (ret); - g_ptr_array_add (de->entries, copy); - } - else - { - cache_another = FALSE; - } - } - else - { - if (de && de->offset < de->entries->len) - { - ret = de->entries->pdata[de->offset]; - de->offset++; - } - cache_another = FALSE; - } - g_mutex_unlock (&direntcache_lock); - } - - out: - return ret; -} - -int -closedir (DIR *dirp) -{ - int (*real_closedir)(DIR *dirp) = dlsym (RTLD_NEXT, "closedir"); - - ensure_initialized (); - - g_mutex_lock (&direntcache_lock); - g_hash_table_remove (direntcache, dirp); - g_mutex_unlock (&direntcache_lock); - - return real_closedir (dirp); -} - -static void -assert_no_cached_entries (DIR *dirp) -{ - DirEntries *de; - g_mutex_lock (&direntcache_lock); - de = g_hash_table_lookup (direntcache, dirp); - g_assert (!de || de->entries->len == 0); - g_mutex_unlock (&direntcache_lock); -} - -void -seekdir (DIR *dirp, long loc) -{ - void (*real_seekdir)(DIR *dirp, long loc) = dlsym (RTLD_NEXT, "seekdir"); - - ensure_initialized (); - - /* For now, crash if seekdir is called when we have cached entries. - * If some app wants to use this and seekdir() we can implement it. - */ - assert_no_cached_entries (dirp); - - real_seekdir (dirp, loc); -} - -void -rewinddir (DIR *dirp) -{ - void (*real_rewinddir)(DIR *dirp) = dlsym (RTLD_NEXT, "rewinddir"); - - ensure_initialized (); - - /* Blow away the cache */ - g_mutex_lock (&direntcache_lock); - g_hash_table_remove (direntcache, dirp); - g_mutex_unlock (&direntcache_lock); - - real_rewinddir (dirp); -} - -int -readdir_r (DIR *dirp, struct dirent *entry, struct dirent **result) -{ - int (*real_readdir_r)(DIR *dirp, struct dirent *entry, struct dirent **result) = dlsym (RTLD_NEXT, READDIR_R); - - ensure_initialized (); - - /* For now, assert that no one is mixing readdir_r() with readdir(). - * It'd be broken to do so, and very few programs use readdir_r() - * anyways. */ - assert_no_cached_entries (dirp); - - return real_readdir_r (dirp, entry, result); -} diff --git a/tests/test-commit-timestamp.sh b/tests/test-commit-timestamp.sh index 7dbdbdfc..0688c63a 100755 --- a/tests/test-commit-timestamp.sh +++ b/tests/test-commit-timestamp.sh @@ -30,11 +30,11 @@ mkdir testrepo-files cd testrepo-files echo first > firstfile cd .. -${CMD_PREFIX} SOURCE_DATE_EPOCH='1234567890' ostree --repo=./testrepo commit -b env -s "env timestamp" -if (${CMD_PREFIX} SOURCE_DATE_EPOCH='invalid' ostree --repo=./testrepo commit -b env -s "invalid timestamp") 2> commit-invalid.txt; then +${CMD_PREFIX} env SOURCE_DATE_EPOCH='1234567890' ostree --repo=./testrepo commit -b env -s "env timestamp" +if (${CMD_PREFIX} env SOURCE_DATE_EPOCH='invalid' ostree --repo=./testrepo commit -b env -s "invalid timestamp") 2> commit-invalid.txt; then assert_not_reached "commit with invalid timestamp succeeded" fi -if (${CMD_PREFIX} SOURCE_DATE_EPOCH='12345678901234567890' ostree --repo=./testrepo commit -b env -s "overflowing timestamp") 2> commit-overflowing.txt; then +if (${CMD_PREFIX} env SOURCE_DATE_EPOCH='12345678901234567890' ostree --repo=./testrepo commit -b env -s "overflowing timestamp") 2> commit-overflowing.txt; then assert_not_reached "commit with overflowing timestamp succeeded" fi ${CMD_PREFIX} ostree --repo=./testrepo show env > show-env.txt From b93c0d0262f331647d0cd75c02e4644ed0483a67 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 2 Nov 2022 12:32:15 +0000 Subject: [PATCH 25/55] build(deps): bump libglnx from `e701578` to `4e44fd9` Bumps libglnx from `e701578` to `4e44fd9`. --- updated-dependencies: - dependency-name: libglnx dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- libglnx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libglnx b/libglnx index e701578c..4e44fd9c 160000 --- a/libglnx +++ b/libglnx @@ -1 +1 @@ -Subproject commit e701578c6f4e621c7c3c688b5a04bcbf0a67d930 +Subproject commit 4e44fd9c174e4196a86fb6d954722feaff612c88 From 722be7e3d74f095db749a9c93df4c618f67371bd Mon Sep 17 00:00:00 2001 From: Ricardo Noriega Date: Fri, 28 Oct 2022 13:59:08 +0200 Subject: [PATCH 26/55] Enabling retry for HTTP 500 internal server error Signed-off-by: Ricardo Noriega Use G_IO_ERROR_BUSY to represent 500 error Signed-off-by: Ricardo Noriega Make G_IO_ERROR_BUSY independent from glib version Signed-off-by: Ricardo Noriega --- src/libostree/ostree-fetcher-util.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/libostree/ostree-fetcher-util.c b/src/libostree/ostree-fetcher-util.c index 450a3abe..1b317630 100644 --- a/src/libostree/ostree-fetcher-util.c +++ b/src/libostree/ostree-fetcher-util.c @@ -239,6 +239,7 @@ _ostree_fetcher_should_retry_request (const GError *error, g_error_matches (error, G_IO_ERROR, G_IO_ERROR_HOST_NOT_FOUND) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_HOST_UNREACHABLE) || g_error_matches (error, G_IO_ERROR, G_IO_ERROR_PARTIAL_INPUT) || + g_error_matches (error, G_IO_ERROR, G_IO_ERROR_BUSY) || #if !GLIB_CHECK_VERSION(2, 44, 0) g_error_matches (error, G_IO_ERROR, G_IO_ERROR_BROKEN_PIPE) || #else @@ -269,6 +270,8 @@ _ostree_fetcher_http_status_code_to_io_error (guint status_code) return G_IO_ERROR_NOT_FOUND; case 408: /* SOUP_STATUS_REQUEST_TIMEOUT */ return G_IO_ERROR_TIMED_OUT; + case 500: /* SOUP_STATUS_INTERNAL_SERVER_ERROR */ + return G_IO_ERROR_BUSY; default: return G_IO_ERROR_FAILED; } From 6ce2324e4a0e75d1546837b606efad18bb71a59f Mon Sep 17 00:00:00 2001 From: Ricardo Noriega Date: Wed, 9 Nov 2022 10:52:16 +0100 Subject: [PATCH 27/55] Add tests for cases under random 500s Signed-off-by: Ricardo Noriega --- tests/test-pull-repeated.sh | 44 ++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/tests/test-pull-repeated.sh b/tests/test-pull-repeated.sh index 4c321618..7f724c95 100755 --- a/tests/test-pull-repeated.sh +++ b/tests/test-pull-repeated.sh @@ -26,18 +26,32 @@ if has_gpgme; then COMMIT_SIGN="--gpg-homedir=${TEST_GPG_KEYHOME} --gpg-sign=${TEST_GPG_KEYID_1}" fi -echo "1..4" +echo "1..6" -# Test pulling from a repo which gives error 500 (internal server error) a lot of the time. +# Sanity check with no network retries and 500s given, pull should fail. +rm ostree-srv httpd repo -rf +setup_fake_remote_repo1 "archive" "${COMMIT_SIGN}" --random-500s=99 + +pushd ${test_tmpdir} +ostree_repo_init repo --mode=archive +${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo +assert_fail ${CMD_PREFIX} ostree --repo=repo pull --mirror origin --network-retries=0 main 2>err.txt +assert_file_has_content err.txt "\(500.*Internal Server Error\)\|\(HTTP 500\)" + +popd +echo "ok no retries after a 500" + +# Test pulling a repo which gives error 500 (internal server error) a lot of the time. +rm ostree-srv httpd repo -rf setup_fake_remote_repo1 "archive" "${COMMIT_SIGN}" --random-500s=50 pushd ${test_tmpdir} ostree_repo_init repo --mode=archive ${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo -for x in $(seq 200); do - if ${CMD_PREFIX} ostree --repo=repo pull --mirror origin main 2>err.txt; then - echo "Success on iteration ${x}" - break; +for x in $(seq 40); do + if ${CMD_PREFIX} ostree --repo=repo pull --mirror origin --network-retries=2 main 2>err.txt; then + echo "Success on iteration ${x}" + break; fi assert_file_has_content err.txt "\(500.*Internal Server Error\)\|\(HTTP 500\)" done @@ -48,6 +62,24 @@ ${CMD_PREFIX} ostree --repo=repo rev-parse main popd echo "ok repeated pull after 500s" +# Test pulling a repo that gives 408s a lot of the time, with many network retries. +rm ostree-srv httpd repo -rf +setup_fake_remote_repo1 "archive" "${COMMIT_SIGN}" --random-500s=50 + +pushd ${test_tmpdir} +ostree_repo_init repo --mode=archive +${CMD_PREFIX} ostree --repo=repo remote add --set=gpg-verify=false origin $(cat httpd-address)/ostree/gnomerepo + +# We limit 500s above to 100, so 100 retries should be enough always. +${CMD_PREFIX} ostree --repo=repo pull --mirror origin --network-retries=100 main +echo "Success with big number of network retries" + +${CMD_PREFIX} ostree --repo=repo fsck +${CMD_PREFIX} ostree --repo=repo rev-parse main + +popd +echo "ok big number of retries with one 500s" + # Sanity check with no network retries and 408s given, pull should fail. rm ostree-srv httpd repo -rf setup_fake_remote_repo1 "archive" "${COMMIT_SIGN}" --random-408s=99 From bd325061dc9585886f7e60e58d9fc0c8b37e71db Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 9 Nov 2022 11:18:36 -0500 Subject: [PATCH 28/55] deploy: Don't rebuild selinux policy on first deployment Basically, it should not be necessary - the policy should be up-to-date. We don't want to force on continual policy rebuilds. Even trying to run bwrap when we're *not* in a booted root can cause failures in nested containerization scenarios. Closes: https://github.com/ostreedev/ostree/issues/2758 --- src/libostree/ostree-sysroot-deploy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/libostree/ostree-sysroot-deploy.c b/src/libostree/ostree-sysroot-deploy.c index f27ae0e1..26b07080 100644 --- a/src/libostree/ostree-sysroot-deploy.c +++ b/src/libostree/ostree-sysroot-deploy.c @@ -2987,12 +2987,12 @@ sysroot_finalize_deployment (OstreeSysroot *self, if (!merge_configuration_from (self, merge_deployment, deployment, deployment_dfd, cancellable, error)) return FALSE; - } #ifdef HAVE_SELINUX - if (!sysroot_finalize_selinux_policy(deployment_dfd, error)) - return FALSE; + if (!sysroot_finalize_selinux_policy (deployment_dfd, error)) + return FALSE; #endif /* HAVE_SELINUX */ + } const char *osdeploypath = glnx_strjoina ("ostree/deploy/", ostree_deployment_get_osname (deployment)); glnx_autofd int os_deploy_dfd = -1; From 4bc79ada27fea3d8f1021e5e7d3aca8ac12e741b Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Fri, 11 Nov 2022 14:05:56 +0000 Subject: [PATCH 29/55] copr: only use libostree tags This adds a tag filter to the logic which emits version labels for COPR build, so that it avoids mistakenly picking up tags belonging to the Rust bindings. --- .copr/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.copr/Makefile b/.copr/Makefile index 63669e1d..5f9e58fa 100644 --- a/.copr/Makefile +++ b/.copr/Makefile @@ -4,7 +4,7 @@ srpm: git config --global --add safe.directory '*' ci/make-git-snapshot.sh curl -LO https://src.fedoraproject.org/rpms/ostree/raw/rawhide/f/ostree.spec - sed -ie "s,^Version:.*,Version: $$(git describe --always --tags | sed -e 's,-,\.,g' -e 's,^v,,')," ostree.spec + sed -ie "s,^Version:.*,Version: $$(git describe --always --tags --match 'v2???.*' | sed -e 's,-,\.,g' -e 's,^v,,')," ostree.spec sed -ie 's/^Patch/# Patch/g' ostree.spec # we don't want any downstream patches rpmbuild -bs --define "_sourcedir ${PWD}" --define "_specdir ${PWD}" --define "_builddir ${PWD}" --define "_srcrpmdir ${PWD}" --define "_rpmdir ${PWD}" --define "_buildrootdir ${PWD}/.build" ostree.spec mv *.src.rpm $$outdir From 8b75be17626debb9bfb48d43c12d7c0166aed555 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 11 Nov 2022 15:03:30 -0500 Subject: [PATCH 30/55] ci: Bump memory for ISO testing flow It seems likely that we're allocating more RAM here. What we really need to do is for cosa to express the necessary RAM requirements declaratively, then we compute pod requirements from that. --- .cci.jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index 15d3f531..003588a6 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -41,8 +41,8 @@ stage("Build") { } // Build FCOS and run kola tests. -// Both kola and kolaTestIso require 4G max. Add 1G for overhead. -cosaPod(runAsUser: 0, memory: "5Gi", cpu: "4") { +// There's some parallelization in testiso up to 8G, add 1G for overhead +cosaPod(runAsUser: 0, memory: "9Gi", cpu: "4") { stage("Build FCOS") { checkout scm unstash 'build' From 6f68e3dc4e23cf879645ad4ef69cdff28a6ae77b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 11 Nov 2022 15:08:10 -0500 Subject: [PATCH 31/55] rust: Update to cap-std 1.0 This was one source of our semver bumps; let's switch to 1.0. --- Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a681ab4c..cb83c4dc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,8 +38,8 @@ members = [".", "rust-bindings/sys"] [dependencies] bitflags = "1.2.1" -cap-std = { version = "0.25", optional = true} -io-lifetimes = { version = "0.7", optional = true} +cap-std = { version = "1.0", optional = true} +io-lifetimes = { version = "1.0", optional = true} ffi = { package = "ostree-sys", path = "rust-bindings/sys", version = "0.11.0" } gio = "0.15" glib = "0.15" @@ -53,7 +53,7 @@ thiserror = "1.0.20" maplit = "1.0.2" openat = "0.1.19" tempfile = "3" -cap-tempfile = "0.25" +cap-tempfile = "1.0" [features] cap-std-apis = ["cap-std", "io-lifetimes", "v2017_10"] From 29340dba04d2af4a6c3e067ace43ce670e717d62 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Fri, 28 Oct 2022 12:19:29 +0100 Subject: [PATCH 32/55] Replace calls to g_memdup() with g_memdup2() g_memdup() is subject to an integer overflow on 64-bit machines if the object being copied is larger than UINT_MAX bytes. I suspect none of these objects can actually be that large in practice, but it's easier to replace all the calls than it is to assess whether we need to replace them. A backport in libglnx is used on systems where GLib is older than 2.68.x. Signed-off-by: Simon McVittie --- src/libostree/ostree-repo-commit.c | 2 +- src/libostree/ostree-sign-ed25519.c | 4 ++-- src/libotutil/ot-checksum-utils.c | 2 +- src/libotutil/ot-variant-utils.c | 2 +- tests/test-commit-sign-sh-ext.c | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/libostree/ostree-repo-commit.c b/src/libostree/ostree-repo-commit.c index c22864cd..de79d64a 100644 --- a/src/libostree/ostree-repo-commit.c +++ b/src/libostree/ostree-repo-commit.c @@ -4858,7 +4858,7 @@ _ostree_repo_import_object (OstreeRepo *self, static OstreeRepoTransactionStats * ostree_repo_transaction_stats_copy (OstreeRepoTransactionStats *stats) { - return g_memdup (stats, sizeof (OstreeRepoTransactionStats)); + return g_memdup2 (stats, sizeof (OstreeRepoTransactionStats)); } static void diff --git a/src/libostree/ostree-sign-ed25519.c b/src/libostree/ostree-sign-ed25519.c index 820854fb..b7d87c6c 100644 --- a/src/libostree/ostree-sign-ed25519.c +++ b/src/libostree/ostree-sign-ed25519.c @@ -430,7 +430,7 @@ gboolean ostree_sign_ed25519_add_pk (OstreeSign *self, if (g_list_find_custom (sign->public_keys, key, _compare_ed25519_keys) == NULL) { - gpointer newkey = g_memdup (key, n_elements); + gpointer newkey = g_memdup2 (key, n_elements); sign->public_keys = g_list_prepend (sign->public_keys, newkey); } @@ -466,7 +466,7 @@ _ed25519_add_revoked (OstreeSign *self, if (g_list_find_custom (sign->revoked_keys, key, _compare_ed25519_keys) == NULL) { - gpointer newkey = g_memdup (key, n_elements); + gpointer newkey = g_memdup2 (key, n_elements); sign->revoked_keys = g_list_prepend (sign->revoked_keys, newkey); } diff --git a/src/libotutil/ot-checksum-utils.c b/src/libotutil/ot-checksum-utils.c index df573f2c..2f3a342c 100644 --- a/src/libotutil/ot-checksum-utils.c +++ b/src/libotutil/ot-checksum-utils.c @@ -249,7 +249,7 @@ ot_gio_splice_get_checksum (GOutputStream *out, guint8 digest[_OSTREE_SHA256_DIGEST_LEN]; ot_checksum_get_digest (&checksum, digest, sizeof (digest)); if (out_csum) - *out_csum = g_memdup (digest, sizeof (digest)); + *out_csum = g_memdup2 (digest, sizeof (digest)); return TRUE; } diff --git a/src/libotutil/ot-variant-utils.c b/src/libotutil/ot-variant-utils.c index f6a4e43c..29b64357 100644 --- a/src/libotutil/ot-variant-utils.c +++ b/src/libotutil/ot-variant-utils.c @@ -43,7 +43,7 @@ GVariant * ot_gvariant_new_bytearray (const guchar *data, gsize len) { - gpointer data_copy = g_memdup (data, len); + gpointer data_copy = g_memdup2 (data, len); GVariant *ret = g_variant_new_from_data (G_VARIANT_TYPE ("ay"), data_copy, len, FALSE, g_free, data_copy); return ret; diff --git a/tests/test-commit-sign-sh-ext.c b/tests/test-commit-sign-sh-ext.c index 6dc287d9..22b6deca 100644 --- a/tests/test-commit-sign-sh-ext.c +++ b/tests/test-commit-sign-sh-ext.c @@ -41,7 +41,7 @@ corrupt (GBytes *input) const guint8 *buf = g_bytes_get_data (input, &len); g_assert_cmpint (len, >, 0); g_assert_cmpint (len, <, G_MAXINT); - g_autofree char *newbuf = g_memdup (buf, len); + g_autofree char *newbuf = g_memdup2 (buf, len); g_assert (newbuf != NULL); int o = g_random_int_range (0, len); newbuf[o] = (newbuf[0] + 1); From 8d08e563b4122604fde8b3994605cda9be6b82b9 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 11 Nov 2022 15:11:55 -0500 Subject: [PATCH 33/55] rust: Drop `openat` dependency We can use cap-std in our tests. --- Cargo.toml | 1 - rust-bindings/tests/repo/checkout_at.rs | 18 ++++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a681ab4c..099ee009 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,7 +51,6 @@ thiserror = "1.0.20" [dev-dependencies] maplit = "1.0.2" -openat = "0.1.19" tempfile = "3" cap-tempfile = "0.25" diff --git a/rust-bindings/tests/repo/checkout_at.rs b/rust-bindings/tests/repo/checkout_at.rs index 7cc6b114..5c07b992 100644 --- a/rust-bindings/tests/repo/checkout_at.rs +++ b/rust-bindings/tests/repo/checkout_at.rs @@ -1,4 +1,6 @@ use crate::util::*; +use cap_std::fs::Dir; +use cap_tempfile::cap_std; use ostree::*; use std::os::unix::io::AsRawFd; @@ -8,12 +10,12 @@ fn should_checkout_at_with_none_options() { let checksum = test_repo.test_commit("test"); let checkout_dir = tempfile::tempdir().expect("checkout dir"); - let dirfd = openat::Dir::open(checkout_dir.path()).expect("openat"); + let dir = Dir::open_ambient_dir(checkout_dir.path(), cap_std::ambient_authority()).unwrap(); test_repo .repo .checkout_at( None, - dirfd.as_raw_fd(), + dir.as_raw_fd(), "test-checkout", &checksum, gio::Cancellable::NONE, @@ -29,12 +31,12 @@ fn should_checkout_at_with_default_options() { let checksum = test_repo.test_commit("test"); let checkout_dir = tempfile::tempdir().expect("checkout dir"); - let dirfd = openat::Dir::open(checkout_dir.path()).expect("openat"); + let dir = Dir::open_ambient_dir(checkout_dir.path(), cap_std::ambient_authority()).unwrap(); test_repo .repo .checkout_at( Some(&RepoCheckoutAtOptions::default()), - dirfd.as_raw_fd(), + dir.as_raw_fd(), "test-checkout", &checksum, gio::Cancellable::NONE, @@ -50,7 +52,7 @@ fn should_checkout_at_with_options() { let checksum = test_repo.test_commit("test"); let checkout_dir = tempfile::tempdir().expect("checkout dir"); - let dirfd = openat::Dir::open(checkout_dir.path()).expect("openat"); + let dir = Dir::open_ambient_dir(checkout_dir.path(), cap_std::ambient_authority()).unwrap(); test_repo .repo .checkout_at( @@ -61,7 +63,7 @@ fn should_checkout_at_with_options() { devino_to_csum_cache: Some(RepoDevInoCache::new()), ..Default::default() }), - dirfd.as_raw_fd(), + dir.as_raw_fd(), "test-checkout", &checksum, gio::Cancellable::NONE, @@ -80,7 +82,7 @@ fn should_checkout_at_with_filter() { let checksum = test_repo.test_commit("test"); let checkout_dir = tempfile::tempdir().expect("checkout dir"); - let dirfd = openat::Dir::open(checkout_dir.path()).expect("openat"); + let dir = Dir::open_ambient_dir(checkout_dir.path(), cap_std::ambient_authority()).unwrap(); test_repo .repo .checkout_at( @@ -94,7 +96,7 @@ fn should_checkout_at_with_filter() { }), ..Default::default() }), - dirfd.as_raw_fd(), + dir.as_raw_fd(), "test-checkout", &checksum, gio::Cancellable::NONE, From c4db171daea396efa7f1697bf9a8a94d046aa601 Mon Sep 17 00:00:00 2001 From: Rafael Garcia Ruiz Date: Thu, 17 Nov 2022 14:49:08 +0100 Subject: [PATCH 34/55] 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 --- Makefile-libostree.am | 6 +++--- apidoc/ostree-sections.txt | 1 + rust-bindings/sys/src/lib.rs | 6 ++++++ src/libostree/libostree-devel.sym | 4 ++++ src/libostree/ostree-kernel-args.c | 27 +++++++++++++++++++++++---- src/libostree/ostree-kernel-args.h | 4 ++++ 6 files changed, 41 insertions(+), 7 deletions(-) diff --git a/Makefile-libostree.am b/Makefile-libostree.am index ea5e8ed5..98e37706 100644 --- a/Makefile-libostree.am +++ b/Makefile-libostree.am @@ -171,9 +171,9 @@ endif # USE_GPGME symbol_files = $(top_srcdir)/src/libostree/libostree-released.sym # Uncomment this include when adding new development symbols. -#if BUILDOPT_IS_DEVEL_BUILD -#symbol_files += $(top_srcdir)/src/libostree/libostree-devel.sym -#endif +if BUILDOPT_IS_DEVEL_BUILD +symbol_files += $(top_srcdir)/src/libostree/libostree-devel.sym +endif # http://blog.jgc.org/2007/06/escaping-comma-and-space-in-gnu-make.html wl_versionscript_arg = -Wl,--version-script= diff --git a/apidoc/ostree-sections.txt b/apidoc/ostree-sections.txt index 900e1704..d9f91208 100644 --- a/apidoc/ostree-sections.txt +++ b/apidoc/ostree-sections.txt @@ -738,6 +738,7 @@ ostree_kernel_args_get_last_value ostree_kernel_args_from_string ostree_kernel_args_to_strv ostree_kernel_args_to_string +ostree_kernel_args_contains

diff --git a/rust-bindings/sys/src/lib.rs b/rust-bindings/sys/src/lib.rs index 1d28759a..df245a6c 100644 --- a/rust-bindings/sys/src/lib.rs +++ b/rust-bindings/sys/src/lib.rs @@ -1313,6 +1313,12 @@ extern "C" { #[cfg(any(feature = "v2022_5", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2022_5")))] pub fn ostree_kernel_args_append_if_missing(kargs: *mut OstreeKernelArgs, arg: *const c_char); + #[cfg(any(feature = "v2022_7", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2022_7")))] + pub fn ostree_kernel_args_contains( + kargs: *mut OstreeKernelArgs, + arg: *const c_char, + ) -> gboolean; #[cfg(any(feature = "v2019_3", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2019_3")))] pub fn ostree_kernel_args_append_proc_cmdline( diff --git a/src/libostree/libostree-devel.sym b/src/libostree/libostree-devel.sym index eef5cba0..2926fe62 100644 --- a/src/libostree/libostree-devel.sym +++ b/src/libostree/libostree-devel.sym @@ -20,6 +20,10 @@ - uncomment the include in Makefile-libostree.am */ +LIBOSTREE_2022.7 { +global: + ostree_kernel_args_contains; +} LIBOSTREE_2022.5; /* Stub section for the stable release *after* this development one; don't * edit this other than to update the year. This is just a copy/paste diff --git a/src/libostree/ostree-kernel-args.c b/src/libostree/ostree-kernel-args.c index 08dcf992..b5fe4def 100644 --- a/src/libostree/ostree-kernel-args.c +++ b/src/libostree/ostree-kernel-args.c @@ -820,12 +820,31 @@ void ostree_kernel_args_append_if_missing (OstreeKernelArgs *kargs, const char *arg) { - g_autofree char *key = g_strdup (arg); - split_keyeq (key); - // Don't insert a duplicate key. - if (g_hash_table_contains (kargs->table, key)) + if (ostree_kernel_args_contains (kargs, arg)) return; ostree_kernel_args_append (kargs, arg); } + +/** + * ostree_kernel_args_contains: + * @kargs: a OstreeKernelArgs instance + * @arg: key or key/value pair to check + * + * Search for @arg which is in the form of key=value pair at the hash table kargs->table + * and returns true if finds it. + * + *Returns: %TRUE if @arg is contained in @kargs, %FALSE otherwise. + * + * Since: 2022.7 + **/ +gboolean +ostree_kernel_args_contains (OstreeKernelArgs *kargs, + const char *arg) +{ + g_autofree char *key = g_strdup (arg); + split_keyeq (key); + + return g_hash_table_contains (kargs->table, key); +} diff --git a/src/libostree/ostree-kernel-args.h b/src/libostree/ostree-kernel-args.h index 2e1b249a..94c494f6 100644 --- a/src/libostree/ostree-kernel-args.h +++ b/src/libostree/ostree-kernel-args.h @@ -134,4 +134,8 @@ _OSTREE_PUBLIC void ostree_kernel_args_append_if_missing (OstreeKernelArgs *kargs, const char *arg); +_OSTREE_PUBLIC +gboolean ostree_kernel_args_contains (OstreeKernelArgs *kargs, + const char *arg); + G_END_DECLS From bd487add8c06b89e0cbfe77c5a09c718847e7ca7 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 18 Nov 2022 15:40:42 +0000 Subject: [PATCH 35/55] ot-builtin-commit: Fix a typo in a command line help string Signed-off-by: Philip Withnall --- src/ostree/ot-builtin-commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index c43f9b3c..76aa25f1 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -105,7 +105,7 @@ static GOptionEntry options[] = { { "base", 0, 0, G_OPTION_ARG_STRING, &opt_base, "Start from the given commit as a base (no modifiers apply)", "REV" }, { "tree", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_trees, "Overlay the given argument as a tree", "dir=PATH or tar=TARFILE or ref=COMMIT" }, { "add-metadata-string", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_metadata_strings, "Add a key/value pair to metadata", "KEY=VALUE" }, - { "add-metadata", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_metadata_variants, "Add a key/value pair to metadata, where the KEY is a string, an VALUE is g_variant_parse() formatted", "KEY=VALUE" }, + { "add-metadata", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_metadata_variants, "Add a key/value pair to metadata, where the KEY is a string, and VALUE is g_variant_parse() formatted", "KEY=VALUE" }, { "keep-metadata", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_metadata_keep, "Keep metadata KEY and its associated VALUE from parent", "KEY" }, { "add-detached-metadata-string", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_detached_metadata_strings, "Add a key/value pair to detached metadata", "KEY=VALUE" }, { "owner-uid", 0, 0, G_OPTION_ARG_INT, &opt_owner_uid, "Set file ownership user id", "UID" }, From aef063dfd30093acef79497f775a89876824ca29 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Fri, 18 Nov 2022 15:41:59 +0000 Subject: [PATCH 36/55] =?UTF-8?q?ot-builtin-commit:=20Don=E2=80=99t=20ment?= =?UTF-8?q?ion=20a=20C=20function=20name=20in=20a=20help=20string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Instead mention the formal name of the format accepted by `g_variant_parse()`. Signed-off-by: Philip Withnall --- src/ostree/ot-builtin-commit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ostree/ot-builtin-commit.c b/src/ostree/ot-builtin-commit.c index 76aa25f1..1db2e2bc 100644 --- a/src/ostree/ot-builtin-commit.c +++ b/src/ostree/ot-builtin-commit.c @@ -105,7 +105,7 @@ static GOptionEntry options[] = { { "base", 0, 0, G_OPTION_ARG_STRING, &opt_base, "Start from the given commit as a base (no modifiers apply)", "REV" }, { "tree", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_trees, "Overlay the given argument as a tree", "dir=PATH or tar=TARFILE or ref=COMMIT" }, { "add-metadata-string", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_metadata_strings, "Add a key/value pair to metadata", "KEY=VALUE" }, - { "add-metadata", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_metadata_variants, "Add a key/value pair to metadata, where the KEY is a string, and VALUE is g_variant_parse() formatted", "KEY=VALUE" }, + { "add-metadata", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_metadata_variants, "Add a key/value pair to metadata, where the KEY is a string, and VALUE is in GVariant Text Format", "KEY=VALUE" }, { "keep-metadata", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_metadata_keep, "Keep metadata KEY and its associated VALUE from parent", "KEY" }, { "add-detached-metadata-string", 0, 0, G_OPTION_ARG_STRING_ARRAY, &opt_detached_metadata_strings, "Add a key/value pair to detached metadata", "KEY=VALUE" }, { "owner-uid", 0, 0, G_OPTION_ARG_INT, &opt_owner_uid, "Set file ownership user id", "UID" }, From f6d308f130c0ca52e1e5d2d951e3f3a5f00c569c Mon Sep 17 00:00:00 2001 From: Rafael Garcia Ruiz Date: Fri, 18 Nov 2022 18:24:01 +0100 Subject: [PATCH 37/55] 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 --- apidoc/ostree-sections.txt | 1 + rust-bindings/sys/src/lib.rs | 7 +++++++ src/libostree/libostree-devel.sym | 1 + src/libostree/ostree-kernel-args.c | 22 ++++++++++++++++++++++ src/libostree/ostree-kernel-args.h | 4 ++++ 5 files changed, 35 insertions(+) diff --git a/apidoc/ostree-sections.txt b/apidoc/ostree-sections.txt index d9f91208..49f2748b 100644 --- a/apidoc/ostree-sections.txt +++ b/apidoc/ostree-sections.txt @@ -739,6 +739,7 @@ ostree_kernel_args_from_string ostree_kernel_args_to_strv ostree_kernel_args_to_string ostree_kernel_args_contains +ostree_kernel_args_delete_if_present
diff --git a/rust-bindings/sys/src/lib.rs b/rust-bindings/sys/src/lib.rs index df245a6c..943914ab 100644 --- a/rust-bindings/sys/src/lib.rs +++ b/rust-bindings/sys/src/lib.rs @@ -1319,6 +1319,13 @@ extern "C" { kargs: *mut OstreeKernelArgs, arg: *const c_char, ) -> gboolean; + #[cfg(any(feature = "v2022_7", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2022_7")))] + pub fn ostree_kernel_args_delete_if_present( + kargs: *mut OstreeKernelArgs, + arg: *const c_char, + error: *mut *mut glib::GError, + ) -> gboolean; #[cfg(any(feature = "v2019_3", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2019_3")))] pub fn ostree_kernel_args_append_proc_cmdline( diff --git a/src/libostree/libostree-devel.sym b/src/libostree/libostree-devel.sym index 2926fe62..6a82433a 100644 --- a/src/libostree/libostree-devel.sym +++ b/src/libostree/libostree-devel.sym @@ -23,6 +23,7 @@ LIBOSTREE_2022.7 { global: ostree_kernel_args_contains; + ostree_kernel_args_delete_if_present; } LIBOSTREE_2022.5; /* Stub section for the stable release *after* this development one; don't diff --git a/src/libostree/ostree-kernel-args.c b/src/libostree/ostree-kernel-args.c index b5fe4def..d15d28a7 100644 --- a/src/libostree/ostree-kernel-args.c +++ b/src/libostree/ostree-kernel-args.c @@ -848,3 +848,25 @@ ostree_kernel_args_contains (OstreeKernelArgs *kargs, return g_hash_table_contains (kargs->table, key); } + +/** + * ostree_kernel_args_delete_if_present: + * @kargs: a OstreeKernelArgs instance + * @arg: key or key/value pair to be deleted + * @error: an GError instance + * + * Deletes @arg which is in the form of key=value pair from the hash table kargs->table. + * + * Returns: %TRUE on success, %FALSE on failure + * + * Since: 2022.7 + **/ +gboolean +ostree_kernel_args_delete_if_present (OstreeKernelArgs *kargs, + const char *arg, + GError **error) +{ + if (ostree_kernel_args_contains (kargs, arg)) + return ostree_kernel_args_delete (kargs, arg, error); + return TRUE; +} diff --git a/src/libostree/ostree-kernel-args.h b/src/libostree/ostree-kernel-args.h index 94c494f6..6a1aaac1 100644 --- a/src/libostree/ostree-kernel-args.h +++ b/src/libostree/ostree-kernel-args.h @@ -138,4 +138,8 @@ _OSTREE_PUBLIC gboolean ostree_kernel_args_contains (OstreeKernelArgs *kargs, const char *arg); +_OSTREE_PUBLIC +gboolean ostree_kernel_args_delete_if_present (OstreeKernelArgs *kargs, + const char *arg, + GError **error); G_END_DECLS From 406bfc78d1c1eb848dfd5000c9b7c6404c499146 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 18 Nov 2022 10:42:58 -0500 Subject: [PATCH 38/55] ci: Fix case where cosa != buildroot We can't override host binaries in this case. We'll need to watch carefully and verify we're still testing things. --- .cci.jenkinsfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.cci.jenkinsfile b/.cci.jenkinsfile index 003588a6..762b705b 100644 --- a/.cci.jenkinsfile +++ b/.cci.jenkinsfile @@ -34,6 +34,7 @@ stage("Build") { shwrap(""" make install DESTDIR=\$(pwd)/installed/rootfs make -C tests/kolainst install DESTDIR=\$(pwd)/installed/tests + bash -c '. /usr/lib/os-release && echo \$VERSION_ID' >\$(pwd)/installed/buildroot-id """) } stash includes: "installed/", name: 'build' @@ -47,8 +48,12 @@ cosaPod(runAsUser: 0, memory: "9Gi", cpu: "4") { checkout scm unstash 'build' shwrap(""" - # Move the bits into the cosa pod - rsync -rlv installed/rootfs/ / + # Move the bits into the cosa pod (but only if major versions match) + buildroot_id=\$(cat installed/buildroot-id) + osver=\$(. /usr/lib/os-release && echo \$VERSION_ID) + if test \$osver = \$buildroot_id; then + rsync -rlv installed/rootfs/ / + fi rsync -rlv installed/tests/ / coreos-assembler init --force https://github.com/coreos/fedora-coreos-config mkdir -p overrides/rootfs From 4202082019f4094ca3d5ffc68e7ed2d0e684481b Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Wed, 16 Nov 2022 16:09:24 +0000 Subject: [PATCH 39/55] ci: adjust git tags filtering Another attempt at fixing logic for version detection in COPR. --- ci/Makefile.dist-packaging | 2 +- ci/make-git-snapshot.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/Makefile.dist-packaging b/ci/Makefile.dist-packaging index de77be6c..6bbe5fe9 100644 --- a/ci/Makefile.dist-packaging +++ b/ci/Makefile.dist-packaging @@ -2,7 +2,7 @@ mypath = $(dir $(realpath $(firstword $(MAKEFILE_LIST)))) topsrcdir = $(shell git rev-parse --show-toplevel) -GITREV = $(shell git describe --always --tags) +GITREV = $(shell git describe --always --tags --match 'v2???.*') GITREV_FOR_PKG = $(shell echo "$(GITREV)" | sed -e 's,-,\.,g' -e 's,^v,,') PACKAGE ?= $(shell basename $(topsrcdir)) diff --git a/ci/make-git-snapshot.sh b/ci/make-git-snapshot.sh index acfdd6c2..22f65a50 100755 --- a/ci/make-git-snapshot.sh +++ b/ci/make-git-snapshot.sh @@ -3,7 +3,7 @@ set -xeuo pipefail TOP=$(git rev-parse --show-toplevel) GITREV=$(git rev-parse HEAD) -gitdescribe=$(git describe --always --tags $GITREV) +gitdescribe=$(git describe --always --tags --match 'v2???.*' $GITREV) version=$(echo "$gitdescribe" | sed -e 's,-,\.,g' -e 's,^v,,') name=libostree PKG_VER="${name}-${version}" From fe8dec90908a62a1da48456b172625db342c9e1e Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Fri, 18 Nov 2022 09:13:12 +0000 Subject: [PATCH 40/55] cargo: bump minimum Rust version to 1.63 This bumps MSRV to 1.63, in order to prepare for the next version of gtk-rs stack. Ref: https://gtk-rs.org/blog/2022/10/18/new-release.html --- .github/workflows/rust.yml | 9 +++++++-- Cargo.toml | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index 6e468fd6..a3bb8678 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -14,8 +14,6 @@ env: CARGO_PROJECT_FEATURES: "v2021_5,cap-std-apis" # TODO: Automatically query this from the C side LATEST_LIBOSTREE: "v2022_6" - # Minimum supported Rust version (MSRV) - ACTION_MSRV_TOOLCHAIN: 1.58.1 # Pinned toolchain for linting ACTION_LINTS_TOOLCHAIN: 1.64.0 @@ -38,6 +36,13 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v2 + - name: Detect crate MSRV + shell: bash + run: | + msrv=$(cargo metadata --format-version 1 --no-deps | \ + jq -r '.packages | .[0].rust_version') + echo "Crate MSRV: $msrv" + echo "ACTION_MSRV_TOOLCHAIN=$msrv" >> $GITHUB_ENV - name: Remove system Rust toolchain run: dnf remove -y rust cargo - name: Install toolchain diff --git a/Cargo.toml b/Cargo.toml index 8cee182d..e97aeb2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,6 +8,7 @@ license = "MIT" name = "ostree" readme = "rust-bindings/README.md" repository = "https://github.com/ostreedev/ostree" +rust-version = "1.63.0" version = "0.16.0" exclude = [ From 49d54d6ca8f347a852ef8fd48e5c0bbf91cfe8fb Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 21 Nov 2022 16:34:00 +0000 Subject: [PATCH 41/55] lib/pull: Fix a small leak when a variable is reused Signed-off-by: Philip Withnall --- src/libostree/ostree-repo-pull.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libostree/ostree-repo-pull.c b/src/libostree/ostree-repo-pull.c index 86b4358a..9412f1e1 100644 --- a/src/libostree/ostree-repo-pull.c +++ b/src/libostree/ostree-repo-pull.c @@ -4712,6 +4712,7 @@ ostree_repo_pull_with_options (OstreeRepo *self, !load_remote_repo_config (pull_data, &remote_config, cancellable, error)) goto out; + g_clear_pointer (&remote_mode_str, g_free); if (!ot_keyfile_get_value_with_default (remote_config, "core", "mode", "bare", &remote_mode_str, error)) goto out; From c0b6cf92985ce761d2279c0fe86caef8625a089b Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 21 Nov 2022 16:35:02 +0000 Subject: [PATCH 42/55] ot-builtin-pull: Fix a minor leak with progress reporting `ostree_async_progress_get_status()` returns an allocated string. Signed-off-by: Philip Withnall --- src/ostree/ot-builtin-pull-local.c | 2 +- src/ostree/ot-builtin-pull.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ostree/ot-builtin-pull-local.c b/src/ostree/ot-builtin-pull-local.c index c39930af..5dfaf887 100644 --- a/src/ostree/ot-builtin-pull-local.c +++ b/src/ostree/ot-builtin-pull-local.c @@ -211,7 +211,7 @@ ostree_builtin_pull_local (int argc, char **argv, OstreeCommandInvocation *invoc if (!console.is_tty) { g_assert (progress); - const char *status = ostree_async_progress_get_status (progress); + g_autofree char *status = ostree_async_progress_get_status (progress); if (status) g_print ("%s\n", status); } diff --git a/src/ostree/ot-builtin-pull.c b/src/ostree/ot-builtin-pull.c index 61f408eb..e6cc053b 100644 --- a/src/ostree/ot-builtin-pull.c +++ b/src/ostree/ot-builtin-pull.c @@ -389,7 +389,7 @@ ostree_builtin_pull (int argc, char **argv, OstreeCommandInvocation *invocation, if (!console.is_tty && !opt_dry_run) { g_assert (progress); - const char *status = ostree_async_progress_get_status (progress); + g_autofree char *status = ostree_async_progress_get_status (progress); if (status) g_print ("%s\n", status); } From 1a76f45fd7bf9fc0b7c6c5f1cdefd71db45407a6 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 15 Nov 2022 08:09:52 -0500 Subject: [PATCH 43/55] rust: Update to gio 0.16 This was quite seamless; the only thing I had to tweak was adding `+ Send` bounds in the `Box` manual checksum_async API. --- Cargo.toml | 4 +- rust-bindings/Makefile | 2 +- rust-bindings/src/auto/async_progress.rs | 58 +- rust-bindings/src/auto/bootconfig_parser.rs | 118 +- rust-bindings/src/auto/collection_ref.rs | 26 +- rust-bindings/src/auto/commit_sizes_entry.rs | 14 +- rust-bindings/src/auto/constants.rs | 145 +- rust-bindings/src/auto/content_writer.rs | 17 +- rust-bindings/src/auto/deployment.rs | 93 +- rust-bindings/src/auto/diff_item.rs | 1 + rust-bindings/src/auto/enums.rs | 326 ++- rust-bindings/src/auto/flags.rs | 111 +- rust-bindings/src/auto/functions.rs | 435 +--- rust-bindings/src/auto/gpg_verify_result.rs | 37 +- rust-bindings/src/auto/mutable_tree.rs | 169 +- rust-bindings/src/auto/remote.rs | 8 +- rust-bindings/src/auto/repo.rs | 2040 +++-------------- .../src/auto/repo_commit_modifier.rs | 103 +- rust-bindings/src/auto/repo_dev_ino_cache.rs | 12 +- rust-bindings/src/auto/repo_file.rs | 94 +- rust-bindings/src/auto/repo_finder.rs | 3 +- rust-bindings/src/auto/repo_finder_avahi.rs | 4 +- rust-bindings/src/auto/repo_finder_config.rs | 12 +- rust-bindings/src/auto/repo_finder_mount.rs | 4 +- .../src/auto/repo_finder_override.rs | 12 +- rust-bindings/src/auto/repo_finder_result.rs | 7 +- rust-bindings/src/auto/se_policy.rs | 126 +- rust-bindings/src/auto/sign.rs | 216 +- rust-bindings/src/auto/sysroot.rs | 629 ++--- rust-bindings/src/auto/sysroot_upgrader.rs | 170 +- rust-bindings/src/auto/versions.txt | 4 +- rust-bindings/src/functions.rs | 12 +- rust-bindings/src/object_name.rs | 3 +- rust-bindings/sys/Cargo.toml | 8 +- rust-bindings/sys/build.rs | 2 +- rust-bindings/sys/src/auto/versions.txt | 4 +- rust-bindings/sys/src/lib.rs | 91 +- rust-bindings/sys/tests/abi.rs | 45 +- 38 files changed, 1145 insertions(+), 4020 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e97aeb2b..666fc15e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -42,8 +42,8 @@ bitflags = "1.2.1" cap-std = { version = "1.0", optional = true} io-lifetimes = { version = "1.0", optional = true} ffi = { package = "ostree-sys", path = "rust-bindings/sys", version = "0.11.0" } -gio = "0.15" -glib = "0.15" +gio = "0.16" +glib = "0.16" hex = "0.4.2" libc = "0.2" once_cell = "1.4.0" diff --git a/rust-bindings/Makefile b/rust-bindings/Makefile index eccaacb3..a49ab80e 100644 --- a/rust-bindings/Makefile +++ b/rust-bindings/Makefile @@ -1,5 +1,5 @@ GIR_REPO := https://github.com/gtk-rs/gir.git -GIR_VERSION := c8a7a13d2c4d3a57ae646e38a821d57243cf7983 +GIR_VERSION := e94fdc6499e45d89bada123f4d2e63ceb6af997d OSTREE_REPO := ../ostree OSTREE_VERSION := patch-v2022.2 RUSTDOC_STRIPPER_VERSION := 0.1.17 diff --git a/rust-bindings/src/auto/async_progress.rs b/rust-bindings/src/auto/async_progress.rs index 3f779c76..2706d5b4 100644 --- a/rust-bindings/src/auto/async_progress.rs +++ b/rust-bindings/src/auto/async_progress.rs @@ -22,11 +22,13 @@ glib::wrapper! { impl AsyncProgress { #[doc(alias = "ostree_async_progress_new")] pub fn new() -> AsyncProgress { - unsafe { from_glib_full(ffi::ostree_async_progress_new()) } + unsafe { + from_glib_full(ffi::ostree_async_progress_new()) + } } //#[doc(alias = "ostree_async_progress_new_and_connect")] - //pub fn new_and_connect(changed: /*Unimplemented*/Option, user_data: /*Unimplemented*/Option) -> AsyncProgress { + //pub fn new_and_connect(changed: /*Unimplemented*/Option, user_data: /*Unimplemented*/Option) -> AsyncProgress { // unsafe { TODO: call ffi:ostree_async_progress_new_and_connect() } //} @@ -49,7 +51,7 @@ impl AsyncProgress { //#[cfg(any(feature = "v2017_6", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_6")))] //#[doc(alias = "ostree_async_progress_get")] - //pub fn get(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { + //pub fn get(&self, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) { // unsafe { TODO: call ffi:ostree_async_progress_get() } //} @@ -58,13 +60,17 @@ impl AsyncProgress { #[doc(alias = "ostree_async_progress_get_status")] #[doc(alias = "get_status")] pub fn status(&self) -> Option { - unsafe { from_glib_full(ffi::ostree_async_progress_get_status(self.to_glib_none().0)) } + unsafe { + from_glib_full(ffi::ostree_async_progress_get_status(self.to_glib_none().0)) + } } #[doc(alias = "ostree_async_progress_get_uint")] #[doc(alias = "get_uint")] pub fn uint(&self, key: &str) -> u32 { - unsafe { ffi::ostree_async_progress_get_uint(self.to_glib_none().0, key.to_glib_none().0) } + unsafe { + ffi::ostree_async_progress_get_uint(self.to_glib_none().0, key.to_glib_none().0) + } } #[doc(alias = "ostree_async_progress_get_uint64")] @@ -81,17 +87,14 @@ impl AsyncProgress { #[doc(alias = "get_variant")] pub fn variant(&self, key: &str) -> Option { unsafe { - from_glib_full(ffi::ostree_async_progress_get_variant( - self.to_glib_none().0, - key.to_glib_none().0, - )) + from_glib_full(ffi::ostree_async_progress_get_variant(self.to_glib_none().0, key.to_glib_none().0)) } } //#[cfg(any(feature = "v2017_6", feature = "dox"))] //#[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_6")))] //#[doc(alias = "ostree_async_progress_set")] - //pub fn set(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) { + //pub fn set(&self, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) { // unsafe { TODO: call ffi:ostree_async_progress_set() } //} @@ -114,11 +117,7 @@ impl AsyncProgress { #[doc(alias = "ostree_async_progress_set_uint64")] pub fn set_uint64(&self, key: &str, value: u64) { unsafe { - ffi::ostree_async_progress_set_uint64( - self.to_glib_none().0, - key.to_glib_none().0, - value, - ); + ffi::ostree_async_progress_set_uint64(self.to_glib_none().0, key.to_glib_none().0, value); } } @@ -127,42 +126,29 @@ impl AsyncProgress { #[doc(alias = "ostree_async_progress_set_variant")] pub fn set_variant(&self, key: &str, value: &glib::Variant) { unsafe { - ffi::ostree_async_progress_set_variant( - self.to_glib_none().0, - key.to_glib_none().0, - value.to_glib_none().0, - ); + ffi::ostree_async_progress_set_variant(self.to_glib_none().0, key.to_glib_none().0, value.to_glib_none().0); } } #[doc(alias = "changed")] pub fn connect_changed(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn changed_trampoline( - this: *mut ffi::OstreeAsyncProgress, - f: glib::ffi::gpointer, - ) { + unsafe extern "C" fn changed_trampoline(this: *mut ffi::OstreeAsyncProgress, f: glib::ffi::gpointer) { let f: &F = &*(f as *const F); f(&from_glib_borrow(this)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"changed\0".as_ptr() as *const _, - Some(transmute::<_, unsafe extern "C" fn()>( - changed_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) + connect_raw(self.as_ptr() as *mut _, b"changed\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>(changed_trampoline:: as *const ())), Box_::into_raw(f)) } } } impl Default for AsyncProgress { - fn default() -> Self { - Self::new() - } -} + fn default() -> Self { + Self::new() + } + } impl fmt::Display for AsyncProgress { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/rust-bindings/src/auto/bootconfig_parser.rs b/rust-bindings/src/auto/bootconfig_parser.rs index 2116dd56..042824c3 100644 --- a/rust-bindings/src/auto/bootconfig_parser.rs +++ b/rust-bindings/src/auto/bootconfig_parser.rs @@ -19,22 +19,23 @@ glib::wrapper! { impl BootconfigParser { #[doc(alias = "ostree_bootconfig_parser_new")] pub fn new() -> BootconfigParser { - unsafe { from_glib_full(ffi::ostree_bootconfig_parser_new()) } + unsafe { + from_glib_full(ffi::ostree_bootconfig_parser_new()) + } } #[doc(alias = "ostree_bootconfig_parser_clone")] - #[must_use] +#[must_use] pub fn clone(&self) -> Option { - unsafe { from_glib_full(ffi::ostree_bootconfig_parser_clone(self.to_glib_none().0)) } + unsafe { + from_glib_full(ffi::ostree_bootconfig_parser_clone(self.to_glib_none().0)) + } } #[doc(alias = "ostree_bootconfig_parser_get")] pub fn get(&self, key: &str) -> Option { unsafe { - from_glib_none(ffi::ostree_bootconfig_parser_get( - self.to_glib_none().0, - key.to_glib_none().0, - )) + from_glib_none(ffi::ostree_bootconfig_parser_get(self.to_glib_none().0, key.to_glib_none().0)) } } @@ -44,68 +45,34 @@ impl BootconfigParser { #[doc(alias = "get_overlay_initrds")] pub fn overlay_initrds(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::ostree_bootconfig_parser_get_overlay_initrds( - self.to_glib_none().0, - )) + FromGlibPtrContainer::from_glib_none(ffi::ostree_bootconfig_parser_get_overlay_initrds(self.to_glib_none().0)) } } #[doc(alias = "ostree_bootconfig_parser_parse")] - pub fn parse( - &self, - path: &impl IsA, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn parse(&self, path: &impl IsA, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_bootconfig_parser_parse( - self.to_glib_none().0, - path.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_bootconfig_parser_parse(self.to_glib_none().0, path.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_bootconfig_parser_parse_at")] - pub fn parse_at( - &self, - dfd: i32, - path: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn parse_at(&self, dfd: i32, path: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_bootconfig_parser_parse_at( - self.to_glib_none().0, - dfd, - path.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_bootconfig_parser_parse_at(self.to_glib_none().0, dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_bootconfig_parser_set")] pub fn set(&self, key: &str, value: &str) { unsafe { - ffi::ostree_bootconfig_parser_set( - self.to_glib_none().0, - key.to_glib_none().0, - value.to_glib_none().0, - ); + ffi::ostree_bootconfig_parser_set(self.to_glib_none().0, key.to_glib_none().0, value.to_glib_none().0); } } @@ -114,67 +81,36 @@ impl BootconfigParser { #[doc(alias = "ostree_bootconfig_parser_set_overlay_initrds")] pub fn set_overlay_initrds(&self, initrds: &[&str]) { unsafe { - ffi::ostree_bootconfig_parser_set_overlay_initrds( - self.to_glib_none().0, - initrds.to_glib_none().0, - ); + ffi::ostree_bootconfig_parser_set_overlay_initrds(self.to_glib_none().0, initrds.to_glib_none().0); } } #[doc(alias = "ostree_bootconfig_parser_write")] - pub fn write( - &self, - output: &impl IsA, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn write(&self, output: &impl IsA, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_bootconfig_parser_write( - self.to_glib_none().0, - output.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_bootconfig_parser_write(self.to_glib_none().0, output.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_bootconfig_parser_write_at")] - pub fn write_at( - &self, - dfd: i32, - path: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn write_at(&self, dfd: i32, path: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_bootconfig_parser_write_at( - self.to_glib_none().0, - dfd, - path.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_bootconfig_parser_write_at(self.to_glib_none().0, dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } } impl Default for BootconfigParser { - fn default() -> Self { - Self::new() - } -} + fn default() -> Self { + Self::new() + } + } impl fmt::Display for BootconfigParser { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/rust-bindings/src/auto/collection_ref.rs b/rust-bindings/src/auto/collection_ref.rs index 611ec9bb..603b0156 100644 --- a/rust-bindings/src/auto/collection_ref.rs +++ b/rust-bindings/src/auto/collection_ref.rs @@ -20,32 +20,21 @@ impl CollectionRef { #[doc(alias = "ostree_collection_ref_new")] pub fn new(collection_id: Option<&str>, ref_name: &str) -> Option { unsafe { - from_glib_full(ffi::ostree_collection_ref_new( - collection_id.to_glib_none().0, - ref_name.to_glib_none().0, - )) + from_glib_full(ffi::ostree_collection_ref_new(collection_id.to_glib_none().0, ref_name.to_glib_none().0)) } } #[doc(alias = "ostree_collection_ref_equal")] - fn equal(&self, ref2: &CollectionRef) -> bool { + fn equal(&self, ref2: &CollectionRef) -> bool { unsafe { - from_glib(ffi::ostree_collection_ref_equal( - ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(self).0 - as glib::ffi::gconstpointer, - ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(ref2).0 - as glib::ffi::gconstpointer, - )) + from_glib(ffi::ostree_collection_ref_equal(ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(self).0 as glib::ffi::gconstpointer, ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(ref2).0 as glib::ffi::gconstpointer)) } } #[doc(alias = "ostree_collection_ref_hash")] - fn hash(&self) -> u32 { + fn hash(&self) -> u32 { unsafe { - ffi::ostree_collection_ref_hash( - ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(self).0 - as glib::ffi::gconstpointer, - ) + ffi::ostree_collection_ref_hash(ToGlibPtr::<*const ffi::OstreeCollectionRef>::to_glib_none(self).0 as glib::ffi::gconstpointer) } } } @@ -61,10 +50,7 @@ impl Eq for CollectionRef {} impl hash::Hash for CollectionRef { #[inline] - fn hash(&self, state: &mut H) - where - H: hash::Hasher, - { + fn hash(&self, state: &mut H) where H: hash::Hasher { hash::Hash::hash(&self.hash(), state) } } diff --git a/rust-bindings/src/auto/commit_sizes_entry.rs b/rust-bindings/src/auto/commit_sizes_entry.rs index ecb0c210..c52ecc5c 100644 --- a/rust-bindings/src/auto/commit_sizes_entry.rs +++ b/rust-bindings/src/auto/commit_sizes_entry.rs @@ -18,19 +18,9 @@ glib::wrapper! { impl CommitSizesEntry { #[doc(alias = "ostree_commit_sizes_entry_new")] - pub fn new( - checksum: &str, - objtype: ObjectType, - unpacked: u64, - archived: u64, - ) -> Option { + pub fn new(checksum: &str, objtype: ObjectType, unpacked: u64, archived: u64) -> Option { unsafe { - from_glib_full(ffi::ostree_commit_sizes_entry_new( - checksum.to_glib_none().0, - objtype.into_glib(), - unpacked, - archived, - )) + from_glib_full(ffi::ostree_commit_sizes_entry_new(checksum.to_glib_none().0, objtype.into_glib(), unpacked, archived)) } } } diff --git a/rust-bindings/src/auto/constants.rs b/rust-bindings/src/auto/constants.rs index 768bce81..396d5c85 100644 --- a/rust-bindings/src/auto/constants.rs +++ b/rust-bindings/src/auto/constants.rs @@ -5,175 +5,72 @@ use std::ffi::CStr; #[doc(alias = "OSTREE_COMMIT_GVARIANT_STRING")] -pub static COMMIT_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_COMMIT_GVARIANT_STRING) - .to_str() - .unwrap() - }); +pub static COMMIT_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_GVARIANT_STRING).to_str().unwrap()}); #[cfg(any(feature = "v2020_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_4")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_ARCHITECTURE")] -pub static COMMIT_META_KEY_ARCHITECTURE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ARCHITECTURE) - .to_str() - .unwrap() - }); +pub static COMMIT_META_KEY_ARCHITECTURE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ARCHITECTURE).to_str().unwrap()}); #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_COLLECTION_BINDING")] -pub static COMMIT_META_KEY_COLLECTION_BINDING: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_COLLECTION_BINDING) - .to_str() - .unwrap() - }); +pub static COMMIT_META_KEY_COLLECTION_BINDING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_COLLECTION_BINDING).to_str().unwrap()}); #[cfg(any(feature = "v2017_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_7")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_ENDOFLIFE")] -pub static COMMIT_META_KEY_ENDOFLIFE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE) - .to_str() - .unwrap() - }); +pub static COMMIT_META_KEY_ENDOFLIFE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE).to_str().unwrap()}); #[cfg(any(feature = "v2017_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_7")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE")] -pub static COMMIT_META_KEY_ENDOFLIFE_REBASE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE) - .to_str() - .unwrap() - }); +pub static COMMIT_META_KEY_ENDOFLIFE_REBASE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE).to_str().unwrap()}); #[cfg(any(feature = "v2017_9", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_9")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_REF_BINDING")] -pub static COMMIT_META_KEY_REF_BINDING: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_REF_BINDING) - .to_str() - .unwrap() - }); +pub static COMMIT_META_KEY_REF_BINDING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_REF_BINDING).to_str().unwrap()}); #[cfg(any(feature = "v2017_13", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_13")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_SOURCE_TITLE")] -pub static COMMIT_META_KEY_SOURCE_TITLE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_SOURCE_TITLE) - .to_str() - .unwrap() - }); +pub static COMMIT_META_KEY_SOURCE_TITLE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_SOURCE_TITLE).to_str().unwrap()}); #[cfg(any(feature = "v2014_9", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2014_9")))] #[doc(alias = "OSTREE_COMMIT_META_KEY_VERSION")] -pub static COMMIT_META_KEY_VERSION: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_VERSION) - .to_str() - .unwrap() - }); +pub static COMMIT_META_KEY_VERSION: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_VERSION).to_str().unwrap()}); #[doc(alias = "OSTREE_DIRMETA_GVARIANT_STRING")] -pub static DIRMETA_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_DIRMETA_GVARIANT_STRING) - .to_str() - .unwrap() - }); +pub static DIRMETA_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_DIRMETA_GVARIANT_STRING).to_str().unwrap()}); #[doc(alias = "OSTREE_FILEMETA_GVARIANT_STRING")] -pub static FILEMETA_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_FILEMETA_GVARIANT_STRING) - .to_str() - .unwrap() - }); +pub static FILEMETA_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_FILEMETA_GVARIANT_STRING).to_str().unwrap()}); #[doc(alias = "OSTREE_GPG_KEY_GVARIANT_STRING")] -pub static GPG_KEY_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_GPG_KEY_GVARIANT_STRING) - .to_str() - .unwrap() - }); +pub static GPG_KEY_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_GPG_KEY_GVARIANT_STRING).to_str().unwrap()}); #[cfg(any(feature = "v2021_1", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_1")))] #[doc(alias = "OSTREE_METADATA_KEY_BOOTABLE")] -pub static METADATA_KEY_BOOTABLE: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_METADATA_KEY_BOOTABLE) - .to_str() - .unwrap() - }); +pub static METADATA_KEY_BOOTABLE: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_METADATA_KEY_BOOTABLE).to_str().unwrap()}); #[cfg(any(feature = "v2021_1", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_1")))] #[doc(alias = "OSTREE_METADATA_KEY_LINUX")] -pub static METADATA_KEY_LINUX: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_METADATA_KEY_LINUX) - .to_str() - .unwrap() - }); +pub static METADATA_KEY_LINUX: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_METADATA_KEY_LINUX).to_str().unwrap()}); #[cfg(any(feature = "v2018_9", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_9")))] #[doc(alias = "OSTREE_META_KEY_DEPLOY_COLLECTION_ID")] -pub static META_KEY_DEPLOY_COLLECTION_ID: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_META_KEY_DEPLOY_COLLECTION_ID) - .to_str() - .unwrap() - }); +pub static META_KEY_DEPLOY_COLLECTION_ID: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_META_KEY_DEPLOY_COLLECTION_ID).to_str().unwrap()}); #[cfg(any(feature = "v2018_3", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_3")))] #[doc(alias = "OSTREE_ORIGIN_TRANSIENT_GROUP")] -pub static ORIGIN_TRANSIENT_GROUP: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_ORIGIN_TRANSIENT_GROUP) - .to_str() - .unwrap() - }); +pub static ORIGIN_TRANSIENT_GROUP: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_ORIGIN_TRANSIENT_GROUP).to_str().unwrap()}); #[cfg(any(feature = "v2022_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2022_2")))] #[doc(alias = "OSTREE_PATH_BOOTED")] -pub static PATH_BOOTED: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_PATH_BOOTED).to_str().unwrap() - }); +pub static PATH_BOOTED: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_PATH_BOOTED).to_str().unwrap()}); #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "OSTREE_REPO_METADATA_REF")] -pub static REPO_METADATA_REF: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_REPO_METADATA_REF) - .to_str() - .unwrap() - }); +pub static REPO_METADATA_REF: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_REPO_METADATA_REF).to_str().unwrap()}); #[cfg(any(feature = "v2020_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_4")))] #[doc(alias = "OSTREE_SIGN_NAME_ED25519")] -pub static SIGN_NAME_ED25519: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_SIGN_NAME_ED25519) - .to_str() - .unwrap() - }); +pub static SIGN_NAME_ED25519: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_SIGN_NAME_ED25519).to_str().unwrap()}); #[doc(alias = "OSTREE_SUMMARY_GVARIANT_STRING")] -pub static SUMMARY_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_SUMMARY_GVARIANT_STRING) - .to_str() - .unwrap() - }); +pub static SUMMARY_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_SUMMARY_GVARIANT_STRING).to_str().unwrap()}); #[doc(alias = "OSTREE_SUMMARY_SIG_GVARIANT_STRING")] -pub static SUMMARY_SIG_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_SUMMARY_SIG_GVARIANT_STRING) - .to_str() - .unwrap() - }); +pub static SUMMARY_SIG_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_SUMMARY_SIG_GVARIANT_STRING).to_str().unwrap()}); #[doc(alias = "OSTREE_TREE_GVARIANT_STRING")] -pub static TREE_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = - once_cell::sync::Lazy::new(|| unsafe { - CStr::from_ptr(ffi::OSTREE_TREE_GVARIANT_STRING) - .to_str() - .unwrap() - }); +pub static TREE_GVARIANT_STRING: once_cell::sync::Lazy<&'static str> = once_cell::sync::Lazy::new(|| unsafe{CStr::from_ptr(ffi::OSTREE_TREE_GVARIANT_STRING).to_str().unwrap()}); diff --git a/rust-bindings/src/auto/content_writer.rs b/rust-bindings/src/auto/content_writer.rs index 86e3e847..4151b28e 100644 --- a/rust-bindings/src/auto/content_writer.rs +++ b/rust-bindings/src/auto/content_writer.rs @@ -18,22 +18,11 @@ glib::wrapper! { impl ContentWriter { #[doc(alias = "ostree_content_writer_finish")] - pub fn finish( - &self, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn finish(&self, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_content_writer_finish( - self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_content_writer_finish(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } } diff --git a/rust-bindings/src/auto/deployment.rs b/rust-bindings/src/auto/deployment.rs index 00af6cff..cba219c3 100644 --- a/rust-bindings/src/auto/deployment.rs +++ b/rust-bindings/src/auto/deployment.rs @@ -20,100 +20,97 @@ glib::wrapper! { impl Deployment { #[doc(alias = "ostree_deployment_new")] - pub fn new( - index: i32, - osname: &str, - csum: &str, - deployserial: i32, - bootcsum: Option<&str>, - bootserial: i32, - ) -> Deployment { + pub fn new(index: i32, osname: &str, csum: &str, deployserial: i32, bootcsum: Option<&str>, bootserial: i32) -> Deployment { unsafe { - from_glib_full(ffi::ostree_deployment_new( - index, - osname.to_glib_none().0, - csum.to_glib_none().0, - deployserial, - bootcsum.to_glib_none().0, - bootserial, - )) + from_glib_full(ffi::ostree_deployment_new(index, osname.to_glib_none().0, csum.to_glib_none().0, deployserial, bootcsum.to_glib_none().0, bootserial)) } } #[doc(alias = "ostree_deployment_clone")] - #[must_use] +#[must_use] pub fn clone(&self) -> Option { - unsafe { from_glib_full(ffi::ostree_deployment_clone(self.to_glib_none().0)) } + unsafe { + from_glib_full(ffi::ostree_deployment_clone(self.to_glib_none().0)) + } } #[doc(alias = "ostree_deployment_equal")] pub fn equal(&self, bp: &Deployment) -> bool { unsafe { - from_glib(ffi::ostree_deployment_equal( - ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(self).0 - as glib::ffi::gconstpointer, - ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(bp).0 - as glib::ffi::gconstpointer, - )) + from_glib(ffi::ostree_deployment_equal(ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(self).0 as glib::ffi::gconstpointer, ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(bp).0 as glib::ffi::gconstpointer)) } } #[doc(alias = "ostree_deployment_get_bootconfig")] #[doc(alias = "get_bootconfig")] pub fn bootconfig(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_deployment_get_bootconfig(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_deployment_get_bootconfig(self.to_glib_none().0)) + } } #[doc(alias = "ostree_deployment_get_bootcsum")] #[doc(alias = "get_bootcsum")] pub fn bootcsum(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_deployment_get_bootcsum(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_deployment_get_bootcsum(self.to_glib_none().0)) + } } #[doc(alias = "ostree_deployment_get_bootserial")] #[doc(alias = "get_bootserial")] pub fn bootserial(&self) -> i32 { - unsafe { ffi::ostree_deployment_get_bootserial(self.to_glib_none().0) } + unsafe { + ffi::ostree_deployment_get_bootserial(self.to_glib_none().0) + } } #[doc(alias = "ostree_deployment_get_csum")] #[doc(alias = "get_csum")] pub fn csum(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_deployment_get_csum(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_deployment_get_csum(self.to_glib_none().0)) + } } #[doc(alias = "ostree_deployment_get_deployserial")] #[doc(alias = "get_deployserial")] pub fn deployserial(&self) -> i32 { - unsafe { ffi::ostree_deployment_get_deployserial(self.to_glib_none().0) } + unsafe { + ffi::ostree_deployment_get_deployserial(self.to_glib_none().0) + } } #[doc(alias = "ostree_deployment_get_index")] #[doc(alias = "get_index")] pub fn index(&self) -> i32 { - unsafe { ffi::ostree_deployment_get_index(self.to_glib_none().0) } + unsafe { + ffi::ostree_deployment_get_index(self.to_glib_none().0) + } } #[doc(alias = "ostree_deployment_get_origin")] #[doc(alias = "get_origin")] pub fn origin(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_deployment_get_origin(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_deployment_get_origin(self.to_glib_none().0)) + } } #[doc(alias = "ostree_deployment_get_origin_relpath")] #[doc(alias = "get_origin_relpath")] pub fn origin_relpath(&self) -> Option { unsafe { - from_glib_full(ffi::ostree_deployment_get_origin_relpath( - self.to_glib_none().0, - )) + from_glib_full(ffi::ostree_deployment_get_origin_relpath(self.to_glib_none().0)) } } #[doc(alias = "ostree_deployment_get_osname")] #[doc(alias = "get_osname")] pub fn osname(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_deployment_get_osname(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_deployment_get_osname(self.to_glib_none().0)) + } } #[cfg(any(feature = "v2016_4", feature = "dox"))] @@ -121,16 +118,15 @@ impl Deployment { #[doc(alias = "ostree_deployment_get_unlocked")] #[doc(alias = "get_unlocked")] pub fn unlocked(&self) -> DeploymentUnlockedState { - unsafe { from_glib(ffi::ostree_deployment_get_unlocked(self.to_glib_none().0)) } + unsafe { + from_glib(ffi::ostree_deployment_get_unlocked(self.to_glib_none().0)) + } } #[doc(alias = "ostree_deployment_hash")] pub fn hash(&self) -> u32 { unsafe { - ffi::ostree_deployment_hash( - ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(self).0 - as glib::ffi::gconstpointer, - ) + ffi::ostree_deployment_hash(ToGlibPtr::<*mut ffi::OstreeDeployment>::to_glib_none(self).0 as glib::ffi::gconstpointer) } } @@ -138,23 +134,24 @@ impl Deployment { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_3")))] #[doc(alias = "ostree_deployment_is_pinned")] pub fn is_pinned(&self) -> bool { - unsafe { from_glib(ffi::ostree_deployment_is_pinned(self.to_glib_none().0)) } + unsafe { + from_glib(ffi::ostree_deployment_is_pinned(self.to_glib_none().0)) + } } #[cfg(any(feature = "v2018_3", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_3")))] #[doc(alias = "ostree_deployment_is_staged")] pub fn is_staged(&self) -> bool { - unsafe { from_glib(ffi::ostree_deployment_is_staged(self.to_glib_none().0)) } + unsafe { + from_glib(ffi::ostree_deployment_is_staged(self.to_glib_none().0)) + } } #[doc(alias = "ostree_deployment_set_bootconfig")] pub fn set_bootconfig(&self, bootconfig: Option<&BootconfigParser>) { unsafe { - ffi::ostree_deployment_set_bootconfig( - self.to_glib_none().0, - bootconfig.to_glib_none().0, - ); + ffi::ostree_deployment_set_bootconfig(self.to_glib_none().0, bootconfig.to_glib_none().0); } } @@ -193,9 +190,7 @@ impl Deployment { #[doc(alias = "ostree_deployment_unlocked_state_to_string")] pub fn unlocked_state_to_string(state: DeploymentUnlockedState) -> Option { unsafe { - from_glib_none(ffi::ostree_deployment_unlocked_state_to_string( - state.into_glib(), - )) + from_glib_none(ffi::ostree_deployment_unlocked_state_to_string(state.into_glib())) } } } diff --git a/rust-bindings/src/auto/diff_item.rs b/rust-bindings/src/auto/diff_item.rs index a7330acc..7320367f 100644 --- a/rust-bindings/src/auto/diff_item.rs +++ b/rust-bindings/src/auto/diff_item.rs @@ -2,6 +2,7 @@ // from gir-files // DO NOT EDIT + glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct DiffItem(Shared); diff --git a/rust-bindings/src/auto/enums.rs b/rust-bindings/src/auto/enums.rs index 573c5d98..2eecdb97 100644 --- a/rust-bindings/src/auto/enums.rs +++ b/rust-bindings/src/auto/enums.rs @@ -5,7 +5,8 @@ use glib::translate::*; use std::fmt; -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeDeploymentUnlockedState")] pub enum DeploymentUnlockedState { @@ -17,23 +18,19 @@ pub enum DeploymentUnlockedState { Hotfix, #[doc(alias = "OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT")] Transient, - #[doc(hidden)] +#[doc(hidden)] __Unknown(i32), } impl fmt::Display for DeploymentUnlockedState { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "DeploymentUnlockedState::{}", - match *self { - Self::None => "None", - Self::Development => "Development", - Self::Hotfix => "Hotfix", - Self::Transient => "Transient", - _ => "Unknown", - } - ) + write!(f, "DeploymentUnlockedState::{}", match *self { + Self::None => "None", + Self::Development => "Development", + Self::Hotfix => "Hotfix", + Self::Transient => "Transient", + _ => "Unknown", + }) } } @@ -48,7 +45,7 @@ impl IntoGlib for DeploymentUnlockedState { Self::Hotfix => ffi::OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX, Self::Transient => ffi::OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT, Self::__Unknown(value) => value, - } +} } } @@ -61,11 +58,12 @@ impl FromGlib for DeploymentUnlockedState { ffi::OSTREE_DEPLOYMENT_UNLOCKED_HOTFIX => Self::Hotfix, ffi::OSTREE_DEPLOYMENT_UNLOCKED_TRANSIENT => Self::Transient, value => Self::__Unknown(value), - } +} } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeGpgSignatureAttr")] pub enum GpgSignatureAttr { @@ -99,34 +97,30 @@ pub enum GpgSignatureAttr { KeyExpTimestamp, #[doc(alias = "OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY")] KeyExpTimestampPrimary, - #[doc(hidden)] +#[doc(hidden)] __Unknown(i32), } impl fmt::Display for GpgSignatureAttr { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "GpgSignatureAttr::{}", - match *self { - Self::Valid => "Valid", - Self::SigExpired => "SigExpired", - Self::KeyExpired => "KeyExpired", - Self::KeyRevoked => "KeyRevoked", - Self::KeyMissing => "KeyMissing", - Self::Fingerprint => "Fingerprint", - Self::Timestamp => "Timestamp", - Self::ExpTimestamp => "ExpTimestamp", - Self::PubkeyAlgoName => "PubkeyAlgoName", - Self::HashAlgoName => "HashAlgoName", - Self::UserName => "UserName", - Self::UserEmail => "UserEmail", - Self::FingerprintPrimary => "FingerprintPrimary", - Self::KeyExpTimestamp => "KeyExpTimestamp", - Self::KeyExpTimestampPrimary => "KeyExpTimestampPrimary", - _ => "Unknown", - } - ) + write!(f, "GpgSignatureAttr::{}", match *self { + Self::Valid => "Valid", + Self::SigExpired => "SigExpired", + Self::KeyExpired => "KeyExpired", + Self::KeyRevoked => "KeyRevoked", + Self::KeyMissing => "KeyMissing", + Self::Fingerprint => "Fingerprint", + Self::Timestamp => "Timestamp", + Self::ExpTimestamp => "ExpTimestamp", + Self::PubkeyAlgoName => "PubkeyAlgoName", + Self::HashAlgoName => "HashAlgoName", + Self::UserName => "UserName", + Self::UserEmail => "UserEmail", + Self::FingerprintPrimary => "FingerprintPrimary", + Self::KeyExpTimestamp => "KeyExpTimestamp", + Self::KeyExpTimestampPrimary => "KeyExpTimestampPrimary", + _ => "Unknown", + }) } } @@ -150,11 +144,9 @@ impl IntoGlib for GpgSignatureAttr { Self::UserEmail => ffi::OSTREE_GPG_SIGNATURE_ATTR_USER_EMAIL, Self::FingerprintPrimary => ffi::OSTREE_GPG_SIGNATURE_ATTR_FINGERPRINT_PRIMARY, Self::KeyExpTimestamp => ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP, - Self::KeyExpTimestampPrimary => { - ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY - } + Self::KeyExpTimestampPrimary => ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY, Self::__Unknown(value) => value, - } +} } } @@ -176,15 +168,14 @@ impl FromGlib for GpgSignatureAttr { ffi::OSTREE_GPG_SIGNATURE_ATTR_USER_EMAIL => Self::UserEmail, ffi::OSTREE_GPG_SIGNATURE_ATTR_FINGERPRINT_PRIMARY => Self::FingerprintPrimary, ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP => Self::KeyExpTimestamp, - ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY => { - Self::KeyExpTimestampPrimary - } + ffi::OSTREE_GPG_SIGNATURE_ATTR_KEY_EXP_TIMESTAMP_PRIMARY => Self::KeyExpTimestampPrimary, value => Self::__Unknown(value), - } +} } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeObjectType")] pub enum ObjectType { @@ -206,28 +197,24 @@ pub enum ObjectType { FileXattrs, #[doc(alias = "OSTREE_OBJECT_TYPE_FILE_XATTRS_LINK")] FileXattrsLink, - #[doc(hidden)] +#[doc(hidden)] __Unknown(i32), } impl fmt::Display for ObjectType { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "ObjectType::{}", - match *self { - Self::File => "File", - Self::DirTree => "DirTree", - Self::DirMeta => "DirMeta", - Self::Commit => "Commit", - Self::TombstoneCommit => "TombstoneCommit", - Self::CommitMeta => "CommitMeta", - Self::PayloadLink => "PayloadLink", - Self::FileXattrs => "FileXattrs", - Self::FileXattrsLink => "FileXattrsLink", - _ => "Unknown", - } - ) + write!(f, "ObjectType::{}", match *self { + Self::File => "File", + Self::DirTree => "DirTree", + Self::DirMeta => "DirMeta", + Self::Commit => "Commit", + Self::TombstoneCommit => "TombstoneCommit", + Self::CommitMeta => "CommitMeta", + Self::PayloadLink => "PayloadLink", + Self::FileXattrs => "FileXattrs", + Self::FileXattrsLink => "FileXattrsLink", + _ => "Unknown", + }) } } @@ -247,7 +234,7 @@ impl IntoGlib for ObjectType { Self::FileXattrs => ffi::OSTREE_OBJECT_TYPE_FILE_XATTRS, Self::FileXattrsLink => ffi::OSTREE_OBJECT_TYPE_FILE_XATTRS_LINK, Self::__Unknown(value) => value, - } +} } } @@ -265,13 +252,14 @@ impl FromGlib for ObjectType { ffi::OSTREE_OBJECT_TYPE_FILE_XATTRS => Self::FileXattrs, ffi::OSTREE_OBJECT_TYPE_FILE_XATTRS_LINK => Self::FileXattrsLink, value => Self::__Unknown(value), - } +} } } #[cfg(any(feature = "v2018_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_2")))] -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoCheckoutFilterResult")] pub enum RepoCheckoutFilterResult { @@ -279,7 +267,7 @@ pub enum RepoCheckoutFilterResult { Allow, #[doc(alias = "OSTREE_REPO_CHECKOUT_FILTER_SKIP")] Skip, - #[doc(hidden)] +#[doc(hidden)] __Unknown(i32), } @@ -287,15 +275,11 @@ pub enum RepoCheckoutFilterResult { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_2")))] impl fmt::Display for RepoCheckoutFilterResult { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "RepoCheckoutFilterResult::{}", - match *self { - Self::Allow => "Allow", - Self::Skip => "Skip", - _ => "Unknown", - } - ) + write!(f, "RepoCheckoutFilterResult::{}", match *self { + Self::Allow => "Allow", + Self::Skip => "Skip", + _ => "Unknown", + }) } } @@ -310,7 +294,7 @@ impl IntoGlib for RepoCheckoutFilterResult { Self::Allow => ffi::OSTREE_REPO_CHECKOUT_FILTER_ALLOW, Self::Skip => ffi::OSTREE_REPO_CHECKOUT_FILTER_SKIP, Self::__Unknown(value) => value, - } +} } } @@ -323,11 +307,12 @@ impl FromGlib for RepoCheckoutFilterResult ffi::OSTREE_REPO_CHECKOUT_FILTER_ALLOW => Self::Allow, ffi::OSTREE_REPO_CHECKOUT_FILTER_SKIP => Self::Skip, value => Self::__Unknown(value), - } +} } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoCheckoutMode")] pub enum RepoCheckoutMode { @@ -335,21 +320,17 @@ pub enum RepoCheckoutMode { None, #[doc(alias = "OSTREE_REPO_CHECKOUT_MODE_USER")] User, - #[doc(hidden)] +#[doc(hidden)] __Unknown(i32), } impl fmt::Display for RepoCheckoutMode { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "RepoCheckoutMode::{}", - match *self { - Self::None => "None", - Self::User => "User", - _ => "Unknown", - } - ) + write!(f, "RepoCheckoutMode::{}", match *self { + Self::None => "None", + Self::User => "User", + _ => "Unknown", + }) } } @@ -362,7 +343,7 @@ impl IntoGlib for RepoCheckoutMode { Self::None => ffi::OSTREE_REPO_CHECKOUT_MODE_NONE, Self::User => ffi::OSTREE_REPO_CHECKOUT_MODE_USER, Self::__Unknown(value) => value, - } +} } } @@ -373,11 +354,12 @@ impl FromGlib for RepoCheckoutMode { ffi::OSTREE_REPO_CHECKOUT_MODE_NONE => Self::None, ffi::OSTREE_REPO_CHECKOUT_MODE_USER => Self::User, value => Self::__Unknown(value), - } +} } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoCheckoutOverwriteMode")] pub enum RepoCheckoutOverwriteMode { @@ -389,23 +371,19 @@ pub enum RepoCheckoutOverwriteMode { AddFiles, #[doc(alias = "OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL")] UnionIdentical, - #[doc(hidden)] +#[doc(hidden)] __Unknown(i32), } impl fmt::Display for RepoCheckoutOverwriteMode { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "RepoCheckoutOverwriteMode::{}", - match *self { - Self::None => "None", - Self::UnionFiles => "UnionFiles", - Self::AddFiles => "AddFiles", - Self::UnionIdentical => "UnionIdentical", - _ => "Unknown", - } - ) + write!(f, "RepoCheckoutOverwriteMode::{}", match *self { + Self::None => "None", + Self::UnionFiles => "UnionFiles", + Self::AddFiles => "AddFiles", + Self::UnionIdentical => "UnionIdentical", + _ => "Unknown", + }) } } @@ -420,7 +398,7 @@ impl IntoGlib for RepoCheckoutOverwriteMode { Self::AddFiles => ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES, Self::UnionIdentical => ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL, Self::__Unknown(value) => value, - } +} } } @@ -433,11 +411,12 @@ impl FromGlib for RepoCheckoutOverwriteMod ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_ADD_FILES => Self::AddFiles, ffi::OSTREE_REPO_CHECKOUT_OVERWRITE_UNION_IDENTICAL => Self::UnionIdentical, value => Self::__Unknown(value), - } +} } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoCommitFilterResult")] pub enum RepoCommitFilterResult { @@ -445,21 +424,17 @@ pub enum RepoCommitFilterResult { Allow, #[doc(alias = "OSTREE_REPO_COMMIT_FILTER_SKIP")] Skip, - #[doc(hidden)] +#[doc(hidden)] __Unknown(i32), } impl fmt::Display for RepoCommitFilterResult { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "RepoCommitFilterResult::{}", - match *self { - Self::Allow => "Allow", - Self::Skip => "Skip", - _ => "Unknown", - } - ) + write!(f, "RepoCommitFilterResult::{}", match *self { + Self::Allow => "Allow", + Self::Skip => "Skip", + _ => "Unknown", + }) } } @@ -472,7 +447,7 @@ impl IntoGlib for RepoCommitFilterResult { Self::Allow => ffi::OSTREE_REPO_COMMIT_FILTER_ALLOW, Self::Skip => ffi::OSTREE_REPO_COMMIT_FILTER_SKIP, Self::__Unknown(value) => value, - } +} } } @@ -483,11 +458,12 @@ impl FromGlib for RepoCommitFilterResult { ffi::OSTREE_REPO_COMMIT_FILTER_ALLOW => Self::Allow, ffi::OSTREE_REPO_COMMIT_FILTER_SKIP => Self::Skip, value => Self::__Unknown(value), - } +} } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoCommitIterResult")] pub enum RepoCommitIterResult { @@ -499,23 +475,19 @@ pub enum RepoCommitIterResult { File, #[doc(alias = "OSTREE_REPO_COMMIT_ITER_RESULT_DIR")] Dir, - #[doc(hidden)] +#[doc(hidden)] __Unknown(i32), } impl fmt::Display for RepoCommitIterResult { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "RepoCommitIterResult::{}", - match *self { - Self::Error => "Error", - Self::End => "End", - Self::File => "File", - Self::Dir => "Dir", - _ => "Unknown", - } - ) + write!(f, "RepoCommitIterResult::{}", match *self { + Self::Error => "Error", + Self::End => "End", + Self::File => "File", + Self::Dir => "Dir", + _ => "Unknown", + }) } } @@ -530,7 +502,7 @@ impl IntoGlib for RepoCommitIterResult { Self::File => ffi::OSTREE_REPO_COMMIT_ITER_RESULT_FILE, Self::Dir => ffi::OSTREE_REPO_COMMIT_ITER_RESULT_DIR, Self::__Unknown(value) => value, - } +} } } @@ -543,11 +515,12 @@ impl FromGlib for RepoCommitIterResult { ffi::OSTREE_REPO_COMMIT_ITER_RESULT_FILE => Self::File, ffi::OSTREE_REPO_COMMIT_ITER_RESULT_DIR => Self::Dir, value => Self::__Unknown(value), - } +} } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoMode")] pub enum RepoMode { @@ -561,24 +534,20 @@ pub enum RepoMode { BareUserOnly, #[doc(alias = "OSTREE_REPO_MODE_BARE_SPLIT_XATTRS")] BareSplitXattrs, - #[doc(hidden)] +#[doc(hidden)] __Unknown(i32), } impl fmt::Display for RepoMode { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "RepoMode::{}", - match *self { - Self::Bare => "Bare", - Self::Archive => "Archive", - Self::BareUser => "BareUser", - Self::BareUserOnly => "BareUserOnly", - Self::BareSplitXattrs => "BareSplitXattrs", - _ => "Unknown", - } - ) + write!(f, "RepoMode::{}", match *self { + Self::Bare => "Bare", + Self::Archive => "Archive", + Self::BareUser => "BareUser", + Self::BareUserOnly => "BareUserOnly", + Self::BareSplitXattrs => "BareSplitXattrs", + _ => "Unknown", + }) } } @@ -594,7 +563,7 @@ impl IntoGlib for RepoMode { Self::BareUserOnly => ffi::OSTREE_REPO_MODE_BARE_USER_ONLY, Self::BareSplitXattrs => ffi::OSTREE_REPO_MODE_BARE_SPLIT_XATTRS, Self::__Unknown(value) => value, - } +} } } @@ -608,11 +577,12 @@ impl FromGlib for RepoMode { ffi::OSTREE_REPO_MODE_BARE_USER_ONLY => Self::BareUserOnly, ffi::OSTREE_REPO_MODE_BARE_SPLIT_XATTRS => Self::BareSplitXattrs, value => Self::__Unknown(value), - } +} } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeRepoRemoteChange")] pub enum RepoRemoteChange { @@ -626,24 +596,20 @@ pub enum RepoRemoteChange { DeleteIfExists, #[doc(alias = "OSTREE_REPO_REMOTE_CHANGE_REPLACE")] Replace, - #[doc(hidden)] +#[doc(hidden)] __Unknown(i32), } impl fmt::Display for RepoRemoteChange { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "RepoRemoteChange::{}", - match *self { - Self::Add => "Add", - Self::AddIfNotExists => "AddIfNotExists", - Self::Delete => "Delete", - Self::DeleteIfExists => "DeleteIfExists", - Self::Replace => "Replace", - _ => "Unknown", - } - ) + write!(f, "RepoRemoteChange::{}", match *self { + Self::Add => "Add", + Self::AddIfNotExists => "AddIfNotExists", + Self::Delete => "Delete", + Self::DeleteIfExists => "DeleteIfExists", + Self::Replace => "Replace", + _ => "Unknown", + }) } } @@ -659,7 +625,7 @@ impl IntoGlib for RepoRemoteChange { Self::DeleteIfExists => ffi::OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS, Self::Replace => ffi::OSTREE_REPO_REMOTE_CHANGE_REPLACE, Self::__Unknown(value) => value, - } +} } } @@ -673,11 +639,12 @@ impl FromGlib for RepoRemoteChange { ffi::OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS => Self::DeleteIfExists, ffi::OSTREE_REPO_REMOTE_CHANGE_REPLACE => Self::Replace, value => Self::__Unknown(value), - } +} } } -#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone, Copy)] +#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[derive(Clone, Copy)] #[non_exhaustive] #[doc(alias = "OstreeStaticDeltaGenerateOpt")] pub enum StaticDeltaGenerateOpt { @@ -685,21 +652,17 @@ pub enum StaticDeltaGenerateOpt { Lowlatency, #[doc(alias = "OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR")] Major, - #[doc(hidden)] +#[doc(hidden)] __Unknown(i32), } impl fmt::Display for StaticDeltaGenerateOpt { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!( - f, - "StaticDeltaGenerateOpt::{}", - match *self { - Self::Lowlatency => "Lowlatency", - Self::Major => "Major", - _ => "Unknown", - } - ) + write!(f, "StaticDeltaGenerateOpt::{}", match *self { + Self::Lowlatency => "Lowlatency", + Self::Major => "Major", + _ => "Unknown", + }) } } @@ -712,7 +675,7 @@ impl IntoGlib for StaticDeltaGenerateOpt { Self::Lowlatency => ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_LOWLATENCY, Self::Major => ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR, Self::__Unknown(value) => value, - } +} } } @@ -723,6 +686,7 @@ impl FromGlib for StaticDeltaGenerateOpt { ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_LOWLATENCY => Self::Lowlatency, ffi::OSTREE_STATIC_DELTA_GENERATE_OPT_MAJOR => Self::Major, value => Self::__Unknown(value), - } +} } } + diff --git a/rust-bindings/src/auto/flags.rs b/rust-bindings/src/auto/flags.rs index 76ec18f2..65dd92d0 100644 --- a/rust-bindings/src/auto/flags.rs +++ b/rust-bindings/src/auto/flags.rs @@ -16,11 +16,11 @@ bitflags! { #[doc(alias = "OstreeChecksumFlags")] pub struct ChecksumFlags: u32 { #[doc(alias = "OSTREE_CHECKSUM_FLAGS_NONE")] - const NONE = ffi::OSTREE_CHECKSUM_FLAGS_NONE as u32; + const NONE = ffi::OSTREE_CHECKSUM_FLAGS_NONE as _; #[doc(alias = "OSTREE_CHECKSUM_FLAGS_IGNORE_XATTRS")] - const IGNORE_XATTRS = ffi::OSTREE_CHECKSUM_FLAGS_IGNORE_XATTRS as u32; + const IGNORE_XATTRS = ffi::OSTREE_CHECKSUM_FLAGS_IGNORE_XATTRS as _; #[doc(alias = "OSTREE_CHECKSUM_FLAGS_CANONICAL_PERMISSIONS")] - const CANONICAL_PERMISSIONS = ffi::OSTREE_CHECKSUM_FLAGS_CANONICAL_PERMISSIONS as u32; + const CANONICAL_PERMISSIONS = ffi::OSTREE_CHECKSUM_FLAGS_CANONICAL_PERMISSIONS as _; } } @@ -56,9 +56,9 @@ bitflags! { #[doc(alias = "OstreeDiffFlags")] pub struct DiffFlags: u32 { #[doc(alias = "OSTREE_DIFF_FLAGS_NONE")] - const NONE = ffi::OSTREE_DIFF_FLAGS_NONE as u32; + const NONE = ffi::OSTREE_DIFF_FLAGS_NONE as _; #[doc(alias = "OSTREE_DIFF_FLAGS_IGNORE_XATTRS")] - const IGNORE_XATTRS = ffi::OSTREE_DIFF_FLAGS_IGNORE_XATTRS as u32; + const IGNORE_XATTRS = ffi::OSTREE_DIFF_FLAGS_IGNORE_XATTRS as _; } } @@ -88,7 +88,7 @@ bitflags! { #[doc(alias = "OstreeGpgSignatureFormatFlags")] pub struct GpgSignatureFormatFlags: u32 { #[doc(alias = "OSTREE_GPG_SIGNATURE_FORMAT_DEFAULT")] - const GPG_SIGNATURE_FORMAT_DEFAULT = ffi::OSTREE_GPG_SIGNATURE_FORMAT_DEFAULT as u32; + const GPG_SIGNATURE_FORMAT_DEFAULT = ffi::OSTREE_GPG_SIGNATURE_FORMAT_DEFAULT as _; } } @@ -118,19 +118,19 @@ bitflags! { #[doc(alias = "OstreeRepoCommitModifierFlags")] pub struct RepoCommitModifierFlags: u32 { #[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_NONE")] - const NONE = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_NONE as u32; + const NONE = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_NONE as _; #[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS")] - const SKIP_XATTRS = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS as u32; + const SKIP_XATTRS = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_SKIP_XATTRS as _; #[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES")] - const GENERATE_SIZES = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES as u32; + const GENERATE_SIZES = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_GENERATE_SIZES as _; #[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CANONICAL_PERMISSIONS")] - const CANONICAL_PERMISSIONS = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CANONICAL_PERMISSIONS as u32; + const CANONICAL_PERMISSIONS = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CANONICAL_PERMISSIONS as _; #[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_ERROR_ON_UNLABELED")] - const ERROR_ON_UNLABELED = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_ERROR_ON_UNLABELED as u32; + const ERROR_ON_UNLABELED = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_ERROR_ON_UNLABELED as _; #[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CONSUME")] - const CONSUME = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CONSUME as u32; + const CONSUME = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_CONSUME as _; #[doc(alias = "OSTREE_REPO_COMMIT_MODIFIER_FLAGS_DEVINO_CANONICAL")] - const DEVINO_CANONICAL = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_DEVINO_CANONICAL as u32; + const DEVINO_CANONICAL = ffi::OSTREE_REPO_COMMIT_MODIFIER_FLAGS_DEVINO_CANONICAL as _; } } @@ -162,11 +162,11 @@ bitflags! { #[doc(alias = "OstreeRepoCommitState")] pub struct RepoCommitState: u32 { #[doc(alias = "OSTREE_REPO_COMMIT_STATE_NORMAL")] - const NORMAL = ffi::OSTREE_REPO_COMMIT_STATE_NORMAL as u32; + const NORMAL = ffi::OSTREE_REPO_COMMIT_STATE_NORMAL as _; #[doc(alias = "OSTREE_REPO_COMMIT_STATE_PARTIAL")] - const PARTIAL = ffi::OSTREE_REPO_COMMIT_STATE_PARTIAL as u32; + const PARTIAL = ffi::OSTREE_REPO_COMMIT_STATE_PARTIAL as _; #[doc(alias = "OSTREE_REPO_COMMIT_STATE_FSCK_PARTIAL")] - const FSCK_PARTIAL = ffi::OSTREE_REPO_COMMIT_STATE_FSCK_PARTIAL as u32; + const FSCK_PARTIAL = ffi::OSTREE_REPO_COMMIT_STATE_FSCK_PARTIAL as _; } } @@ -202,9 +202,9 @@ bitflags! { #[doc(alias = "OstreeRepoCommitTraverseFlags")] pub struct RepoCommitTraverseFlags: u32 { #[doc(alias = "OSTREE_REPO_COMMIT_TRAVERSE_FLAG_NONE")] - const NONE = ffi::OSTREE_REPO_COMMIT_TRAVERSE_FLAG_NONE as u32; + const NONE = ffi::OSTREE_REPO_COMMIT_TRAVERSE_FLAG_NONE as _; #[doc(alias = "OSTREE_REPO_COMMIT_TRAVERSE_FLAG_COMMIT_ONLY")] - const COMMIT_ONLY = ffi::OSTREE_REPO_COMMIT_TRAVERSE_FLAG_COMMIT_ONLY as u32; + const COMMIT_ONLY = ffi::OSTREE_REPO_COMMIT_TRAVERSE_FLAG_COMMIT_ONLY as _; } } @@ -234,13 +234,13 @@ bitflags! { #[doc(alias = "OstreeRepoListObjectsFlags")] pub struct RepoListObjectsFlags: u32 { #[doc(alias = "OSTREE_REPO_LIST_OBJECTS_LOOSE")] - const LOOSE = ffi::OSTREE_REPO_LIST_OBJECTS_LOOSE as u32; + const LOOSE = ffi::OSTREE_REPO_LIST_OBJECTS_LOOSE as _; #[doc(alias = "OSTREE_REPO_LIST_OBJECTS_PACKED")] - const PACKED = ffi::OSTREE_REPO_LIST_OBJECTS_PACKED as u32; + const PACKED = ffi::OSTREE_REPO_LIST_OBJECTS_PACKED as _; #[doc(alias = "OSTREE_REPO_LIST_OBJECTS_ALL")] - const ALL = ffi::OSTREE_REPO_LIST_OBJECTS_ALL as u32; + const ALL = ffi::OSTREE_REPO_LIST_OBJECTS_ALL as _; #[doc(alias = "OSTREE_REPO_LIST_OBJECTS_NO_PARENTS")] - const NO_PARENTS = ffi::OSTREE_REPO_LIST_OBJECTS_NO_PARENTS as u32; + const NO_PARENTS = ffi::OSTREE_REPO_LIST_OBJECTS_NO_PARENTS as _; } } @@ -270,13 +270,13 @@ bitflags! { #[doc(alias = "OstreeRepoListRefsExtFlags")] pub struct RepoListRefsExtFlags: u32 { #[doc(alias = "OSTREE_REPO_LIST_REFS_EXT_NONE")] - const NONE = ffi::OSTREE_REPO_LIST_REFS_EXT_NONE as u32; + const NONE = ffi::OSTREE_REPO_LIST_REFS_EXT_NONE as _; #[doc(alias = "OSTREE_REPO_LIST_REFS_EXT_ALIASES")] - const ALIASES = ffi::OSTREE_REPO_LIST_REFS_EXT_ALIASES as u32; + const ALIASES = ffi::OSTREE_REPO_LIST_REFS_EXT_ALIASES as _; #[doc(alias = "OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES")] - const EXCLUDE_REMOTES = ffi::OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES as u32; + const EXCLUDE_REMOTES = ffi::OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES as _; #[doc(alias = "OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS")] - const EXCLUDE_MIRRORS = ffi::OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS as u32; + const EXCLUDE_MIRRORS = ffi::OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS as _; } } @@ -306,13 +306,13 @@ bitflags! { #[doc(alias = "OstreeRepoPruneFlags")] pub struct RepoPruneFlags: u32 { #[doc(alias = "OSTREE_REPO_PRUNE_FLAGS_NONE")] - const NONE = ffi::OSTREE_REPO_PRUNE_FLAGS_NONE as u32; + const NONE = ffi::OSTREE_REPO_PRUNE_FLAGS_NONE as _; #[doc(alias = "OSTREE_REPO_PRUNE_FLAGS_NO_PRUNE")] - const NO_PRUNE = ffi::OSTREE_REPO_PRUNE_FLAGS_NO_PRUNE as u32; + const NO_PRUNE = ffi::OSTREE_REPO_PRUNE_FLAGS_NO_PRUNE as _; #[doc(alias = "OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY")] - const REFS_ONLY = ffi::OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY as u32; + const REFS_ONLY = ffi::OSTREE_REPO_PRUNE_FLAGS_REFS_ONLY as _; #[doc(alias = "OSTREE_REPO_PRUNE_FLAGS_COMMIT_ONLY")] - const COMMIT_ONLY = ffi::OSTREE_REPO_PRUNE_FLAGS_COMMIT_ONLY as u32; + const COMMIT_ONLY = ffi::OSTREE_REPO_PRUNE_FLAGS_COMMIT_ONLY as _; } } @@ -342,17 +342,17 @@ bitflags! { #[doc(alias = "OstreeRepoPullFlags")] pub struct RepoPullFlags: u32 { #[doc(alias = "OSTREE_REPO_PULL_FLAGS_NONE")] - const NONE = ffi::OSTREE_REPO_PULL_FLAGS_NONE as u32; + const NONE = ffi::OSTREE_REPO_PULL_FLAGS_NONE as _; #[doc(alias = "OSTREE_REPO_PULL_FLAGS_MIRROR")] - const MIRROR = ffi::OSTREE_REPO_PULL_FLAGS_MIRROR as u32; + const MIRROR = ffi::OSTREE_REPO_PULL_FLAGS_MIRROR as _; #[doc(alias = "OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY")] - const COMMIT_ONLY = ffi::OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY as u32; + const COMMIT_ONLY = ffi::OSTREE_REPO_PULL_FLAGS_COMMIT_ONLY as _; #[doc(alias = "OSTREE_REPO_PULL_FLAGS_UNTRUSTED")] - const UNTRUSTED = ffi::OSTREE_REPO_PULL_FLAGS_UNTRUSTED as u32; + const UNTRUSTED = ffi::OSTREE_REPO_PULL_FLAGS_UNTRUSTED as _; #[doc(alias = "OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES")] - const BAREUSERONLY_FILES = ffi::OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES as u32; + const BAREUSERONLY_FILES = ffi::OSTREE_REPO_PULL_FLAGS_BAREUSERONLY_FILES as _; #[doc(alias = "OSTREE_REPO_PULL_FLAGS_TRUSTED_HTTP")] - const TRUSTED_HTTP = ffi::OSTREE_REPO_PULL_FLAGS_TRUSTED_HTTP as u32; + const TRUSTED_HTTP = ffi::OSTREE_REPO_PULL_FLAGS_TRUSTED_HTTP as _; } } @@ -382,9 +382,9 @@ bitflags! { #[doc(alias = "OstreeRepoResolveRevExtFlags")] pub struct RepoResolveRevExtFlags: u32 { #[doc(alias = "OSTREE_REPO_RESOLVE_REV_EXT_NONE")] - const NONE = ffi::OSTREE_REPO_RESOLVE_REV_EXT_NONE as u32; + const NONE = ffi::OSTREE_REPO_RESOLVE_REV_EXT_NONE as _; #[doc(alias = "OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY")] - const LOCAL_ONLY = ffi::OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY as u32; + const LOCAL_ONLY = ffi::OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY as _; } } @@ -416,11 +416,11 @@ bitflags! { #[doc(alias = "OstreeRepoVerifyFlags")] pub struct RepoVerifyFlags: u32 { #[doc(alias = "OSTREE_REPO_VERIFY_FLAGS_NONE")] - const NONE = ffi::OSTREE_REPO_VERIFY_FLAGS_NONE as u32; + const NONE = ffi::OSTREE_REPO_VERIFY_FLAGS_NONE as _; #[doc(alias = "OSTREE_REPO_VERIFY_FLAGS_NO_GPG")] - const NO_GPG = ffi::OSTREE_REPO_VERIFY_FLAGS_NO_GPG as u32; + const NO_GPG = ffi::OSTREE_REPO_VERIFY_FLAGS_NO_GPG as _; #[doc(alias = "OSTREE_REPO_VERIFY_FLAGS_NO_SIGNAPI")] - const NO_SIGNAPI = ffi::OSTREE_REPO_VERIFY_FLAGS_NO_SIGNAPI as u32; + const NO_SIGNAPI = ffi::OSTREE_REPO_VERIFY_FLAGS_NO_SIGNAPI as _; } } @@ -456,11 +456,11 @@ bitflags! { #[doc(alias = "OstreeSePolicyRestoreconFlags")] pub struct SePolicyRestoreconFlags: u32 { #[doc(alias = "OSTREE_SEPOLICY_RESTORECON_FLAGS_NONE")] - const NONE = ffi::OSTREE_SEPOLICY_RESTORECON_FLAGS_NONE as u32; + const NONE = ffi::OSTREE_SEPOLICY_RESTORECON_FLAGS_NONE as _; #[doc(alias = "OSTREE_SEPOLICY_RESTORECON_FLAGS_ALLOW_NOLABEL")] - const ALLOW_NOLABEL = ffi::OSTREE_SEPOLICY_RESTORECON_FLAGS_ALLOW_NOLABEL as u32; + const ALLOW_NOLABEL = ffi::OSTREE_SEPOLICY_RESTORECON_FLAGS_ALLOW_NOLABEL as _; #[doc(alias = "OSTREE_SEPOLICY_RESTORECON_FLAGS_KEEP_EXISTING")] - const KEEP_EXISTING = ffi::OSTREE_SEPOLICY_RESTORECON_FLAGS_KEEP_EXISTING as u32; + const KEEP_EXISTING = ffi::OSTREE_SEPOLICY_RESTORECON_FLAGS_KEEP_EXISTING as _; } } @@ -490,17 +490,17 @@ bitflags! { #[doc(alias = "OstreeSysrootSimpleWriteDeploymentFlags")] pub struct SysrootSimpleWriteDeploymentFlags: u32 { #[doc(alias = "OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NONE")] - const NONE = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NONE as u32; + const NONE = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NONE as _; #[doc(alias = "OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN")] - const RETAIN = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN as u32; + const RETAIN = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN as _; #[doc(alias = "OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT")] - const NOT_DEFAULT = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT as u32; + const NOT_DEFAULT = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NOT_DEFAULT as _; #[doc(alias = "OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NO_CLEAN")] - const NO_CLEAN = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NO_CLEAN as u32; + const NO_CLEAN = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_NO_CLEAN as _; #[doc(alias = "OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN_PENDING")] - const RETAIN_PENDING = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN_PENDING as u32; + const RETAIN_PENDING = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN_PENDING as _; #[doc(alias = "OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN_ROLLBACK")] - const RETAIN_ROLLBACK = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN_ROLLBACK as u32; + const RETAIN_ROLLBACK = ffi::OSTREE_SYSROOT_SIMPLE_WRITE_DEPLOYMENT_FLAGS_RETAIN_ROLLBACK as _; } } @@ -530,9 +530,9 @@ bitflags! { #[doc(alias = "OstreeSysrootUpgraderFlags")] pub struct SysrootUpgraderFlags: u32 { #[doc(alias = "OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED")] - const IGNORE_UNCONFIGURED = ffi::OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED as u32; + const IGNORE_UNCONFIGURED = ffi::OSTREE_SYSROOT_UPGRADER_FLAGS_IGNORE_UNCONFIGURED as _; #[doc(alias = "OSTREE_SYSROOT_UPGRADER_FLAGS_STAGE")] - const STAGE = ffi::OSTREE_SYSROOT_UPGRADER_FLAGS_STAGE as u32; + const STAGE = ffi::OSTREE_SYSROOT_UPGRADER_FLAGS_STAGE as _; } } @@ -594,11 +594,11 @@ bitflags! { #[doc(alias = "OstreeSysrootUpgraderPullFlags")] pub struct SysrootUpgraderPullFlags: u32 { #[doc(alias = "OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_NONE")] - const NONE = ffi::OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_NONE as u32; + const NONE = ffi::OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_NONE as _; #[doc(alias = "OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER")] - const ALLOW_OLDER = ffi::OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER as u32; + const ALLOW_OLDER = ffi::OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_ALLOW_OLDER as _; #[doc(alias = "OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_SYNTHETIC")] - const SYNTHETIC = ffi::OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_SYNTHETIC as u32; + const SYNTHETIC = ffi::OSTREE_SYSROOT_UPGRADER_PULL_FLAGS_SYNTHETIC as _; } } @@ -623,3 +623,4 @@ impl FromGlib for SysrootUpgraderPullFlags Self::from_bits_truncate(value) } } + diff --git a/rust-bindings/src/auto/functions.rs b/rust-bindings/src/auto/functions.rs index e9be0c04..26f9fd5a 100644 --- a/rust-bindings/src/auto/functions.rs +++ b/rust-bindings/src/auto/functions.rs @@ -13,30 +13,16 @@ use glib::translate::*; use std::mem; use std::ptr; + #[cfg(any(feature = "v2017_15", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_15")))] #[doc(alias = "ostree_break_hardlink")] -pub fn break_hardlink( - dfd: i32, - path: &str, - skip_xattrs: bool, - cancellable: Option<&impl IsA>, -) -> Result<(), glib::Error> { +pub fn break_hardlink(dfd: i32, path: &str, skip_xattrs: bool, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_break_hardlink( - dfd, - path.to_glib_none().0, - skip_xattrs.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_break_hardlink(dfd, path.to_glib_none().0, skip_xattrs.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -44,7 +30,9 @@ pub fn break_hardlink( #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_4")))] #[doc(alias = "ostree_check_version")] pub fn check_version(required_year: u32, required_release: u32) -> bool { - unsafe { from_glib(ffi::ostree_check_version(required_year, required_release)) } + unsafe { + from_glib(ffi::ostree_check_version(required_year, required_release)) + } } //#[doc(alias = "ostree_checksum_bytes_peek")] @@ -59,12 +47,16 @@ pub fn check_version(required_year: u32, required_release: u32) -> bool { #[doc(alias = "ostree_checksum_from_bytes_v")] pub fn checksum_from_bytes_v(csum_v: &glib::Variant) -> Option { - unsafe { from_glib_full(ffi::ostree_checksum_from_bytes_v(csum_v.to_glib_none().0)) } + unsafe { + from_glib_full(ffi::ostree_checksum_from_bytes_v(csum_v.to_glib_none().0)) + } } #[doc(alias = "ostree_checksum_to_bytes_v")] pub fn checksum_to_bytes_v(checksum: &str) -> Option { - unsafe { from_glib_full(ffi::ostree_checksum_to_bytes_v(checksum.to_glib_none().0)) } + unsafe { + from_glib_full(ffi::ostree_checksum_to_bytes_v(checksum.to_glib_none().0)) + } } #[cfg(any(feature = "v2018_2", feature = "dox"))] @@ -72,41 +64,27 @@ pub fn checksum_to_bytes_v(checksum: &str) -> Option { #[doc(alias = "ostree_commit_get_content_checksum")] pub fn commit_get_content_checksum(commit_variant: &glib::Variant) -> Option { unsafe { - from_glib_full(ffi::ostree_commit_get_content_checksum( - commit_variant.to_glib_none().0, - )) + from_glib_full(ffi::ostree_commit_get_content_checksum(commit_variant.to_glib_none().0)) } } #[cfg(any(feature = "v2020_1", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_1")))] #[doc(alias = "ostree_commit_get_object_sizes")] -pub fn commit_get_object_sizes( - commit_variant: &glib::Variant, -) -> Result, glib::Error> { +pub fn commit_get_object_sizes(commit_variant: &glib::Variant) -> Result, glib::Error> { unsafe { let mut out_sizes_entries = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_commit_get_object_sizes( - commit_variant.to_glib_none().0, - &mut out_sizes_entries, - &mut error, - ); + let is_ok = ffi::ostree_commit_get_object_sizes(commit_variant.to_glib_none().0, &mut out_sizes_entries, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(FromGlibPtrContainer::from_glib_container(out_sizes_entries)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(FromGlibPtrContainer::from_glib_container(out_sizes_entries)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_commit_get_parent")] pub fn commit_get_parent(commit_variant: &glib::Variant) -> Option { unsafe { - from_glib_full(ffi::ostree_commit_get_parent( - commit_variant.to_glib_none().0, - )) + from_glib_full(ffi::ostree_commit_get_parent(commit_variant.to_glib_none().0)) } } @@ -114,7 +92,9 @@ pub fn commit_get_parent(commit_variant: &glib::Variant) -> Option u64 { - unsafe { ffi::ostree_commit_get_timestamp(commit_variant.to_glib_none().0) } + unsafe { + ffi::ostree_commit_get_timestamp(commit_variant.to_glib_none().0) + } } //#[cfg(any(feature = "v2021_1", feature = "dox"))] @@ -125,155 +105,58 @@ pub fn commit_get_timestamp(commit_variant: &glib::Variant) -> u64 { //} #[doc(alias = "ostree_content_file_parse")] -pub fn content_file_parse( - compressed: bool, - content_path: &impl IsA, - trusted: bool, - cancellable: Option<&impl IsA>, -) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> { +pub fn content_file_parse(compressed: bool, content_path: &impl IsA, trusted: bool, cancellable: Option<&impl IsA>) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> { unsafe { let mut out_input = ptr::null_mut(); let mut out_file_info = ptr::null_mut(); let mut out_xattrs = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_content_file_parse( - compressed.into_glib(), - content_path.as_ref().to_glib_none().0, - trusted.into_glib(), - &mut out_input, - &mut out_file_info, - &mut out_xattrs, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_content_file_parse(compressed.into_glib(), content_path.as_ref().to_glib_none().0, trusted.into_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(( - from_glib_full(out_input), - from_glib_full(out_file_info), - from_glib_full(out_xattrs), - )) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok((from_glib_full(out_input), from_glib_full(out_file_info), from_glib_full(out_xattrs))) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_content_file_parse_at")] -pub fn content_file_parse_at( - compressed: bool, - parent_dfd: i32, - path: &str, - trusted: bool, - cancellable: Option<&impl IsA>, -) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> { +pub fn content_file_parse_at(compressed: bool, parent_dfd: i32, path: &str, trusted: bool, cancellable: Option<&impl IsA>) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> { unsafe { let mut out_input = ptr::null_mut(); let mut out_file_info = ptr::null_mut(); let mut out_xattrs = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_content_file_parse_at( - compressed.into_glib(), - parent_dfd, - path.to_glib_none().0, - trusted.into_glib(), - &mut out_input, - &mut out_file_info, - &mut out_xattrs, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_content_file_parse_at(compressed.into_glib(), parent_dfd, path.to_glib_none().0, trusted.into_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(( - from_glib_full(out_input), - from_glib_full(out_file_info), - from_glib_full(out_xattrs), - )) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok((from_glib_full(out_input), from_glib_full(out_file_info), from_glib_full(out_xattrs))) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_content_stream_parse")] -pub fn content_stream_parse( - compressed: bool, - input: &impl IsA, - input_length: u64, - trusted: bool, - cancellable: Option<&impl IsA>, -) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> { +pub fn content_stream_parse(compressed: bool, input: &impl IsA, input_length: u64, trusted: bool, cancellable: Option<&impl IsA>) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), glib::Error> { unsafe { let mut out_input = ptr::null_mut(); let mut out_file_info = ptr::null_mut(); let mut out_xattrs = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_content_stream_parse( - compressed.into_glib(), - input.as_ref().to_glib_none().0, - input_length, - trusted.into_glib(), - &mut out_input, - &mut out_file_info, - &mut out_xattrs, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_content_stream_parse(compressed.into_glib(), input.as_ref().to_glib_none().0, input_length, trusted.into_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(( - from_glib_full(out_input), - from_glib_full(out_file_info), - from_glib_full(out_xattrs), - )) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok((from_glib_full(out_input), from_glib_full(out_file_info), from_glib_full(out_xattrs))) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_create_directory_metadata")] -pub fn create_directory_metadata( - dir_info: &gio::FileInfo, - xattrs: Option<&glib::Variant>, -) -> Option { +pub fn create_directory_metadata(dir_info: &gio::FileInfo, xattrs: Option<&glib::Variant>) -> Option { unsafe { - from_glib_full(ffi::ostree_create_directory_metadata( - dir_info.to_glib_none().0, - xattrs.to_glib_none().0, - )) + from_glib_full(ffi::ostree_create_directory_metadata(dir_info.to_glib_none().0, xattrs.to_glib_none().0)) } } #[doc(alias = "ostree_diff_dirs")] -pub fn diff_dirs( - flags: DiffFlags, - a: &impl IsA, - b: &impl IsA, - modified: &[&DiffItem], - removed: &[gio::File], - added: &[gio::File], - cancellable: Option<&impl IsA>, -) -> Result<(), glib::Error> { +pub fn diff_dirs(flags: DiffFlags, a: &impl IsA, b: &impl IsA, modified: &[&DiffItem], removed: &[gio::File], added: &[gio::File], cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_diff_dirs( - flags.into_glib(), - a.as_ref().to_glib_none().0, - b.as_ref().to_glib_none().0, - modified.to_glib_none().0, - removed.to_glib_none().0, - added.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_diff_dirs(flags.into_glib(), a.as_ref().to_glib_none().0, b.as_ref().to_glib_none().0, modified.to_glib_none().0, removed.to_glib_none().0, added.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -285,63 +168,27 @@ pub fn diff_dirs( //} #[doc(alias = "ostree_diff_print")] -pub fn diff_print( - a: &impl IsA, - b: &impl IsA, - modified: &[&DiffItem], - removed: &[gio::File], - added: &[gio::File], -) { +pub fn diff_print(a: &impl IsA, b: &impl IsA, modified: &[&DiffItem], removed: &[gio::File], added: &[gio::File]) { unsafe { - ffi::ostree_diff_print( - a.as_ref().to_glib_none().0, - b.as_ref().to_glib_none().0, - modified.to_glib_none().0, - removed.to_glib_none().0, - added.to_glib_none().0, - ); + ffi::ostree_diff_print(a.as_ref().to_glib_none().0, b.as_ref().to_glib_none().0, modified.to_glib_none().0, removed.to_glib_none().0, added.to_glib_none().0); } } #[doc(alias = "ostree_fs_get_all_xattrs")] -pub fn fs_get_all_xattrs( - fd: i32, - cancellable: Option<&impl IsA>, -) -> Result { +pub fn fs_get_all_xattrs(fd: i32, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_fs_get_all_xattrs( - fd, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_fs_get_all_xattrs(fd, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_fs_get_all_xattrs_at")] -pub fn fs_get_all_xattrs_at( - dfd: i32, - path: &str, - cancellable: Option<&impl IsA>, -) -> Result { +pub fn fs_get_all_xattrs_at(dfd: i32, path: &str, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_fs_get_all_xattrs_at( - dfd, - path.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_fs_get_all_xattrs_at(dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } @@ -349,12 +196,16 @@ pub fn fs_get_all_xattrs_at( #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))] #[doc(alias = "ostree_gpg_error_quark")] pub fn gpg_error_quark() -> glib::Quark { - unsafe { from_glib(ffi::ostree_gpg_error_quark()) } + unsafe { + from_glib(ffi::ostree_gpg_error_quark()) + } } #[doc(alias = "ostree_metadata_variant_type")] pub fn metadata_variant_type(objtype: ObjectType) -> Option { - unsafe { from_glib_none(ffi::ostree_metadata_variant_type(objtype.into_glib())) } + unsafe { + from_glib_none(ffi::ostree_metadata_variant_type(objtype.into_glib())) + } } #[doc(alias = "ostree_object_from_string")] @@ -362,13 +213,8 @@ pub fn object_from_string(str: &str) -> (glib::GString, ObjectType) { unsafe { let mut out_checksum = ptr::null_mut(); let mut out_objtype = mem::MaybeUninit::uninit(); - ffi::ostree_object_from_string( - str.to_glib_none().0, - &mut out_checksum, - out_objtype.as_mut_ptr(), - ); - let out_objtype = out_objtype.assume_init(); - (from_glib_full(out_checksum), from_glib(out_objtype)) + ffi::ostree_object_from_string(str.to_glib_none().0, &mut out_checksum, out_objtype.as_mut_ptr()); + (from_glib_full(out_checksum), from_glib(out_objtype.assume_init())) } } @@ -377,44 +223,37 @@ pub fn object_name_deserialize(variant: &glib::Variant) -> (glib::GString, Objec unsafe { let mut out_checksum = ptr::null(); let mut out_objtype = mem::MaybeUninit::uninit(); - ffi::ostree_object_name_deserialize( - variant.to_glib_none().0, - &mut out_checksum, - out_objtype.as_mut_ptr(), - ); - let out_objtype = out_objtype.assume_init(); - (from_glib_none(out_checksum), from_glib(out_objtype)) + ffi::ostree_object_name_deserialize(variant.to_glib_none().0, &mut out_checksum, out_objtype.as_mut_ptr()); + (from_glib_none(out_checksum), from_glib(out_objtype.assume_init())) } } #[doc(alias = "ostree_object_name_serialize")] pub fn object_name_serialize(checksum: &str, objtype: ObjectType) -> Option { unsafe { - from_glib_none(ffi::ostree_object_name_serialize( - checksum.to_glib_none().0, - objtype.into_glib(), - )) + from_glib_none(ffi::ostree_object_name_serialize(checksum.to_glib_none().0, objtype.into_glib())) } } #[doc(alias = "ostree_object_to_string")] pub fn object_to_string(checksum: &str, objtype: ObjectType) -> Option { unsafe { - from_glib_full(ffi::ostree_object_to_string( - checksum.to_glib_none().0, - objtype.into_glib(), - )) + from_glib_full(ffi::ostree_object_to_string(checksum.to_glib_none().0, objtype.into_glib())) } } #[doc(alias = "ostree_object_type_from_string")] pub fn object_type_from_string(str: &str) -> ObjectType { - unsafe { from_glib(ffi::ostree_object_type_from_string(str.to_glib_none().0)) } + unsafe { + from_glib(ffi::ostree_object_type_from_string(str.to_glib_none().0)) + } } #[doc(alias = "ostree_object_type_to_string")] pub fn object_type_to_string(objtype: ObjectType) -> Option { - unsafe { from_glib_none(ffi::ostree_object_type_to_string(objtype.into_glib())) } + unsafe { + from_glib_none(ffi::ostree_object_type_to_string(objtype.into_glib())) + } } #[doc(alias = "ostree_parse_refspec")] @@ -423,108 +262,47 @@ pub fn parse_refspec(refspec: &str) -> Result<(Option, glib::GStr let mut out_remote = ptr::null_mut(); let mut out_ref = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_parse_refspec( - refspec.to_glib_none().0, - &mut out_remote, - &mut out_ref, - &mut error, - ); + let is_ok = ffi::ostree_parse_refspec(refspec.to_glib_none().0, &mut out_remote, &mut out_ref, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok((from_glib_full(out_remote), from_glib_full(out_ref))) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok((from_glib_full(out_remote), from_glib_full(out_ref))) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2016_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_6")))] #[doc(alias = "ostree_raw_file_to_archive_z2_stream")] -pub fn raw_file_to_archive_z2_stream( - input: &impl IsA, - file_info: &gio::FileInfo, - xattrs: Option<&glib::Variant>, - cancellable: Option<&impl IsA>, -) -> Result { +pub fn raw_file_to_archive_z2_stream(input: &impl IsA, file_info: &gio::FileInfo, xattrs: Option<&glib::Variant>, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_input = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_raw_file_to_archive_z2_stream( - input.as_ref().to_glib_none().0, - file_info.to_glib_none().0, - xattrs.to_glib_none().0, - &mut out_input, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_raw_file_to_archive_z2_stream(input.as_ref().to_glib_none().0, file_info.to_glib_none().0, xattrs.to_glib_none().0, &mut out_input, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_input)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_input)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2017_3", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_3")))] #[doc(alias = "ostree_raw_file_to_archive_z2_stream_with_options")] -pub fn raw_file_to_archive_z2_stream_with_options( - input: &impl IsA, - file_info: &gio::FileInfo, - xattrs: Option<&glib::Variant>, - options: Option<&glib::Variant>, - cancellable: Option<&impl IsA>, -) -> Result { +pub fn raw_file_to_archive_z2_stream_with_options(input: &impl IsA, file_info: &gio::FileInfo, xattrs: Option<&glib::Variant>, options: Option<&glib::Variant>, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_input = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_raw_file_to_archive_z2_stream_with_options( - input.as_ref().to_glib_none().0, - file_info.to_glib_none().0, - xattrs.to_glib_none().0, - options.to_glib_none().0, - &mut out_input, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_raw_file_to_archive_z2_stream_with_options(input.as_ref().to_glib_none().0, file_info.to_glib_none().0, xattrs.to_glib_none().0, options.to_glib_none().0, &mut out_input, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_input)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_input)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_raw_file_to_content_stream")] -pub fn raw_file_to_content_stream( - input: &impl IsA, - file_info: &gio::FileInfo, - xattrs: Option<&glib::Variant>, - cancellable: Option<&impl IsA>, -) -> Result<(gio::InputStream, u64), glib::Error> { +pub fn raw_file_to_content_stream(input: &impl IsA, file_info: &gio::FileInfo, xattrs: Option<&glib::Variant>, cancellable: Option<&impl IsA>) -> Result<(gio::InputStream, u64), glib::Error> { unsafe { let mut out_input = ptr::null_mut(); let mut out_length = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_raw_file_to_content_stream( - input.as_ref().to_glib_none().0, - file_info.to_glib_none().0, - xattrs.to_glib_none().0, - &mut out_input, - out_length.as_mut_ptr(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - let out_length = out_length.assume_init(); + let is_ok = ffi::ostree_raw_file_to_content_stream(input.as_ref().to_glib_none().0, file_info.to_glib_none().0, xattrs.to_glib_none().0, &mut out_input, out_length.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok((from_glib_full(out_input), out_length)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok((from_glib_full(out_input), out_length.assume_init())) } else { Err(from_glib_full(error)) } } } @@ -534,11 +312,7 @@ pub fn validate_checksum_string(sha256: &str) -> Result<(), glib::Error> { let mut error = ptr::null_mut(); let is_ok = ffi::ostree_validate_checksum_string(sha256.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -550,11 +324,7 @@ pub fn validate_collection_id(collection_id: Option<&str>) -> Result<(), glib::E let mut error = ptr::null_mut(); let is_ok = ffi::ostree_validate_collection_id(collection_id.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -566,11 +336,7 @@ pub fn validate_remote_name(remote_name: &str) -> Result<(), glib::Error> { let mut error = ptr::null_mut(); let is_ok = ffi::ostree_validate_remote_name(remote_name.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -580,11 +346,7 @@ pub fn validate_rev(rev: &str) -> Result<(), glib::Error> { let mut error = ptr::null_mut(); let is_ok = ffi::ostree_validate_rev(rev.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -592,14 +354,9 @@ pub fn validate_rev(rev: &str) -> Result<(), glib::Error> { pub fn validate_structureof_checksum_string(checksum: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = - ffi::ostree_validate_structureof_checksum_string(checksum.to_glib_none().0, &mut error); + let is_ok = ffi::ostree_validate_structureof_checksum_string(checksum.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -609,11 +366,7 @@ pub fn validate_structureof_commit(commit: &glib::Variant) -> Result<(), glib::E let mut error = ptr::null_mut(); let is_ok = ffi::ostree_validate_structureof_commit(commit.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -623,11 +376,7 @@ pub fn validate_structureof_csum_v(checksum: &glib::Variant) -> Result<(), glib: let mut error = ptr::null_mut(); let is_ok = ffi::ostree_validate_structureof_csum_v(checksum.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -637,11 +386,7 @@ pub fn validate_structureof_dirmeta(dirmeta: &glib::Variant) -> Result<(), glib: let mut error = ptr::null_mut(); let is_ok = ffi::ostree_validate_structureof_dirmeta(dirmeta.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -651,11 +396,7 @@ pub fn validate_structureof_dirtree(dirtree: &glib::Variant) -> Result<(), glib: let mut error = ptr::null_mut(); let is_ok = ffi::ostree_validate_structureof_dirtree(dirtree.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -665,11 +406,7 @@ pub fn validate_structureof_file_mode(mode: u32) -> Result<(), glib::Error> { let mut error = ptr::null_mut(); let is_ok = ffi::ostree_validate_structureof_file_mode(mode, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -679,10 +416,6 @@ pub fn validate_structureof_objtype(objtype: u8) -> Result<(), glib::Error> { let mut error = ptr::null_mut(); let is_ok = ffi::ostree_validate_structureof_objtype(objtype, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } diff --git a/rust-bindings/src/auto/gpg_verify_result.rs b/rust-bindings/src/auto/gpg_verify_result.rs index 9eb16494..048037d9 100644 --- a/rust-bindings/src/auto/gpg_verify_result.rs +++ b/rust-bindings/src/auto/gpg_verify_result.rs @@ -21,12 +21,16 @@ glib::wrapper! { impl GpgVerifyResult { #[doc(alias = "ostree_gpg_verify_result_count_all")] pub fn count_all(&self) -> u32 { - unsafe { ffi::ostree_gpg_verify_result_count_all(self.to_glib_none().0) } + unsafe { + ffi::ostree_gpg_verify_result_count_all(self.to_glib_none().0) + } } #[doc(alias = "ostree_gpg_verify_result_count_valid")] pub fn count_valid(&self) -> u32 { - unsafe { ffi::ostree_gpg_verify_result_count_valid(self.to_glib_none().0) } + unsafe { + ffi::ostree_gpg_verify_result_count_valid(self.to_glib_none().0) + } } //#[doc(alias = "ostree_gpg_verify_result_get")] @@ -38,10 +42,7 @@ impl GpgVerifyResult { #[doc(alias = "get_all")] pub fn all(&self, signature_index: u32) -> Option { unsafe { - from_glib_none(ffi::ostree_gpg_verify_result_get_all( - self.to_glib_none().0, - signature_index, - )) + from_glib_none(ffi::ostree_gpg_verify_result_get_all(self.to_glib_none().0, signature_index)) } } @@ -49,17 +50,8 @@ impl GpgVerifyResult { pub fn lookup(&self, key_id: &str) -> Option { unsafe { let mut out_signature_index = mem::MaybeUninit::uninit(); - let ret = from_glib(ffi::ostree_gpg_verify_result_lookup( - self.to_glib_none().0, - key_id.to_glib_none().0, - out_signature_index.as_mut_ptr(), - )); - let out_signature_index = out_signature_index.assume_init(); - if ret { - Some(out_signature_index) - } else { - None - } + let ret = from_glib(ffi::ostree_gpg_verify_result_lookup(self.to_glib_none().0, key_id.to_glib_none().0, out_signature_index.as_mut_ptr())); + if ret { Some(out_signature_index.assume_init()) } else { None } } } @@ -69,16 +61,9 @@ impl GpgVerifyResult { pub fn require_valid_signature(&self) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_gpg_verify_result_require_valid_signature( - self.to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_gpg_verify_result_require_valid_signature(self.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } } diff --git a/rust-bindings/src/auto/mutable_tree.rs b/rust-bindings/src/auto/mutable_tree.rs index 9322775f..ca3ba8d1 100644 --- a/rust-bindings/src/auto/mutable_tree.rs +++ b/rust-bindings/src/auto/mutable_tree.rs @@ -21,24 +21,18 @@ glib::wrapper! { impl MutableTree { #[doc(alias = "ostree_mutable_tree_new")] pub fn new() -> MutableTree { - unsafe { from_glib_full(ffi::ostree_mutable_tree_new()) } + unsafe { + from_glib_full(ffi::ostree_mutable_tree_new()) + } } #[cfg(any(feature = "v2018_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_7")))] #[doc(alias = "ostree_mutable_tree_new_from_checksum")] #[doc(alias = "new_from_checksum")] - pub fn from_checksum( - repo: &Repo, - contents_checksum: &str, - metadata_checksum: &str, - ) -> MutableTree { + pub fn from_checksum(repo: &Repo, contents_checksum: &str, metadata_checksum: &str) -> MutableTree { unsafe { - from_glib_full(ffi::ostree_mutable_tree_new_from_checksum( - repo.to_glib_none().0, - contents_checksum.to_glib_none().0, - metadata_checksum.to_glib_none().0, - )) + from_glib_full(ffi::ostree_mutable_tree_new_from_checksum(repo.to_glib_none().0, contents_checksum.to_glib_none().0, metadata_checksum.to_glib_none().0)) } } @@ -49,16 +43,8 @@ impl MutableTree { pub fn from_commit(repo: &Repo, rev: &str) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_mutable_tree_new_from_commit( - repo.to_glib_none().0, - rev.to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_mutable_tree_new_from_commit(repo.to_glib_none().0, rev.to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } @@ -70,11 +56,7 @@ impl MutableTree { let mut error = ptr::null_mut(); let is_ok = ffi::ostree_mutable_tree_check_error(self.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -83,62 +65,29 @@ impl MutableTree { unsafe { let mut out_subdir = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_mutable_tree_ensure_dir( - self.to_glib_none().0, - name.to_glib_none().0, - &mut out_subdir, - &mut error, - ); + let is_ok = ffi::ostree_mutable_tree_ensure_dir(self.to_glib_none().0, name.to_glib_none().0, &mut out_subdir, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_subdir)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_subdir)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_mutable_tree_ensure_parent_dirs")] - pub fn ensure_parent_dirs( - &self, - split_path: &[&str], - metadata_checksum: &str, - ) -> Result { + pub fn ensure_parent_dirs(&self, split_path: &[&str], metadata_checksum: &str) -> Result { unsafe { let mut out_parent = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_mutable_tree_ensure_parent_dirs( - self.to_glib_none().0, - split_path.to_glib_none().0, - metadata_checksum.to_glib_none().0, - &mut out_parent, - &mut error, - ); + let is_ok = ffi::ostree_mutable_tree_ensure_parent_dirs(self.to_glib_none().0, split_path.to_glib_none().0, metadata_checksum.to_glib_none().0, &mut out_parent, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_parent)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_parent)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2018_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_7")))] #[doc(alias = "ostree_mutable_tree_fill_empty_from_dirtree")] - pub fn fill_empty_from_dirtree( - &self, - repo: &Repo, - contents_checksum: &str, - metadata_checksum: &str, - ) -> bool { + pub fn fill_empty_from_dirtree(&self, repo: &Repo, contents_checksum: &str, metadata_checksum: &str) -> bool { unsafe { - from_glib(ffi::ostree_mutable_tree_fill_empty_from_dirtree( - self.to_glib_none().0, - repo.to_glib_none().0, - contents_checksum.to_glib_none().0, - metadata_checksum.to_glib_none().0, - )) + from_glib(ffi::ostree_mutable_tree_fill_empty_from_dirtree(self.to_glib_none().0, repo.to_glib_none().0, contents_checksum.to_glib_none().0, metadata_checksum.to_glib_none().0)) } } @@ -146,9 +95,7 @@ impl MutableTree { #[doc(alias = "get_contents_checksum")] pub fn contents_checksum(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_mutable_tree_get_contents_checksum( - self.to_glib_none().0, - )) + from_glib_none(ffi::ostree_mutable_tree_get_contents_checksum(self.to_glib_none().0)) } } @@ -162,9 +109,7 @@ impl MutableTree { #[doc(alias = "get_metadata_checksum")] pub fn metadata_checksum(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_mutable_tree_get_metadata_checksum( - self.to_glib_none().0, - )) + from_glib_none(ffi::ostree_mutable_tree_get_metadata_checksum(self.to_glib_none().0)) } } @@ -175,30 +120,14 @@ impl MutableTree { //} #[doc(alias = "ostree_mutable_tree_lookup")] - pub fn lookup( - &self, - name: &str, - ) -> Result<(Option, Option), glib::Error> { + pub fn lookup(&self, name: &str) -> Result<(Option, Option), glib::Error> { unsafe { let mut out_file_checksum = ptr::null_mut(); let mut out_subdir = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_mutable_tree_lookup( - self.to_glib_none().0, - name.to_glib_none().0, - &mut out_file_checksum, - &mut out_subdir, - &mut error, - ); + let is_ok = ffi::ostree_mutable_tree_lookup(self.to_glib_none().0, name.to_glib_none().0, &mut out_file_checksum, &mut out_subdir, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(( - from_glib_full(out_file_checksum), - from_glib_full(out_subdir), - )) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok((from_glib_full(out_file_checksum), from_glib_full(out_subdir))) } else { Err(from_glib_full(error)) } } } @@ -208,18 +137,9 @@ impl MutableTree { pub fn remove(&self, name: &str, allow_noent: bool) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_mutable_tree_remove( - self.to_glib_none().0, - name.to_glib_none().0, - allow_noent.into_glib(), - &mut error, - ); + let is_ok = ffi::ostree_mutable_tree_remove(self.to_glib_none().0, name.to_glib_none().0, allow_noent.into_glib(), &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -227,38 +147,23 @@ impl MutableTree { pub fn replace_file(&self, name: &str, checksum: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_mutable_tree_replace_file( - self.to_glib_none().0, - name.to_glib_none().0, - checksum.to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_mutable_tree_replace_file(self.to_glib_none().0, name.to_glib_none().0, checksum.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_mutable_tree_set_contents_checksum")] pub fn set_contents_checksum(&self, checksum: &str) { unsafe { - ffi::ostree_mutable_tree_set_contents_checksum( - self.to_glib_none().0, - checksum.to_glib_none().0, - ); + ffi::ostree_mutable_tree_set_contents_checksum(self.to_glib_none().0, checksum.to_glib_none().0); } } #[doc(alias = "ostree_mutable_tree_set_metadata_checksum")] pub fn set_metadata_checksum(&self, checksum: &str) { unsafe { - ffi::ostree_mutable_tree_set_metadata_checksum( - self.to_glib_none().0, - checksum.to_glib_none().0, - ); + ffi::ostree_mutable_tree_set_metadata_checksum(self.to_glib_none().0, checksum.to_glib_none().0); } } @@ -267,28 +172,18 @@ impl MutableTree { unsafe { let mut out_subdir = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_mutable_tree_walk( - self.to_glib_none().0, - split_path.to_glib_none().0, - start, - &mut out_subdir, - &mut error, - ); + let is_ok = ffi::ostree_mutable_tree_walk(self.to_glib_none().0, split_path.to_glib_none().0, start, &mut out_subdir, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_subdir)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_subdir)) } else { Err(from_glib_full(error)) } } } } impl Default for MutableTree { - fn default() -> Self { - Self::new() - } -} + fn default() -> Self { + Self::new() + } + } impl fmt::Display for MutableTree { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/rust-bindings/src/auto/remote.rs b/rust-bindings/src/auto/remote.rs index f9b1698d..95939f25 100644 --- a/rust-bindings/src/auto/remote.rs +++ b/rust-bindings/src/auto/remote.rs @@ -19,12 +19,16 @@ impl Remote { #[doc(alias = "ostree_remote_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_remote_get_name(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_remote_get_name(self.to_glib_none().0)) + } } #[doc(alias = "ostree_remote_get_url")] #[doc(alias = "get_url")] pub fn url(&self) -> Option { - unsafe { from_glib_full(ffi::ostree_remote_get_url(self.to_glib_none().0)) } + unsafe { + from_glib_full(ffi::ostree_remote_get_url(self.to_glib_none().0)) + } } } diff --git a/rust-bindings/src/auto/repo.rs b/rust-bindings/src/auto/repo.rs index 7864f2f6..3d9bf74a 100644 --- a/rust-bindings/src/auto/repo.rs +++ b/rust-bindings/src/auto/repo.rs @@ -67,255 +67,123 @@ glib::wrapper! { impl Repo { #[doc(alias = "ostree_repo_new")] pub fn new(path: &impl IsA) -> Repo { - unsafe { from_glib_full(ffi::ostree_repo_new(path.as_ref().to_glib_none().0)) } + unsafe { + from_glib_full(ffi::ostree_repo_new(path.as_ref().to_glib_none().0)) + } } #[doc(alias = "ostree_repo_new_default")] pub fn new_default() -> Repo { - unsafe { from_glib_full(ffi::ostree_repo_new_default()) } + unsafe { + from_glib_full(ffi::ostree_repo_new_default()) + } } #[doc(alias = "ostree_repo_new_for_sysroot_path")] #[doc(alias = "new_for_sysroot_path")] - pub fn for_sysroot_path( - repo_path: &impl IsA, - sysroot_path: &impl IsA, - ) -> Repo { + pub fn for_sysroot_path(repo_path: &impl IsA, sysroot_path: &impl IsA) -> Repo { unsafe { - from_glib_full(ffi::ostree_repo_new_for_sysroot_path( - repo_path.as_ref().to_glib_none().0, - sysroot_path.as_ref().to_glib_none().0, - )) + from_glib_full(ffi::ostree_repo_new_for_sysroot_path(repo_path.as_ref().to_glib_none().0, sysroot_path.as_ref().to_glib_none().0)) } } #[doc(alias = "ostree_repo_abort_transaction")] - pub fn abort_transaction( - &self, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn abort_transaction(&self, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_abort_transaction( - self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_abort_transaction(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_add_gpg_signature_summary")] - pub fn add_gpg_signature_summary( - &self, - key_id: &[&str], - homedir: Option<&str>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn add_gpg_signature_summary(&self, key_id: &[&str], homedir: Option<&str>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_add_gpg_signature_summary( - self.to_glib_none().0, - key_id.to_glib_none().0, - homedir.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_add_gpg_signature_summary(self.to_glib_none().0, key_id.to_glib_none().0, homedir.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_append_gpg_signature")] - pub fn append_gpg_signature( - &self, - commit_checksum: &str, - signature_bytes: &glib::Bytes, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn append_gpg_signature(&self, commit_checksum: &str, signature_bytes: &glib::Bytes, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_append_gpg_signature( - self.to_glib_none().0, - commit_checksum.to_glib_none().0, - signature_bytes.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_append_gpg_signature(self.to_glib_none().0, commit_checksum.to_glib_none().0, signature_bytes.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2016_8", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_8")))] #[doc(alias = "ostree_repo_checkout_at")] - pub fn checkout_at( - &self, - options: Option<&RepoCheckoutAtOptions>, - destination_dfd: i32, - destination_path: impl AsRef, - commit: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn checkout_at(&self, options: Option<&RepoCheckoutAtOptions>, destination_dfd: i32, destination_path: impl AsRef, commit: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_checkout_at( - self.to_glib_none().0, - mut_override(options.to_glib_none().0), - destination_dfd, - destination_path.as_ref().to_glib_none().0, - commit.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_checkout_at(self.to_glib_none().0, mut_override(options.to_glib_none().0), destination_dfd, destination_path.as_ref().to_glib_none().0, commit.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_checkout_gc")] - pub fn checkout_gc( - &self, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn checkout_gc(&self, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_checkout_gc( - self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_checkout_gc(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_checkout_tree")] - pub fn checkout_tree( - &self, - mode: RepoCheckoutMode, - overwrite_mode: RepoCheckoutOverwriteMode, - destination: &impl IsA, - source: &RepoFile, - source_info: &gio::FileInfo, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn checkout_tree(&self, mode: RepoCheckoutMode, overwrite_mode: RepoCheckoutOverwriteMode, destination: &impl IsA, source: &RepoFile, source_info: &gio::FileInfo, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_checkout_tree( - self.to_glib_none().0, - mode.into_glib(), - overwrite_mode.into_glib(), - destination.as_ref().to_glib_none().0, - source.to_glib_none().0, - source_info.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_checkout_tree(self.to_glib_none().0, mode.into_glib(), overwrite_mode.into_glib(), destination.as_ref().to_glib_none().0, source.to_glib_none().0, source_info.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_commit_transaction")] - pub fn commit_transaction( - &self, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn commit_transaction(&self, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_stats = RepoTransactionStats::uninitialized(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_commit_transaction( - self.to_glib_none().0, - out_stats.to_glib_none_mut().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_commit_transaction(self.to_glib_none().0, out_stats.to_glib_none_mut().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(out_stats) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(out_stats) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_copy_config")] pub fn copy_config(&self) -> Option { - unsafe { from_glib_full(ffi::ostree_repo_copy_config(self.to_glib_none().0)) } + unsafe { + from_glib_full(ffi::ostree_repo_copy_config(self.to_glib_none().0)) + } } #[doc(alias = "ostree_repo_create")] - pub fn create( - &self, - mode: RepoMode, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn create(&self, mode: RepoMode, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_create( - self.to_glib_none().0, - mode.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_create(self.to_glib_none().0, mode.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_delete_object")] - pub fn delete_object( - &self, - objtype: ObjectType, - sha256: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn delete_object(&self, objtype: ObjectType, sha256: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_delete_object( - self.to_glib_none().0, - objtype.into_glib(), - sha256.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_delete_object(self.to_glib_none().0, objtype.into_glib(), sha256.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -324,42 +192,24 @@ impl Repo { #[doc(alias = "ostree_repo_equal")] pub fn equal(&self, b: &Repo) -> bool { unsafe { - from_glib(ffi::ostree_repo_equal( - self.to_glib_none().0, - b.to_glib_none().0, - )) + from_glib(ffi::ostree_repo_equal(self.to_glib_none().0, b.to_glib_none().0)) } } //#[doc(alias = "ostree_repo_export_tree_to_archive")] - //pub fn export_tree_to_archive(&self, opts: /*Ignored*/&mut RepoExportArchiveOptions, root: &RepoFile, archive: /*Unimplemented*/Option, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { + //pub fn export_tree_to_archive(&self, opts: /*Ignored*/&mut RepoExportArchiveOptions, root: &RepoFile, archive: /*Unimplemented*/Option, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_export_tree_to_archive() } //} #[cfg(any(feature = "v2017_15", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_15")))] #[doc(alias = "ostree_repo_fsck_object")] - pub fn fsck_object( - &self, - objtype: ObjectType, - sha256: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn fsck_object(&self, objtype: ObjectType, sha256: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_fsck_object( - self.to_glib_none().0, - objtype.into_glib(), - sha256.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_fsck_object(self.to_glib_none().0, objtype.into_glib(), sha256.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -368,7 +218,9 @@ impl Repo { #[doc(alias = "ostree_repo_get_bootloader")] #[doc(alias = "get_bootloader")] pub fn bootloader(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_repo_get_bootloader(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_repo_get_bootloader(self.to_glib_none().0)) + } } #[cfg(any(feature = "v2018_6", feature = "dox"))] @@ -376,13 +228,17 @@ impl Repo { #[doc(alias = "ostree_repo_get_collection_id")] #[doc(alias = "get_collection_id")] pub fn collection_id(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_repo_get_collection_id(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_repo_get_collection_id(self.to_glib_none().0)) + } } #[doc(alias = "ostree_repo_get_config")] #[doc(alias = "get_config")] pub fn config(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_repo_get_config(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_repo_get_config(self.to_glib_none().0)) + } } #[cfg(any(feature = "v2018_9", feature = "dox"))] @@ -391,9 +247,7 @@ impl Repo { #[doc(alias = "get_default_repo_finders")] pub fn default_repo_finders(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_none(ffi::ostree_repo_get_default_repo_finders( - self.to_glib_none().0, - )) + FromGlibPtrContainer::from_glib_none(ffi::ostree_repo_get_default_repo_finders(self.to_glib_none().0)) } } @@ -402,13 +256,17 @@ impl Repo { #[doc(alias = "ostree_repo_get_dfd")] #[doc(alias = "get_dfd")] pub fn dfd(&self) -> i32 { - unsafe { ffi::ostree_repo_get_dfd(self.to_glib_none().0) } + unsafe { + ffi::ostree_repo_get_dfd(self.to_glib_none().0) + } } #[doc(alias = "ostree_repo_get_disable_fsync")] #[doc(alias = "get_disable_fsync")] pub fn is_disable_fsync(&self) -> bool { - unsafe { from_glib(ffi::ostree_repo_get_disable_fsync(self.to_glib_none().0)) } + unsafe { + from_glib(ffi::ostree_repo_get_disable_fsync(self.to_glib_none().0)) + } } #[cfg(any(feature = "v2018_9", feature = "dox"))] @@ -419,68 +277,48 @@ impl Repo { unsafe { let mut out_reserved_bytes = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_get_min_free_space_bytes( - self.to_glib_none().0, - out_reserved_bytes.as_mut_ptr(), - &mut error, - ); - let out_reserved_bytes = out_reserved_bytes.assume_init(); + let is_ok = ffi::ostree_repo_get_min_free_space_bytes(self.to_glib_none().0, out_reserved_bytes.as_mut_ptr(), &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(out_reserved_bytes) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(out_reserved_bytes.assume_init()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_get_mode")] #[doc(alias = "get_mode")] pub fn mode(&self) -> RepoMode { - unsafe { from_glib(ffi::ostree_repo_get_mode(self.to_glib_none().0)) } + unsafe { + from_glib(ffi::ostree_repo_get_mode(self.to_glib_none().0)) + } } #[doc(alias = "ostree_repo_get_parent")] #[doc(alias = "get_parent")] - #[must_use] +#[must_use] pub fn parent(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_repo_get_parent(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_repo_get_parent(self.to_glib_none().0)) + } } #[doc(alias = "ostree_repo_get_path")] #[doc(alias = "get_path")] pub fn path(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_repo_get_path(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_repo_get_path(self.to_glib_none().0)) + } } #[cfg(any(feature = "v2016_5", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))] #[doc(alias = "ostree_repo_get_remote_boolean_option")] #[doc(alias = "get_remote_boolean_option")] - pub fn remote_boolean_option( - &self, - remote_name: &str, - option_name: &str, - default_value: bool, - ) -> Result { + pub fn remote_boolean_option(&self, remote_name: &str, option_name: &str, default_value: bool) -> Result { unsafe { let mut out_value = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_get_remote_boolean_option( - self.to_glib_none().0, - remote_name.to_glib_none().0, - option_name.to_glib_none().0, - default_value.into_glib(), - out_value.as_mut_ptr(), - &mut error, - ); - let out_value = out_value.assume_init(); + let is_ok = ffi::ostree_repo_get_remote_boolean_option(self.to_glib_none().0, remote_name.to_glib_none().0, option_name.to_glib_none().0, default_value.into_glib(), out_value.as_mut_ptr(), &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib(out_value)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib(out_value.assume_init())) } else { Err(from_glib_full(error)) } } } @@ -488,27 +326,13 @@ impl Repo { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))] #[doc(alias = "ostree_repo_get_remote_list_option")] #[doc(alias = "get_remote_list_option")] - pub fn remote_list_option( - &self, - remote_name: &str, - option_name: &str, - ) -> Result, glib::Error> { + pub fn remote_list_option(&self, remote_name: &str, option_name: &str) -> Result, glib::Error> { unsafe { let mut out_value = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_get_remote_list_option( - self.to_glib_none().0, - remote_name.to_glib_none().0, - option_name.to_glib_none().0, - &mut out_value, - &mut error, - ); + let is_ok = ffi::ostree_repo_get_remote_list_option(self.to_glib_none().0, remote_name.to_glib_none().0, option_name.to_glib_none().0, &mut out_value, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(FromGlibPtrContainer::from_glib_full(out_value)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(FromGlibPtrContainer::from_glib_full(out_value)) } else { Err(from_glib_full(error)) } } } @@ -516,122 +340,48 @@ impl Repo { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))] #[doc(alias = "ostree_repo_get_remote_option")] #[doc(alias = "get_remote_option")] - pub fn remote_option( - &self, - remote_name: &str, - option_name: &str, - default_value: Option<&str>, - ) -> Result { + pub fn remote_option(&self, remote_name: &str, option_name: &str, default_value: Option<&str>) -> Result { unsafe { let mut out_value = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_get_remote_option( - self.to_glib_none().0, - remote_name.to_glib_none().0, - option_name.to_glib_none().0, - default_value.to_glib_none().0, - &mut out_value, - &mut error, - ); + let is_ok = ffi::ostree_repo_get_remote_option(self.to_glib_none().0, remote_name.to_glib_none().0, option_name.to_glib_none().0, default_value.to_glib_none().0, &mut out_value, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_value)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_value)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2020_8", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_8")))] #[doc(alias = "ostree_repo_gpg_sign_data")] - pub fn gpg_sign_data( - &self, - data: &glib::Bytes, - old_signatures: &glib::Bytes, - key_id: &[&str], - homedir: Option<&str>, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn gpg_sign_data(&self, data: &glib::Bytes, old_signatures: &glib::Bytes, key_id: &[&str], homedir: Option<&str>, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_signatures = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_gpg_sign_data( - self.to_glib_none().0, - data.to_glib_none().0, - old_signatures.to_glib_none().0, - key_id.to_glib_none().0, - homedir.to_glib_none().0, - &mut out_signatures, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_gpg_sign_data(self.to_glib_none().0, data.to_glib_none().0, old_signatures.to_glib_none().0, key_id.to_glib_none().0, homedir.to_glib_none().0, &mut out_signatures, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_signatures)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_signatures)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2016_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_6")))] #[doc(alias = "ostree_repo_gpg_verify_data")] - pub fn gpg_verify_data( - &self, - remote_name: Option<&str>, - data: &glib::Bytes, - signatures: &glib::Bytes, - keyringdir: Option<&impl IsA>, - extra_keyring: Option<&impl IsA>, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn gpg_verify_data(&self, remote_name: Option<&str>, data: &glib::Bytes, signatures: &glib::Bytes, keyringdir: Option<&impl IsA>, extra_keyring: Option<&impl IsA>, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_gpg_verify_data( - self.to_glib_none().0, - remote_name.to_glib_none().0, - data.to_glib_none().0, - signatures.to_glib_none().0, - keyringdir.map(|p| p.as_ref()).to_glib_none().0, - extra_keyring.map(|p| p.as_ref()).to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_repo_gpg_verify_data(self.to_glib_none().0, remote_name.to_glib_none().0, data.to_glib_none().0, signatures.to_glib_none().0, keyringdir.map(|p| p.as_ref()).to_glib_none().0, extra_keyring.map(|p| p.as_ref()).to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_has_object")] - pub fn has_object( - &self, - objtype: ObjectType, - checksum: &str, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn has_object(&self, objtype: ObjectType, checksum: &str, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_have_object = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_has_object( - self.to_glib_none().0, - objtype.into_glib(), - checksum.to_glib_none().0, - out_have_object.as_mut_ptr(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - let out_have_object = out_have_object.assume_init(); + let is_ok = ffi::ostree_repo_has_object(self.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, out_have_object.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib(out_have_object)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib(out_have_object.assume_init())) } else { Err(from_glib_full(error)) } } } @@ -639,75 +389,43 @@ impl Repo { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_12")))] #[doc(alias = "ostree_repo_hash")] pub fn hash(&self) -> u32 { - unsafe { ffi::ostree_repo_hash(self.to_glib_none().0) } + unsafe { + ffi::ostree_repo_hash(self.to_glib_none().0) + } } //#[doc(alias = "ostree_repo_import_archive_to_mtree")] - //pub fn import_archive_to_mtree(&self, opts: /*Ignored*/&mut RepoImportArchiveOptions, archive: /*Unimplemented*/Option, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { + //pub fn import_archive_to_mtree(&self, opts: /*Ignored*/&mut RepoImportArchiveOptions, archive: /*Unimplemented*/Option, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { // unsafe { TODO: call ffi:ostree_repo_import_archive_to_mtree() } //} #[doc(alias = "ostree_repo_import_object_from")] - pub fn import_object_from( - &self, - source: &Repo, - objtype: ObjectType, - checksum: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn import_object_from(&self, source: &Repo, objtype: ObjectType, checksum: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_import_object_from( - self.to_glib_none().0, - source.to_glib_none().0, - objtype.into_glib(), - checksum.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_import_object_from(self.to_glib_none().0, source.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2016_5", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))] #[doc(alias = "ostree_repo_import_object_from_with_trust")] - pub fn import_object_from_with_trust( - &self, - source: &Repo, - objtype: ObjectType, - checksum: &str, - trusted: bool, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn import_object_from_with_trust(&self, source: &Repo, objtype: ObjectType, checksum: &str, trusted: bool, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_import_object_from_with_trust( - self.to_glib_none().0, - source.to_glib_none().0, - objtype.into_glib(), - checksum.to_glib_none().0, - trusted.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_import_object_from_with_trust(self.to_glib_none().0, source.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, trusted.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_is_system")] pub fn is_system(&self) -> bool { - unsafe { from_glib(ffi::ostree_repo_is_system(self.to_glib_none().0)) } + unsafe { + from_glib(ffi::ostree_repo_is_system(self.to_glib_none().0)) + } } #[doc(alias = "ostree_repo_is_writable")] @@ -716,11 +434,7 @@ impl Repo { let mut error = ptr::null_mut(); let is_ok = ffi::ostree_repo_is_writable(self.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -751,156 +465,72 @@ impl Repo { #[cfg(any(feature = "v2020_8", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_8")))] #[doc(alias = "ostree_repo_list_static_delta_indexes")] - pub fn list_static_delta_indexes( - &self, - cancellable: Option<&impl IsA>, - ) -> Result, glib::Error> { + pub fn list_static_delta_indexes(&self, cancellable: Option<&impl IsA>) -> Result, glib::Error> { unsafe { let mut out_indexes = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_list_static_delta_indexes( - self.to_glib_none().0, - &mut out_indexes, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_list_static_delta_indexes(self.to_glib_none().0, &mut out_indexes, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(FromGlibPtrContainer::from_glib_container(out_indexes)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(FromGlibPtrContainer::from_glib_container(out_indexes)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_list_static_delta_names")] - pub fn list_static_delta_names( - &self, - cancellable: Option<&impl IsA>, - ) -> Result, glib::Error> { + pub fn list_static_delta_names(&self, cancellable: Option<&impl IsA>) -> Result, glib::Error> { unsafe { let mut out_deltas = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_list_static_delta_names( - self.to_glib_none().0, - &mut out_deltas, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_list_static_delta_names(self.to_glib_none().0, &mut out_deltas, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(FromGlibPtrContainer::from_glib_container(out_deltas)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(FromGlibPtrContainer::from_glib_container(out_deltas)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2015_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2015_7")))] #[doc(alias = "ostree_repo_load_commit")] - pub fn load_commit( - &self, - checksum: &str, - ) -> Result<(glib::Variant, RepoCommitState), glib::Error> { + pub fn load_commit(&self, checksum: &str) -> Result<(glib::Variant, RepoCommitState), glib::Error> { unsafe { let mut out_commit = ptr::null_mut(); let mut out_state = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_load_commit( - self.to_glib_none().0, - checksum.to_glib_none().0, - &mut out_commit, - out_state.as_mut_ptr(), - &mut error, - ); - let out_state = out_state.assume_init(); + let is_ok = ffi::ostree_repo_load_commit(self.to_glib_none().0, checksum.to_glib_none().0, &mut out_commit, out_state.as_mut_ptr(), &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok((from_glib_full(out_commit), from_glib(out_state))) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok((from_glib_full(out_commit), from_glib(out_state.assume_init()))) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_load_object_stream")] - pub fn load_object_stream( - &self, - objtype: ObjectType, - checksum: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(gio::InputStream, u64), glib::Error> { + pub fn load_object_stream(&self, objtype: ObjectType, checksum: &str, cancellable: Option<&impl IsA>) -> Result<(gio::InputStream, u64), glib::Error> { unsafe { let mut out_input = ptr::null_mut(); let mut out_size = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_load_object_stream( - self.to_glib_none().0, - objtype.into_glib(), - checksum.to_glib_none().0, - &mut out_input, - out_size.as_mut_ptr(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - let out_size = out_size.assume_init(); + let is_ok = ffi::ostree_repo_load_object_stream(self.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, &mut out_input, out_size.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok((from_glib_full(out_input), out_size)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok((from_glib_full(out_input), out_size.assume_init())) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_load_variant")] - pub fn load_variant( - &self, - objtype: ObjectType, - sha256: &str, - ) -> Result { + pub fn load_variant(&self, objtype: ObjectType, sha256: &str) -> Result { unsafe { let mut out_variant = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_load_variant( - self.to_glib_none().0, - objtype.into_glib(), - sha256.to_glib_none().0, - &mut out_variant, - &mut error, - ); + let is_ok = ffi::ostree_repo_load_variant(self.to_glib_none().0, objtype.into_glib(), sha256.to_glib_none().0, &mut out_variant, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_variant)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_variant)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_load_variant_if_exists")] - pub fn load_variant_if_exists( - &self, - objtype: ObjectType, - sha256: &str, - ) -> Result, glib::Error> { + pub fn load_variant_if_exists(&self, objtype: ObjectType, sha256: &str) -> Result, glib::Error> { unsafe { let mut out_variant = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_load_variant_if_exists( - self.to_glib_none().0, - objtype.into_glib(), - sha256.to_glib_none().0, - &mut out_variant, - &mut error, - ); + let is_ok = ffi::ostree_repo_load_variant_if_exists(self.to_glib_none().0, objtype.into_glib(), sha256.to_glib_none().0, &mut out_variant, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_variant)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_variant)) } else { Err(from_glib_full(error)) } } } @@ -924,128 +554,55 @@ impl Repo { pub fn mark_commit_partial(&self, checksum: &str, is_partial: bool) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_mark_commit_partial( - self.to_glib_none().0, - checksum.to_glib_none().0, - is_partial.into_glib(), - &mut error, - ); + let is_ok = ffi::ostree_repo_mark_commit_partial(self.to_glib_none().0, checksum.to_glib_none().0, is_partial.into_glib(), &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2019_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2019_4")))] #[doc(alias = "ostree_repo_mark_commit_partial_reason")] - pub fn mark_commit_partial_reason( - &self, - checksum: &str, - is_partial: bool, - in_state: RepoCommitState, - ) -> Result<(), glib::Error> { + pub fn mark_commit_partial_reason(&self, checksum: &str, is_partial: bool, in_state: RepoCommitState) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_mark_commit_partial_reason( - self.to_glib_none().0, - checksum.to_glib_none().0, - is_partial.into_glib(), - in_state.into_glib(), - &mut error, - ); + let is_ok = ffi::ostree_repo_mark_commit_partial_reason(self.to_glib_none().0, checksum.to_glib_none().0, is_partial.into_glib(), in_state.into_glib(), &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_open")] - pub fn open( - &self, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn open(&self, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_open( - self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_open(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_prepare_transaction")] - pub fn prepare_transaction( - &self, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn prepare_transaction(&self, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_transaction_resume = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_prepare_transaction( - self.to_glib_none().0, - out_transaction_resume.as_mut_ptr(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - let out_transaction_resume = out_transaction_resume.assume_init(); + let is_ok = ffi::ostree_repo_prepare_transaction(self.to_glib_none().0, out_transaction_resume.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib(out_transaction_resume)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib(out_transaction_resume.assume_init())) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_prune")] - pub fn prune( - &self, - flags: RepoPruneFlags, - depth: i32, - cancellable: Option<&impl IsA>, - ) -> Result<(i32, i32, u64), glib::Error> { + pub fn prune(&self, flags: RepoPruneFlags, depth: i32, cancellable: Option<&impl IsA>) -> Result<(i32, i32, u64), glib::Error> { unsafe { let mut out_objects_total = mem::MaybeUninit::uninit(); let mut out_objects_pruned = mem::MaybeUninit::uninit(); let mut out_pruned_object_size_total = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_prune( - self.to_glib_none().0, - flags.into_glib(), - depth, - out_objects_total.as_mut_ptr(), - out_objects_pruned.as_mut_ptr(), - out_pruned_object_size_total.as_mut_ptr(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - let out_objects_total = out_objects_total.assume_init(); - let out_objects_pruned = out_objects_pruned.assume_init(); - let out_pruned_object_size_total = out_pruned_object_size_total.assume_init(); + let is_ok = ffi::ostree_repo_prune(self.to_glib_none().0, flags.into_glib(), depth, out_objects_total.as_mut_ptr(), out_objects_pruned.as_mut_ptr(), out_pruned_object_size_total.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(( - out_objects_total, - out_objects_pruned, - out_pruned_object_size_total, - )) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok((out_objects_total.assume_init(), out_objects_pruned.assume_init(), out_pruned_object_size_total.assume_init())) } else { Err(from_glib_full(error)) } } } @@ -1057,406 +614,167 @@ impl Repo { //} #[doc(alias = "ostree_repo_prune_static_deltas")] - pub fn prune_static_deltas( - &self, - commit: Option<&str>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn prune_static_deltas(&self, commit: Option<&str>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_prune_static_deltas( - self.to_glib_none().0, - commit.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_prune_static_deltas(self.to_glib_none().0, commit.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_pull")] - pub fn pull( - &self, - remote_name: &str, - refs_to_fetch: &[&str], - flags: RepoPullFlags, - progress: Option<&AsyncProgress>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn pull(&self, remote_name: &str, refs_to_fetch: &[&str], flags: RepoPullFlags, progress: Option<&AsyncProgress>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_pull( - self.to_glib_none().0, - remote_name.to_glib_none().0, - refs_to_fetch.to_glib_none().0, - flags.into_glib(), - progress.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_pull(self.to_glib_none().0, remote_name.to_glib_none().0, refs_to_fetch.to_glib_none().0, flags.into_glib(), progress.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_pull_one_dir")] - pub fn pull_one_dir( - &self, - remote_name: &str, - dir_to_pull: &str, - refs_to_fetch: &[&str], - flags: RepoPullFlags, - progress: Option<&AsyncProgress>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn pull_one_dir(&self, remote_name: &str, dir_to_pull: &str, refs_to_fetch: &[&str], flags: RepoPullFlags, progress: Option<&AsyncProgress>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_pull_one_dir( - self.to_glib_none().0, - remote_name.to_glib_none().0, - dir_to_pull.to_glib_none().0, - refs_to_fetch.to_glib_none().0, - flags.into_glib(), - progress.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_pull_one_dir(self.to_glib_none().0, remote_name.to_glib_none().0, dir_to_pull.to_glib_none().0, refs_to_fetch.to_glib_none().0, flags.into_glib(), progress.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_pull_with_options")] - pub fn pull_with_options( - &self, - remote_name_or_baseurl: &str, - options: &glib::Variant, - progress: Option<&AsyncProgress>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn pull_with_options(&self, remote_name_or_baseurl: &str, options: &glib::Variant, progress: Option<&AsyncProgress>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_pull_with_options( - self.to_glib_none().0, - remote_name_or_baseurl.to_glib_none().0, - options.to_glib_none().0, - progress.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_pull_with_options(self.to_glib_none().0, remote_name_or_baseurl.to_glib_none().0, options.to_glib_none().0, progress.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_query_object_storage_size")] - pub fn query_object_storage_size( - &self, - objtype: ObjectType, - sha256: &str, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn query_object_storage_size(&self, objtype: ObjectType, sha256: &str, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_size = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_query_object_storage_size( - self.to_glib_none().0, - objtype.into_glib(), - sha256.to_glib_none().0, - out_size.as_mut_ptr(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - let out_size = out_size.assume_init(); + let is_ok = ffi::ostree_repo_query_object_storage_size(self.to_glib_none().0, objtype.into_glib(), sha256.to_glib_none().0, out_size.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(out_size) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(out_size.assume_init()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_read_commit")] - pub fn read_commit( - &self, - ref_: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(gio::File, glib::GString), glib::Error> { + pub fn read_commit(&self, ref_: &str, cancellable: Option<&impl IsA>) -> Result<(gio::File, glib::GString), glib::Error> { unsafe { let mut out_root = ptr::null_mut(); let mut out_commit = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_read_commit( - self.to_glib_none().0, - ref_.to_glib_none().0, - &mut out_root, - &mut out_commit, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_read_commit(self.to_glib_none().0, ref_.to_glib_none().0, &mut out_root, &mut out_commit, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok((from_glib_full(out_root), from_glib_full(out_commit))) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok((from_glib_full(out_root), from_glib_full(out_commit))) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_read_commit_detached_metadata")] - pub fn read_commit_detached_metadata( - &self, - checksum: &str, - cancellable: Option<&impl IsA>, - ) -> Result, glib::Error> { + pub fn read_commit_detached_metadata(&self, checksum: &str, cancellable: Option<&impl IsA>) -> Result, glib::Error> { unsafe { let mut out_metadata = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_read_commit_detached_metadata( - self.to_glib_none().0, - checksum.to_glib_none().0, - &mut out_metadata, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_read_commit_detached_metadata(self.to_glib_none().0, checksum.to_glib_none().0, &mut out_metadata, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_metadata)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_metadata)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_regenerate_summary")] - pub fn regenerate_summary( - &self, - additional_metadata: Option<&glib::Variant>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn regenerate_summary(&self, additional_metadata: Option<&glib::Variant>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_regenerate_summary( - self.to_glib_none().0, - additional_metadata.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_regenerate_summary(self.to_glib_none().0, additional_metadata.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2017_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_2")))] #[doc(alias = "ostree_repo_reload_config")] - pub fn reload_config( - &self, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn reload_config(&self, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_reload_config( - self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_reload_config(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_remote_add")] - pub fn remote_add( - &self, - name: &str, - url: Option<&str>, - options: Option<&glib::Variant>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn remote_add(&self, name: &str, url: Option<&str>, options: Option<&glib::Variant>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_remote_add( - self.to_glib_none().0, - name.to_glib_none().0, - url.to_glib_none().0, - options.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_remote_add(self.to_glib_none().0, name.to_glib_none().0, url.to_glib_none().0, options.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_remote_change")] - pub fn remote_change( - &self, - sysroot: Option<&impl IsA>, - changeop: RepoRemoteChange, - name: &str, - url: Option<&str>, - options: Option<&glib::Variant>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn remote_change(&self, sysroot: Option<&impl IsA>, changeop: RepoRemoteChange, name: &str, url: Option<&str>, options: Option<&glib::Variant>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_remote_change( - self.to_glib_none().0, - sysroot.map(|p| p.as_ref()).to_glib_none().0, - changeop.into_glib(), - name.to_glib_none().0, - url.to_glib_none().0, - options.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_remote_change(self.to_glib_none().0, sysroot.map(|p| p.as_ref()).to_glib_none().0, changeop.into_glib(), name.to_glib_none().0, url.to_glib_none().0, options.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_remote_delete")] - pub fn remote_delete( - &self, - name: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn remote_delete(&self, name: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_remote_delete( - self.to_glib_none().0, - name.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_remote_delete(self.to_glib_none().0, name.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_remote_fetch_summary")] - pub fn remote_fetch_summary( - &self, - name: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(glib::Bytes, glib::Bytes), glib::Error> { + pub fn remote_fetch_summary(&self, name: &str, cancellable: Option<&impl IsA>) -> Result<(glib::Bytes, glib::Bytes), glib::Error> { unsafe { let mut out_summary = ptr::null_mut(); let mut out_signatures = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_remote_fetch_summary( - self.to_glib_none().0, - name.to_glib_none().0, - &mut out_summary, - &mut out_signatures, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_remote_fetch_summary(self.to_glib_none().0, name.to_glib_none().0, &mut out_summary, &mut out_signatures, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok((from_glib_full(out_summary), from_glib_full(out_signatures))) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok((from_glib_full(out_summary), from_glib_full(out_signatures))) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2016_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_6")))] #[doc(alias = "ostree_repo_remote_fetch_summary_with_options")] - pub fn remote_fetch_summary_with_options( - &self, - name: &str, - options: Option<&glib::Variant>, - cancellable: Option<&impl IsA>, - ) -> Result<(glib::Bytes, glib::Bytes), glib::Error> { + pub fn remote_fetch_summary_with_options(&self, name: &str, options: Option<&glib::Variant>, cancellable: Option<&impl IsA>) -> Result<(glib::Bytes, glib::Bytes), glib::Error> { unsafe { let mut out_summary = ptr::null_mut(); let mut out_signatures = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_remote_fetch_summary_with_options( - self.to_glib_none().0, - name.to_glib_none().0, - options.to_glib_none().0, - &mut out_summary, - &mut out_signatures, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_remote_fetch_summary_with_options(self.to_glib_none().0, name.to_glib_none().0, options.to_glib_none().0, &mut out_summary, &mut out_signatures, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok((from_glib_full(out_summary), from_glib_full(out_signatures))) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok((from_glib_full(out_summary), from_glib_full(out_signatures))) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2021_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_4")))] #[doc(alias = "ostree_repo_remote_get_gpg_keys")] - pub fn remote_get_gpg_keys( - &self, - name: Option<&str>, - key_ids: &[&str], - cancellable: Option<&impl IsA>, - ) -> Result, glib::Error> { + pub fn remote_get_gpg_keys(&self, name: Option<&str>, key_ids: &[&str], cancellable: Option<&impl IsA>) -> Result, glib::Error> { unsafe { let mut out_keys = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_remote_get_gpg_keys( - self.to_glib_none().0, - name.to_glib_none().0, - key_ids.to_glib_none().0, - &mut out_keys, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_remote_get_gpg_keys(self.to_glib_none().0, name.to_glib_none().0, key_ids.to_glib_none().0, &mut out_keys, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(FromGlibPtrContainer::from_glib_container(out_keys)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(FromGlibPtrContainer::from_glib_container(out_keys)) } else { Err(from_glib_full(error)) } } } @@ -1465,19 +783,9 @@ impl Repo { unsafe { let mut out_gpg_verify = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_remote_get_gpg_verify( - self.to_glib_none().0, - name.to_glib_none().0, - out_gpg_verify.as_mut_ptr(), - &mut error, - ); - let out_gpg_verify = out_gpg_verify.assume_init(); + let is_ok = ffi::ostree_repo_remote_get_gpg_verify(self.to_glib_none().0, name.to_glib_none().0, out_gpg_verify.as_mut_ptr(), &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib(out_gpg_verify)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib(out_gpg_verify.assume_init())) } else { Err(from_glib_full(error)) } } } @@ -1486,19 +794,9 @@ impl Repo { unsafe { let mut out_gpg_verify_summary = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_remote_get_gpg_verify_summary( - self.to_glib_none().0, - name.to_glib_none().0, - out_gpg_verify_summary.as_mut_ptr(), - &mut error, - ); - let out_gpg_verify_summary = out_gpg_verify_summary.assume_init(); + let is_ok = ffi::ostree_repo_remote_get_gpg_verify_summary(self.to_glib_none().0, name.to_glib_none().0, out_gpg_verify_summary.as_mut_ptr(), &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib(out_gpg_verify_summary)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib(out_gpg_verify_summary.assume_init())) } else { Err(from_glib_full(error)) } } } @@ -1507,48 +805,20 @@ impl Repo { unsafe { let mut out_url = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_remote_get_url( - self.to_glib_none().0, - name.to_glib_none().0, - &mut out_url, - &mut error, - ); + let is_ok = ffi::ostree_repo_remote_get_url(self.to_glib_none().0, name.to_glib_none().0, &mut out_url, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_url)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_url)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_remote_gpg_import")] - pub fn remote_gpg_import( - &self, - name: &str, - source_stream: Option<&impl IsA>, - key_ids: &[&str], - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn remote_gpg_import(&self, name: &str, source_stream: Option<&impl IsA>, key_ids: &[&str], cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_imported = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_remote_gpg_import( - self.to_glib_none().0, - name.to_glib_none().0, - source_stream.map(|p| p.as_ref()).to_glib_none().0, - key_ids.to_glib_none().0, - out_imported.as_mut_ptr(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - let out_imported = out_imported.assume_init(); + let is_ok = ffi::ostree_repo_remote_gpg_import(self.to_glib_none().0, name.to_glib_none().0, source_stream.map(|p| p.as_ref()).to_glib_none().0, key_ids.to_glib_none().0, out_imported.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(out_imported) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(out_imported.assume_init()) } else { Err(from_glib_full(error)) } } } @@ -1556,10 +826,7 @@ impl Repo { pub fn remote_list(&self) -> Vec { unsafe { let mut out_n_remotes = mem::MaybeUninit::uninit(); - let ret = FromGlibContainer::from_glib_full_num( - ffi::ostree_repo_remote_list(self.to_glib_none().0, out_n_remotes.as_mut_ptr()), - out_n_remotes.assume_init() as usize, - ); + let ret = FromGlibContainer::from_glib_full_num(ffi::ostree_repo_remote_list(self.to_glib_none().0, out_n_remotes.as_mut_ptr()), out_n_remotes.assume_init() as _); ret } } @@ -1579,186 +846,82 @@ impl Repo { #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_resolve_collection_ref")] - pub fn resolve_collection_ref( - &self, - ref_: &CollectionRef, - allow_noent: bool, - flags: RepoResolveRevExtFlags, - cancellable: Option<&impl IsA>, - ) -> Result, glib::Error> { + pub fn resolve_collection_ref(&self, ref_: &CollectionRef, allow_noent: bool, flags: RepoResolveRevExtFlags, cancellable: Option<&impl IsA>) -> Result, glib::Error> { unsafe { let mut out_rev = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_resolve_collection_ref( - self.to_glib_none().0, - ref_.to_glib_none().0, - allow_noent.into_glib(), - flags.into_glib(), - &mut out_rev, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_resolve_collection_ref(self.to_glib_none().0, ref_.to_glib_none().0, allow_noent.into_glib(), flags.into_glib(), &mut out_rev, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_rev)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_rev)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_resolve_keyring_for_collection")] - pub fn resolve_keyring_for_collection( - &self, - collection_id: &str, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn resolve_keyring_for_collection(&self, collection_id: &str, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_resolve_keyring_for_collection( - self.to_glib_none().0, - collection_id.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_repo_resolve_keyring_for_collection(self.to_glib_none().0, collection_id.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_resolve_rev")] - pub fn resolve_rev( - &self, - refspec: &str, - allow_noent: bool, - ) -> Result, glib::Error> { + pub fn resolve_rev(&self, refspec: &str, allow_noent: bool) -> Result, glib::Error> { unsafe { let mut out_rev = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_resolve_rev( - self.to_glib_none().0, - refspec.to_glib_none().0, - allow_noent.into_glib(), - &mut out_rev, - &mut error, - ); + let is_ok = ffi::ostree_repo_resolve_rev(self.to_glib_none().0, refspec.to_glib_none().0, allow_noent.into_glib(), &mut out_rev, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_rev)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_rev)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2016_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_7")))] #[doc(alias = "ostree_repo_resolve_rev_ext")] - pub fn resolve_rev_ext( - &self, - refspec: &str, - allow_noent: bool, - flags: RepoResolveRevExtFlags, - ) -> Result, glib::Error> { + pub fn resolve_rev_ext(&self, refspec: &str, allow_noent: bool, flags: RepoResolveRevExtFlags) -> Result, glib::Error> { unsafe { let mut out_rev = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_resolve_rev_ext( - self.to_glib_none().0, - refspec.to_glib_none().0, - allow_noent.into_glib(), - flags.into_glib(), - &mut out_rev, - &mut error, - ); + let is_ok = ffi::ostree_repo_resolve_rev_ext(self.to_glib_none().0, refspec.to_glib_none().0, allow_noent.into_glib(), flags.into_glib(), &mut out_rev, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_rev)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_rev)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_scan_hardlinks")] - pub fn scan_hardlinks( - &self, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn scan_hardlinks(&self, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_scan_hardlinks( - self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_scan_hardlinks(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2017_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))] #[doc(alias = "ostree_repo_set_alias_ref_immediate")] - pub fn set_alias_ref_immediate( - &self, - remote: Option<&str>, - ref_: &str, - target: Option<&str>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn set_alias_ref_immediate(&self, remote: Option<&str>, ref_: &str, target: Option<&str>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_set_alias_ref_immediate( - self.to_glib_none().0, - remote.to_glib_none().0, - ref_.to_glib_none().0, - target.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_set_alias_ref_immediate(self.to_glib_none().0, remote.to_glib_none().0, ref_.to_glib_none().0, target.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2016_5", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_5")))] #[doc(alias = "ostree_repo_set_cache_dir")] - pub fn set_cache_dir( - &self, - dfd: i32, - path: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn set_cache_dir(&self, dfd: i32, path: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_set_cache_dir( - self.to_glib_none().0, - dfd, - path.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_set_cache_dir(self.to_glib_none().0, dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -1768,44 +931,21 @@ impl Repo { pub fn set_collection_id(&self, collection_id: Option<&str>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_set_collection_id( - self.to_glib_none().0, - collection_id.to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_set_collection_id(self.to_glib_none().0, collection_id.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_set_collection_ref_immediate")] - pub fn set_collection_ref_immediate( - &self, - ref_: &CollectionRef, - checksum: Option<&str>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn set_collection_ref_immediate(&self, ref_: &CollectionRef, checksum: Option<&str>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_set_collection_ref_immediate( - self.to_glib_none().0, - ref_.to_glib_none().0, - checksum.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_set_collection_ref_immediate(self.to_glib_none().0, ref_.to_glib_none().0, checksum.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -1817,201 +957,77 @@ impl Repo { } #[doc(alias = "ostree_repo_set_ref_immediate")] - pub fn set_ref_immediate( - &self, - remote: Option<&str>, - ref_: &str, - checksum: Option<&str>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn set_ref_immediate(&self, remote: Option<&str>, ref_: &str, checksum: Option<&str>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_set_ref_immediate( - self.to_glib_none().0, - remote.to_glib_none().0, - ref_.to_glib_none().0, - checksum.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_set_ref_immediate(self.to_glib_none().0, remote.to_glib_none().0, ref_.to_glib_none().0, checksum.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_sign_commit")] - pub fn sign_commit( - &self, - commit_checksum: &str, - key_id: &str, - homedir: Option<&str>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn sign_commit(&self, commit_checksum: &str, key_id: &str, homedir: Option<&str>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_sign_commit( - self.to_glib_none().0, - commit_checksum.to_glib_none().0, - key_id.to_glib_none().0, - homedir.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_sign_commit(self.to_glib_none().0, commit_checksum.to_glib_none().0, key_id.to_glib_none().0, homedir.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_sign_delta")] - pub fn sign_delta( - &self, - from_commit: &str, - to_commit: &str, - key_id: &str, - homedir: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn sign_delta(&self, from_commit: &str, to_commit: &str, key_id: &str, homedir: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_sign_delta( - self.to_glib_none().0, - from_commit.to_glib_none().0, - to_commit.to_glib_none().0, - key_id.to_glib_none().0, - homedir.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_sign_delta(self.to_glib_none().0, from_commit.to_glib_none().0, to_commit.to_glib_none().0, key_id.to_glib_none().0, homedir.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2021_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_4")))] #[doc(alias = "ostree_repo_signature_verify_commit_data")] - pub fn signature_verify_commit_data( - &self, - remote_name: &str, - commit_data: &glib::Bytes, - commit_metadata: &glib::Bytes, - flags: RepoVerifyFlags, - ) -> Result, glib::Error> { + pub fn signature_verify_commit_data(&self, remote_name: &str, commit_data: &glib::Bytes, commit_metadata: &glib::Bytes, flags: RepoVerifyFlags) -> Result, glib::Error> { unsafe { let mut out_results = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_signature_verify_commit_data( - self.to_glib_none().0, - remote_name.to_glib_none().0, - commit_data.to_glib_none().0, - commit_metadata.to_glib_none().0, - flags.into_glib(), - &mut out_results, - &mut error, - ); + let is_ok = ffi::ostree_repo_signature_verify_commit_data(self.to_glib_none().0, remote_name.to_glib_none().0, commit_data.to_glib_none().0, commit_metadata.to_glib_none().0, flags.into_glib(), &mut out_results, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_results)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_results)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_static_delta_execute_offline")] - pub fn static_delta_execute_offline( - &self, - dir_or_file: &impl IsA, - skip_validation: bool, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn static_delta_execute_offline(&self, dir_or_file: &impl IsA, skip_validation: bool, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_static_delta_execute_offline( - self.to_glib_none().0, - dir_or_file.as_ref().to_glib_none().0, - skip_validation.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_static_delta_execute_offline(self.to_glib_none().0, dir_or_file.as_ref().to_glib_none().0, skip_validation.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2020_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))] #[doc(alias = "ostree_repo_static_delta_execute_offline_with_signature")] - pub fn static_delta_execute_offline_with_signature( - &self, - dir_or_file: &impl IsA, - sign: &impl IsA, - skip_validation: bool, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn static_delta_execute_offline_with_signature(&self, dir_or_file: &impl IsA, sign: &impl IsA, skip_validation: bool, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_static_delta_execute_offline_with_signature( - self.to_glib_none().0, - dir_or_file.as_ref().to_glib_none().0, - sign.as_ref().to_glib_none().0, - skip_validation.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_static_delta_execute_offline_with_signature(self.to_glib_none().0, dir_or_file.as_ref().to_glib_none().0, sign.as_ref().to_glib_none().0, skip_validation.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_static_delta_generate")] - pub fn static_delta_generate( - &self, - opt: StaticDeltaGenerateOpt, - from: Option<&str>, - to: &str, - metadata: Option<&glib::Variant>, - params: Option<&glib::Variant>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn static_delta_generate(&self, opt: StaticDeltaGenerateOpt, from: Option<&str>, to: &str, metadata: Option<&glib::Variant>, params: Option<&glib::Variant>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_static_delta_generate( - self.to_glib_none().0, - opt.into_glib(), - from.to_glib_none().0, - to.to_glib_none().0, - metadata.to_glib_none().0, - params.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_static_delta_generate(self.to_glib_none().0, opt.into_glib(), from.to_glib_none().0, to.to_glib_none().0, metadata.to_glib_none().0, params.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -2025,27 +1041,13 @@ impl Repo { #[cfg(any(feature = "v2020_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))] #[doc(alias = "ostree_repo_static_delta_verify_signature")] - pub fn static_delta_verify_signature( - &self, - delta_id: &str, - sign: &impl IsA, - ) -> Result, glib::Error> { + pub fn static_delta_verify_signature(&self, delta_id: &str, sign: &impl IsA) -> Result, glib::Error> { unsafe { let mut out_success_message = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_static_delta_verify_signature( - self.to_glib_none().0, - delta_id.to_glib_none().0, - sign.as_ref().to_glib_none().0, - &mut out_success_message, - &mut error, - ); + let is_ok = ffi::ostree_repo_static_delta_verify_signature(self.to_glib_none().0, delta_id.to_glib_none().0, sign.as_ref().to_glib_none().0, &mut out_success_message, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_success_message)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_success_message)) } else { Err(from_glib_full(error)) } } } @@ -2054,34 +1056,21 @@ impl Repo { #[doc(alias = "ostree_repo_transaction_set_collection_ref")] pub fn transaction_set_collection_ref(&self, ref_: &CollectionRef, checksum: Option<&str>) { unsafe { - ffi::ostree_repo_transaction_set_collection_ref( - self.to_glib_none().0, - ref_.to_glib_none().0, - checksum.to_glib_none().0, - ); + ffi::ostree_repo_transaction_set_collection_ref(self.to_glib_none().0, ref_.to_glib_none().0, checksum.to_glib_none().0); } } #[doc(alias = "ostree_repo_transaction_set_ref")] pub fn transaction_set_ref(&self, remote: Option<&str>, ref_: &str, checksum: Option<&str>) { unsafe { - ffi::ostree_repo_transaction_set_ref( - self.to_glib_none().0, - remote.to_glib_none().0, - ref_.to_glib_none().0, - checksum.to_glib_none().0, - ); + ffi::ostree_repo_transaction_set_ref(self.to_glib_none().0, remote.to_glib_none().0, ref_.to_glib_none().0, checksum.to_glib_none().0); } } #[doc(alias = "ostree_repo_transaction_set_refspec")] pub fn transaction_set_refspec(&self, refspec: &str, checksum: Option<&str>) { unsafe { - ffi::ostree_repo_transaction_set_refspec( - self.to_glib_none().0, - refspec.to_glib_none().0, - checksum.to_glib_none().0, - ); + ffi::ostree_repo_transaction_set_refspec(self.to_glib_none().0, refspec.to_glib_none().0, checksum.to_glib_none().0); } } @@ -2117,258 +1106,93 @@ impl Repo { //} #[doc(alias = "ostree_repo_verify_commit")] - pub fn verify_commit( - &self, - commit_checksum: &str, - keyringdir: Option<&impl IsA>, - extra_keyring: Option<&impl IsA>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn verify_commit(&self, commit_checksum: &str, keyringdir: Option<&impl IsA>, extra_keyring: Option<&impl IsA>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_verify_commit( - self.to_glib_none().0, - commit_checksum.to_glib_none().0, - keyringdir.map(|p| p.as_ref()).to_glib_none().0, - extra_keyring.map(|p| p.as_ref()).to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_verify_commit(self.to_glib_none().0, commit_checksum.to_glib_none().0, keyringdir.map(|p| p.as_ref()).to_glib_none().0, extra_keyring.map(|p| p.as_ref()).to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_verify_commit_ext")] - pub fn verify_commit_ext( - &self, - commit_checksum: &str, - keyringdir: Option<&impl IsA>, - extra_keyring: Option<&impl IsA>, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn verify_commit_ext(&self, commit_checksum: &str, keyringdir: Option<&impl IsA>, extra_keyring: Option<&impl IsA>, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_verify_commit_ext( - self.to_glib_none().0, - commit_checksum.to_glib_none().0, - keyringdir.map(|p| p.as_ref()).to_glib_none().0, - extra_keyring.map(|p| p.as_ref()).to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_repo_verify_commit_ext(self.to_glib_none().0, commit_checksum.to_glib_none().0, keyringdir.map(|p| p.as_ref()).to_glib_none().0, extra_keyring.map(|p| p.as_ref()).to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2016_14", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_14")))] #[doc(alias = "ostree_repo_verify_commit_for_remote")] - pub fn verify_commit_for_remote( - &self, - commit_checksum: &str, - remote_name: &str, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn verify_commit_for_remote(&self, commit_checksum: &str, remote_name: &str, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_verify_commit_for_remote( - self.to_glib_none().0, - commit_checksum.to_glib_none().0, - remote_name.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_repo_verify_commit_for_remote(self.to_glib_none().0, commit_checksum.to_glib_none().0, remote_name.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_verify_summary")] - pub fn verify_summary( - &self, - remote_name: &str, - summary: &glib::Bytes, - signatures: &glib::Bytes, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn verify_summary(&self, remote_name: &str, summary: &glib::Bytes, signatures: &glib::Bytes, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_verify_summary( - self.to_glib_none().0, - remote_name.to_glib_none().0, - summary.to_glib_none().0, - signatures.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_repo_verify_summary(self.to_glib_none().0, remote_name.to_glib_none().0, summary.to_glib_none().0, signatures.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_write_archive_to_mtree")] - pub fn write_archive_to_mtree( - &self, - archive: &impl IsA, - mtree: &MutableTree, - modifier: Option<&RepoCommitModifier>, - autocreate_parents: bool, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn write_archive_to_mtree(&self, archive: &impl IsA, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, autocreate_parents: bool, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_write_archive_to_mtree( - self.to_glib_none().0, - archive.as_ref().to_glib_none().0, - mtree.to_glib_none().0, - modifier.to_glib_none().0, - autocreate_parents.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_write_archive_to_mtree(self.to_glib_none().0, archive.as_ref().to_glib_none().0, mtree.to_glib_none().0, modifier.to_glib_none().0, autocreate_parents.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_write_archive_to_mtree_from_fd")] - pub fn write_archive_to_mtree_from_fd( - &self, - fd: i32, - mtree: &MutableTree, - modifier: Option<&RepoCommitModifier>, - autocreate_parents: bool, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn write_archive_to_mtree_from_fd(&self, fd: i32, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, autocreate_parents: bool, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_write_archive_to_mtree_from_fd( - self.to_glib_none().0, - fd, - mtree.to_glib_none().0, - modifier.to_glib_none().0, - autocreate_parents.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_write_archive_to_mtree_from_fd(self.to_glib_none().0, fd, mtree.to_glib_none().0, modifier.to_glib_none().0, autocreate_parents.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_write_commit")] - pub fn write_commit( - &self, - parent: Option<&str>, - subject: Option<&str>, - body: Option<&str>, - metadata: Option<&glib::Variant>, - root: &RepoFile, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn write_commit(&self, parent: Option<&str>, subject: Option<&str>, body: Option<&str>, metadata: Option<&glib::Variant>, root: &RepoFile, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_commit = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_write_commit( - self.to_glib_none().0, - parent.to_glib_none().0, - subject.to_glib_none().0, - body.to_glib_none().0, - metadata.to_glib_none().0, - root.to_glib_none().0, - &mut out_commit, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_write_commit(self.to_glib_none().0, parent.to_glib_none().0, subject.to_glib_none().0, body.to_glib_none().0, metadata.to_glib_none().0, root.to_glib_none().0, &mut out_commit, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_commit)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_commit)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_write_commit_detached_metadata")] - pub fn write_commit_detached_metadata( - &self, - checksum: &str, - metadata: Option<&glib::Variant>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn write_commit_detached_metadata(&self, checksum: &str, metadata: Option<&glib::Variant>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_write_commit_detached_metadata( - self.to_glib_none().0, - checksum.to_glib_none().0, - metadata.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_write_commit_detached_metadata(self.to_glib_none().0, checksum.to_glib_none().0, metadata.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_write_commit_with_time")] - pub fn write_commit_with_time( - &self, - parent: Option<&str>, - subject: Option<&str>, - body: Option<&str>, - metadata: Option<&glib::Variant>, - root: &RepoFile, - time: u64, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn write_commit_with_time(&self, parent: Option<&str>, subject: Option<&str>, body: Option<&str>, metadata: Option<&glib::Variant>, root: &RepoFile, time: u64, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_commit = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_write_commit_with_time( - self.to_glib_none().0, - parent.to_glib_none().0, - subject.to_glib_none().0, - body.to_glib_none().0, - metadata.to_glib_none().0, - root.to_glib_none().0, - time, - &mut out_commit, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_write_commit_with_time(self.to_glib_none().0, parent.to_glib_none().0, subject.to_glib_none().0, body.to_glib_none().0, metadata.to_glib_none().0, root.to_glib_none().0, time, &mut out_commit, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_commit)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_commit)) } else { Err(from_glib_full(error)) } } } @@ -2376,281 +1200,104 @@ impl Repo { pub fn write_config(&self, new_config: &glib::KeyFile) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_write_config( - self.to_glib_none().0, - new_config.to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_write_config(self.to_glib_none().0, new_config.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_write_content_trusted")] - pub fn write_content_trusted( - &self, - checksum: &str, - object_input: &impl IsA, - length: u64, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn write_content_trusted(&self, checksum: &str, object_input: &impl IsA, length: u64, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_write_content_trusted( - self.to_glib_none().0, - checksum.to_glib_none().0, - object_input.as_ref().to_glib_none().0, - length, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_write_content_trusted(self.to_glib_none().0, checksum.to_glib_none().0, object_input.as_ref().to_glib_none().0, length, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_write_dfd_to_mtree")] - pub fn write_dfd_to_mtree( - &self, - dfd: i32, - path: &str, - mtree: &MutableTree, - modifier: Option<&RepoCommitModifier>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn write_dfd_to_mtree(&self, dfd: i32, path: &str, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_write_dfd_to_mtree( - self.to_glib_none().0, - dfd, - path.to_glib_none().0, - mtree.to_glib_none().0, - modifier.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_write_dfd_to_mtree(self.to_glib_none().0, dfd, path.to_glib_none().0, mtree.to_glib_none().0, modifier.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_write_directory_to_mtree")] - pub fn write_directory_to_mtree( - &self, - dir: &impl IsA, - mtree: &MutableTree, - modifier: Option<&RepoCommitModifier>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn write_directory_to_mtree(&self, dir: &impl IsA, mtree: &MutableTree, modifier: Option<&RepoCommitModifier>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_write_directory_to_mtree( - self.to_glib_none().0, - dir.as_ref().to_glib_none().0, - mtree.to_glib_none().0, - modifier.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_write_directory_to_mtree(self.to_glib_none().0, dir.as_ref().to_glib_none().0, mtree.to_glib_none().0, modifier.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_write_metadata_stream_trusted")] - pub fn write_metadata_stream_trusted( - &self, - objtype: ObjectType, - checksum: &str, - object_input: &impl IsA, - length: u64, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn write_metadata_stream_trusted(&self, objtype: ObjectType, checksum: &str, object_input: &impl IsA, length: u64, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_write_metadata_stream_trusted( - self.to_glib_none().0, - objtype.into_glib(), - checksum.to_glib_none().0, - object_input.as_ref().to_glib_none().0, - length, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_write_metadata_stream_trusted(self.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, object_input.as_ref().to_glib_none().0, length, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_write_metadata_trusted")] - pub fn write_metadata_trusted( - &self, - objtype: ObjectType, - checksum: &str, - variant: &glib::Variant, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn write_metadata_trusted(&self, objtype: ObjectType, checksum: &str, variant: &glib::Variant, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_write_metadata_trusted( - self.to_glib_none().0, - objtype.into_glib(), - checksum.to_glib_none().0, - variant.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_write_metadata_trusted(self.to_glib_none().0, objtype.into_glib(), checksum.to_glib_none().0, variant.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_write_mtree")] - pub fn write_mtree( - &self, - mtree: &MutableTree, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn write_mtree(&self, mtree: &MutableTree, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_file = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_write_mtree( - self.to_glib_none().0, - mtree.to_glib_none().0, - &mut out_file, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_write_mtree(self.to_glib_none().0, mtree.to_glib_none().0, &mut out_file, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_file)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_file)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2021_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_2")))] #[doc(alias = "ostree_repo_write_regfile")] - pub fn write_regfile( - &self, - expected_checksum: Option<&str>, - uid: u32, - gid: u32, - mode: u32, - content_len: u64, - xattrs: Option<&glib::Variant>, - ) -> Result { + pub fn write_regfile(&self, expected_checksum: Option<&str>, uid: u32, gid: u32, mode: u32, content_len: u64, xattrs: Option<&glib::Variant>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_write_regfile( - self.to_glib_none().0, - expected_checksum.to_glib_none().0, - uid, - gid, - mode, - content_len, - xattrs.to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_repo_write_regfile(self.to_glib_none().0, expected_checksum.to_glib_none().0, uid, gid, mode, content_len, xattrs.to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2021_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_2")))] #[doc(alias = "ostree_repo_write_regfile_inline")] - pub fn write_regfile_inline( - &self, - expected_checksum: Option<&str>, - uid: u32, - gid: u32, - mode: u32, - xattrs: Option<&glib::Variant>, - buf: &[u8], - cancellable: Option<&impl IsA>, - ) -> Result { - let len = buf.len() as usize; + pub fn write_regfile_inline(&self, expected_checksum: Option<&str>, uid: u32, gid: u32, mode: u32, xattrs: Option<&glib::Variant>, buf: &[u8], cancellable: Option<&impl IsA>) -> Result { + let len = buf.len() as _; unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_write_regfile_inline( - self.to_glib_none().0, - expected_checksum.to_glib_none().0, - uid, - gid, - mode, - xattrs.to_glib_none().0, - buf.to_glib_none().0, - len, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_repo_write_regfile_inline(self.to_glib_none().0, expected_checksum.to_glib_none().0, uid, gid, mode, xattrs.to_glib_none().0, buf.to_glib_none().0, len, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2021_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2021_2")))] #[doc(alias = "ostree_repo_write_symlink")] - pub fn write_symlink( - &self, - expected_checksum: Option<&str>, - uid: u32, - gid: u32, - xattrs: Option<&glib::Variant>, - symlink_target: &str, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn write_symlink(&self, expected_checksum: Option<&str>, uid: u32, gid: u32, xattrs: Option<&glib::Variant>, symlink_target: &str, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_write_symlink( - self.to_glib_none().0, - expected_checksum.to_glib_none().0, - uid, - gid, - xattrs.to_glib_none().0, - symlink_target.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_repo_write_symlink(self.to_glib_none().0, expected_checksum.to_glib_none().0, uid, gid, xattrs.to_glib_none().0, symlink_target.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } @@ -2667,28 +1314,11 @@ impl Repo { #[cfg(any(feature = "v2017_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))] #[doc(alias = "ostree_repo_create_at")] - pub fn create_at( - dfd: i32, - path: &str, - mode: RepoMode, - options: Option<&glib::Variant>, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn create_at(dfd: i32, path: &str, mode: RepoMode, options: Option<&glib::Variant>, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_create_at( - dfd, - path.to_glib_none().0, - mode.into_glib(), - options.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_repo_create_at(dfd, path.to_glib_none().0, mode.into_glib(), options.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } @@ -2697,47 +1327,25 @@ impl Repo { unsafe { let mut out_mode = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_mode_from_string( - mode.to_glib_none().0, - out_mode.as_mut_ptr(), - &mut error, - ); - let out_mode = out_mode.assume_init(); + let is_ok = ffi::ostree_repo_mode_from_string(mode.to_glib_none().0, out_mode.as_mut_ptr(), &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib(out_mode)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib(out_mode.assume_init())) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2017_10", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))] #[doc(alias = "ostree_repo_open_at")] - pub fn open_at( - dfd: i32, - path: &str, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn open_at(dfd: i32, path: &str, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_repo_open_at( - dfd, - path.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_repo_open_at(dfd, path.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } //#[doc(alias = "ostree_repo_pull_default_console_progress_changed")] - //pub fn pull_default_console_progress_changed(progress: &AsyncProgress, user_data: /*Unimplemented*/Option) { + //pub fn pull_default_console_progress_changed(progress: &AsyncProgress, user_data: /*Unimplemented*/Option) { // unsafe { TODO: call ffi:ostree_repo_pull_default_console_progress_changed() } //} @@ -2761,35 +1369,15 @@ impl Repo { //} #[doc(alias = "gpg-verify-result")] - pub fn connect_gpg_verify_result( - &self, - f: F, - ) -> SignalHandlerId { - unsafe extern "C" fn gpg_verify_result_trampoline< - F: Fn(&Repo, &str, &GpgVerifyResult) + Send + 'static, - >( - this: *mut ffi::OstreeRepo, - checksum: *mut libc::c_char, - result: *mut ffi::OstreeGpgVerifyResult, - f: glib::ffi::gpointer, - ) { + pub fn connect_gpg_verify_result(&self, f: F) -> SignalHandlerId { + unsafe extern "C" fn gpg_verify_result_trampoline(this: *mut ffi::OstreeRepo, checksum: *mut libc::c_char, result: *mut ffi::OstreeGpgVerifyResult, f: glib::ffi::gpointer) { let f: &F = &*(f as *const F); - f( - &from_glib_borrow(this), - &glib::GString::from_glib_borrow(checksum), - &from_glib_borrow(result), - ) + f(&from_glib_borrow(this), &glib::GString::from_glib_borrow(checksum), &from_glib_borrow(result)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"gpg-verify-result\0".as_ptr() as *const _, - Some(transmute::<_, unsafe extern "C" fn()>( - gpg_verify_result_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) + connect_raw(self.as_ptr() as *mut _, b"gpg-verify-result\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>(gpg_verify_result_trampoline:: as *const ())), Box_::into_raw(f)) } } } diff --git a/rust-bindings/src/auto/repo_commit_modifier.rs b/rust-bindings/src/auto/repo_commit_modifier.rs index 75504434..7179c48b 100644 --- a/rust-bindings/src/auto/repo_commit_modifier.rs +++ b/rust-bindings/src/auto/repo_commit_modifier.rs @@ -31,27 +31,13 @@ glib::wrapper! { impl RepoCommitModifier { #[doc(alias = "ostree_repo_commit_modifier_new")] - pub fn new( - flags: RepoCommitModifierFlags, - commit_filter: Option< - Box_ RepoCommitFilterResult + 'static>, - >, - ) -> RepoCommitModifier { - let commit_filter_data: Box_< - Option RepoCommitFilterResult + 'static>>, - > = Box_::new(commit_filter); - unsafe extern "C" fn commit_filter_func( - repo: *mut ffi::OstreeRepo, - path: *const libc::c_char, - file_info: *mut gio::ffi::GFileInfo, - user_data: glib::ffi::gpointer, - ) -> ffi::OstreeRepoCommitFilterResult { + pub fn new(flags: RepoCommitModifierFlags, commit_filter: Option RepoCommitFilterResult + 'static>>) -> RepoCommitModifier { + let commit_filter_data: Box_ RepoCommitFilterResult + 'static>>> = Box_::new(commit_filter); + unsafe extern "C" fn commit_filter_func(repo: *mut ffi::OstreeRepo, path: *const libc::c_char, file_info: *mut gio::ffi::GFileInfo, user_data: glib::ffi::gpointer) -> ffi::OstreeRepoCommitFilterResult { let repo = from_glib_borrow(repo); let path: Borrowed = from_glib_borrow(path); let file_info = from_glib_borrow(file_info); - let callback: &Option< - Box_ RepoCommitFilterResult + 'static>, - > = &*(user_data as *mut _); + let callback: &Option RepoCommitFilterResult + 'static>> = &*(user_data as *mut _); let res = if let Some(ref callback) = *callback { callback(&repo, path.as_str(), &file_info) } else { @@ -59,29 +45,14 @@ impl RepoCommitModifier { }; res.into_glib() } - let commit_filter = if commit_filter_data.is_some() { - Some(commit_filter_func as _) - } else { - None - }; + let commit_filter = if commit_filter_data.is_some() { Some(commit_filter_func as _) } else { None }; unsafe extern "C" fn destroy_notify_func(data: glib::ffi::gpointer) { - let _callback: Box_< - Option< - Box_ RepoCommitFilterResult + 'static>, - >, - > = Box_::from_raw(data as *mut _); + let _callback: Box_ RepoCommitFilterResult + 'static>>> = Box_::from_raw(data as *mut _); } let destroy_call3 = Some(destroy_notify_func as _); - let super_callback0: Box_< - Option RepoCommitFilterResult + 'static>>, - > = commit_filter_data; + let super_callback0: Box_ RepoCommitFilterResult + 'static>>> = commit_filter_data; unsafe { - from_glib_full(ffi::ostree_repo_commit_modifier_new( - flags.into_glib(), - commit_filter, - Box_::into_raw(super_callback0) as *mut _, - destroy_call3, - )) + from_glib_full(ffi::ostree_repo_commit_modifier_new(flags.into_glib(), commit_filter, Box_::into_raw(super_callback0) as *mut _, destroy_call3)) } } @@ -90,64 +61,33 @@ impl RepoCommitModifier { #[doc(alias = "ostree_repo_commit_modifier_set_devino_cache")] pub fn set_devino_cache(&self, cache: &RepoDevInoCache) { unsafe { - ffi::ostree_repo_commit_modifier_set_devino_cache( - self.to_glib_none().0, - cache.to_glib_none().0, - ); + ffi::ostree_repo_commit_modifier_set_devino_cache(self.to_glib_none().0, cache.to_glib_none().0); } } #[doc(alias = "ostree_repo_commit_modifier_set_sepolicy")] pub fn set_sepolicy(&self, sepolicy: Option<&SePolicy>) { unsafe { - ffi::ostree_repo_commit_modifier_set_sepolicy( - self.to_glib_none().0, - sepolicy.to_glib_none().0, - ); + ffi::ostree_repo_commit_modifier_set_sepolicy(self.to_glib_none().0, sepolicy.to_glib_none().0); } } #[cfg(any(feature = "v2020_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_4")))] #[doc(alias = "ostree_repo_commit_modifier_set_sepolicy_from_commit")] - pub fn set_sepolicy_from_commit( - &self, - repo: &Repo, - rev: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn set_sepolicy_from_commit(&self, repo: &Repo, rev: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_commit_modifier_set_sepolicy_from_commit( - self.to_glib_none().0, - repo.to_glib_none().0, - rev.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_commit_modifier_set_sepolicy_from_commit(self.to_glib_none().0, repo.to_glib_none().0, rev.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_commit_modifier_set_xattr_callback")] - pub fn set_xattr_callback glib::Variant + 'static>( - &self, - callback: P, - ) { + pub fn set_xattr_callback glib::Variant + 'static>(&self, callback: P) { let callback_data: Box_

= Box_::new(callback); - unsafe extern "C" fn callback_func< - P: Fn(&Repo, &str, &gio::FileInfo) -> glib::Variant + 'static, - >( - repo: *mut ffi::OstreeRepo, - path: *const libc::c_char, - file_info: *mut gio::ffi::GFileInfo, - user_data: glib::ffi::gpointer, - ) -> *mut glib::ffi::GVariant { + unsafe extern "C" fn callback_func glib::Variant + 'static>(repo: *mut ffi::OstreeRepo, path: *const libc::c_char, file_info: *mut gio::ffi::GFileInfo, user_data: glib::ffi::gpointer) -> *mut glib::ffi::GVariant { let repo = from_glib_borrow(repo); let path: Borrowed = from_glib_borrow(path); let file_info = from_glib_borrow(file_info); @@ -156,22 +96,13 @@ impl RepoCommitModifier { res.to_glib_full() } let callback = Some(callback_func::

as _); - unsafe extern "C" fn destroy_func< - P: Fn(&Repo, &str, &gio::FileInfo) -> glib::Variant + 'static, - >( - data: glib::ffi::gpointer, - ) { + unsafe extern "C" fn destroy_func glib::Variant + 'static>(data: glib::ffi::gpointer) { let _callback: Box_

= Box_::from_raw(data as *mut _); } let destroy_call2 = Some(destroy_func::

as _); let super_callback0: Box_

= callback_data; unsafe { - ffi::ostree_repo_commit_modifier_set_xattr_callback( - self.to_glib_none().0, - callback, - destroy_call2, - Box_::into_raw(super_callback0) as *mut _, - ); + ffi::ostree_repo_commit_modifier_set_xattr_callback(self.to_glib_none().0, callback, destroy_call2, Box_::into_raw(super_callback0) as *mut _); } } } diff --git a/rust-bindings/src/auto/repo_dev_ino_cache.rs b/rust-bindings/src/auto/repo_dev_ino_cache.rs index fbba9189..13881473 100644 --- a/rust-bindings/src/auto/repo_dev_ino_cache.rs +++ b/rust-bindings/src/auto/repo_dev_ino_cache.rs @@ -18,12 +18,14 @@ glib::wrapper! { impl RepoDevInoCache { #[doc(alias = "ostree_repo_devino_cache_new")] pub fn new() -> RepoDevInoCache { - unsafe { from_glib_full(ffi::ostree_repo_devino_cache_new()) } + unsafe { + from_glib_full(ffi::ostree_repo_devino_cache_new()) + } } } impl Default for RepoDevInoCache { - fn default() -> Self { - Self::new() - } -} + fn default() -> Self { + Self::new() + } + } diff --git a/rust-bindings/src/auto/repo_file.rs b/rust-bindings/src/auto/repo_file.rs index 29796933..3631c3ad 100644 --- a/rust-bindings/src/auto/repo_file.rs +++ b/rust-bindings/src/auto/repo_file.rs @@ -25,54 +25,44 @@ impl RepoFile { let mut error = ptr::null_mut(); let is_ok = ffi::ostree_repo_file_ensure_resolved(self.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_file_get_checksum")] #[doc(alias = "get_checksum")] pub fn checksum(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_repo_file_get_checksum(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_repo_file_get_checksum(self.to_glib_none().0)) + } } #[doc(alias = "ostree_repo_file_get_repo")] #[doc(alias = "get_repo")] pub fn repo(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_repo_file_get_repo(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_repo_file_get_repo(self.to_glib_none().0)) + } } #[doc(alias = "ostree_repo_file_get_root")] #[doc(alias = "get_root")] - #[must_use] +#[must_use] pub fn root(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_repo_file_get_root(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_repo_file_get_root(self.to_glib_none().0)) + } } #[doc(alias = "ostree_repo_file_get_xattrs")] #[doc(alias = "get_xattrs")] - pub fn xattrs( - &self, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn xattrs(&self, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_xattrs = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_file_get_xattrs( - self.to_glib_none().0, - &mut out_xattrs, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_file_get_xattrs(self.to_glib_none().0, &mut out_xattrs, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_xattrs)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_xattrs)) } else { Err(from_glib_full(error)) } } } @@ -81,90 +71,54 @@ impl RepoFile { unsafe { let mut is_dir = mem::MaybeUninit::uninit(); let mut out_container = ptr::null_mut(); - let ret = ffi::ostree_repo_file_tree_find_child( - self.to_glib_none().0, - name.to_glib_none().0, - is_dir.as_mut_ptr(), - &mut out_container, - ); - let is_dir = is_dir.assume_init(); - (ret, from_glib(is_dir), from_glib_full(out_container)) + let ret = ffi::ostree_repo_file_tree_find_child(self.to_glib_none().0, name.to_glib_none().0, is_dir.as_mut_ptr(), &mut out_container); + (ret, from_glib(is_dir.assume_init()), from_glib_full(out_container)) } } #[doc(alias = "ostree_repo_file_tree_get_contents")] pub fn tree_get_contents(&self) -> Option { unsafe { - from_glib_full(ffi::ostree_repo_file_tree_get_contents( - self.to_glib_none().0, - )) + from_glib_full(ffi::ostree_repo_file_tree_get_contents(self.to_glib_none().0)) } } #[doc(alias = "ostree_repo_file_tree_get_contents_checksum")] pub fn tree_get_contents_checksum(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_repo_file_tree_get_contents_checksum( - self.to_glib_none().0, - )) + from_glib_none(ffi::ostree_repo_file_tree_get_contents_checksum(self.to_glib_none().0)) } } #[doc(alias = "ostree_repo_file_tree_get_metadata")] pub fn tree_get_metadata(&self) -> Option { unsafe { - from_glib_full(ffi::ostree_repo_file_tree_get_metadata( - self.to_glib_none().0, - )) + from_glib_full(ffi::ostree_repo_file_tree_get_metadata(self.to_glib_none().0)) } } #[doc(alias = "ostree_repo_file_tree_get_metadata_checksum")] pub fn tree_get_metadata_checksum(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_repo_file_tree_get_metadata_checksum( - self.to_glib_none().0, - )) + from_glib_none(ffi::ostree_repo_file_tree_get_metadata_checksum(self.to_glib_none().0)) } } #[doc(alias = "ostree_repo_file_tree_query_child")] - pub fn tree_query_child( - &self, - n: i32, - attributes: &str, - flags: gio::FileQueryInfoFlags, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn tree_query_child(&self, n: i32, attributes: &str, flags: gio::FileQueryInfoFlags, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_info = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_repo_file_tree_query_child( - self.to_glib_none().0, - n, - attributes.to_glib_none().0, - flags.into_glib(), - &mut out_info, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_repo_file_tree_query_child(self.to_glib_none().0, n, attributes.to_glib_none().0, flags.into_glib(), &mut out_info, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_info)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_info)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_repo_file_tree_set_metadata")] pub fn tree_set_metadata(&self, checksum: &str, metadata: &glib::Variant) { unsafe { - ffi::ostree_repo_file_tree_set_metadata( - self.to_glib_none().0, - checksum.to_glib_none().0, - metadata.to_glib_none().0, - ); + ffi::ostree_repo_file_tree_set_metadata(self.to_glib_none().0, checksum.to_glib_none().0, metadata.to_glib_none().0); } } } diff --git a/rust-bindings/src/auto/repo_finder.rs b/rust-bindings/src/auto/repo_finder.rs index 1252c2be..6247a8d5 100644 --- a/rust-bindings/src/auto/repo_finder.rs +++ b/rust-bindings/src/auto/repo_finder.rs @@ -24,7 +24,8 @@ glib::wrapper! { } impl RepoFinder { - pub const NONE: Option<&'static RepoFinder> = None; + pub const NONE: Option<&'static RepoFinder> = None; + } pub trait RepoFinderExt: 'static {} diff --git a/rust-bindings/src/auto/repo_finder_avahi.rs b/rust-bindings/src/auto/repo_finder_avahi.rs index c86a3878..46b29841 100644 --- a/rust-bindings/src/auto/repo_finder_avahi.rs +++ b/rust-bindings/src/auto/repo_finder_avahi.rs @@ -22,7 +22,9 @@ impl RepoFinderAvahi { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_finder_avahi_new")] pub fn new(context: Option<&glib::MainContext>) -> RepoFinderAvahi { - unsafe { from_glib_full(ffi::ostree_repo_finder_avahi_new(context.to_glib_none().0)) } + unsafe { + from_glib_full(ffi::ostree_repo_finder_avahi_new(context.to_glib_none().0)) + } } #[cfg(any(feature = "v2018_6", feature = "dox"))] diff --git a/rust-bindings/src/auto/repo_finder_config.rs b/rust-bindings/src/auto/repo_finder_config.rs index 74c6c035..a8640172 100644 --- a/rust-bindings/src/auto/repo_finder_config.rs +++ b/rust-bindings/src/auto/repo_finder_config.rs @@ -22,17 +22,19 @@ impl RepoFinderConfig { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_finder_config_new")] pub fn new() -> RepoFinderConfig { - unsafe { from_glib_full(ffi::ostree_repo_finder_config_new()) } + unsafe { + from_glib_full(ffi::ostree_repo_finder_config_new()) + } } } #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] impl Default for RepoFinderConfig { - fn default() -> Self { - Self::new() - } -} + fn default() -> Self { + Self::new() + } + } impl fmt::Display for RepoFinderConfig { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/rust-bindings/src/auto/repo_finder_mount.rs b/rust-bindings/src/auto/repo_finder_mount.rs index b34713b6..b5d08472 100644 --- a/rust-bindings/src/auto/repo_finder_mount.rs +++ b/rust-bindings/src/auto/repo_finder_mount.rs @@ -32,9 +32,7 @@ impl RepoFinderMount { #[doc(alias = "ostree_repo_finder_mount_new")] pub fn new(monitor: Option<&impl IsA>) -> RepoFinderMount { unsafe { - from_glib_full(ffi::ostree_repo_finder_mount_new( - monitor.map(|p| p.as_ref()).to_glib_none().0, - )) + from_glib_full(ffi::ostree_repo_finder_mount_new(monitor.map(|p| p.as_ref()).to_glib_none().0)) } } diff --git a/rust-bindings/src/auto/repo_finder_override.rs b/rust-bindings/src/auto/repo_finder_override.rs index 1c1522b9..724c5a10 100644 --- a/rust-bindings/src/auto/repo_finder_override.rs +++ b/rust-bindings/src/auto/repo_finder_override.rs @@ -22,7 +22,9 @@ impl RepoFinderOverride { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] #[doc(alias = "ostree_repo_finder_override_new")] pub fn new() -> RepoFinderOverride { - unsafe { from_glib_full(ffi::ostree_repo_finder_override_new()) } + unsafe { + from_glib_full(ffi::ostree_repo_finder_override_new()) + } } #[cfg(any(feature = "v2018_6", feature = "dox"))] @@ -38,10 +40,10 @@ impl RepoFinderOverride { #[cfg(any(feature = "v2018_6", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_6")))] impl Default for RepoFinderOverride { - fn default() -> Self { - Self::new() - } -} + fn default() -> Self { + Self::new() + } + } impl fmt::Display for RepoFinderOverride { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { diff --git a/rust-bindings/src/auto/repo_finder_result.rs b/rust-bindings/src/auto/repo_finder_result.rs index 80bf2575..f918c03b 100644 --- a/rust-bindings/src/auto/repo_finder_result.rs +++ b/rust-bindings/src/auto/repo_finder_result.rs @@ -3,7 +3,6 @@ // DO NOT EDIT use std::cmp; -use glib::translate::*; glib::wrapper! { #[derive(Debug, Hash)] @@ -23,8 +22,10 @@ impl RepoFinderResult { //} #[doc(alias = "ostree_repo_finder_result_compare")] - fn compare(&self, b: &RepoFinderResult) -> i32 { - unsafe { ffi::ostree_repo_finder_result_compare(self.to_glib_none().0, b.to_glib_none().0) } + fn compare(&self, b: &RepoFinderResult) -> i32 { + unsafe { + ffi::ostree_repo_finder_result_compare(self.to_glib_none().0, b.to_glib_none().0) + } } } diff --git a/rust-bindings/src/auto/se_policy.rs b/rust-bindings/src/auto/se_policy.rs index 99590929..386e5bee 100644 --- a/rust-bindings/src/auto/se_policy.rs +++ b/rust-bindings/src/auto/se_policy.rs @@ -22,67 +22,32 @@ glib::wrapper! { impl SePolicy { #[doc(alias = "ostree_sepolicy_new")] - pub fn new( - path: &impl IsA, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn new(path: &impl IsA, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_sepolicy_new( - path.as_ref().to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_sepolicy_new(path.as_ref().to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2017_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_4")))] #[doc(alias = "ostree_sepolicy_new_at")] - pub fn new_at( - rootfs_dfd: i32, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn new_at(rootfs_dfd: i32, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_sepolicy_new_at( - rootfs_dfd, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_sepolicy_new_at(rootfs_dfd, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sepolicy_new_from_commit")] #[doc(alias = "new_from_commit")] - pub fn from_commit( - repo: &Repo, - rev: &str, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn from_commit(repo: &Repo, rev: &str, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_sepolicy_new_from_commit( - repo.to_glib_none().0, - rev.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_sepolicy_new_from_commit(repo.to_glib_none().0, rev.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } @@ -91,77 +56,47 @@ impl SePolicy { #[doc(alias = "ostree_sepolicy_get_csum")] #[doc(alias = "get_csum")] pub fn csum(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_sepolicy_get_csum(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_sepolicy_get_csum(self.to_glib_none().0)) + } } #[doc(alias = "ostree_sepolicy_get_label")] #[doc(alias = "get_label")] - pub fn label( - &self, - relpath: &str, - unix_mode: u32, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn label(&self, relpath: &str, unix_mode: u32, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_label = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sepolicy_get_label( - self.to_glib_none().0, - relpath.to_glib_none().0, - unix_mode, - &mut out_label, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sepolicy_get_label(self.to_glib_none().0, relpath.to_glib_none().0, unix_mode, &mut out_label, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_label)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_label)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sepolicy_get_name")] #[doc(alias = "get_name")] pub fn name(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_sepolicy_get_name(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_sepolicy_get_name(self.to_glib_none().0)) + } } #[doc(alias = "ostree_sepolicy_get_path")] #[doc(alias = "get_path")] pub fn path(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_sepolicy_get_path(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_sepolicy_get_path(self.to_glib_none().0)) + } } #[doc(alias = "ostree_sepolicy_restorecon")] - pub fn restorecon( - &self, - path: &str, - info: Option<&gio::FileInfo>, - target: &impl IsA, - flags: SePolicyRestoreconFlags, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn restorecon(&self, path: &str, info: Option<&gio::FileInfo>, target: &impl IsA, flags: SePolicyRestoreconFlags, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_new_label = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sepolicy_restorecon( - self.to_glib_none().0, - path.to_glib_none().0, - info.to_glib_none().0, - target.as_ref().to_glib_none().0, - flags.into_glib(), - &mut out_new_label, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sepolicy_restorecon(self.to_glib_none().0, path.to_glib_none().0, info.to_glib_none().0, target.as_ref().to_glib_none().0, flags.into_glib(), &mut out_new_label, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_new_label)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_new_label)) } else { Err(from_glib_full(error)) } } } @@ -169,18 +104,9 @@ impl SePolicy { pub fn setfscreatecon(&self, path: &str, mode: u32) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sepolicy_setfscreatecon( - self.to_glib_none().0, - path.to_glib_none().0, - mode, - &mut error, - ); + let is_ok = ffi::ostree_sepolicy_setfscreatecon(self.to_glib_none().0, path.to_glib_none().0, mode, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } diff --git a/rust-bindings/src/auto/sign.rs b/rust-bindings/src/auto/sign.rs index 577697c9..64b1da6c 100644 --- a/rust-bindings/src/auto/sign.rs +++ b/rust-bindings/src/auto/sign.rs @@ -24,14 +24,17 @@ glib::wrapper! { } impl Sign { - pub const NONE: Option<&'static Sign> = None; + pub const NONE: Option<&'static Sign> = None; + #[cfg(any(feature = "v2020_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_get_all")] #[doc(alias = "get_all")] pub fn all() -> Vec { - unsafe { FromGlibPtrContainer::from_glib_full(ffi::ostree_sign_get_all()) } + unsafe { + FromGlibPtrContainer::from_glib_full(ffi::ostree_sign_get_all()) + } } #[cfg(any(feature = "v2020_2", feature = "dox"))] @@ -42,11 +45,7 @@ impl Sign { unsafe { let mut error = ptr::null_mut(); let ret = ffi::ostree_sign_get_by_name(name.to_glib_none().0, &mut error); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } } @@ -65,40 +64,22 @@ pub trait SignExt: 'static { #[cfg(any(feature = "v2020_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_commit")] - fn commit( - &self, - repo: &Repo, - commit_checksum: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error>; + fn commit(&self, repo: &Repo, commit_checksum: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error>; #[cfg(any(feature = "v2020_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_commit_verify")] - fn commit_verify( - &self, - repo: &Repo, - commit_checksum: &str, - cancellable: Option<&impl IsA>, - ) -> Result, glib::Error>; + fn commit_verify(&self, repo: &Repo, commit_checksum: &str, cancellable: Option<&impl IsA>) -> Result, glib::Error>; #[cfg(any(feature = "v2020_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_data")] - fn data( - &self, - data: &glib::Bytes, - cancellable: Option<&impl IsA>, - ) -> Result; + fn data(&self, data: &glib::Bytes, cancellable: Option<&impl IsA>) -> Result; #[cfg(any(feature = "v2020_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_data_verify")] - fn data_verify( - &self, - data: &glib::Bytes, - signatures: &glib::Variant, - ) -> Result, glib::Error>; + fn data_verify(&self, data: &glib::Bytes, signatures: &glib::Variant) -> Result, glib::Error>; #[cfg(any(feature = "v2020_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] @@ -134,12 +115,7 @@ pub trait SignExt: 'static { #[cfg(any(feature = "v2020_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] #[doc(alias = "ostree_sign_summary")] - fn summary( - &self, - repo: &Repo, - keys: &glib::Variant, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error>; + fn summary(&self, repo: &Repo, keys: &glib::Variant, cancellable: Option<&impl IsA>) -> Result<(), glib::Error>; } impl> SignExt for O { @@ -148,17 +124,9 @@ impl> SignExt for O { fn add_pk(&self, public_key: &glib::Variant) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sign_add_pk( - self.as_ref().to_glib_none().0, - public_key.to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sign_add_pk(self.as_ref().to_glib_none().0, public_key.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -169,124 +137,63 @@ impl> SignExt for O { let mut error = ptr::null_mut(); let is_ok = ffi::ostree_sign_clear_keys(self.as_ref().to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2020_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] - fn commit( - &self, - repo: &Repo, - commit_checksum: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + fn commit(&self, repo: &Repo, commit_checksum: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sign_commit( - self.as_ref().to_glib_none().0, - repo.to_glib_none().0, - commit_checksum.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sign_commit(self.as_ref().to_glib_none().0, repo.to_glib_none().0, commit_checksum.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2020_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] - fn commit_verify( - &self, - repo: &Repo, - commit_checksum: &str, - cancellable: Option<&impl IsA>, - ) -> Result, glib::Error> { + fn commit_verify(&self, repo: &Repo, commit_checksum: &str, cancellable: Option<&impl IsA>) -> Result, glib::Error> { unsafe { let mut out_success_message = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sign_commit_verify( - self.as_ref().to_glib_none().0, - repo.to_glib_none().0, - commit_checksum.to_glib_none().0, - &mut out_success_message, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sign_commit_verify(self.as_ref().to_glib_none().0, repo.to_glib_none().0, commit_checksum.to_glib_none().0, &mut out_success_message, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_success_message)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_success_message)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2020_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] - fn data( - &self, - data: &glib::Bytes, - cancellable: Option<&impl IsA>, - ) -> Result { + fn data(&self, data: &glib::Bytes, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut signature = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sign_data( - self.as_ref().to_glib_none().0, - data.to_glib_none().0, - &mut signature, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sign_data(self.as_ref().to_glib_none().0, data.to_glib_none().0, &mut signature, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(signature)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(signature)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2020_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] - fn data_verify( - &self, - data: &glib::Bytes, - signatures: &glib::Variant, - ) -> Result, glib::Error> { + fn data_verify(&self, data: &glib::Bytes, signatures: &glib::Variant) -> Result, glib::Error> { unsafe { let mut out_success_message = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sign_data_verify( - self.as_ref().to_glib_none().0, - data.to_glib_none().0, - signatures.to_glib_none().0, - &mut out_success_message, - &mut error, - ); + let is_ok = ffi::ostree_sign_data_verify(self.as_ref().to_glib_none().0, data.to_glib_none().0, signatures.to_glib_none().0, &mut out_success_message, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_success_message)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_success_message)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2020_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] fn name(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_sign_get_name(self.as_ref().to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_sign_get_name(self.as_ref().to_glib_none().0)) + } } #[cfg(any(feature = "v2020_2", feature = "dox"))] @@ -294,17 +201,9 @@ impl> SignExt for O { fn load_pk(&self, options: &glib::Variant) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sign_load_pk( - self.as_ref().to_glib_none().0, - options.to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sign_load_pk(self.as_ref().to_glib_none().0, options.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -312,9 +211,7 @@ impl> SignExt for O { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] fn metadata_format(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_sign_metadata_format( - self.as_ref().to_glib_none().0, - )) + from_glib_none(ffi::ostree_sign_metadata_format(self.as_ref().to_glib_none().0)) } } @@ -322,9 +219,7 @@ impl> SignExt for O { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] fn metadata_key(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_sign_metadata_key( - self.as_ref().to_glib_none().0, - )) + from_glib_none(ffi::ostree_sign_metadata_key(self.as_ref().to_glib_none().0)) } } @@ -333,17 +228,9 @@ impl> SignExt for O { fn set_pk(&self, public_key: &glib::Variant) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sign_set_pk( - self.as_ref().to_glib_none().0, - public_key.to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sign_set_pk(self.as_ref().to_glib_none().0, public_key.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -352,43 +239,20 @@ impl> SignExt for O { fn set_sk(&self, secret_key: &glib::Variant) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sign_set_sk( - self.as_ref().to_glib_none().0, - secret_key.to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sign_set_sk(self.as_ref().to_glib_none().0, secret_key.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2020_2", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_2")))] - fn summary( - &self, - repo: &Repo, - keys: &glib::Variant, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + fn summary(&self, repo: &Repo, keys: &glib::Variant, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sign_summary( - self.as_ref().to_glib_none().0, - repo.to_glib_none().0, - keys.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sign_summary(self.as_ref().to_glib_none().0, repo.to_glib_none().0, keys.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } } diff --git a/rust-bindings/src/auto/sysroot.rs b/rust-bindings/src/auto/sysroot.rs index 134bf7ed..54dcdc42 100644 --- a/rust-bindings/src/auto/sysroot.rs +++ b/rust-bindings/src/auto/sysroot.rs @@ -49,35 +49,24 @@ impl Sysroot { #[doc(alias = "ostree_sysroot_new")] pub fn new(path: Option<&impl IsA>) -> Sysroot { unsafe { - from_glib_full(ffi::ostree_sysroot_new( - path.map(|p| p.as_ref()).to_glib_none().0, - )) + from_glib_full(ffi::ostree_sysroot_new(path.map(|p| p.as_ref()).to_glib_none().0)) } } #[doc(alias = "ostree_sysroot_new_default")] pub fn new_default() -> Sysroot { - unsafe { from_glib_full(ffi::ostree_sysroot_new_default()) } + unsafe { + from_glib_full(ffi::ostree_sysroot_new_default()) + } } #[doc(alias = "ostree_sysroot_cleanup")] - pub fn cleanup( - &self, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn cleanup(&self, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_cleanup( - self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_cleanup(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -91,218 +80,90 @@ impl Sysroot { #[cfg(any(feature = "v2018_5", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_5")))] #[doc(alias = "ostree_sysroot_deploy_tree")] - pub fn deploy_tree( - &self, - osname: Option<&str>, - revision: &str, - origin: Option<&glib::KeyFile>, - provided_merge_deployment: Option<&Deployment>, - override_kernel_argv: &[&str], - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn deploy_tree(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, provided_merge_deployment: Option<&Deployment>, override_kernel_argv: &[&str], cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_new_deployment = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_deploy_tree( - self.to_glib_none().0, - osname.to_glib_none().0, - revision.to_glib_none().0, - origin.to_glib_none().0, - provided_merge_deployment.to_glib_none().0, - override_kernel_argv.to_glib_none().0, - &mut out_new_deployment, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_deploy_tree(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, provided_merge_deployment.to_glib_none().0, override_kernel_argv.to_glib_none().0, &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_new_deployment)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2020_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))] #[doc(alias = "ostree_sysroot_deploy_tree_with_options")] - pub fn deploy_tree_with_options( - &self, - osname: Option<&str>, - revision: &str, - origin: Option<&glib::KeyFile>, - provided_merge_deployment: Option<&Deployment>, - opts: Option<&SysrootDeployTreeOpts>, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn deploy_tree_with_options(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, provided_merge_deployment: Option<&Deployment>, opts: Option<&SysrootDeployTreeOpts>, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_new_deployment = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_deploy_tree_with_options( - self.to_glib_none().0, - osname.to_glib_none().0, - revision.to_glib_none().0, - origin.to_glib_none().0, - provided_merge_deployment.to_glib_none().0, - mut_override(opts.to_glib_none().0), - &mut out_new_deployment, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_deploy_tree_with_options(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, provided_merge_deployment.to_glib_none().0, mut_override(opts.to_glib_none().0), &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_new_deployment)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sysroot_deployment_set_kargs")] - pub fn deployment_set_kargs( - &self, - deployment: &Deployment, - new_kargs: &[&str], - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn deployment_set_kargs(&self, deployment: &Deployment, new_kargs: &[&str], cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_deployment_set_kargs( - self.to_glib_none().0, - deployment.to_glib_none().0, - new_kargs.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_deployment_set_kargs(self.to_glib_none().0, deployment.to_glib_none().0, new_kargs.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sysroot_deployment_set_kargs_in_place")] - pub fn deployment_set_kargs_in_place( - &self, - deployment: &Deployment, - kargs_str: Option<&str>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn deployment_set_kargs_in_place(&self, deployment: &Deployment, kargs_str: Option<&str>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_deployment_set_kargs_in_place( - self.to_glib_none().0, - deployment.to_glib_none().0, - kargs_str.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_deployment_set_kargs_in_place(self.to_glib_none().0, deployment.to_glib_none().0, kargs_str.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sysroot_deployment_set_mutable")] - pub fn deployment_set_mutable( - &self, - deployment: &Deployment, - is_mutable: bool, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn deployment_set_mutable(&self, deployment: &Deployment, is_mutable: bool, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_deployment_set_mutable( - self.to_glib_none().0, - deployment.to_glib_none().0, - is_mutable.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_deployment_set_mutable(self.to_glib_none().0, deployment.to_glib_none().0, is_mutable.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2018_3", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_3")))] #[doc(alias = "ostree_sysroot_deployment_set_pinned")] - pub fn deployment_set_pinned( - &self, - deployment: &Deployment, - is_pinned: bool, - ) -> Result<(), glib::Error> { + pub fn deployment_set_pinned(&self, deployment: &Deployment, is_pinned: bool) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_deployment_set_pinned( - self.to_glib_none().0, - deployment.to_glib_none().0, - is_pinned.into_glib(), - &mut error, - ); + let is_ok = ffi::ostree_sysroot_deployment_set_pinned(self.to_glib_none().0, deployment.to_glib_none().0, is_pinned.into_glib(), &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2016_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_4")))] #[doc(alias = "ostree_sysroot_deployment_unlock")] - pub fn deployment_unlock( - &self, - deployment: &Deployment, - unlocked_state: DeploymentUnlockedState, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn deployment_unlock(&self, deployment: &Deployment, unlocked_state: DeploymentUnlockedState, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_deployment_unlock( - self.to_glib_none().0, - deployment.to_glib_none().0, - unlocked_state.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_deployment_unlock(self.to_glib_none().0, deployment.to_glib_none().0, unlocked_state.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sysroot_ensure_initialized")] - pub fn ensure_initialized( - &self, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn ensure_initialized(&self, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_ensure_initialized( - self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_ensure_initialized(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -310,26 +171,23 @@ impl Sysroot { #[doc(alias = "get_booted_deployment")] pub fn booted_deployment(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_sysroot_get_booted_deployment( - self.to_glib_none().0, - )) + from_glib_none(ffi::ostree_sysroot_get_booted_deployment(self.to_glib_none().0)) } } #[doc(alias = "ostree_sysroot_get_bootversion")] #[doc(alias = "get_bootversion")] pub fn bootversion(&self) -> i32 { - unsafe { ffi::ostree_sysroot_get_bootversion(self.to_glib_none().0) } + unsafe { + ffi::ostree_sysroot_get_bootversion(self.to_glib_none().0) + } } #[doc(alias = "ostree_sysroot_get_deployment_directory")] #[doc(alias = "get_deployment_directory")] pub fn deployment_directory(&self, deployment: &Deployment) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_get_deployment_directory( - self.to_glib_none().0, - deployment.to_glib_none().0, - )) + from_glib_full(ffi::ostree_sysroot_get_deployment_directory(self.to_glib_none().0, deployment.to_glib_none().0)) } } @@ -337,10 +195,7 @@ impl Sysroot { #[doc(alias = "get_deployment_dirpath")] pub fn deployment_dirpath(&self, deployment: &Deployment) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_get_deployment_dirpath( - self.to_glib_none().0, - deployment.to_glib_none().0, - )) + from_glib_full(ffi::ostree_sysroot_get_deployment_dirpath(self.to_glib_none().0, deployment.to_glib_none().0)) } } @@ -348,33 +203,32 @@ impl Sysroot { #[doc(alias = "get_deployments")] pub fn deployments(&self) -> Vec { unsafe { - FromGlibPtrContainer::from_glib_container(ffi::ostree_sysroot_get_deployments( - self.to_glib_none().0, - )) + FromGlibPtrContainer::from_glib_container(ffi::ostree_sysroot_get_deployments(self.to_glib_none().0)) } } #[doc(alias = "ostree_sysroot_get_fd")] #[doc(alias = "get_fd")] pub fn fd(&self) -> i32 { - unsafe { ffi::ostree_sysroot_get_fd(self.to_glib_none().0) } + unsafe { + ffi::ostree_sysroot_get_fd(self.to_glib_none().0) + } } #[doc(alias = "ostree_sysroot_get_merge_deployment")] #[doc(alias = "get_merge_deployment")] pub fn merge_deployment(&self, osname: Option<&str>) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_get_merge_deployment( - self.to_glib_none().0, - osname.to_glib_none().0, - )) + from_glib_full(ffi::ostree_sysroot_get_merge_deployment(self.to_glib_none().0, osname.to_glib_none().0)) } } #[doc(alias = "ostree_sysroot_get_path")] #[doc(alias = "get_path")] pub fn path(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_sysroot_get_path(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_sysroot_get_path(self.to_glib_none().0)) + } } #[cfg(any(feature = "v2018_5", feature = "dox"))] @@ -383,40 +237,27 @@ impl Sysroot { #[doc(alias = "get_staged_deployment")] pub fn staged_deployment(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_sysroot_get_staged_deployment( - self.to_glib_none().0, - )) + from_glib_none(ffi::ostree_sysroot_get_staged_deployment(self.to_glib_none().0)) } } #[doc(alias = "ostree_sysroot_get_subbootversion")] #[doc(alias = "get_subbootversion")] pub fn subbootversion(&self) -> i32 { - unsafe { ffi::ostree_sysroot_get_subbootversion(self.to_glib_none().0) } + unsafe { + ffi::ostree_sysroot_get_subbootversion(self.to_glib_none().0) + } } #[cfg(any(feature = "v2016_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_4")))] #[doc(alias = "ostree_sysroot_init_osname")] - pub fn init_osname( - &self, - osname: &str, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn init_osname(&self, osname: &str, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_init_osname( - self.to_glib_none().0, - osname.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_init_osname(self.to_glib_none().0, osname.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -428,11 +269,7 @@ impl Sysroot { let mut error = ptr::null_mut(); let is_ok = ffi::ostree_sysroot_initialize(self.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -440,53 +277,31 @@ impl Sysroot { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_1")))] #[doc(alias = "ostree_sysroot_is_booted")] pub fn is_booted(&self) -> bool { - unsafe { from_glib(ffi::ostree_sysroot_is_booted(self.to_glib_none().0)) } + unsafe { + from_glib(ffi::ostree_sysroot_is_booted(self.to_glib_none().0)) + } } #[doc(alias = "ostree_sysroot_load")] - pub fn load( - &self, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn load(&self, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_load( - self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_load(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2016_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2016_4")))] #[doc(alias = "ostree_sysroot_load_if_changed")] - pub fn load_if_changed( - &self, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn load_if_changed(&self, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_changed = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_load_if_changed( - self.to_glib_none().0, - out_changed.as_mut_ptr(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - let out_changed = out_changed.assume_init(); + let is_ok = ffi::ostree_sysroot_load_if_changed(self.to_glib_none().0, out_changed.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib(out_changed)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib(out_changed.assume_init())) } else { Err(from_glib_full(error)) } } } @@ -496,117 +311,76 @@ impl Sysroot { let mut error = ptr::null_mut(); let is_ok = ffi::ostree_sysroot_lock(self.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sysroot_lock_async")] - pub fn lock_async) + 'static>( - &self, - cancellable: Option<&impl IsA>, - callback: P, - ) { - let main_context = glib::MainContext::ref_thread_default(); - let is_main_context_owner = main_context.is_owner(); - let has_acquired_main_context = (!is_main_context_owner) - .then(|| main_context.acquire().ok()) - .flatten(); - assert!( - is_main_context_owner || has_acquired_main_context.is_some(), - "Async operations only allowed if the thread is owning the MainContext" - ); - - let user_data: Box_> = - Box_::new(glib::thread_guard::ThreadGuard::new(callback)); - unsafe extern "C" fn lock_async_trampoline) + 'static>( - _source_object: *mut glib::gobject_ffi::GObject, - res: *mut gio::ffi::GAsyncResult, - user_data: glib::ffi::gpointer, - ) { + pub fn lock_async) + 'static>(&self, cancellable: Option<&impl IsA>, callback: P) { + + let main_context = glib::MainContext::ref_thread_default(); + let is_main_context_owner = main_context.is_owner(); + let has_acquired_main_context = (!is_main_context_owner) + .then(|| main_context.acquire().ok()) + .flatten(); + assert!( + is_main_context_owner || has_acquired_main_context.is_some(), + "Async operations only allowed if the thread is owning the MainContext" + ); + + let user_data: Box_> = Box_::new(glib::thread_guard::ThreadGuard::new(callback)); + unsafe extern "C" fn lock_async_trampoline) + 'static>(_source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, user_data: glib::ffi::gpointer) { let mut error = ptr::null_mut(); let _ = ffi::ostree_sysroot_lock_finish(_source_object as *mut _, res, &mut error); - let result = if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - }; - let callback: Box_> = - Box_::from_raw(user_data as *mut _); + let result = if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }; + let callback: Box_> = Box_::from_raw(user_data as *mut _); let callback: P = callback.into_inner(); callback(result); } let callback = lock_async_trampoline::

; unsafe { - ffi::ostree_sysroot_lock_async( - self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - Some(callback), - Box_::into_raw(user_data) as *mut _, - ); + ffi::ostree_sysroot_lock_async(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, Some(callback), Box_::into_raw(user_data) as *mut _); } } - pub fn lock_future( - &self, - ) -> Pin> + 'static>> { + + pub fn lock_future(&self) -> Pin> + 'static>> { + Box_::pin(gio::GioFuture::new(self, move |obj, cancellable, send| { - obj.lock_async(Some(cancellable), move |res| { - send.resolve(res); - }); + obj.lock_async( + Some(cancellable), + move |res| { + send.resolve(res); + }, + ); })) } #[doc(alias = "ostree_sysroot_origin_new_from_refspec")] pub fn origin_new_from_refspec(&self, refspec: &str) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_origin_new_from_refspec( - self.to_glib_none().0, - refspec.to_glib_none().0, - )) + from_glib_full(ffi::ostree_sysroot_origin_new_from_refspec(self.to_glib_none().0, refspec.to_glib_none().0)) } } #[doc(alias = "ostree_sysroot_prepare_cleanup")] - pub fn prepare_cleanup( - &self, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn prepare_cleanup(&self, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_prepare_cleanup( - self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_prepare_cleanup(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2017_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_7")))] #[doc(alias = "ostree_sysroot_query_deployments_for")] - pub fn query_deployments_for( - &self, - osname: Option<&str>, - ) -> (Option, Option) { + pub fn query_deployments_for(&self, osname: Option<&str>) -> (Option, Option) { unsafe { let mut out_pending = ptr::null_mut(); let mut out_rollback = ptr::null_mut(); - ffi::ostree_sysroot_query_deployments_for( - self.to_glib_none().0, - osname.to_glib_none().0, - &mut out_pending, - &mut out_rollback, - ); + ffi::ostree_sysroot_query_deployments_for(self.to_glib_none().0, osname.to_glib_none().0, &mut out_pending, &mut out_rollback); (from_glib_full(out_pending), from_glib_full(out_rollback)) } } @@ -615,7 +389,9 @@ impl Sysroot { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_7")))] #[doc(alias = "ostree_sysroot_repo")] pub fn repo(&self) -> Option { - unsafe { from_glib_none(ffi::ostree_sysroot_repo(self.to_glib_none().0)) } + unsafe { + from_glib_none(ffi::ostree_sysroot_repo(self.to_glib_none().0)) + } } #[cfg(any(feature = "v2021_1", feature = "dox"))] @@ -624,13 +400,8 @@ impl Sysroot { pub fn require_booted_deployment(&self) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = - ffi::ostree_sysroot_require_booted_deployment(self.to_glib_none().0, &mut error); - if error.is_null() { - Ok(from_glib_none(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_sysroot_require_booted_deployment(self.to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_none(ret)) } else { Err(from_glib_full(error)) } } } @@ -644,128 +415,51 @@ impl Sysroot { } #[doc(alias = "ostree_sysroot_simple_write_deployment")] - pub fn simple_write_deployment( - &self, - osname: Option<&str>, - new_deployment: &Deployment, - merge_deployment: Option<&Deployment>, - flags: SysrootSimpleWriteDeploymentFlags, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn simple_write_deployment(&self, osname: Option<&str>, new_deployment: &Deployment, merge_deployment: Option<&Deployment>, flags: SysrootSimpleWriteDeploymentFlags, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_simple_write_deployment( - self.to_glib_none().0, - osname.to_glib_none().0, - new_deployment.to_glib_none().0, - merge_deployment.to_glib_none().0, - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_simple_write_deployment(self.to_glib_none().0, osname.to_glib_none().0, new_deployment.to_glib_none().0, merge_deployment.to_glib_none().0, flags.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2020_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))] #[doc(alias = "ostree_sysroot_stage_overlay_initrd")] - pub fn stage_overlay_initrd( - &self, - fd: i32, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn stage_overlay_initrd(&self, fd: i32, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_checksum = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_stage_overlay_initrd( - self.to_glib_none().0, - fd, - &mut out_checksum, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_stage_overlay_initrd(self.to_glib_none().0, fd, &mut out_checksum, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_checksum)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_checksum)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2018_5", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2018_5")))] #[doc(alias = "ostree_sysroot_stage_tree")] - pub fn stage_tree( - &self, - osname: Option<&str>, - revision: &str, - origin: Option<&glib::KeyFile>, - merge_deployment: Option<&Deployment>, - override_kernel_argv: &[&str], - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn stage_tree(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, merge_deployment: Option<&Deployment>, override_kernel_argv: &[&str], cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_new_deployment = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_stage_tree( - self.to_glib_none().0, - osname.to_glib_none().0, - revision.to_glib_none().0, - origin.to_glib_none().0, - merge_deployment.to_glib_none().0, - override_kernel_argv.to_glib_none().0, - &mut out_new_deployment, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_stage_tree(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, merge_deployment.to_glib_none().0, override_kernel_argv.to_glib_none().0, &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_new_deployment)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2020_7", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_7")))] #[doc(alias = "ostree_sysroot_stage_tree_with_options")] - pub fn stage_tree_with_options( - &self, - osname: Option<&str>, - revision: &str, - origin: Option<&glib::KeyFile>, - merge_deployment: Option<&Deployment>, - opts: &SysrootDeployTreeOpts, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn stage_tree_with_options(&self, osname: Option<&str>, revision: &str, origin: Option<&glib::KeyFile>, merge_deployment: Option<&Deployment>, opts: &SysrootDeployTreeOpts, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_new_deployment = ptr::null_mut(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_stage_tree_with_options( - self.to_glib_none().0, - osname.to_glib_none().0, - revision.to_glib_none().0, - origin.to_glib_none().0, - merge_deployment.to_glib_none().0, - mut_override(opts.to_glib_none().0), - &mut out_new_deployment, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_stage_tree_with_options(self.to_glib_none().0, osname.to_glib_none().0, revision.to_glib_none().0, origin.to_glib_none().0, merge_deployment.to_glib_none().0, mut_override(opts.to_glib_none().0), &mut out_new_deployment, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib_full(out_new_deployment)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib_full(out_new_deployment)) } else { Err(from_glib_full(error)) } } } @@ -774,18 +468,9 @@ impl Sysroot { unsafe { let mut out_acquired = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_try_lock( - self.to_glib_none().0, - out_acquired.as_mut_ptr(), - &mut error, - ); - let out_acquired = out_acquired.assume_init(); + let is_ok = ffi::ostree_sysroot_try_lock(self.to_glib_none().0, out_acquired.as_mut_ptr(), &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib(out_acquired)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib(out_acquired.assume_init())) } else { Err(from_glib_full(error)) } } } @@ -804,77 +489,34 @@ impl Sysroot { } #[doc(alias = "ostree_sysroot_write_deployments")] - pub fn write_deployments( - &self, - new_deployments: &[Deployment], - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn write_deployments(&self, new_deployments: &[Deployment], cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_write_deployments( - self.to_glib_none().0, - new_deployments.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_write_deployments(self.to_glib_none().0, new_deployments.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[cfg(any(feature = "v2017_4", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_4")))] #[doc(alias = "ostree_sysroot_write_deployments_with_options")] - pub fn write_deployments_with_options( - &self, - new_deployments: &[Deployment], - opts: &SysrootWriteDeploymentsOpts, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn write_deployments_with_options(&self, new_deployments: &[Deployment], opts: &SysrootWriteDeploymentsOpts, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_write_deployments_with_options( - self.to_glib_none().0, - new_deployments.to_glib_none().0, - mut_override(opts.to_glib_none().0), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_write_deployments_with_options(self.to_glib_none().0, new_deployments.to_glib_none().0, mut_override(opts.to_glib_none().0), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sysroot_write_origin_file")] - pub fn write_origin_file( - &self, - deployment: &Deployment, - new_origin: Option<&glib::KeyFile>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn write_origin_file(&self, deployment: &Deployment, new_origin: Option<&glib::KeyFile>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_write_origin_file( - self.to_glib_none().0, - deployment.to_glib_none().0, - new_origin.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_write_origin_file(self.to_glib_none().0, deployment.to_glib_none().0, new_origin.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -882,9 +524,7 @@ impl Sysroot { #[doc(alias = "get_deployment_origin_path")] pub fn deployment_origin_path(deployment_path: &impl IsA) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_get_deployment_origin_path( - deployment_path.as_ref().to_glib_none().0, - )) + from_glib_full(ffi::ostree_sysroot_get_deployment_origin_path(deployment_path.as_ref().to_glib_none().0)) } } @@ -892,27 +532,14 @@ impl Sysroot { #[cfg_attr(feature = "dox", doc(cfg(feature = "v2017_10")))] #[doc(alias = "journal-msg")] pub fn connect_journal_msg(&self, f: F) -> SignalHandlerId { - unsafe extern "C" fn journal_msg_trampoline( - this: *mut ffi::OstreeSysroot, - msg: *mut libc::c_char, - f: glib::ffi::gpointer, - ) { + unsafe extern "C" fn journal_msg_trampoline(this: *mut ffi::OstreeSysroot, msg: *mut libc::c_char, f: glib::ffi::gpointer) { let f: &F = &*(f as *const F); - f( - &from_glib_borrow(this), - &glib::GString::from_glib_borrow(msg), - ) + f(&from_glib_borrow(this), &glib::GString::from_glib_borrow(msg)) } unsafe { let f: Box_ = Box_::new(f); - connect_raw( - self.as_ptr() as *mut _, - b"journal-msg\0".as_ptr() as *const _, - Some(transmute::<_, unsafe extern "C" fn()>( - journal_msg_trampoline:: as *const (), - )), - Box_::into_raw(f), - ) + connect_raw(self.as_ptr() as *mut _, b"journal-msg\0".as_ptr() as *const _, + Some(transmute::<_, unsafe extern "C" fn()>(journal_msg_trampoline:: as *const ())), Box_::into_raw(f)) } } } diff --git a/rust-bindings/src/auto/sysroot_upgrader.rs b/rust-bindings/src/auto/sysroot_upgrader.rs index f16e3900..9e9b9104 100644 --- a/rust-bindings/src/auto/sysroot_upgrader.rs +++ b/rust-bindings/src/auto/sysroot_upgrader.rs @@ -27,100 +27,48 @@ glib::wrapper! { impl SysrootUpgrader { #[doc(alias = "ostree_sysroot_upgrader_new")] - pub fn new( - sysroot: &Sysroot, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn new(sysroot: &Sysroot, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_sysroot_upgrader_new( - sysroot.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_sysroot_upgrader_new(sysroot.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sysroot_upgrader_new_for_os")] #[doc(alias = "new_for_os")] - pub fn for_os( - sysroot: &Sysroot, - osname: Option<&str>, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn for_os(sysroot: &Sysroot, osname: Option<&str>, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_sysroot_upgrader_new_for_os( - sysroot.to_glib_none().0, - osname.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_sysroot_upgrader_new_for_os(sysroot.to_glib_none().0, osname.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sysroot_upgrader_new_for_os_with_flags")] #[doc(alias = "new_for_os_with_flags")] - pub fn for_os_with_flags( - sysroot: &Sysroot, - osname: Option<&str>, - flags: SysrootUpgraderFlags, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn for_os_with_flags(sysroot: &Sysroot, osname: Option<&str>, flags: SysrootUpgraderFlags, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut error = ptr::null_mut(); - let ret = ffi::ostree_sysroot_upgrader_new_for_os_with_flags( - sysroot.to_glib_none().0, - osname.to_glib_none().0, - flags.into_glib(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - if error.is_null() { - Ok(from_glib_full(ret)) - } else { - Err(from_glib_full(error)) - } + let ret = ffi::ostree_sysroot_upgrader_new_for_os_with_flags(sysroot.to_glib_none().0, osname.to_glib_none().0, flags.into_glib(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + if error.is_null() { Ok(from_glib_full(ret)) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sysroot_upgrader_deploy")] - pub fn deploy( - &self, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn deploy(&self, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_upgrader_deploy( - self.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_upgrader_deploy(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sysroot_upgrader_dup_origin")] pub fn dup_origin(&self) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_upgrader_dup_origin( - self.to_glib_none().0, - )) + from_glib_full(ffi::ostree_sysroot_upgrader_dup_origin(self.to_glib_none().0)) } } @@ -128,9 +76,7 @@ impl SysrootUpgrader { #[doc(alias = "get_origin")] pub fn origin(&self) -> Option { unsafe { - from_glib_none(ffi::ostree_sysroot_upgrader_get_origin( - self.to_glib_none().0, - )) + from_glib_none(ffi::ostree_sysroot_upgrader_get_origin(self.to_glib_none().0)) } } @@ -138,94 +84,39 @@ impl SysrootUpgrader { #[doc(alias = "get_origin_description")] pub fn origin_description(&self) -> Option { unsafe { - from_glib_full(ffi::ostree_sysroot_upgrader_get_origin_description( - self.to_glib_none().0, - )) + from_glib_full(ffi::ostree_sysroot_upgrader_get_origin_description(self.to_glib_none().0)) } } #[doc(alias = "ostree_sysroot_upgrader_pull")] - pub fn pull( - &self, - flags: RepoPullFlags, - upgrader_flags: SysrootUpgraderPullFlags, - progress: Option<&AsyncProgress>, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn pull(&self, flags: RepoPullFlags, upgrader_flags: SysrootUpgraderPullFlags, progress: Option<&AsyncProgress>, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_changed = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_upgrader_pull( - self.to_glib_none().0, - flags.into_glib(), - upgrader_flags.into_glib(), - progress.to_glib_none().0, - out_changed.as_mut_ptr(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - let out_changed = out_changed.assume_init(); + let is_ok = ffi::ostree_sysroot_upgrader_pull(self.to_glib_none().0, flags.into_glib(), upgrader_flags.into_glib(), progress.to_glib_none().0, out_changed.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib(out_changed)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib(out_changed.assume_init())) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sysroot_upgrader_pull_one_dir")] - pub fn pull_one_dir( - &self, - dir_to_pull: &str, - flags: RepoPullFlags, - upgrader_flags: SysrootUpgraderPullFlags, - progress: Option<&AsyncProgress>, - cancellable: Option<&impl IsA>, - ) -> Result { + pub fn pull_one_dir(&self, dir_to_pull: &str, flags: RepoPullFlags, upgrader_flags: SysrootUpgraderPullFlags, progress: Option<&AsyncProgress>, cancellable: Option<&impl IsA>) -> Result { unsafe { let mut out_changed = mem::MaybeUninit::uninit(); let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_upgrader_pull_one_dir( - self.to_glib_none().0, - dir_to_pull.to_glib_none().0, - flags.into_glib(), - upgrader_flags.into_glib(), - progress.to_glib_none().0, - out_changed.as_mut_ptr(), - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); - let out_changed = out_changed.assume_init(); + let is_ok = ffi::ostree_sysroot_upgrader_pull_one_dir(self.to_glib_none().0, dir_to_pull.to_glib_none().0, flags.into_glib(), upgrader_flags.into_glib(), progress.to_glib_none().0, out_changed.as_mut_ptr(), cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(from_glib(out_changed)) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(from_glib(out_changed.assume_init())) } else { Err(from_glib_full(error)) } } } #[doc(alias = "ostree_sysroot_upgrader_set_origin")] - pub fn set_origin( - &self, - origin: Option<&glib::KeyFile>, - cancellable: Option<&impl IsA>, - ) -> Result<(), glib::Error> { + pub fn set_origin(&self, origin: Option<&glib::KeyFile>, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_upgrader_set_origin( - self.to_glib_none().0, - origin.to_glib_none().0, - cancellable.map(|p| p.as_ref()).to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_upgrader_set_origin(self.to_glib_none().0, origin.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } @@ -245,18 +136,9 @@ impl SysrootUpgrader { pub fn check_timestamps(repo: &Repo, from_rev: &str, to_rev: &str) -> Result<(), glib::Error> { unsafe { let mut error = ptr::null_mut(); - let is_ok = ffi::ostree_sysroot_upgrader_check_timestamps( - repo.to_glib_none().0, - from_rev.to_glib_none().0, - to_rev.to_glib_none().0, - &mut error, - ); + let is_ok = ffi::ostree_sysroot_upgrader_check_timestamps(repo.to_glib_none().0, from_rev.to_glib_none().0, to_rev.to_glib_none().0, &mut error); assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); - if error.is_null() { - Ok(()) - } else { - Err(from_glib_full(error)) - } + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } } } } diff --git a/rust-bindings/src/auto/versions.txt b/rust-bindings/src/auto/versions.txt index 15372ec6..23200b1b 100644 --- a/rust-bindings/src/auto/versions.txt +++ b/rust-bindings/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d) -from gir-files (@ 94f67628d6ed) +Generated by gir (https://github.com/gtk-rs/gir @ e94fdc6499e4) +from gir-files (@ 0dbd87c01724) diff --git a/rust-bindings/src/functions.rs b/rust-bindings/src/functions.rs index 309a1799..2372da60 100644 --- a/rust-bindings/src/functions.rs +++ b/rust-bindings/src/functions.rs @@ -10,7 +10,7 @@ pub fn checksum_file, Q: IsA>( f: &P, objtype: ObjectType, cancellable: Option<&Q>, -) -> Result> { +) -> Result> { unsafe { let mut out_csum = ptr::null_mut(); let mut error = ptr::null_mut(); @@ -29,7 +29,7 @@ pub fn checksum_file, Q: IsA>( pub fn checksum_file_async< P: IsA, Q: IsA, - R: FnOnce(Result>) + Send + 'static, + R: FnOnce(Result>) + Send + 'static, >( f: &P, objtype: ObjectType, @@ -39,7 +39,7 @@ pub fn checksum_file_async< ) { let user_data: Box = Box::new(callback); unsafe extern "C" fn checksum_file_async_trampoline< - R: FnOnce(Result>) + Send + 'static, + R: FnOnce(Result>) + Send + 'static, >( _source_object: *mut glib::gobject_ffi::GObject, res: *mut gio::ffi::GAsyncResult, @@ -77,7 +77,7 @@ pub fn checksum_file_async_future + Clone + 'static>( f: &P, objtype: ObjectType, io_priority: i32, -) -> Pin>> + 'static>> { +) -> Pin>> + 'static>> { let f = f.clone(); Box::pin(gio::GioFuture::new(&f, move |f, cancellable, send| { checksum_file_async(f, objtype, io_priority, Some(cancellable), move |res| { @@ -93,7 +93,7 @@ pub fn checksum_file_from_input, Q: IsA, objtype: ObjectType, cancellable: Option<&Q>, -) -> Result> { +) -> Result> { unsafe { let mut out_csum = ptr::null_mut(); let mut error = ptr::null_mut(); @@ -147,7 +147,7 @@ unsafe fn checksum_file_error( out_csum: *mut [*mut u8; 32], error: *mut glib::ffi::GError, ret: i32, -) -> Result> { +) -> Result> { if !error.is_null() { Err(Box::::new(from_glib_full(error))) } else if ret == GFALSE { diff --git a/rust-bindings/src/object_name.rs b/rust-bindings/src/object_name.rs index ed4c1bfe..d6071780 100644 --- a/rust-bindings/src/object_name.rs +++ b/rust-bindings/src/object_name.rs @@ -1,6 +1,5 @@ use crate::ObjectType; use crate::{object_name_deserialize, object_name_serialize, object_to_string}; -use glib::translate::*; use glib::GString; use std::fmt::Display; use std::fmt::Error; @@ -9,7 +8,7 @@ use std::hash::Hash; use std::hash::Hasher; fn hash_object_name(v: &glib::Variant) -> u32 { - unsafe { ffi::ostree_hash_object_name(v.to_glib_none().0 as glib::ffi::gconstpointer) } + unsafe { ffi::ostree_hash_object_name(v.as_ptr() as glib::ffi::gconstpointer) } } /// A reference to an object in an OSTree repo. It contains both a checksum and an diff --git a/rust-bindings/sys/Cargo.toml b/rust-bindings/sys/Cargo.toml index f2cc5fbd..c855052d 100644 --- a/rust-bindings/sys/Cargo.toml +++ b/rust-bindings/sys/Cargo.toml @@ -6,15 +6,15 @@ libc = "0.2" [dependencies.gio] package = "gio-sys" -version = "0.15" +version = "0.16" [dependencies.glib] package = "glib-sys" -version = "0.15" +version = "0.16" [dependencies.gobject] package = "gobject-sys" -version = "0.15" +version = "0.16" [dev-dependencies] shell-words = "1.0.0" @@ -56,7 +56,7 @@ v2019_6 = ["v2019_4"] v2020_1 = ["v2019_6"] v2020_2 = ["v2020_1"] v2020_4 = ["v2020_2"] -dox = [] +dox = ["glib/dox", "gobject/dox", "gio/dox"] v2020_7 = ["v2020_4"] v2020_8 = ["v2020_7"] v2021_1 = ["v2020_8"] diff --git a/rust-bindings/sys/build.rs b/rust-bindings/sys/build.rs index 8c0c4a3a..e136ab29 100644 --- a/rust-bindings/sys/build.rs +++ b/rust-bindings/sys/build.rs @@ -11,7 +11,7 @@ fn main() {} // prevent linking libraries to avoid documentation failure #[cfg(not(feature = "dox"))] fn main() { if let Err(s) = system_deps::Config::new().probe() { - println!("cargo:warning={}", s); + println!("cargo:warning={s}"); process::exit(1); } } diff --git a/rust-bindings/sys/src/auto/versions.txt b/rust-bindings/sys/src/auto/versions.txt index 15372ec6..23200b1b 100644 --- a/rust-bindings/sys/src/auto/versions.txt +++ b/rust-bindings/sys/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ c8a7a13d2c4d) -from gir-files (@ 94f67628d6ed) +Generated by gir (https://github.com/gtk-rs/gir @ e94fdc6499e4) +from gir-files (@ 0dbd87c01724) diff --git a/rust-bindings/sys/src/lib.rs b/rust-bindings/sys/src/lib.rs index 943914ab..75bcae8d 100644 --- a/rust-bindings/sys/src/lib.rs +++ b/rust-bindings/sys/src/lib.rs @@ -302,7 +302,7 @@ pub struct OstreeAsyncProgressClass { impl ::std::fmt::Debug for OstreeAsyncProgressClass { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeAsyncProgressClass @ {:p}", self)) + f.debug_struct(&format!("OstreeAsyncProgressClass @ {self:p}")) .field("parent_class", &self.parent_class) .field("changed", &self.changed) .finish() @@ -366,7 +366,7 @@ pub struct OstreeCollectionRef { impl ::std::fmt::Debug for OstreeCollectionRef { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeCollectionRef @ {:p}", self)) + f.debug_struct(&format!("OstreeCollectionRef @ {self:p}")) .field("collection_id", &self.collection_id) .field("ref_name", &self.ref_name) .finish() @@ -384,7 +384,7 @@ pub struct OstreeCommitSizesEntry { impl ::std::fmt::Debug for OstreeCommitSizesEntry { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeCommitSizesEntry @ {:p}", self)) + f.debug_struct(&format!("OstreeCommitSizesEntry @ {self:p}")) .field("checksum", &self.checksum) .field("objtype", &self.objtype) .field("unpacked", &self.unpacked) @@ -401,7 +401,7 @@ pub struct OstreeContentWriterClass { impl ::std::fmt::Debug for OstreeContentWriterClass { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeContentWriterClass @ {:p}", self)) + f.debug_struct(&format!("OstreeContentWriterClass @ {self:p}")) .field("parent_class", &self.parent_class) .finish() } @@ -420,7 +420,7 @@ pub struct OstreeDiffDirsOptions { impl ::std::fmt::Debug for OstreeDiffDirsOptions { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeDiffDirsOptions @ {:p}", self)) + f.debug_struct(&format!("OstreeDiffDirsOptions @ {self:p}")) .field("owner_uid", &self.owner_uid) .field("owner_gid", &self.owner_gid) .field("devino_to_csum_cache", &self.devino_to_csum_cache) @@ -445,7 +445,7 @@ pub struct OstreeDiffItem { impl ::std::fmt::Debug for OstreeDiffItem { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeDiffItem @ {:p}", self)) + f.debug_struct(&format!("OstreeDiffItem @ {self:p}")) .field("refcount", &self.refcount) .field("src", &self.src) .field("target", &self.target) @@ -513,7 +513,7 @@ pub struct OstreeMutableTreeClass { impl ::std::fmt::Debug for OstreeMutableTreeClass { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeMutableTreeClass @ {:p}", self)) + f.debug_struct(&format!("OstreeMutableTreeClass @ {self:p}")) .field("parent_class", &self.parent_class) .finish() } @@ -528,7 +528,7 @@ pub struct OstreeMutableTreeIter { impl ::std::fmt::Debug for OstreeMutableTreeIter { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeMutableTreeIter @ {:p}", self)) + f.debug_struct(&format!("OstreeMutableTreeIter @ {self:p}")) .field("in_files", &self.in_files) .field("iter", &self.iter) .finish() @@ -543,8 +543,7 @@ pub struct OstreeRemote { impl ::std::fmt::Debug for OstreeRemote { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRemote @ {:p}", self)) - .finish() + f.debug_struct(&format!("OstreeRemote @ {self:p}")).finish() } } @@ -574,7 +573,7 @@ pub struct OstreeRepoCheckoutAtOptions { impl ::std::fmt::Debug for OstreeRepoCheckoutAtOptions { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoCheckoutAtOptions @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoCheckoutAtOptions @ {self:p}")) .field("mode", &self.mode) .field("overwrite_mode", &self.overwrite_mode) .field("enable_uncompressed_cache", &self.enable_uncompressed_cache) @@ -612,7 +611,7 @@ pub struct OstreeRepoCheckoutOptions { impl ::std::fmt::Debug for OstreeRepoCheckoutOptions { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoCheckoutOptions @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoCheckoutOptions @ {self:p}")) .field("mode", &self.mode) .field("overwrite_mode", &self.overwrite_mode) .field("enable_uncompressed_cache", &self.enable_uncompressed_cache) @@ -628,7 +627,7 @@ pub struct OstreeRepoCommitModifier { impl ::std::fmt::Debug for OstreeRepoCommitModifier { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoCommitModifier @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoCommitModifier @ {self:p}")) .finish() } } @@ -643,7 +642,7 @@ pub struct OstreeRepoCommitTraverseIter { impl ::std::fmt::Debug for OstreeRepoCommitTraverseIter { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoCommitTraverseIter @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoCommitTraverseIter @ {self:p}")) .field("initialized", &self.initialized) .field("dummy", &self.dummy) .finish() @@ -658,7 +657,7 @@ pub struct OstreeRepoDevInoCache { impl ::std::fmt::Debug for OstreeRepoDevInoCache { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoDevInoCache @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoDevInoCache @ {self:p}")) .finish() } } @@ -672,7 +671,7 @@ pub struct OstreeRepoExportArchiveOptions { impl ::std::fmt::Debug for OstreeRepoExportArchiveOptions { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoExportArchiveOptions @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoExportArchiveOptions @ {self:p}")) .field("disable_xattrs", &self.disable_xattrs) .finish() } @@ -686,7 +685,7 @@ pub struct OstreeRepoFileClass { impl ::std::fmt::Debug for OstreeRepoFileClass { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoFileClass @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoFileClass @ {self:p}")) .field("parent_class", &self.parent_class) .finish() } @@ -708,7 +707,7 @@ pub struct OstreeRepoFinderAvahiClass { impl ::std::fmt::Debug for OstreeRepoFinderAvahiClass { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoFinderAvahiClass @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoFinderAvahiClass @ {self:p}")) .field("parent_class", &self.parent_class) .finish() } @@ -722,7 +721,7 @@ pub struct OstreeRepoFinderConfigClass { impl ::std::fmt::Debug for OstreeRepoFinderConfigClass { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoFinderConfigClass @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoFinderConfigClass @ {self:p}")) .field("parent_class", &self.parent_class) .finish() } @@ -753,7 +752,7 @@ pub struct OstreeRepoFinderInterface { impl ::std::fmt::Debug for OstreeRepoFinderInterface { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoFinderInterface @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoFinderInterface @ {self:p}")) .field("g_iface", &self.g_iface) .field("resolve_async", &self.resolve_async) .field("resolve_finish", &self.resolve_finish) @@ -769,7 +768,7 @@ pub struct OstreeRepoFinderMountClass { impl ::std::fmt::Debug for OstreeRepoFinderMountClass { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoFinderMountClass @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoFinderMountClass @ {self:p}")) .field("parent_class", &self.parent_class) .finish() } @@ -783,7 +782,7 @@ pub struct OstreeRepoFinderOverrideClass { impl ::std::fmt::Debug for OstreeRepoFinderOverrideClass { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoFinderOverrideClass @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoFinderOverrideClass @ {self:p}")) .field("parent_class", &self.parent_class) .finish() } @@ -803,7 +802,7 @@ pub struct OstreeRepoFinderResult { impl ::std::fmt::Debug for OstreeRepoFinderResult { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoFinderResult @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoFinderResult @ {self:p}")) .field("remote", &self.remote) .field("finder", &self.finder) .field("priority", &self.priority) @@ -823,7 +822,7 @@ pub struct OstreeRepoImportArchiveOptions { impl ::std::fmt::Debug for OstreeRepoImportArchiveOptions { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoImportArchiveOptions @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoImportArchiveOptions @ {self:p}")) .field( "ignore_unsupported_content", &self.ignore_unsupported_content, @@ -844,7 +843,7 @@ pub struct OstreeRepoPruneOptions { impl ::std::fmt::Debug for OstreeRepoPruneOptions { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoPruneOptions @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoPruneOptions @ {self:p}")) .field("flags", &self.flags) .field("reachable", &self.reachable) .field("unused_bools", &self.unused_bools) @@ -871,7 +870,7 @@ pub struct OstreeRepoTransactionStats { impl ::std::fmt::Debug for OstreeRepoTransactionStats { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoTransactionStats @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoTransactionStats @ {self:p}")) .field("metadata_objects_total", &self.metadata_objects_total) .field("metadata_objects_written", &self.metadata_objects_written) .field("content_objects_total", &self.content_objects_total) @@ -945,7 +944,7 @@ pub struct OstreeSignInterface { impl ::std::fmt::Debug for OstreeSignInterface { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeSignInterface @ {:p}", self)) + f.debug_struct(&format!("OstreeSignInterface @ {self:p}")) .field("g_iface", &self.g_iface) .field("get_name", &self.get_name) .field("data", &self.data) @@ -973,7 +972,7 @@ pub struct OstreeSysrootDeployTreeOpts { impl ::std::fmt::Debug for OstreeSysrootDeployTreeOpts { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeSysrootDeployTreeOpts @ {:p}", self)) + f.debug_struct(&format!("OstreeSysrootDeployTreeOpts @ {self:p}")) .field("unused_bools", &self.unused_bools) .field("unused_ints", &self.unused_ints) .field("override_kernel_argv", &self.override_kernel_argv) @@ -994,7 +993,7 @@ pub struct OstreeSysrootWriteDeploymentsOpts { impl ::std::fmt::Debug for OstreeSysrootWriteDeploymentsOpts { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeSysrootWriteDeploymentsOpts @ {:p}", self)) + f.debug_struct(&format!("OstreeSysrootWriteDeploymentsOpts @ {self:p}")) .field("do_postclean", &self.do_postclean) .field("unused_bools", &self.unused_bools) .field("unused_ints", &self.unused_ints) @@ -1012,7 +1011,7 @@ pub struct OstreeAsyncProgress { impl ::std::fmt::Debug for OstreeAsyncProgress { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeAsyncProgress @ {:p}", self)) + f.debug_struct(&format!("OstreeAsyncProgress @ {self:p}")) .finish() } } @@ -1025,7 +1024,7 @@ pub struct OstreeBootconfigParser { impl ::std::fmt::Debug for OstreeBootconfigParser { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeBootconfigParser @ {:p}", self)) + f.debug_struct(&format!("OstreeBootconfigParser @ {self:p}")) .finish() } } @@ -1038,7 +1037,7 @@ pub struct OstreeContentWriter { impl ::std::fmt::Debug for OstreeContentWriter { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeContentWriter @ {:p}", self)) + f.debug_struct(&format!("OstreeContentWriter @ {self:p}")) .finish() } } @@ -1051,7 +1050,7 @@ pub struct OstreeDeployment { impl ::std::fmt::Debug for OstreeDeployment { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeDeployment @ {:p}", self)) + f.debug_struct(&format!("OstreeDeployment @ {self:p}")) .finish() } } @@ -1064,7 +1063,7 @@ pub struct OstreeGpgVerifyResult { impl ::std::fmt::Debug for OstreeGpgVerifyResult { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeGpgVerifyResult @ {:p}", self)) + f.debug_struct(&format!("OstreeGpgVerifyResult @ {self:p}")) .finish() } } @@ -1077,7 +1076,7 @@ pub struct OstreeMutableTree { impl ::std::fmt::Debug for OstreeMutableTree { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeMutableTree @ {:p}", self)) + f.debug_struct(&format!("OstreeMutableTree @ {self:p}")) .finish() } } @@ -1090,7 +1089,7 @@ pub struct OstreeRepo { impl ::std::fmt::Debug for OstreeRepo { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepo @ {:p}", self)).finish() + f.debug_struct(&format!("OstreeRepo @ {self:p}")).finish() } } @@ -1102,7 +1101,7 @@ pub struct OstreeRepoFile { impl ::std::fmt::Debug for OstreeRepoFile { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoFile @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoFile @ {self:p}")) .finish() } } @@ -1115,7 +1114,7 @@ pub struct OstreeRepoFinderAvahi { impl ::std::fmt::Debug for OstreeRepoFinderAvahi { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoFinderAvahi @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoFinderAvahi @ {self:p}")) .finish() } } @@ -1128,7 +1127,7 @@ pub struct OstreeRepoFinderConfig { impl ::std::fmt::Debug for OstreeRepoFinderConfig { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoFinderConfig @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoFinderConfig @ {self:p}")) .finish() } } @@ -1141,7 +1140,7 @@ pub struct OstreeRepoFinderMount { impl ::std::fmt::Debug for OstreeRepoFinderMount { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoFinderMount @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoFinderMount @ {self:p}")) .finish() } } @@ -1154,7 +1153,7 @@ pub struct OstreeRepoFinderOverride { impl ::std::fmt::Debug for OstreeRepoFinderOverride { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeRepoFinderOverride @ {:p}", self)) + f.debug_struct(&format!("OstreeRepoFinderOverride @ {self:p}")) .finish() } } @@ -1167,7 +1166,7 @@ pub struct OstreeSePolicy { impl ::std::fmt::Debug for OstreeSePolicy { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeSePolicy @ {:p}", self)) + f.debug_struct(&format!("OstreeSePolicy @ {self:p}")) .finish() } } @@ -1180,7 +1179,7 @@ pub struct OstreeSysroot { impl ::std::fmt::Debug for OstreeSysroot { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeSysroot @ {:p}", self)) + f.debug_struct(&format!("OstreeSysroot @ {self:p}")) .finish() } } @@ -1193,7 +1192,7 @@ pub struct OstreeSysrootUpgrader { impl ::std::fmt::Debug for OstreeSysrootUpgrader { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - f.debug_struct(&format!("OstreeSysrootUpgrader @ {:p}", self)) + f.debug_struct(&format!("OstreeSysrootUpgrader @ {self:p}")) .finish() } } @@ -1207,7 +1206,7 @@ pub struct OstreeRepoFinder { impl ::std::fmt::Debug for OstreeRepoFinder { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - write!(f, "OstreeRepoFinder @ {:p}", self) + write!(f, "OstreeRepoFinder @ {self:p}") } } @@ -1219,7 +1218,7 @@ pub struct OstreeSign { impl ::std::fmt::Debug for OstreeSign { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { - write!(f, "OstreeSign @ {:p}", self) + write!(f, "OstreeSign @ {self:p}") } } diff --git a/rust-bindings/sys/tests/abi.rs b/rust-bindings/sys/tests/abi.rs index 3adba9ff..bc4c69f0 100644 --- a/rust-bindings/sys/tests/abi.rs +++ b/rust-bindings/sys/tests/abi.rs @@ -40,7 +40,7 @@ impl Compiler { cmd.arg(out); let status = cmd.spawn()?.wait()?; if !status.success() { - return Err(format!("compilation command {:?} failed, {}", &cmd, status).into()); + return Err(format!("compilation command {cmd:?} failed, {status}").into()); } Ok(()) } @@ -56,7 +56,7 @@ fn get_var(name: &str, default: &str) -> Result, Box> { match env::var(name) { Ok(value) => Ok(shell_words::split(&value)?), Err(env::VarError::NotPresent) => Ok(shell_words::split(default)?), - Err(err) => Err(format!("{} {}", name, err).into()), + Err(err) => Err(format!("{name} {err}").into()), } } @@ -70,7 +70,7 @@ fn pkg_config_cflags(packages: &[&str]) -> Result, Box> { cmd.args(packages); let out = cmd.output()?; if !out.status.success() { - return Err(format!("command {:?} returned {}", &cmd, out.status).into()); + return Err(format!("command {cmd:?} returned {}", out.status).into()); } let stdout = str::from_utf8(&out.stdout)?; Ok(shell_words::split(stdout.trim())?) @@ -115,13 +115,8 @@ fn cross_validate_constants_with_c() { let mut c_constants: Vec<(String, String)> = Vec::new(); for l in get_c_output("constant").unwrap().lines() { - let mut words = l.trim().split(';'); - let name = words.next().expect("Failed to parse name").to_owned(); - let value = words - .next() - .and_then(|s| s.parse().ok()) - .expect("Failed to parse value"); - c_constants.push((name, value)); + let (name, value) = l.split_once(';').expect("Missing ';' separator"); + c_constants.push((name.to_owned(), value.to_owned())); } let mut results = Results::default(); @@ -131,15 +126,14 @@ fn cross_validate_constants_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_value != c_value { results.record_failed(); eprintln!( - "Constant value mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_value, &c_value + "Constant value mismatch for {rust_name}\nRust: {rust_value:?}\nC: {c_value:?}", ); continue; } @@ -156,17 +150,11 @@ fn cross_validate_layout_with_c() { let mut c_layouts = Vec::new(); for l in get_c_output("layout").unwrap().lines() { - let mut words = l.trim().split(';'); - let name = words.next().expect("Failed to parse name").to_owned(); - let size = words - .next() - .and_then(|s| s.parse().ok()) - .expect("Failed to parse size"); - let alignment = words - .next() - .and_then(|s| s.parse().ok()) - .expect("Failed to parse alignment"); - c_layouts.push((name, Layout { size, alignment })); + let (name, value) = l.split_once(';').expect("Missing first ';' separator"); + let (size, alignment) = value.split_once(';').expect("Missing second ';' separator"); + let size = size.parse().expect("Failed to parse size"); + let alignment = alignment.parse().expect("Failed to parse alignment"); + c_layouts.push((name.to_owned(), Layout { size, alignment })); } let mut results = Results::default(); @@ -175,16 +163,13 @@ fn cross_validate_layout_with_c() { { if rust_name != c_name { results.record_failed(); - eprintln!("Name mismatch:\nRust: {:?}\nC: {:?}", rust_name, c_name,); + eprintln!("Name mismatch:\nRust: {rust_name:?}\nC: {c_name:?}"); continue; } if rust_layout != c_layout { results.record_failed(); - eprintln!( - "Layout mismatch for {}\nRust: {:?}\nC: {:?}", - rust_name, rust_layout, &c_layout - ); + eprintln!("Layout mismatch for {rust_name}\nRust: {rust_layout:?}\nC: {c_layout:?}",); continue; } @@ -205,7 +190,7 @@ fn get_c_output(name: &str) -> Result> { let mut abi_cmd = Command::new(exe); let output = abi_cmd.output()?; if !output.status.success() { - return Err(format!("command {:?} failed, {:?}", &abi_cmd, &output).into()); + return Err(format!("command {abi_cmd:?} failed, {output:?}").into()); } Ok(String::from_utf8(output.stdout)?) From 61daa277a1c3032b1e752e1e312e5b4b33bb28fe Mon Sep 17 00:00:00 2001 From: Luca BRUNO Date: Fri, 4 Mar 2022 14:28:35 +0000 Subject: [PATCH 44/55] ostree: manually patch generated files This manually adds a missing `ToGlibPtr` import, which seems to be result of some bugs in `gir` code-generation. --- rust-bindings/src/auto/repo_finder_result.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/rust-bindings/src/auto/repo_finder_result.rs b/rust-bindings/src/auto/repo_finder_result.rs index f918c03b..b4846b5e 100644 --- a/rust-bindings/src/auto/repo_finder_result.rs +++ b/rust-bindings/src/auto/repo_finder_result.rs @@ -3,6 +3,7 @@ // DO NOT EDIT use std::cmp; +use glib::translate::*; glib::wrapper! { #[derive(Debug, Hash)] From a4f56459268869f0188607ae2a897d6bf1136208 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Fri, 18 Nov 2022 11:26:46 -0500 Subject: [PATCH 45/55] repo: Avoid potential double unwind when writing panic value Thanks to @shinmao for the report! Closes: https://github.com/ostreedev/ostree/issues/2775 --- .../repo_checkout_filter.rs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/rust-bindings/src/repo_checkout_at_options/repo_checkout_filter.rs b/rust-bindings/src/repo_checkout_at_options/repo_checkout_filter.rs index 755efea2..c63b3ffb 100644 --- a/rust-bindings/src/repo_checkout_at_options/repo_checkout_filter.rs +++ b/rust-bindings/src/repo_checkout_at_options/repo_checkout_filter.rs @@ -107,18 +107,26 @@ pub(super) unsafe extern "C" fn filter_trampoline_unwindsafe( /// /// If the panic value is either `&str` or `String`, we print it. Otherwise, we don't. fn print_panic(panic: Box) { - eprintln!("A Rust callback invoked by C code panicked."); - eprintln!("Unwinding across FFI boundaries is Undefined Behavior so abort() will be called."); + use std::io::Write; + let stderr = std::io::stderr(); + let mut stderr = stderr.lock(); + // Directly write to stderr instead of eprintln!() as that function panics + // if writing fails, which would involve a double panic which we don't want. + let _ = stderr.write_all( + r#"A Rust callback invoked by C code panicked. +Unwinding across FFI boundaries is Undefined Behavior so abort() will be called."# + .as_bytes(), + ); let msg = { if let Some(s) = panic.as_ref().downcast_ref::<&str>() { s } else if let Some(s) = panic.as_ref().downcast_ref::() { s } else { - "UNABLE TO SHOW VALUE OF PANIC" + "(non-string panic value)" } }; - eprintln!("Panic value: {}", msg); + let _ = stderr.write_all(msg.as_bytes()); } #[cfg(test)] From 71e3bb8b80f14e471c9ae05acb888f1d2d95851d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 21 Nov 2022 13:40:53 -0500 Subject: [PATCH 46/55] Allow missing docs on two `glib::wrapper` functions This is being triggered in gtk-rs generated code. --- rust-bindings/src/lib.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rust-bindings/src/lib.rs b/rust-bindings/src/lib.rs index 1cbeabd7..01f8ad08 100644 --- a/rust-bindings/src/lib.rs +++ b/rust-bindings/src/lib.rs @@ -50,6 +50,7 @@ pub use crate::functions::*; mod mutable_tree; pub use crate::mutable_tree::*; #[cfg(any(feature = "v2019_3", feature = "dox"))] +#[allow(missing_docs)] mod kernel_args; #[cfg(any(feature = "v2019_3", feature = "dox"))] pub use crate::kernel_args::*; @@ -63,6 +64,7 @@ pub use crate::repo::*; mod repo_checkout_at_options; #[cfg(any(feature = "v2016_8", feature = "dox"))] pub use crate::repo_checkout_at_options::*; +#[allow(missing_docs)] mod repo_transaction_stats; pub use repo_transaction_stats::RepoTransactionStats; mod se_policy; From 599ffefe7f069712d54f63f67e4a6f92570c554e Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 21 Nov 2022 15:16:04 -0500 Subject: [PATCH 47/55] sysroot: Add an API to initialize with mountns This lowers down into the C library some logic we have in the binary/app logic, in prep for having more Rust-native CLI code in https://github.com/ostreedev/ostree-rs-ext/pull/412 Basically we want to *ensure* a mount namespace by invoking `unshare()` if necessary, instead of requiring our callers to do this dance. This also helps fix e.g. Closes: https://github.com/ostreedev/ostree/issues/2769 --- apidoc/ostree-sections.txt | 1 + src/libostree/libostree-devel.sym | 1 + src/libostree/ostree-sysroot.c | 57 +++++++++++++++++++++++++++++++ src/libostree/ostree-sysroot.h | 3 ++ src/ostree/ot-main.c | 20 ++--------- 5 files changed, 65 insertions(+), 17 deletions(-) diff --git a/apidoc/ostree-sections.txt b/apidoc/ostree-sections.txt index 49f2748b..eb162dc4 100644 --- a/apidoc/ostree-sections.txt +++ b/apidoc/ostree-sections.txt @@ -548,6 +548,7 @@ OstreeSysroot ostree_sysroot_new ostree_sysroot_new_default ostree_sysroot_initialize +ostree_sysroot_initialize_with_mount_namespace ostree_sysroot_get_path ostree_sysroot_load ostree_sysroot_load_if_changed diff --git a/src/libostree/libostree-devel.sym b/src/libostree/libostree-devel.sym index 6a82433a..8f374bbe 100644 --- a/src/libostree/libostree-devel.sym +++ b/src/libostree/libostree-devel.sym @@ -24,6 +24,7 @@ LIBOSTREE_2022.7 { global: ostree_kernel_args_contains; ostree_kernel_args_delete_if_present; + ostree_sysroot_initialize_with_mount_namespace; } LIBOSTREE_2022.5; /* Stub section for the stable release *after* this development one; don't diff --git a/src/libostree/ostree-sysroot.c b/src/libostree/ostree-sysroot.c index b15265f5..4c63a657 100644 --- a/src/libostree/ostree-sysroot.c +++ b/src/libostree/ostree-sysroot.c @@ -259,6 +259,63 @@ ostree_sysroot_set_mount_namespace_in_use (OstreeSysroot *self) self->mount_namespace_in_use = TRUE; } +/** + * ostree_sysroot_initialize_with_mount_namespace: + * + * Prepare the current process for modifying a booted sysroot, if applicable. + * This function subsumes the functionality of `ostree_sysroot_initialize` + * and may be invoked wherever that function is. + * + * If the sysroot does not appear to be booted, or where the current process is not uid 0, + * this function returns successfully. + * + * Otherwise, if the process is in the same mount namespace as pid 1, create + * a new namespace. + * + * If you invoke this function, it must be before ostree_sysroot_load(); it may + * be invoked before or after ostree_sysroot_initialize(). + * + * Since: 2022.7 + */ +gboolean +ostree_sysroot_initialize_with_mount_namespace (OstreeSysroot *self, GCancellable *cancellable, GError **error) +{ + GLNX_AUTO_PREFIX_ERROR ("Initializing with mountns", error); + /* Must be before we're loaded, as otherwise we'd have to close/reopen all our + fds, e.g. the repo */ + g_assert (self->loadstate < OSTREE_SYSROOT_LOAD_STATE_LOADED); + + if (!ostree_sysroot_initialize (self, error)) + return FALSE; + + /* Do nothing if we're not privileged */ + if (getuid () != 0) + return TRUE; + + /* We also assume operating on non-booted roots won't have a readonly sysroot */ + if (!self->root_is_ostree_booted) + return TRUE; + + g_autofree char *mntns_pid1 = + glnx_readlinkat_malloc (AT_FDCWD, "/proc/1/ns/mnt", cancellable, error); + if (!mntns_pid1) + return glnx_prefix_error (error, "Reading /proc/1/ns/mnt"); + g_autofree char *mntns_self = + glnx_readlinkat_malloc (AT_FDCWD, "/proc/self/ns/mnt", cancellable, error); + if (!mntns_self) + return glnx_prefix_error (error, "Reading /proc/self/ns/mnt"); + + // If the mount namespaces are the same, we need to unshare(). + if (strcmp (mntns_pid1, mntns_self) == 0) + { + if (unshare (CLONE_NEWNS) < 0) + return glnx_throw_errno_prefix (error, "Failed to invoke unshare(CLONE_NEWNS)"); + } + + ostree_sysroot_set_mount_namespace_in_use (self); + return TRUE; +} + /** * ostree_sysroot_get_path: * @self: Sysroot diff --git a/src/libostree/ostree-sysroot.h b/src/libostree/ostree-sysroot.h index 0cde9e44..23c7139a 100644 --- a/src/libostree/ostree-sysroot.h +++ b/src/libostree/ostree-sysroot.h @@ -50,6 +50,9 @@ OstreeSysroot* ostree_sysroot_new_default (void); _OSTREE_PUBLIC void ostree_sysroot_set_mount_namespace_in_use (OstreeSysroot *self); +_OSTREE_PUBLIC +gboolean ostree_sysroot_initialize_with_mount_namespace (OstreeSysroot *self, GCancellable *cancellable, GError **error); + _OSTREE_PUBLIC GFile *ostree_sysroot_get_path (OstreeSysroot *self); diff --git a/src/ostree/ot-main.c b/src/ostree/ot-main.c index 770962a4..da4735b6 100644 --- a/src/ostree/ot-main.c +++ b/src/ostree/ot-main.c @@ -586,23 +586,9 @@ ostree_admin_sysroot_load (OstreeSysroot *sysroot, { if ((flags & OSTREE_ADMIN_BUILTIN_FLAG_UNLOCKED) == 0) { - /* If we're requested to lock the sysroot, first check if we're operating - * on a booted (not physical) sysroot. Then find out if the /sysroot - * subdir is a read-only mount point, and if so, create a new mount - * namespace and tell the sysroot that we've done so. See the docs for - * ostree_sysroot_set_mount_namespace_in_use(). - * - * This is a conservative approach; we could just always - * unshare() too. - */ - if (ostree_sysroot_is_booted (sysroot)) - { - gboolean setup_ns = FALSE; - if (!maybe_setup_mount_namespace (&setup_ns, error)) - return FALSE; - if (setup_ns) - ostree_sysroot_set_mount_namespace_in_use (sysroot); - } + /* Set up the mount namespace, if applicable */ + if (!ostree_sysroot_initialize_with_mount_namespace (sysroot, cancellable, error)) + return FALSE; /* Released when sysroot is finalized, or on process exit */ if (!ot_admin_sysroot_lock (sysroot, error)) From cceb04de159c43ea76907c3fc1aeb6411245556e Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 22 Nov 2022 09:53:59 -0500 Subject: [PATCH 48/55] rust: Regenerate with latest gir and C sources --- rust-bindings/Makefile | 2 +- rust-bindings/src/auto/flags.rs | 7 +++++ rust-bindings/src/auto/repo_finder_result.rs | 2 +- rust-bindings/src/auto/sysroot.rs | 12 +++++++ rust-bindings/src/auto/versions.txt | 4 +-- rust-bindings/sys/Cargo.toml | 4 +++ rust-bindings/sys/src/auto/versions.txt | 4 +-- rust-bindings/sys/src/lib.rs | 33 ++++++++++++-------- 8 files changed, 49 insertions(+), 19 deletions(-) diff --git a/rust-bindings/Makefile b/rust-bindings/Makefile index a49ab80e..652d7e46 100644 --- a/rust-bindings/Makefile +++ b/rust-bindings/Makefile @@ -1,5 +1,5 @@ GIR_REPO := https://github.com/gtk-rs/gir.git -GIR_VERSION := e94fdc6499e45d89bada123f4d2e63ceb6af997d +GIR_VERSION := 0eeebbdf9d4d5a0b0148c7fa055bf961e16e54a0 OSTREE_REPO := ../ostree OSTREE_VERSION := patch-v2022.2 RUSTDOC_STRIPPER_VERSION := 0.1.17 diff --git a/rust-bindings/src/auto/flags.rs b/rust-bindings/src/auto/flags.rs index 65dd92d0..7f822000 100644 --- a/rust-bindings/src/auto/flags.rs +++ b/rust-bindings/src/auto/flags.rs @@ -590,6 +590,13 @@ impl ToValue for SysrootUpgraderFlags { } } +impl From for glib::Value { + #[inline] + fn from(v: SysrootUpgraderFlags) -> Self { + ToValue::to_value(&v) + } +} + bitflags! { #[doc(alias = "OstreeSysrootUpgraderPullFlags")] pub struct SysrootUpgraderPullFlags: u32 { diff --git a/rust-bindings/src/auto/repo_finder_result.rs b/rust-bindings/src/auto/repo_finder_result.rs index b4846b5e..4908673e 100644 --- a/rust-bindings/src/auto/repo_finder_result.rs +++ b/rust-bindings/src/auto/repo_finder_result.rs @@ -2,8 +2,8 @@ // from gir-files // DO NOT EDIT -use std::cmp; use glib::translate::*; +use std::cmp; glib::wrapper! { #[derive(Debug, Hash)] diff --git a/rust-bindings/src/auto/sysroot.rs b/rust-bindings/src/auto/sysroot.rs index 54dcdc42..abb80387 100644 --- a/rust-bindings/src/auto/sysroot.rs +++ b/rust-bindings/src/auto/sysroot.rs @@ -273,6 +273,18 @@ impl Sysroot { } } + #[cfg(any(feature = "v2022_7", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2022_7")))] + #[doc(alias = "ostree_sysroot_initialize_with_mount_namespace")] + pub fn initialize_with_mount_namespace(&self, cancellable: Option<&impl IsA>) -> Result<(), glib::Error> { + unsafe { + let mut error = ptr::null_mut(); + let is_ok = ffi::ostree_sysroot_initialize_with_mount_namespace(self.to_glib_none().0, cancellable.map(|p| p.as_ref()).to_glib_none().0, &mut error); + assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null()); + if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) } + } + } + #[cfg(any(feature = "v2020_1", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_1")))] #[doc(alias = "ostree_sysroot_is_booted")] diff --git a/rust-bindings/src/auto/versions.txt b/rust-bindings/src/auto/versions.txt index 23200b1b..97f80dcd 100644 --- a/rust-bindings/src/auto/versions.txt +++ b/rust-bindings/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e94fdc6499e4) -from gir-files (@ 0dbd87c01724) +Generated by gir (https://github.com/gtk-rs/gir @ 0eeebbdf9d4d) +from gir-files (@ 8c831311be59) diff --git a/rust-bindings/sys/Cargo.toml b/rust-bindings/sys/Cargo.toml index c855052d..543f515d 100644 --- a/rust-bindings/sys/Cargo.toml +++ b/rust-bindings/sys/Cargo.toml @@ -67,6 +67,7 @@ v2021_5 = ["v2021_4"] v2022_2 = ["v2021_5"] v2022_5 = ["v2022_2"] v2022_6 = ["v2022_5"] +v2022_7 = ["v2022_5"] [lib] name = "ostree_sys" @@ -224,3 +225,6 @@ version = "2022.5" [package.metadata.system-deps.ostree_1.v2022_6] version = "2022.6" + +[package.metadata.system-deps.ostree_1.v2022_7] +version = "2022.7" diff --git a/rust-bindings/sys/src/auto/versions.txt b/rust-bindings/sys/src/auto/versions.txt index 23200b1b..97f80dcd 100644 --- a/rust-bindings/sys/src/auto/versions.txt +++ b/rust-bindings/sys/src/auto/versions.txt @@ -1,2 +1,2 @@ -Generated by gir (https://github.com/gtk-rs/gir @ e94fdc6499e4) -from gir-files (@ 0dbd87c01724) +Generated by gir (https://github.com/gtk-rs/gir @ 0eeebbdf9d4d) +from gir-files (@ 8c831311be59) diff --git a/rust-bindings/sys/src/lib.rs b/rust-bindings/sys/src/lib.rs index 75bcae8d..f71a18de 100644 --- a/rust-bindings/sys/src/lib.rs +++ b/rust-bindings/sys/src/lib.rs @@ -1312,19 +1312,6 @@ extern "C" { #[cfg(any(feature = "v2022_5", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2022_5")))] pub fn ostree_kernel_args_append_if_missing(kargs: *mut OstreeKernelArgs, arg: *const c_char); - #[cfg(any(feature = "v2022_7", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v2022_7")))] - pub fn ostree_kernel_args_contains( - kargs: *mut OstreeKernelArgs, - arg: *const c_char, - ) -> gboolean; - #[cfg(any(feature = "v2022_7", feature = "dox"))] - #[cfg_attr(feature = "dox", doc(cfg(feature = "v2022_7")))] - pub fn ostree_kernel_args_delete_if_present( - kargs: *mut OstreeKernelArgs, - arg: *const c_char, - error: *mut *mut glib::GError, - ) -> gboolean; #[cfg(any(feature = "v2019_3", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2019_3")))] pub fn ostree_kernel_args_append_proc_cmdline( @@ -1332,11 +1319,24 @@ extern "C" { cancellable: *mut gio::GCancellable, error: *mut *mut glib::GError, ) -> gboolean; + #[cfg(any(feature = "v2022_7", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2022_7")))] + pub fn ostree_kernel_args_contains( + kargs: *mut OstreeKernelArgs, + arg: *const c_char, + ) -> gboolean; pub fn ostree_kernel_args_delete( kargs: *mut OstreeKernelArgs, arg: *const c_char, error: *mut *mut glib::GError, ) -> gboolean; + #[cfg(any(feature = "v2022_7", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2022_7")))] + pub fn ostree_kernel_args_delete_if_present( + kargs: *mut OstreeKernelArgs, + arg: *const c_char, + error: *mut *mut glib::GError, + ) -> gboolean; #[cfg(any(feature = "v2019_3", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2019_3")))] pub fn ostree_kernel_args_delete_key_entry( @@ -3218,6 +3218,13 @@ extern "C" { self_: *mut OstreeSysroot, error: *mut *mut glib::GError, ) -> gboolean; + #[cfg(any(feature = "v2022_7", feature = "dox"))] + #[cfg_attr(feature = "dox", doc(cfg(feature = "v2022_7")))] + pub fn ostree_sysroot_initialize_with_mount_namespace( + self_: *mut OstreeSysroot, + cancellable: *mut gio::GCancellable, + error: *mut *mut glib::GError, + ) -> gboolean; #[cfg(any(feature = "v2020_1", feature = "dox"))] #[cfg_attr(feature = "dox", doc(cfg(feature = "v2020_1")))] pub fn ostree_sysroot_is_booted(self_: *mut OstreeSysroot) -> gboolean; From 180a1d8f0a35e4324e86de834a3db0f7ad3f8b4d Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 22 Nov 2022 10:09:02 -0500 Subject: [PATCH 49/55] tests/inst: Update to latest ostree-ext --- tests/inst/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/inst/Cargo.toml b/tests/inst/Cargo.toml index cc3f712a..40b1dd36 100644 --- a/tests/inst/Cargo.toml +++ b/tests/inst/Cargo.toml @@ -20,7 +20,7 @@ serde_json = "1.0" sh-inline = "0.2.0" anyhow = "1.0" tempfile = "3.1.0" -ostree-ext = { version = "0.7.0" } +ostree-ext = { version = "0.9" } libtest-mimic = "0.5.0" twoway = "0.2.1" hyper = { version = "0.14", features = ["runtime", "http1", "http2", "tcp", "server"] } From c0beedbb48895b367444bcf62ee2d884856d718b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 22 Nov 2022 10:12:30 -0500 Subject: [PATCH 50/55] tests/inst: Drop nix dependency It has various semver bumps and we were literally just using it to duplicate what's already in `libc`. --- tests/inst/Cargo.toml | 2 +- tests/inst/src/sysroot.rs | 2 +- tests/inst/src/treegen.rs | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/inst/Cargo.toml b/tests/inst/Cargo.toml index 40b1dd36..c6211adb 100644 --- a/tests/inst/Cargo.toml +++ b/tests/inst/Cargo.toml @@ -29,12 +29,12 @@ futures = "0.3.4" http = "0.2.0" tokio = { version = "1.4.0", features = ["full"] } futures-util = "0.3.1" +libc = "0.2.100" base64 = "0.12.0" procspawn = "0.8" rand = "0.8" strum = "0.18.0" strum_macros = "0.18.0" -nix = "0.23.0" # See discussion in https://github.com/coreos/rpm-ostree/pull/2569#issuecomment-780569188 rpmostree-client = { git = "https://github.com/coreos/rpm-ostree", tag = "v2021.3" } diff --git a/tests/inst/src/sysroot.rs b/tests/inst/src/sysroot.rs index 818b4eb1..3a2547db 100644 --- a/tests/inst/src/sysroot.rs +++ b/tests/inst/src/sysroot.rs @@ -52,6 +52,6 @@ pub(crate) fn itest_tmpfiles() -> Result<()> { return Ok(()); } let metadata = Path::new("/run/ostree").metadata()?; - assert_eq!(metadata.permissions().mode() & !nix::libc::S_IFMT, 0o755); + assert_eq!(metadata.permissions().mode() & !libc::S_IFMT, 0o755); Ok(()) } diff --git a/tests/inst/src/treegen.rs b/tests/inst/src/treegen.rs index ab0c5bdb..8d65f02b 100644 --- a/tests/inst/src/treegen.rs +++ b/tests/inst/src/treegen.rs @@ -75,7 +75,6 @@ pub(crate) fn mutate_one_executable_to( /// Find ELF files in the srcdir, write new copies to dest (only percentage) pub(crate) fn mutate_executables_to(src: &Dir, dest: &Dir, percentage: u32) -> Result { - use nix::sys::stat::Mode as NixMode; assert!(percentage > 0 && percentage <= 100); let mut mutated = 0; for entry in src.entries()? { @@ -84,13 +83,13 @@ pub(crate) fn mutate_executables_to(src: &Dir, dest: &Dir, percentage: u32) -> R continue; } let meta = entry.metadata()?; - let mode = NixMode::from_bits_truncate(meta.mode()); + let mode = meta.mode(); // Must be executable - if !mode.intersects(NixMode::S_IXUSR | NixMode::S_IXGRP | NixMode::S_IXOTH) { + if mode & (libc::S_IXUSR | libc::S_IXGRP | libc::S_IXOTH) == 0 { continue; } // Not suid - if mode.intersects(NixMode::S_ISUID | NixMode::S_ISGID) { + if mode & (libc::S_ISUID | libc::S_ISGID) == 0 { continue; } // Greater than 1k in size From eadb8c3d58b9e86c7ce0434a1d94aa6d10ecb0c9 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 22 Nov 2022 10:14:17 -0500 Subject: [PATCH 51/55] tests/inst: Update cap-std-ext to 1.0 --- tests/inst/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/inst/Cargo.toml b/tests/inst/Cargo.toml index c6211adb..7cf3baaa 100644 --- a/tests/inst/Cargo.toml +++ b/tests/inst/Cargo.toml @@ -11,7 +11,7 @@ name = "ostree-test" path = "src/insttestmain.rs" [dependencies] -cap-std-ext = "0.25" +cap-std-ext = "1.0" clap = "2.32.0" structopt = "0.3" serde = "1.0.111" From 2dc92b25cd60f1c1ed0952815c22db5089400cd3 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 22 Nov 2022 10:14:17 -0500 Subject: [PATCH 52/55] tests/inst: Update sh-inline --- tests/inst/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/inst/Cargo.toml b/tests/inst/Cargo.toml index 7cf3baaa..a3d211a0 100644 --- a/tests/inst/Cargo.toml +++ b/tests/inst/Cargo.toml @@ -17,7 +17,7 @@ structopt = "0.3" serde = "1.0.111" serde_derive = "1.0.111" serde_json = "1.0" -sh-inline = "0.2.0" +sh-inline = "0.4.0" anyhow = "1.0" tempfile = "3.1.0" ostree-ext = { version = "0.9" } From 647f7fb7f1c3209810a37cb52c834026960e829b Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 22 Nov 2022 10:26:44 -0500 Subject: [PATCH 53/55] tests: Require OSTREE_TEST_SUDO to be set to use `sudo` IMO, tools invoking `sudo` automatically is a huge anti-pattern. Require this to be opt-in. In practice also...these tests really want to be *integration* and not unit tests because involving `sudo` alongside uninstalled binaries just creates a giant mess. Closes: https://github.com/ostreedev/ostree/issues/2761 --- tests/libtest.sh | 6 ++++++ tests/test-basic-bare-split-xattrs.sh | 2 ++ tests/test-repo-finder-mount-integration.sh | 1 + 3 files changed, 9 insertions(+) diff --git a/tests/libtest.sh b/tests/libtest.sh index af000363..264094b1 100755 --- a/tests/libtest.sh +++ b/tests/libtest.sh @@ -614,6 +614,12 @@ skip_without_user_xattrs () { fi } +skip_without_sudo () { + if test -z "${OSTREE_TEST_SUDO:-}"; then + skip "this test needs sudo, skipping without OSTREE_TEST_SUDO being set" + fi +} + # Usage: if ! skip_one_without_whiteouts_devices; then ... more tests ...; fi skip_one_without_whiteouts_devices() { if ! can_create_whiteout_devices; then diff --git a/tests/test-basic-bare-split-xattrs.sh b/tests/test-basic-bare-split-xattrs.sh index bf828eb7..b30e9d6d 100755 --- a/tests/test-basic-bare-split-xattrs.sh +++ b/tests/test-basic-bare-split-xattrs.sh @@ -9,7 +9,9 @@ set -euo pipefail mode="bare-split-xattrs" OSTREE="${CMD_PREFIX} ostree --repo=${test_tmpdir}/repo" +skip_without_sudo SUDO="sudo --non-interactive" + PRIVILEGED="false" if [ $(id -u) -eq 0 ]; then PRIVILEGED="true" diff --git a/tests/test-repo-finder-mount-integration.sh b/tests/test-repo-finder-mount-integration.sh index e7a0f86a..b1a8d422 100755 --- a/tests/test-repo-finder-mount-integration.sh +++ b/tests/test-repo-finder-mount-integration.sh @@ -24,6 +24,7 @@ set -euo pipefail . $(dirname $0)/libtest.sh +skip_without_sudo SUDO="sudo --non-interactive" # Skip the test if a well-known USB stick is not available. From d29eebca5c9d2e691bb19556cfa5d0aa77169fe3 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Tue, 22 Nov 2022 13:43:06 -0500 Subject: [PATCH 54/55] ci: Add a flow that combines C build and Rust integration tests Today it's just the Jenkins flow which builds our Rust integration tests. Let's add a flow to the GH actions which does this, and also runs inside a (privileged) container. Prep for doing more testing of the ostree-container path here. --- .github/workflows/tests.yml | 63 +++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e3bc1726..b74a34ac 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -26,6 +26,22 @@ jobs: run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - name: Test style run: ./ci/ci-commitmessage-submodules.sh + build-integration: + runs-on: ubuntu-latest + container: quay.io/coreos-assembler/fcos-buildroot:testing-devel + steps: + - uses: actions/checkout@v3 + - name: Cache Dependencies + uses: Swatinem/rust-cache@ce325b60658c1b38465c06cc965b79baf32c1e72 + with: + key: "integration" + - name: Build + run: cd tests/inst && cargo build --verbose --release + - name: Upload binary + uses: actions/upload-artifact@v2 + with: + name: ostree-test + path: tests/inst/target/release/ostree-test minimal: name: "Build - FCOS minimal" runs-on: ubuntu-latest @@ -44,6 +60,53 @@ jobs: --without-openssl --without-avahi --without-libmount --disable-rofiles-fuse \ --without-libsodium && make + build-c: + name: "Build (Fedora)" + runs-on: ubuntu-latest + container: registry.ci.openshift.org/coreos/fcos-buildroot:testing-devel + steps: + - name: Checkout repository + uses: actions/checkout@v3 + # https://github.com/actions/checkout/issues/760 + - name: Mark git checkout as safe + run: git config --global --add safe.directory "$GITHUB_WORKSPACE" + - name: Build + run: | + env NOCONFIGURE=1 ./autogen.sh && + ./configure --with-curl --with-selinux --with-dracut=yesbutnoconf && + make -j 4 && make install DESTDIR=$(pwd)/install && tar -c -C install --zstd -f inst.tar.zst . + - name: Upload binary + uses: actions/upload-artifact@v2 + with: + name: inst.tar.zst + path: inst.tar.zst + privtest: + name: "Privileged testing" + needs: [build-c, build-integration] + runs-on: ubuntu-latest + container: + image: quay.io/fedora/fedora-coreos:testing-devel + options: "--privileged --pid=host -v /run/systemd:/run/systemd -v /:/run/host" + steps: + - name: Checkout repository + uses: actions/checkout@v3 + - name: Download install tree + uses: actions/download-artifact@v2 + with: + name: inst.tar.zst + - name: Install + run: tar -C / -xvf inst.tar.zst && rm -f inst.tar.zst + - name: Download test binary + uses: actions/download-artifact@v2 + with: + name: ostree-test + - name: Install + run: install ostree-test /usr/bin + - name: Setup + # https://github.com/ostreedev/ostree-rs-ext/issues/417 + run: mkdir -p /var/tmp + - name: Integration tests (unit) + run: ostree-test tests: # Distro configuration matrix # From e2f8ea6957a7b793e3ed93a3c76de63bd7bc0637 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 23 Nov 2022 09:02:52 -0500 Subject: [PATCH 55/55] Release 2022.7 --- configure.ac | 2 +- src/libostree/libostree-devel.sym | 7 ------- src/libostree/libostree-released.sym | 7 +++++++ tests/test-symbols.sh | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/configure.ac b/configure.ac index 7d4f5fe9..84c02b2a 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ m4_define([year_version], [2022]) m4_define([release_version], [7]) m4_define([package_version], [year_version.release_version]) AC_INIT([libostree], [package_version], [walters@verbum.org]) -is_release_build=no +is_release_build=yes AC_CONFIG_HEADER([config.h]) AC_CONFIG_MACRO_DIR([buildutil]) AC_CONFIG_AUX_DIR([build-aux]) diff --git a/src/libostree/libostree-devel.sym b/src/libostree/libostree-devel.sym index 8f374bbe..9168db73 100644 --- a/src/libostree/libostree-devel.sym +++ b/src/libostree/libostree-devel.sym @@ -20,13 +20,6 @@ - uncomment the include in Makefile-libostree.am */ -LIBOSTREE_2022.7 { -global: - ostree_kernel_args_contains; - ostree_kernel_args_delete_if_present; - ostree_sysroot_initialize_with_mount_namespace; -} LIBOSTREE_2022.5; - /* Stub section for the stable release *after* this development one; don't * edit this other than to update the year. This is just a copy/paste * source. Replace $LASTSTABLE with the last stable version, and $NEWVERSION diff --git a/src/libostree/libostree-released.sym b/src/libostree/libostree-released.sym index a5b9bdda..ee4e3fde 100644 --- a/src/libostree/libostree-released.sym +++ b/src/libostree/libostree-released.sym @@ -689,6 +689,13 @@ global: ostree_sysroot_deployment_set_kargs_in_place; } LIBOSTREE_2022.4; +LIBOSTREE_2022.7 { +global: + ostree_kernel_args_contains; + ostree_kernel_args_delete_if_present; + ostree_sysroot_initialize_with_mount_namespace; +} LIBOSTREE_2022.5; + /* NOTE: Only add more content here in release commits! See the * comments at the top of this file. */ diff --git a/tests/test-symbols.sh b/tests/test-symbols.sh index 6eeb73ae..1442e2d7 100755 --- a/tests/test-symbols.sh +++ b/tests/test-symbols.sh @@ -54,7 +54,7 @@ echo 'ok documented symbols' # ONLY update this checksum in release commits! cat > released-sha256.txt <