bindings: Consistently check for `dox` feature
authorColin Walters <walters@verbum.org>
Thu, 15 Dec 2022 01:09:37 +0000 (20:09 -0500)
committerColin Walters <walters@verbum.org>
Thu, 26 Jan 2023 19:34:32 +0000 (14:34 -0500)
This fixes the build on docs.rs:

https://docs.rs/crate/ostree-ext/0.10.2/builds/699039
```
[INFO] running `Command { std: "docker" "start" "-a" "7d90466f040d987cbcc393bc89f5f0688f052f49e2339c354dd731fdaf0f9667", kill_on_drop: false }`
[INFO] [stderr]     Checking ostree v0.17.0
[INFO] [stderr] error[E0063]: missing field `process_passthrough_whiteouts` in initializer of `repo_checkout_at_options::RepoCheckoutAtOptions`
[INFO] [stderr]   --> /opt/rustwide/cargo-home/registry/src/github.com-1ecc6299db9ec823/ostree-0.17.0/rust-bindings/src/repo_checkout_at_options/mod.rs:61:9
[INFO] [stderr]    |
[INFO] [stderr] 61 |         RepoCheckoutAtOptions {
[INFO] [stderr]    |         ^^^^^^^^^^^^^^^^^^^^^ missing `process_passthrough_whiteouts`
```

rust-bindings/src/repo_checkout_at_options/mod.rs
rust-bindings/tests/repo/checkout_at.rs
rust-bindings/tests/repo/mod.rs
rust-bindings/tests/tests.rs

index 099bd22978b0b846dddc3c34cd878a4a7a084983..13223cc44bccd60fce9d909b3baf40a321323650 100644 (file)
@@ -65,19 +65,19 @@ impl Default for RepoCheckoutAtOptions {
             enable_fsync: false,
             process_whiteouts: false,
             no_copy_fallback: false,
-            #[cfg(feature = "v2017_6")]
+            #[cfg(any(feature = "v2017_6", feature = "dox"))]
             force_copy: false,
-            #[cfg(feature = "v2017_7")]
+            #[cfg(any(feature = "v2017_7", feature = "dox"))]
             bareuseronly_dirs: false,
-            #[cfg(feature = "v2018_9")]
+            #[cfg(any(feature = "v2018_9", feature = "dox"))]
             force_copy_zerosized: false,
-            #[cfg(feature = "v2022_6")]
+            #[cfg(any(feature = "v2022_6", feature = "dox"))]
             process_passthrough_whiteouts: false,
             subpath: None,
             devino_to_csum_cache: None,
-            #[cfg(feature = "v2018_2")]
+            #[cfg(any(feature = "v2018_2", feature = "dox"))]
             filter: None,
-            #[cfg(feature = "v2017_6")]
+            #[cfg(any(feature = "v2017_6", feature = "dox"))]
             sepolicy: None,
             sepolicy_prefix: None,
         }
@@ -114,22 +114,22 @@ impl<'a> ToGlibPtr<'a, *const ffi::OstreeRepoCheckoutAtOptions> for RepoCheckout
         options.process_whiteouts = self.process_whiteouts.into_glib();
         options.no_copy_fallback = self.no_copy_fallback.into_glib();
 
-        #[cfg(feature = "v2017_6")]
+        #[cfg(any(feature = "v2017_6", feature = "dox"))]
         {
             options.force_copy = self.force_copy.into_glib();
         }
 
-        #[cfg(feature = "v2017_7")]
+        #[cfg(any(feature = "v2017_7", feature = "dox"))]
         {
             options.bareuseronly_dirs = self.bareuseronly_dirs.into_glib();
         }
 
-        #[cfg(feature = "v2018_9")]
+        #[cfg(any(feature = "v2018_9", feature = "dox"))]
         {
             options.force_copy_zerosized = self.force_copy_zerosized.into_glib();
         }
 
-        #[cfg(feature = "v2022_6")]
+        #[cfg(any(feature = "v2022_6", feature = "dox"))]
         {
             options.process_passthrough_whiteouts = self.process_passthrough_whiteouts.into_glib();
         }
