conf: anchor function name patterns to avoid unexpected exclusions

This commit is contained in:
Felix Krull 2020-08-26 22:18:00 +02:00 committed by Colin Walters
parent 8ef294b627
commit 1ab87e6b97
5 changed files with 49 additions and 13 deletions

View File

@ -127,7 +127,7 @@ name = "OSTree.CollectionRef"
status = "generate"
[[object.function]]
# [IGNORE] helper functions for NULL-terminated arrays
pattern = "dupv|freev"
pattern = "^(dupv|freev)$"
ignore = true
[[object.function]]
@ -140,12 +140,12 @@ name = "OSTree.Repo"
status = "generate"
[[object.function]]
# [MANUAL] we special-case the checksum value
pattern = "write_content|write_content_async|write_metadata|write_metadata_async"
pattern = "^(write_content|write_content_async|write_metadata|write_metadata_async)$"
ignore = true
[[object.function]]
# [FAIL] these fail because of issues with arrays of dubious lifetimes
pattern = "find_remotes_async|pull_from_remotes_async"
pattern = "^(find_remotes_async|pull_from_remotes_async)$"
ignore = true
[[object.function]]
@ -167,7 +167,7 @@ name = "OSTree.RepoFinder"
status = "generate"
[[object.function]]
# [FAIL] these fail because of issues with arrays of dubious lifetimes/NULL-terminated arrays
pattern = "resolve_async|resolve_all_async"
pattern = "^(resolve_async|resolve_all_async)$"
ignore = true
[[object]]
@ -202,7 +202,7 @@ name = "OSTree.Sign"
status = "generate"
[[object.function]]
# [IGNORE] these shouldn't be on this type, they belong to subclasses
pattern = "dummy_.+|ed25519_.+"
pattern = "^(dummy_.+|ed25519_.+)$"
ignore = true
[[object]]
@ -219,30 +219,30 @@ name = "OSTree.*"
status = "generate"
[[object.function]]
# [MANUAL] probably can't be autogenerated because of the custom Checksum type
pattern = "checksum_file|checksum_file_async|checksum_file_at|checksum_file_from_input"
pattern = "^(checksum_file|checksum_file_async|checksum_file_at|checksum_file_from_input)$"
ignore = true
[[object.function]]
# [IGNORE] low-level checksum functions, we have a custom checksum API
pattern = "cmp_checksum_bytes|checksum_from_bytes|checksum_to_bytes|checksum_inplace_from_bytes|checksum_inplace_to_bytes|checksum_b64_from_bytes|checksum_b64_to_bytes|checksum_b64_inplace_from_bytes|checksum_b64_inplace_to_bytes"
pattern = "^(cmp_checksum_bytes|checksum_from_bytes|checksum_to_bytes|checksum_inplace_from_bytes|checksum_inplace_to_bytes|checksum_b64_from_bytes|checksum_b64_to_bytes|checksum_b64_inplace_from_bytes|checksum_b64_inplace_to_bytes)$"
ignore = true
[[object.function]]
# [IGNORE] needs custom handling to deal with its raw pointer parameter
pattern = "hash_object_name"
name = "hash_object_name"
ignore = true
[[object.function]]
# [IGNORE] private API
pattern = "cmd__private__"
name = "cmd__private__"
ignore = true
[[object.constant]]
# [IGNORE] version-dependent constants
pattern = "VERSION|VERSION_S|YEAR_VERSION|RELEASE_VERSION"
pattern = "^(VERSION|VERSION_S|YEAR_VERSION|RELEASE_VERSION)$"
ignore = true
[[object.constant]]
# [IGNORE] build-dependent constants
pattern = "BUILT_FEATURES"
name = "BUILT_FEATURES"
ignore = true

View File

@ -41,6 +41,18 @@ pub fn check_version(required_year: u32, required_release: u32) -> bool {
// unsafe { TODO: call ostree_sys:ostree_checksum_bytes_peek_validate() }
//}
pub fn checksum_from_bytes_v(csum_v: &glib::Variant) -> Option<GString> {
unsafe {
from_glib_full(ostree_sys::ostree_checksum_from_bytes_v(csum_v.to_glib_none().0))
}
}
pub fn checksum_to_bytes_v(checksum: &str) -> Option<glib::Variant> {
unsafe {
from_glib_full(ostree_sys::ostree_checksum_to_bytes_v(checksum.to_glib_none().0))
}
}
#[cfg(any(feature = "v2018_2", feature = "dox"))]
pub fn commit_get_content_checksum(commit_variant: &glib::Variant) -> Option<GString> {
unsafe {

View File

@ -903,6 +903,14 @@ impl Repo {
}
}
pub fn write_content_trusted<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(&self, checksum: &str, object_input: &P, length: u64, cancellable: Option<&Q>) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ostree_sys::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)) }
}
}
pub fn write_dfd_to_mtree<P: IsA<MutableTree>, Q: IsA<gio::Cancellable>>(&self, dfd: i32, path: &str, mtree: &P, modifier: Option<&RepoCommitModifier>, cancellable: Option<&Q>) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
@ -919,6 +927,22 @@ impl Repo {
}
}
pub fn write_metadata_stream_trusted<P: IsA<gio::InputStream>, Q: IsA<gio::Cancellable>>(&self, objtype: ObjectType, checksum: &str, object_input: &P, length: u64, cancellable: Option<&Q>) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ostree_sys::ostree_repo_write_metadata_stream_trusted(self.to_glib_none().0, objtype.to_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)) }
}
}
pub fn write_metadata_trusted<P: IsA<gio::Cancellable>>(&self, objtype: ObjectType, checksum: &str, variant: &glib::Variant, cancellable: Option<&P>) -> Result<(), glib::Error> {
unsafe {
let mut error = ptr::null_mut();
let _ = ostree_sys::ostree_repo_write_metadata_trusted(self.to_glib_none().0, objtype.to_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)) }
}
}
pub fn write_mtree<P: IsA<MutableTree>, Q: IsA<gio::Cancellable>>(&self, mtree: &P, cancellable: Option<&Q>) -> Result<gio::File, glib::Error> {
unsafe {
let mut out_file = ptr::null_mut();

View File

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 2d1ffab1)
from gir-files (https://github.com/gtk-rs/gir-files @ 26bb987)
from gir-files (https://github.com/gtk-rs/gir-files @ ea146ce)

View File

@ -1,2 +1,2 @@
Generated by gir (https://github.com/gtk-rs/gir @ 2d1ffab1)
from gir-files (https://github.com/gtk-rs/gir-files @ 26bb987)
from gir-files (https://github.com/gtk-rs/gir-files @ ea146ce)