@@ -143,16 +143,16 @@ impl<'a> ToGlibPtr<'a, *const ffi::OstreeRepoCheckoutAtOptions> for RepoCheckout
         let devino_to_csum_cache = self.devino_to_csum_cache.to_glib_none();
         options.devino_to_csum_cache = devino_to_csum_cache.0;
 
-        #[cfg(feature = "v2017_6")]
+        #[cfg(any(feature = "v2017_6", feature = "dox"))]
         let sepolicy = {
             let sepolicy = self.sepolicy.to_glib_none();
             options.sepolicy = sepolicy.0;
             sepolicy
         };
-        #[cfg(not(feature = "v2017_6"))]
+        #[cfg(not(any(feature = "v2017_6", feature = "dox")))]
         let sepolicy = None.to_glib_none();
 
-        #[cfg(feature = "v2018_2")]
+        #[cfg(any(feature = "v2018_2", feature = "dox"))]
         {
             if let Some(filter) = &self.filter {
                 options.filter_user_data = filter.to_glib_none().0;
@@ -195,24 +195,24 @@ mod tests {
             assert_eq!((*ptr).enable_fsync, GFALSE);
             assert_eq!((*ptr).process_whiteouts, GFALSE);
             assert_eq!((*ptr).no_copy_fallback, GFALSE);
-            #[cfg(feature = "v2017_6")]
+            #[cfg(any(feature = "v2017_6", feature = "dox"))]
             assert_eq!((*ptr).force_copy, GFALSE);
-            #[cfg(feature = "v2017_7")]
+            #[cfg(any(feature = "v2017_7", feature = "dox"))]
             assert_eq!((*ptr).bareuseronly_dirs, GFALSE);
-            #[cfg(feature = "v2018_9")]
+            #[cfg(any(feature = "v2018_9", feature = "dox"))]
             assert_eq!((*ptr).force_copy_zerosized, GFALSE);
-            #[cfg(feature = "v2022_6")]
+            #[cfg(any(feature = "v2022_6", feature = "dox"))]
             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]);
             assert_eq!((*ptr).unused_ptrs, [ptr::null_mut(); 3]);
-            #[cfg(feature = "v2018_2")]
+            #[cfg(any(feature = "v2018_2", feature = "dox"))]
             assert_eq!((*ptr).filter, None);
-            #[cfg(feature = "v2018_2")]
+            #[cfg(any(feature = "v2018_2", feature = "dox"))]
             assert_eq!((*ptr).filter_user_data, ptr::null_mut());
-            #[cfg(feature = "v2017_6")]
+            #[cfg(any(feature = "v2017_6", feature = "dox"))]
             assert_eq!((*ptr).sepolicy, ptr::null_mut());
             assert_eq!((*ptr).sepolicy_prefix, ptr::null());
         }
@@ -227,21 +227,21 @@ mod tests {
             enable_fsync: true,
             process_whiteouts: true,
             no_copy_fallback: true,
-            #[cfg(feature = "v2017_6")]
+            #[cfg(any(feature = "v2017_6", feature = "dox"))]
             force_copy: true,
-            #[cfg(feature = "v2017_7")]
+            #[cfg(any(feature = "v2017_7", feature = "dox"))]
             bareuseronly_dirs: true,
-            #[cfg(feature = "v2018_9")]
+            #[cfg(any(feature = "v2018_9", feature = "dox"))]
             force_copy_zerosized: true,
-            #[cfg(feature = "v2022_6")]
+            #[cfg(any(feature = "v2022_6", feature = "dox"))]
             process_passthrough_whiteouts: true,
             subpath: Some("sub/path".into()),
             devino_to_csum_cache: Some(RepoDevInoCache::new()),
-            #[cfg(feature = "v2018_2")]
+            #[cfg(any(feature = "v2018_2", feature = "dox"))]
             filter: RepoCheckoutFilter::new(|_repo, _path, _stat| {
                 crate::RepoCheckoutFilterResult::Skip
             }),
-            #[cfg(feature = "v2017_6")]
+            #[cfg(any(feature = "v2017_6", feature = "dox"))]
             sepolicy: Some(
                 SePolicy::new(&gio::File::for_path("a/b"), gio::Cancellable::NONE).unwrap(),
             ),
@@ -259,13 +259,13 @@ mod tests {
             assert_eq!((*ptr).enable_fsync, GTRUE);
             assert_eq!((*ptr).process_whiteouts, GTRUE);
             assert_eq!((*ptr).no_copy_fallback, GTRUE);
-            #[cfg(feature = "v2017_6")]
+            #[cfg(any(feature = "v2017_6", feature = "dox"))]
             assert_eq!((*ptr).force_copy, GTRUE);
-            #[cfg(feature = "v2017_7")]
+            #[cfg(any(feature = "v2017_7", feature = "dox"))]
             assert_eq!((*ptr).bareuseronly_dirs, GTRUE);
-            #[cfg(feature = "v2018_9")]
+            #[cfg(any(feature = "v2018_9", feature = "dox"))]
             assert_eq!((*ptr).force_copy_zerosized, GTRUE);
-            #[cfg(feature = "v2022_6")]
+            #[cfg(any(feature = "v2022_6", feature = "dox"))]
             assert_eq!((*ptr).process_passthrough_whiteouts, GTRUE);
             assert_eq!((*ptr).unused_bools, [GFALSE; 3]);
             assert_eq!(
@@ -278,14 +278,14 @@ mod tests {
             );
             assert_eq!((*ptr).unused_ints, [0; 6]);
             assert_eq!((*ptr).unused_ptrs, [ptr::null_mut(); 3]);
-            #[cfg(feature = "v2018_2")]
+            #[cfg(any(feature = "v2018_2", feature = "dox"))]
             assert!((*ptr).filter == Some(repo_checkout_filter::filter_trampoline_unwindsafe));
-            #[cfg(feature = "v2018_2")]
+            #[cfg(any(feature = "v2018_2", feature = "dox"))]
             assert_eq!(
                 (*ptr).filter_user_data,
                 options.filter.as_ref().unwrap().to_glib_none().0,
             );
-            #[cfg(feature = "v2017_6")]
+            #[cfg(any(feature = "v2017_6", feature = "dox"))]
             assert_eq!((*ptr).sepolicy, options.sepolicy.to_glib_none().0);
             assert_eq!(
                 CStr::from_ptr((*ptr).sepolicy_prefix),
index 5c07b99226002ee7ffd24fca641b6e7278933ede..0c79b4286adea61b7484d322c11900d33723b9a7 100644 (file)
@@ -74,7 +74,7 @@ fn should_checkout_at_with_options() {
 }
 
 #[test]
-#[cfg(feature = "v2018_2")]
+#[cfg(any(feature = "v2018_2", feature = "dox"))]
 fn should_checkout_at_with_filter() {
     use std::path::Path;
 
index 54ee7ac08d1cf2018c22417a4edbcdf4c82624eb..a8d2b9d05c5de370438bf8910444f438d5d98894 100644 (file)
@@ -2,7 +2,7 @@ use crate::util::*;
 use ostree::prelude::*;
 use ostree::{ObjectName, ObjectType};
 
-#[cfg(feature = "v2016_8")]
+#[cfg(any(feature = "v2016_8", feature = "dox"))]
 mod checkout_at;
 mod generate_static;
 
@@ -178,7 +178,7 @@ fn should_write_content_to_repo() {
 }
 
 #[test]
-#[cfg(feature = "v2016_4")]
+#[cfg(any(feature = "v2016_4", feature = "dox"))]
 fn repo_file() {
     use std::os::unix::fs::MetadataExt;
     let test_repo = TestRepo::new();
index 18076002b471e60e82cb615800304248fc93b351..46e71d76832d5dd0e1db7169202c891d882b7265 100644 (file)
@@ -1,6 +1,6 @@
 mod core;
 mod functions;
 mod repo;
-#[cfg(feature = "v2020_2")]
+#[cfg(any(feature = "v2020_2", feature = "dox"))]
 mod sign;
 mod util;