mirror of
https://github.com/ostreedev/ostree.git
synced 2025-01-09 01:18:35 +03:00
Generate functions and constants
This commit is contained in:
parent
306046f572
commit
5e8753b369
@ -85,3 +85,9 @@ status = "generate"
|
||||
pattern = "lookup"
|
||||
ignore = true
|
||||
|
||||
[[object]]
|
||||
name = "OSTree.*"
|
||||
status = "generate"
|
||||
[[object.function]]
|
||||
pattern = "cmp_checksum_bytes|checksum_inplace_to_bytes"
|
||||
ignore = true
|
||||
|
1
rust-bindings/rust/libostree/Cargo.lock
generated
1
rust-bindings/rust/libostree/Cargo.lock
generated
@ -88,6 +88,7 @@ dependencies = [
|
||||
"glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libostree-sys 0.2.0",
|
||||
]
|
||||
|
@ -8,6 +8,7 @@ name = "libostree"
|
||||
[dependencies]
|
||||
libc = "^0.2.0"
|
||||
bitflags = "^1.0.0"
|
||||
lazy_static = "1.1.0"
|
||||
glib = "^0.6.0"
|
||||
gio = "^0.5.0"
|
||||
glib-sys = "^0.7"
|
||||
|
@ -25,10 +25,6 @@ glib_wrapper! {
|
||||
}
|
||||
|
||||
impl AsyncProgress {
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A new progress object
|
||||
pub fn new() -> AsyncProgress {
|
||||
unsafe {
|
||||
from_glib_full(ffi::ostree_async_progress_new())
|
||||
@ -46,32 +42,12 @@ impl Default for AsyncProgress {
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait containing all `AsyncProgress` methods.
|
||||
///
|
||||
/// # Implementors
|
||||
///
|
||||
/// [`AsyncProgress`](struct.AsyncProgress.html)
|
||||
pub trait AsyncProgressExt {
|
||||
/// Process any pending signals, ensuring the main context is cleared
|
||||
/// of sources used by this object. Also ensures that no further
|
||||
/// events will be queued.
|
||||
fn finish(&self);
|
||||
|
||||
//#[cfg(any(feature = "v2017_6", feature = "dox"))]
|
||||
//fn get(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
|
||||
|
||||
/// Get the human-readable status string from the `AsyncProgress`. This
|
||||
/// operation is thread-safe. The retuned value may be `None` if no status is
|
||||
/// set.
|
||||
///
|
||||
/// This is a convenience function to get the well-known `status` key.
|
||||
///
|
||||
/// Feature: `v2017_6`
|
||||
///
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// the current status, or `None` if none is set
|
||||
#[cfg(any(feature = "v2017_6", feature = "dox"))]
|
||||
fn get_status(&self) -> Option<String>;
|
||||
|
||||
@ -79,33 +55,12 @@ pub trait AsyncProgressExt {
|
||||
|
||||
fn get_uint64(&self, key: &str) -> u64;
|
||||
|
||||
/// Look up a key in the `AsyncProgress` and return the `glib::Variant` associated
|
||||
/// with it. The lookup is thread-safe.
|
||||
///
|
||||
/// Feature: `v2017_6`
|
||||
///
|
||||
/// ## `key`
|
||||
/// a key to look up
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// value for the given `key`, or `None` if
|
||||
/// it was not set
|
||||
#[cfg(any(feature = "v2017_6", feature = "dox"))]
|
||||
fn get_variant(&self, key: &str) -> Option<glib::Variant>;
|
||||
|
||||
//#[cfg(any(feature = "v2017_6", feature = "dox"))]
|
||||
//fn set(&self, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
|
||||
|
||||
/// Set the human-readable status string for the `AsyncProgress`. This
|
||||
/// operation is thread-safe. `None` may be passed to clear the status.
|
||||
///
|
||||
/// This is a convenience function to set the well-known `status` key.
|
||||
///
|
||||
/// Feature: `v2017_6`
|
||||
///
|
||||
/// ## `status`
|
||||
/// new status string, or `None` to clear the status
|
||||
#[cfg(any(feature = "v2017_6", feature = "dox"))]
|
||||
fn set_status<'a, P: Into<Option<&'a str>>>(&self, status: P);
|
||||
|
||||
@ -113,23 +68,9 @@ pub trait AsyncProgressExt {
|
||||
|
||||
fn set_uint64(&self, key: &str, value: u64);
|
||||
|
||||
/// Assign a new `value` to the given `key`, replacing any existing value. The
|
||||
/// operation is thread-safe. `value` may be a floating reference;
|
||||
/// `glib::Variant::ref_sink` will be called on it.
|
||||
///
|
||||
/// Any watchers of the `AsyncProgress` will be notified of the change if
|
||||
/// `value` differs from the existing value for `key`.
|
||||
///
|
||||
/// Feature: `v2017_6`
|
||||
///
|
||||
/// ## `key`
|
||||
/// a key to set
|
||||
/// ## `value`
|
||||
/// the value to assign to `key`
|
||||
#[cfg(any(feature = "v2017_6", feature = "dox"))]
|
||||
fn set_variant(&self, key: &str, value: &glib::Variant);
|
||||
|
||||
/// Emitted when `self_` has been changed.
|
||||
fn connect_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
|
||||
}
|
||||
|
||||
|
@ -22,21 +22,6 @@ glib_wrapper! {
|
||||
}
|
||||
|
||||
impl CollectionRef {
|
||||
/// Create a new `CollectionRef` containing (`collection_id`, `ref_name`). If
|
||||
/// `collection_id` is `None`, this is equivalent to a plain ref name string (not a
|
||||
/// refspec; no remote name is included), which can be used for non-P2P
|
||||
/// operations.
|
||||
///
|
||||
/// Feature: `v2018_6`
|
||||
///
|
||||
/// ## `collection_id`
|
||||
/// a collection ID, or `None` for a plain ref
|
||||
/// ## `ref_name`
|
||||
/// a ref name
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// a new `CollectionRef`
|
||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||
pub fn new<'a, P: Into<Option<&'a str>>>(collection_id: P, ref_name: &str) -> CollectionRef {
|
||||
let collection_id = collection_id.into();
|
||||
@ -46,14 +31,6 @@ impl CollectionRef {
|
||||
}
|
||||
}
|
||||
|
||||
/// Create a copy of the given `self`.
|
||||
///
|
||||
/// Feature: `v2018_6`
|
||||
///
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// a newly allocated copy of `self`
|
||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||
pub fn dup(&self) -> Option<CollectionRef> {
|
||||
unsafe {
|
||||
@ -61,18 +38,6 @@ impl CollectionRef {
|
||||
}
|
||||
}
|
||||
|
||||
/// Copy an array of `OstreeCollectionRefs`, including deep copies of all its
|
||||
/// elements. `refs` must be `None`-terminated; it may be empty, but must not be
|
||||
/// `None`.
|
||||
///
|
||||
/// Feature: `v2018_6`
|
||||
///
|
||||
/// ## `refs`
|
||||
/// `None`-terminated array of `OstreeCollectionRefs`
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// a newly allocated copy of `refs`
|
||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||
pub fn dupv(refs: &[&CollectionRef]) -> Vec<CollectionRef> {
|
||||
unsafe {
|
||||
@ -80,19 +45,6 @@ impl CollectionRef {
|
||||
}
|
||||
}
|
||||
|
||||
/// Compare `ref1` and `ref2` and return `true` if they have the same collection ID and
|
||||
/// ref name, and `false` otherwise. Both `ref1` and `ref2` must be non-`None`.
|
||||
///
|
||||
/// Feature: `v2018_6`
|
||||
///
|
||||
/// ## `ref1`
|
||||
/// an `CollectionRef`
|
||||
/// ## `ref2`
|
||||
/// another `CollectionRef`
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// `true` if `ref1` and `ref2` are equal, `false` otherwise
|
||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||
fn equal<'a, P: Into<Option<&'a CollectionRef>>>(&self, ref2: P) -> bool {
|
||||
unsafe {
|
||||
@ -100,13 +52,6 @@ impl CollectionRef {
|
||||
}
|
||||
}
|
||||
|
||||
/// Free the given array of `refs`, including freeing all its elements. `refs`
|
||||
/// must be `None`-terminated; it may be empty, but must not be `None`.
|
||||
///
|
||||
/// Feature: `v2018_6`
|
||||
///
|
||||
/// ## `refs`
|
||||
/// an array of `OstreeCollectionRefs`
|
||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||
pub fn freev(refs: &[&CollectionRef]) {
|
||||
unsafe {
|
||||
@ -114,17 +59,6 @@ impl CollectionRef {
|
||||
}
|
||||
}
|
||||
|
||||
/// Hash the given `ref_`. This function is suitable for use with `glib::HashTable`.
|
||||
/// `ref_` must be non-`None`.
|
||||
///
|
||||
/// Feature: `v2018_6`
|
||||
///
|
||||
/// ## `ref_`
|
||||
/// an `CollectionRef`
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// hash value for `ref_`
|
||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||
fn hash(&self) -> u32 {
|
||||
unsafe {
|
||||
|
61
rust-bindings/rust/libostree/src/auto/constants.rs
Normal file
61
rust-bindings/rust/libostree/src/auto/constants.rs
Normal file
@ -0,0 +1,61 @@
|
||||
// This file was generated by gir (https://github.com/gtk-rs/gir @ c385982)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
|
||||
// DO NOT EDIT
|
||||
|
||||
use ffi;
|
||||
use std::ffi::CStr;
|
||||
|
||||
lazy_static! {
|
||||
pub static ref COMMIT_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_GVARIANT_STRING).to_str().unwrap()};
|
||||
}
|
||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||
lazy_static! {
|
||||
pub static ref COMMIT_META_KEY_COLLECTION_BINDING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_COLLECTION_BINDING).to_str().unwrap()};
|
||||
}
|
||||
#[cfg(any(feature = "v2017_7", feature = "dox"))]
|
||||
lazy_static! {
|
||||
pub static ref COMMIT_META_KEY_ENDOFLIFE: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE).to_str().unwrap()};
|
||||
}
|
||||
#[cfg(any(feature = "v2017_7", feature = "dox"))]
|
||||
lazy_static! {
|
||||
pub static ref COMMIT_META_KEY_ENDOFLIFE_REBASE: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_ENDOFLIFE_REBASE).to_str().unwrap()};
|
||||
}
|
||||
#[cfg(any(feature = "v2017_9", feature = "dox"))]
|
||||
lazy_static! {
|
||||
pub static ref COMMIT_META_KEY_REF_BINDING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_REF_BINDING).to_str().unwrap()};
|
||||
}
|
||||
#[cfg(any(feature = "v2017_13", feature = "dox"))]
|
||||
lazy_static! {
|
||||
pub static ref COMMIT_META_KEY_SOURCE_TITLE: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_SOURCE_TITLE).to_str().unwrap()};
|
||||
}
|
||||
#[cfg(any(feature = "v2014_9", feature = "dox"))]
|
||||
lazy_static! {
|
||||
pub static ref COMMIT_META_KEY_VERSION: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_COMMIT_META_KEY_VERSION).to_str().unwrap()};
|
||||
}
|
||||
lazy_static! {
|
||||
pub static ref DIRMETA_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_DIRMETA_GVARIANT_STRING).to_str().unwrap()};
|
||||
}
|
||||
lazy_static! {
|
||||
pub static ref FILEMETA_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_FILEMETA_GVARIANT_STRING).to_str().unwrap()};
|
||||
}
|
||||
#[cfg(any(feature = "v2018_3", feature = "dox"))]
|
||||
lazy_static! {
|
||||
pub static ref ORIGIN_TRANSIENT_GROUP: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_ORIGIN_TRANSIENT_GROUP).to_str().unwrap()};
|
||||
}
|
||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||
lazy_static! {
|
||||
pub static ref REPO_METADATA_REF: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_REPO_METADATA_REF).to_str().unwrap()};
|
||||
}
|
||||
lazy_static! {
|
||||
pub static ref SUMMARY_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_SUMMARY_GVARIANT_STRING).to_str().unwrap()};
|
||||
}
|
||||
lazy_static! {
|
||||
pub static ref SUMMARY_SIG_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_SUMMARY_SIG_GVARIANT_STRING).to_str().unwrap()};
|
||||
}
|
||||
lazy_static! {
|
||||
pub static ref TREE_GVARIANT_STRING: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_TREE_GVARIANT_STRING).to_str().unwrap()};
|
||||
}
|
||||
#[cfg(any(feature = "v2017_4", feature = "dox"))]
|
||||
lazy_static! {
|
||||
pub static ref VERSION_S: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_VERSION_S).to_str().unwrap()};
|
||||
}
|
@ -5,9 +5,6 @@
|
||||
use ffi;
|
||||
use glib::translate::*;
|
||||
|
||||
/// Formatting flags for `GpgVerifyResultExt::describe`. Currently
|
||||
/// there's only one possible output format, but this enumeration allows
|
||||
/// for future variations.
|
||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum GpgSignatureFormatFlags {
|
||||
@ -38,8 +35,6 @@ impl FromGlib<ffi::OstreeGpgSignatureFormatFlags> for GpgSignatureFormatFlags {
|
||||
}
|
||||
}
|
||||
|
||||
/// Enumeration for core object types; `ObjectType::File` is for
|
||||
/// content, the other types are metadata.
|
||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum ObjectType {
|
||||
@ -160,8 +155,6 @@ impl FromGlib<ffi::OstreeRepoCheckoutOverwriteMode> for RepoCheckoutOverwriteMod
|
||||
}
|
||||
}
|
||||
|
||||
/// See the documentation of `Repo` for more information about the
|
||||
/// possible modes.
|
||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum RepoMode {
|
||||
@ -237,7 +230,6 @@ impl FromGlib<ffi::OstreeRepoPruneFlags> for RepoPruneFlags {
|
||||
}
|
||||
}
|
||||
|
||||
/// The remote change operation.
|
||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum RepoRemoteChange {
|
||||
@ -307,7 +299,6 @@ impl FromGlib<ffi::OstreeRepoResolveRevExtFlags> for RepoResolveRevExtFlags {
|
||||
}
|
||||
}
|
||||
|
||||
/// Parameters controlling optimization of static deltas.
|
||||
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
#[derive(Clone, Copy)]
|
||||
pub enum StaticDeltaGenerateOpt {
|
||||
|
376
rust-bindings/rust/libostree/src/auto/functions.rs
Normal file
376
rust-bindings/rust/libostree/src/auto/functions.rs
Normal file
@ -0,0 +1,376 @@
|
||||
// This file was generated by gir (https://github.com/gtk-rs/gir @ c385982)
|
||||
// from gir-files (https://github.com/gtk-rs/gir-files @ ???)
|
||||
// DO NOT EDIT
|
||||
|
||||
use Error;
|
||||
use ObjectType;
|
||||
use ffi;
|
||||
use gio;
|
||||
use glib;
|
||||
use glib::object::IsA;
|
||||
use glib::translate::*;
|
||||
use std::mem;
|
||||
use std::ptr;
|
||||
|
||||
|
||||
#[cfg(any(feature = "v2017_15", feature = "dox"))]
|
||||
pub fn break_hardlink<'a, P: Into<Option<&'a gio::Cancellable>>>(dfd: i32, path: &str, skip_xattrs: bool, cancellable: P) -> Result<(), Error> {
|
||||
let cancellable = cancellable.into();
|
||||
let cancellable = cancellable.to_glib_none();
|
||||
unsafe {
|
||||
let mut error = ptr::null_mut();
|
||||
let _ = ffi::ostree_break_hardlink(dfd, path.to_glib_none().0, skip_xattrs.to_glib(), cancellable.0, &mut error);
|
||||
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn check_version(required_year: u32, required_release: u32) -> bool {
|
||||
unsafe {
|
||||
from_glib(ffi::ostree_check_version(required_year, required_release))
|
||||
}
|
||||
}
|
||||
|
||||
//pub fn checksum_b64_from_bytes(csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32) -> Option<String> {
|
||||
// unsafe { TODO: call ffi::ostree_checksum_b64_from_bytes() }
|
||||
//}
|
||||
|
||||
//pub fn checksum_b64_inplace_from_bytes(csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, buf: &str) {
|
||||
// unsafe { TODO: call ffi::ostree_checksum_b64_inplace_from_bytes() }
|
||||
//}
|
||||
|
||||
//pub fn checksum_b64_inplace_to_bytes(checksum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 28 }; 32, buf: u8) {
|
||||
// unsafe { TODO: call ffi::ostree_checksum_b64_inplace_to_bytes() }
|
||||
//}
|
||||
|
||||
//pub fn checksum_b64_to_bytes(checksum: &str) -> /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32 {
|
||||
// unsafe { TODO: call ffi::ostree_checksum_b64_to_bytes() }
|
||||
//}
|
||||
|
||||
//pub fn checksum_bytes_peek(bytes: &glib::Variant) -> /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32 {
|
||||
// unsafe { TODO: call ffi::ostree_checksum_bytes_peek() }
|
||||
//}
|
||||
|
||||
//pub fn checksum_bytes_peek_validate(bytes: &glib::Variant) -> Result</*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, Error> {
|
||||
// unsafe { TODO: call ffi::ostree_checksum_bytes_peek_validate() }
|
||||
//}
|
||||
|
||||
//pub fn checksum_file<'a, P: IsA<gio::File>, Q: Into<Option<&'a gio::Cancellable>>>(f: &P, objtype: ObjectType, out_csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, cancellable: Q) -> Result<(), Error> {
|
||||
// unsafe { TODO: call ffi::ostree_checksum_file() }
|
||||
//}
|
||||
|
||||
//pub fn checksum_file_async<'a, P: IsA<gio::File>, Q: Into<Option<&'a gio::Cancellable>>, R: /*Ignored*/gio::AsyncReadyCallback>(f: &P, objtype: ObjectType, io_priority: i32, cancellable: Q, callback: R) {
|
||||
// unsafe { TODO: call ffi::ostree_checksum_file_async() }
|
||||
//}
|
||||
|
||||
//#[cfg(any(feature = "v2017_13", feature = "dox"))]
|
||||
//pub fn checksum_file_at<'a, P: Into<Option</*Unimplemented*/Fundamental: Pointer>>, Q: Into<Option<&'a gio::Cancellable>>>(dfd: i32, path: &str, stbuf: P, objtype: ObjectType, flags: /*Ignored*/ChecksumFlags, out_checksum: &str, cancellable: Q) -> Result<(), Error> {
|
||||
// unsafe { TODO: call ffi::ostree_checksum_file_at() }
|
||||
//}
|
||||
|
||||
//pub fn checksum_file_from_input<'a, 'b, 'c, P: Into<Option<&'a glib::Variant>>, Q: IsA<gio::InputStream> + 'b, R: Into<Option<&'b Q>>, S: Into<Option<&'c gio::Cancellable>>>(file_info: &gio::FileInfo, xattrs: P, in_: R, objtype: ObjectType, out_csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, cancellable: S) -> Result<(), Error> {
|
||||
// unsafe { TODO: call ffi::ostree_checksum_file_from_input() }
|
||||
//}
|
||||
|
||||
//pub fn checksum_from_bytes(csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32) -> Option<String> {
|
||||
// unsafe { TODO: call ffi::ostree_checksum_from_bytes() }
|
||||
//}
|
||||
|
||||
pub fn checksum_from_bytes_v(csum_v: &glib::Variant) -> Option<String> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::ostree_checksum_from_bytes_v(csum_v.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
//pub fn checksum_inplace_from_bytes(csum: /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32, buf: &str) {
|
||||
// unsafe { TODO: call ffi::ostree_checksum_inplace_from_bytes() }
|
||||
//}
|
||||
|
||||
//pub fn checksum_to_bytes(checksum: &str) -> /*Unknown conversion*//*Unimplemented*/FixedArray TypeId { ns_id: 0, id: 3 }; 32 {
|
||||
// unsafe { TODO: call ffi::ostree_checksum_to_bytes() }
|
||||
//}
|
||||
|
||||
pub fn checksum_to_bytes_v(checksum: &str) -> Option<glib::Variant> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::ostree_checksum_to_bytes_v(checksum.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
//pub fn cmd__private__() -> /*Ignored*/Option<CmdPrivateVTable> {
|
||||
// unsafe { TODO: call ffi::ostree_cmd__private__() }
|
||||
//}
|
||||
|
||||
pub fn commit_get_content_checksum(commit_variant: &glib::Variant) -> Option<String> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::ostree_commit_get_content_checksum(commit_variant.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn commit_get_parent(commit_variant: &glib::Variant) -> Option<String> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::ostree_commit_get_parent(commit_variant.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn commit_get_timestamp(commit_variant: &glib::Variant) -> u64 {
|
||||
unsafe {
|
||||
ffi::ostree_commit_get_timestamp(commit_variant.to_glib_none().0)
|
||||
}
|
||||
}
|
||||
|
||||
pub fn content_file_parse<'a, P: IsA<gio::File>, Q: Into<Option<&'a gio::Cancellable>>>(compressed: bool, content_path: &P, trusted: bool, cancellable: Q) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), Error> {
|
||||
let cancellable = cancellable.into();
|
||||
let cancellable = cancellable.to_glib_none();
|
||||
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.to_glib(), content_path.to_glib_none().0, trusted.to_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.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)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn content_file_parse_at<'a, P: Into<Option<&'a gio::Cancellable>>>(compressed: bool, parent_dfd: i32, path: &str, trusted: bool, cancellable: P) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), Error> {
|
||||
let cancellable = cancellable.into();
|
||||
let cancellable = cancellable.to_glib_none();
|
||||
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.to_glib(), parent_dfd, path.to_glib_none().0, trusted.to_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.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)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn content_stream_parse<'a, P: IsA<gio::InputStream>, Q: Into<Option<&'a gio::Cancellable>>>(compressed: bool, input: &P, input_length: u64, trusted: bool, cancellable: Q) -> Result<(gio::InputStream, gio::FileInfo, glib::Variant), Error> {
|
||||
let cancellable = cancellable.into();
|
||||
let cancellable = cancellable.to_glib_none();
|
||||
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.to_glib(), input.to_glib_none().0, input_length, trusted.to_glib(), &mut out_input, &mut out_file_info, &mut out_xattrs, cancellable.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)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn create_directory_metadata<'a, P: Into<Option<&'a glib::Variant>>>(dir_info: &gio::FileInfo, xattrs: P) -> Option<glib::Variant> {
|
||||
let xattrs = xattrs.into();
|
||||
let xattrs = xattrs.to_glib_none();
|
||||
unsafe {
|
||||
from_glib_full(ffi::ostree_create_directory_metadata(dir_info.to_glib_none().0, xattrs.0))
|
||||
}
|
||||
}
|
||||
|
||||
//pub fn diff_dirs<'a, P: IsA<gio::File>, Q: IsA<gio::File>, R: Into<Option<&'a gio::Cancellable>>>(flags: /*Ignored*/DiffFlags, a: &P, b: &Q, modified: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 24 }, removed: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, added: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, cancellable: R) -> Result<(), Error> {
|
||||
// unsafe { TODO: call ffi::ostree_diff_dirs() }
|
||||
//}
|
||||
|
||||
//pub fn diff_dirs_with_options<'a, 'b, P: IsA<gio::File>, Q: IsA<gio::File>, R: Into<Option<&'a /*Ignored*/DiffDirsOptions>>, S: Into<Option<&'b gio::Cancellable>>>(flags: /*Ignored*/DiffFlags, a: &P, b: &Q, modified: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 24 }, removed: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, added: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, options: R, cancellable: S) -> Result<(), Error> {
|
||||
// unsafe { TODO: call ffi::ostree_diff_dirs_with_options() }
|
||||
//}
|
||||
|
||||
//pub fn diff_print<P: IsA<gio::File>, Q: IsA<gio::File>>(a: &P, b: &Q, modified: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 1, id: 24 }, removed: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }, added: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 4, id: 15 }) {
|
||||
// unsafe { TODO: call ffi::ostree_diff_print() }
|
||||
//}
|
||||
|
||||
//pub fn gpg_error_quark() -> /*Ignored*/glib::Quark {
|
||||
// unsafe { TODO: call ffi::ostree_gpg_error_quark() }
|
||||
//}
|
||||
|
||||
//pub fn hash_object_name<P: Into<Option</*Unimplemented*/Fundamental: Pointer>>>(a: P) -> u32 {
|
||||
// unsafe { TODO: call ffi::ostree_hash_object_name() }
|
||||
//}
|
||||
|
||||
//pub fn metadata_variant_type(objtype: ObjectType) -> /*Ignored*/Option<glib::VariantType> {
|
||||
// unsafe { TODO: call ffi::ostree_metadata_variant_type() }
|
||||
//}
|
||||
|
||||
pub fn object_from_string(str: &str) -> (String, ObjectType) {
|
||||
unsafe {
|
||||
let mut out_checksum = ptr::null_mut();
|
||||
let mut out_objtype = mem::uninitialized();
|
||||
ffi::ostree_object_from_string(str.to_glib_none().0, &mut out_checksum, &mut out_objtype);
|
||||
(from_glib_full(out_checksum), from_glib(out_objtype))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn object_name_deserialize(variant: &glib::Variant) -> (String, ObjectType) {
|
||||
unsafe {
|
||||
let mut out_checksum = ptr::null();
|
||||
let mut out_objtype = mem::uninitialized();
|
||||
ffi::ostree_object_name_deserialize(variant.to_glib_none().0, &mut out_checksum, &mut out_objtype);
|
||||
(from_glib_none(out_checksum), from_glib(out_objtype))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn object_name_serialize(checksum: &str, objtype: ObjectType) -> Option<glib::Variant> {
|
||||
unsafe {
|
||||
from_glib_none(ffi::ostree_object_name_serialize(checksum.to_glib_none().0, objtype.to_glib()))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn object_to_string(checksum: &str, objtype: ObjectType) -> Option<String> {
|
||||
unsafe {
|
||||
from_glib_full(ffi::ostree_object_to_string(checksum.to_glib_none().0, objtype.to_glib()))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn object_type_from_string(str: &str) -> ObjectType {
|
||||
unsafe {
|
||||
from_glib(ffi::ostree_object_type_from_string(str.to_glib_none().0))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn object_type_to_string(objtype: ObjectType) -> Option<String> {
|
||||
unsafe {
|
||||
from_glib_none(ffi::ostree_object_type_to_string(objtype.to_glib()))
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_refspec(refspec: &str) -> Result<(Option<String>, String), Error> {
|
||||
unsafe {
|
||||
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)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn raw_file_to_archive_z2_stream<'a, 'b, P: IsA<gio::InputStream>, Q: Into<Option<&'a glib::Variant>>, R: Into<Option<&'b gio::Cancellable>>>(input: &P, file_info: &gio::FileInfo, xattrs: Q, cancellable: R) -> Result<gio::InputStream, Error> {
|
||||
let xattrs = xattrs.into();
|
||||
let xattrs = xattrs.to_glib_none();
|
||||
let cancellable = cancellable.into();
|
||||
let cancellable = cancellable.to_glib_none();
|
||||
unsafe {
|
||||
let mut out_input = ptr::null_mut();
|
||||
let mut error = ptr::null_mut();
|
||||
let _ = ffi::ostree_raw_file_to_archive_z2_stream(input.to_glib_none().0, file_info.to_glib_none().0, xattrs.0, &mut out_input, cancellable.0, &mut error);
|
||||
if error.is_null() { Ok(from_glib_full(out_input)) } else { Err(from_glib_full(error)) }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v2017_3", feature = "dox"))]
|
||||
pub fn raw_file_to_archive_z2_stream_with_options<'a, 'b, 'c, P: IsA<gio::InputStream>, Q: Into<Option<&'a glib::Variant>>, R: Into<Option<&'b glib::Variant>>, S: Into<Option<&'c gio::Cancellable>>>(input: &P, file_info: &gio::FileInfo, xattrs: Q, options: R, cancellable: S) -> Result<gio::InputStream, Error> {
|
||||
let xattrs = xattrs.into();
|
||||
let xattrs = xattrs.to_glib_none();
|
||||
let options = options.into();
|
||||
let options = options.to_glib_none();
|
||||
let cancellable = cancellable.into();
|
||||
let cancellable = cancellable.to_glib_none();
|
||||
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.to_glib_none().0, file_info.to_glib_none().0, xattrs.0, options.0, &mut out_input, cancellable.0, &mut error);
|
||||
if error.is_null() { Ok(from_glib_full(out_input)) } else { Err(from_glib_full(error)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn raw_file_to_content_stream<'a, 'b, P: IsA<gio::InputStream>, Q: Into<Option<&'a glib::Variant>>, R: Into<Option<&'b gio::Cancellable>>>(input: &P, file_info: &gio::FileInfo, xattrs: Q, cancellable: R) -> Result<(gio::InputStream, u64), Error> {
|
||||
let xattrs = xattrs.into();
|
||||
let xattrs = xattrs.to_glib_none();
|
||||
let cancellable = cancellable.into();
|
||||
let cancellable = cancellable.to_glib_none();
|
||||
unsafe {
|
||||
let mut out_input = ptr::null_mut();
|
||||
let mut out_length = mem::uninitialized();
|
||||
let mut error = ptr::null_mut();
|
||||
let _ = ffi::ostree_raw_file_to_content_stream(input.to_glib_none().0, file_info.to_glib_none().0, xattrs.0, &mut out_input, &mut out_length, cancellable.0, &mut error);
|
||||
if error.is_null() { Ok((from_glib_full(out_input), out_length)) } else { Err(from_glib_full(error)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn validate_checksum_string(sha256: &str) -> Result<(), 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)) }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||
pub fn validate_collection_id<'a, P: Into<Option<&'a str>>>(collection_id: P) -> Result<(), Error> {
|
||||
let collection_id = collection_id.into();
|
||||
let collection_id = collection_id.to_glib_none();
|
||||
unsafe {
|
||||
let mut error = ptr::null_mut();
|
||||
let _ = ffi::ostree_validate_collection_id(collection_id.0, &mut error);
|
||||
if error.is_null() { Ok(()) } else { Err(from_glib_full(error)) }
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "v2017_8", feature = "dox"))]
|
||||
pub fn validate_remote_name(remote_name: &str) -> Result<(), 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)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn validate_rev(rev: &str) -> Result<(), 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)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn validate_structureof_checksum_string(checksum: &str) -> Result<(), 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)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn validate_structureof_commit(commit: &glib::Variant) -> Result<(), 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)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn validate_structureof_csum_v(checksum: &glib::Variant) -> Result<(), 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)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn validate_structureof_dirmeta(dirmeta: &glib::Variant) -> Result<(), 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)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn validate_structureof_dirtree(dirtree: &glib::Variant) -> Result<(), 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)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn validate_structureof_file_mode(mode: u32) -> Result<(), 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)) }
|
||||
}
|
||||
}
|
||||
|
||||
pub fn validate_structureof_objtype(objtype: u8) -> Result<(), 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)) }
|
||||
}
|
||||
}
|
@ -22,20 +22,6 @@ glib_wrapper! {
|
||||
}
|
||||
|
||||
impl GpgVerifyResult {
|
||||
/// Similar to `GpgVerifyResultExt::describe` but takes a `glib::Variant` of
|
||||
/// all attributes for a GPG signature instead of an `GpgVerifyResult`
|
||||
/// and signature index.
|
||||
///
|
||||
/// The `variant` `<emphasis>`MUST`</emphasis>` have been created by
|
||||
/// `GpgVerifyResultExt::get_all`.
|
||||
/// ## `variant`
|
||||
/// a `glib::Variant` from `GpgVerifyResultExt::get_all`
|
||||
/// ## `output_buffer`
|
||||
/// a `glib::String` to hold the description
|
||||
/// ## `line_prefix`
|
||||
/// optional line prefix string
|
||||
/// ## `flags`
|
||||
/// flags to adjust the description format
|
||||
pub fn describe_variant<'a, P: Into<Option<&'a str>>>(variant: &glib::Variant, output_buffer: &mut glib::String, line_prefix: P, flags: GpgSignatureFormatFlags) {
|
||||
let line_prefix = line_prefix.into();
|
||||
let line_prefix = line_prefix.to_glib_none();
|
||||
@ -45,105 +31,19 @@ impl GpgVerifyResult {
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait containing all `GpgVerifyResult` methods.
|
||||
///
|
||||
/// # Implementors
|
||||
///
|
||||
/// [`GpgVerifyResult`](struct.GpgVerifyResult.html)
|
||||
pub trait GpgVerifyResultExt {
|
||||
/// Counts all the signatures in `self`.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// signature count
|
||||
fn count_all(&self) -> u32;
|
||||
|
||||
/// Counts only the valid signatures in `self`.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// valid signature count
|
||||
fn count_valid(&self) -> u32;
|
||||
|
||||
/// Appends a brief, human-readable description of the GPG signature at
|
||||
/// `signature_index` in `self` to the `output_buffer`. The description
|
||||
/// spans multiple lines. A `line_prefix` string, if given, will precede
|
||||
/// each line of the description.
|
||||
///
|
||||
/// The `flags` argument is reserved for future variations to the description
|
||||
/// format. Currently must be 0.
|
||||
///
|
||||
/// It is a programmer error to request an invalid `signature_index`. Use
|
||||
/// `GpgVerifyResultExt::count_all` to find the number of signatures in
|
||||
/// `self`.
|
||||
/// ## `signature_index`
|
||||
/// which signature to describe
|
||||
/// ## `output_buffer`
|
||||
/// a `glib::String` to hold the description
|
||||
/// ## `line_prefix`
|
||||
/// optional line prefix string
|
||||
/// ## `flags`
|
||||
/// flags to adjust the description format
|
||||
fn describe<'a, P: Into<Option<&'a str>>>(&self, signature_index: u32, output_buffer: &mut glib::String, line_prefix: P, flags: GpgSignatureFormatFlags);
|
||||
|
||||
//fn get(&self, signature_index: u32, attrs: /*Unimplemented*/&CArray TypeId { ns_id: 1, id: 26 }) -> Option<glib::Variant>;
|
||||
|
||||
/// Builds a `glib::Variant` tuple of all available attributes for the GPG signature
|
||||
/// at `signature_index` in `self`.
|
||||
///
|
||||
/// The child values in the returned `glib::Variant` tuple are ordered to match the
|
||||
/// `GpgSignatureAttr` enumeration, which means the enum values can be
|
||||
/// used as index values in functions like `glib::Variant::get_child`. See the
|
||||
/// `GpgSignatureAttr` description for the `glib::VariantType` of each
|
||||
/// available attribute.
|
||||
///
|
||||
/// `<note>`
|
||||
/// `<para>`
|
||||
/// The `GpgSignatureAttr` enumeration may be extended in the future
|
||||
/// with new attributes, which would affect the `glib::Variant` tuple returned by
|
||||
/// this function. While the position and type of current child values in
|
||||
/// the `glib::Variant` tuple will not change, to avoid backward-compatibility
|
||||
/// issues `<emphasis>`please do not depend on the tuple's overall size or
|
||||
/// type signature`</emphasis>`.
|
||||
/// `</para>`
|
||||
/// `</note>`
|
||||
///
|
||||
/// It is a programmer error to request an invalid `signature_index`. Use
|
||||
/// `GpgVerifyResultExt::count_all` to find the number of signatures in
|
||||
/// `self`.
|
||||
/// ## `signature_index`
|
||||
/// which signature to get attributes from
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// a new, floating, `glib::Variant` tuple
|
||||
fn get_all(&self, signature_index: u32) -> Option<glib::Variant>;
|
||||
|
||||
/// Searches `self` for a signature signed by `key_id`. If a match is found,
|
||||
/// the function returns `true` and sets `out_signature_index` so that further
|
||||
/// signature details can be obtained through `GpgVerifyResultExt::get`.
|
||||
/// If no match is found, the function returns `false` and leaves
|
||||
/// `out_signature_index` unchanged.
|
||||
/// ## `key_id`
|
||||
/// a GPG key ID or fingerprint
|
||||
/// ## `out_signature_index`
|
||||
/// return location for the index of the signature
|
||||
/// signed by `key_id`, or `None`
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// `true` on success, `false` on failure
|
||||
fn lookup(&self, key_id: &str) -> Option<u32>;
|
||||
|
||||
/// Checks if the result contains at least one signature from the
|
||||
/// trusted keyring. You can call this function immediately after
|
||||
/// `RepoExt::verify_summary` or `RepoExt::verify_commit_ext` -
|
||||
/// it will handle the `None` `self` and filled `error` too.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// `true` if `self` was not `None` and had at least one
|
||||
/// signature from trusted keyring, otherwise `false`
|
||||
fn require_valid_signature(&self) -> Result<(), Error>;
|
||||
}
|
||||
|
||||
|
@ -62,6 +62,34 @@ pub use self::flags::RepoCommitState;
|
||||
pub use self::flags::RepoPullFlags;
|
||||
pub use self::flags::SePolicyRestoreconFlags;
|
||||
|
||||
pub mod functions;
|
||||
|
||||
mod constants;
|
||||
pub use self::constants::COMMIT_GVARIANT_STRING;
|
||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||
pub use self::constants::COMMIT_META_KEY_COLLECTION_BINDING;
|
||||
#[cfg(any(feature = "v2017_7", feature = "dox"))]
|
||||
pub use self::constants::COMMIT_META_KEY_ENDOFLIFE;
|
||||
#[cfg(any(feature = "v2017_7", feature = "dox"))]
|
||||
pub use self::constants::COMMIT_META_KEY_ENDOFLIFE_REBASE;
|
||||
#[cfg(any(feature = "v2017_9", feature = "dox"))]
|
||||
pub use self::constants::COMMIT_META_KEY_REF_BINDING;
|
||||
#[cfg(any(feature = "v2017_13", feature = "dox"))]
|
||||
pub use self::constants::COMMIT_META_KEY_SOURCE_TITLE;
|
||||
#[cfg(any(feature = "v2014_9", feature = "dox"))]
|
||||
pub use self::constants::COMMIT_META_KEY_VERSION;
|
||||
pub use self::constants::DIRMETA_GVARIANT_STRING;
|
||||
pub use self::constants::FILEMETA_GVARIANT_STRING;
|
||||
#[cfg(any(feature = "v2018_3", feature = "dox"))]
|
||||
pub use self::constants::ORIGIN_TRANSIENT_GROUP;
|
||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||
pub use self::constants::REPO_METADATA_REF;
|
||||
pub use self::constants::SUMMARY_GVARIANT_STRING;
|
||||
pub use self::constants::SUMMARY_SIG_GVARIANT_STRING;
|
||||
pub use self::constants::TREE_GVARIANT_STRING;
|
||||
#[cfg(any(feature = "v2017_4", feature = "dox"))]
|
||||
pub use self::constants::VERSION_S;
|
||||
|
||||
#[doc(hidden)]
|
||||
pub mod traits {
|
||||
pub use super::AsyncProgressExt;
|
||||
|
@ -21,28 +21,12 @@ glib_wrapper! {
|
||||
}
|
||||
|
||||
impl MutableTree {
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A new tree
|
||||
pub fn new() -> MutableTree {
|
||||
unsafe {
|
||||
from_glib_full(ffi::ostree_mutable_tree_new())
|
||||
}
|
||||
}
|
||||
|
||||
/// Creates a new OstreeMutableTree with the contents taken from the given repo
|
||||
/// and checksums. The data will be loaded from the repo lazily as needed.
|
||||
/// ## `repo`
|
||||
/// The repo which contains the objects refered by the checksums.
|
||||
/// ## `contents_checksum`
|
||||
/// dirtree checksum
|
||||
/// ## `metadata_checksum`
|
||||
/// dirmeta checksum
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// A new tree
|
||||
pub fn new_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))
|
||||
@ -56,49 +40,14 @@ impl Default for MutableTree {
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait containing all `MutableTree` methods.
|
||||
///
|
||||
/// # Implementors
|
||||
///
|
||||
/// [`MutableTree`](struct.MutableTree.html)
|
||||
pub trait MutableTreeExt {
|
||||
/// In some cases, a tree may be in a "lazy" state that loads
|
||||
/// data in the background; if an error occurred during a non-throwing
|
||||
/// API call, it will have been cached. This function checks for a
|
||||
/// cached error. The tree remains in error state.
|
||||
///
|
||||
/// Feature: `v2018_7`
|
||||
///
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// `TRUE` on success
|
||||
#[cfg(any(feature = "v2018_7", feature = "dox"))]
|
||||
fn check_error(&self) -> Result<(), Error>;
|
||||
|
||||
/// Returns the subdirectory of self with filename `name`, creating an empty one
|
||||
/// it if it doesn't exist.
|
||||
/// ## `name`
|
||||
/// Name of subdirectory of self to retrieve/creates
|
||||
/// ## `out_subdir`
|
||||
/// the subdirectory
|
||||
fn ensure_dir(&self, name: &str) -> Result<MutableTree, Error>;
|
||||
|
||||
//fn ensure_parent_dirs(&self, split_path: /*Unknown conversion*//*Unimplemented*/PtrArray TypeId { ns_id: 0, id: 28 }, metadata_checksum: &str) -> Result<MutableTree, Error>;
|
||||
|
||||
/// Merges `self` with the tree given by `contents_checksum` and
|
||||
/// `metadata_checksum`, but only if it's possible without writing new objects to
|
||||
/// the `repo`. We can do this if either `self` is empty, the tree given by
|
||||
/// `contents_checksum` is empty or if both trees already have the same
|
||||
/// `contents_checksum`.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// `true` if merge was successful, `false` if it was not possible.
|
||||
///
|
||||
/// This function enables optimisations when composing trees. The provided
|
||||
/// checksums are not loaded or checked when this function is called. Instead
|
||||
/// the contents will be loaded only when needed.
|
||||
fn fill_empty_from_dirtree(&self, repo: &Repo, contents_checksum: &str, metadata_checksum: &str) -> bool;
|
||||
|
||||
fn get_contents_checksum(&self) -> Option<String>;
|
||||
|
@ -21,16 +21,6 @@ glib_wrapper! {
|
||||
}
|
||||
|
||||
impl Remote {
|
||||
/// Get the human-readable name of the remote. This is what the user configured,
|
||||
/// if the remote was explicitly configured; and will otherwise be a stable,
|
||||
/// arbitrary, string.
|
||||
///
|
||||
/// Feature: `v2018_6`
|
||||
///
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// remote’s name
|
||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||
pub fn get_name(&self) -> Option<String> {
|
||||
unsafe {
|
||||
@ -38,14 +28,6 @@ impl Remote {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the URL from the remote.
|
||||
///
|
||||
/// Feature: `v2018_6`
|
||||
///
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// the remote's URL
|
||||
#[cfg(any(feature = "v2018_6", feature = "dox"))]
|
||||
pub fn get_url(&self) -> Option<String> {
|
||||
unsafe {
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -28,21 +28,6 @@ impl RepoCommitModifier {
|
||||
// unsafe { TODO: call ffi::ostree_repo_commit_modifier_new() }
|
||||
//}
|
||||
|
||||
/// See the documentation for
|
||||
/// `ostree_repo_devino_cache_new()`. This function can
|
||||
/// then be used for later calls to
|
||||
/// `ostree_repo_write_directory_to_mtree()` to optimize commits.
|
||||
///
|
||||
/// Note if your process has multiple writers, you should use separate
|
||||
/// `OSTreeRepo` instances if you want to also use this API.
|
||||
///
|
||||
/// This function will add a reference to `cache` without copying - you
|
||||
/// should avoid further mutation of the cache.
|
||||
///
|
||||
/// Feature: `v2017_13`
|
||||
///
|
||||
/// ## `cache`
|
||||
/// A hash table caching device,inode to checksums
|
||||
#[cfg(any(feature = "v2017_13", feature = "dox"))]
|
||||
pub fn set_devino_cache(&self, cache: &RepoDevInoCache) {
|
||||
unsafe {
|
||||
@ -50,16 +35,6 @@ impl RepoCommitModifier {
|
||||
}
|
||||
}
|
||||
|
||||
/// If `policy` is non-`None`, use it to look up labels to use for
|
||||
/// "security.selinux" extended attributes.
|
||||
///
|
||||
/// Note that any policy specified this way operates in addition to any
|
||||
/// extended attributes provided via
|
||||
/// `RepoCommitModifier::set_xattr_callback`. However if both
|
||||
/// specify a value for "security.selinux", then the one from the
|
||||
/// policy wins.
|
||||
/// ## `sepolicy`
|
||||
/// Policy to use for labeling
|
||||
pub fn set_sepolicy<'a, P: Into<Option<&'a SePolicy>>>(&self, sepolicy: P) {
|
||||
let sepolicy = sepolicy.into();
|
||||
let sepolicy = sepolicy.to_glib_none();
|
||||
|
@ -21,17 +21,6 @@ glib_wrapper! {
|
||||
}
|
||||
|
||||
impl RepoDevInoCache {
|
||||
/// OSTree has support for pairing `RepoExt::checkout_tree_at` using
|
||||
/// hardlinks in combination with a later
|
||||
/// `RepoExt::write_directory_to_mtree` using a (normally modified)
|
||||
/// directory. In order for OSTree to optimally detect just the new
|
||||
/// files, use this function and fill in the `devino_to_csum_cache`
|
||||
/// member of `OstreeRepoCheckoutAtOptions`, then call
|
||||
/// `ostree_repo_commit_set_devino_cache`.
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// Newly allocated cache
|
||||
pub fn new() -> RepoDevInoCache {
|
||||
unsafe {
|
||||
from_glib_full(ffi::ostree_repo_devino_cache_new())
|
||||
|
@ -25,26 +25,13 @@ glib_wrapper! {
|
||||
}
|
||||
}
|
||||
|
||||
/// Trait containing all `RepoFile` methods.
|
||||
///
|
||||
/// # Implementors
|
||||
///
|
||||
/// [`RepoFile`](struct.RepoFile.html)
|
||||
pub trait RepoFileExt {
|
||||
fn ensure_resolved(&self) -> Result<(), Error>;
|
||||
|
||||
fn get_checksum(&self) -> Option<String>;
|
||||
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// Repository
|
||||
fn get_repo(&self) -> Option<Repo>;
|
||||
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// The root directory for the commit referenced by this file
|
||||
fn get_root(&self) -> Option<RepoFile>;
|
||||
|
||||
fn tree_get_contents(&self) -> Option<glib::Variant>;
|
||||
|
@ -25,14 +25,6 @@ glib_wrapper! {
|
||||
}
|
||||
|
||||
impl SePolicy {
|
||||
/// ## `path`
|
||||
/// Path to a root directory
|
||||
/// ## `cancellable`
|
||||
/// Cancellable
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// An accessor object for SELinux policy in root located at `path`
|
||||
pub fn new<'a, P: IsA<gio::File>, Q: Into<Option<&'a gio::Cancellable>>>(path: &P, cancellable: Q) -> Result<SePolicy, Error> {
|
||||
let cancellable = cancellable.into();
|
||||
let cancellable = cancellable.to_glib_none();
|
||||
@ -43,14 +35,6 @@ impl SePolicy {
|
||||
}
|
||||
}
|
||||
|
||||
/// ## `rootfs_dfd`
|
||||
/// Directory fd for rootfs (will not be cloned)
|
||||
/// ## `cancellable`
|
||||
/// Cancellable
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// An accessor object for SELinux policy in root located at `rootfs_dfd`
|
||||
pub fn new_at<'a, P: Into<Option<&'a gio::Cancellable>>>(rootfs_dfd: i32, cancellable: P) -> Result<SePolicy, Error> {
|
||||
let cancellable = cancellable.into();
|
||||
let cancellable = cancellable.to_glib_none();
|
||||
@ -66,62 +50,17 @@ impl SePolicy {
|
||||
//}
|
||||
}
|
||||
|
||||
/// Trait containing all `SePolicy` methods.
|
||||
///
|
||||
/// # Implementors
|
||||
///
|
||||
/// [`SePolicy`](struct.SePolicy.html)
|
||||
pub trait SePolicyExt {
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// Checksum of current policy
|
||||
fn get_csum(&self) -> Option<String>;
|
||||
|
||||
/// Store in `out_label` the security context for the given `relpath` and
|
||||
/// mode `unix_mode`. If the policy does not specify a label, `None`
|
||||
/// will be returned.
|
||||
/// ## `relpath`
|
||||
/// Path
|
||||
/// ## `unix_mode`
|
||||
/// Unix mode
|
||||
/// ## `out_label`
|
||||
/// Return location for security context
|
||||
/// ## `cancellable`
|
||||
/// Cancellable
|
||||
fn get_label<'a, P: Into<Option<&'a gio::Cancellable>>>(&self, relpath: &str, unix_mode: u32, cancellable: P) -> Result<String, Error>;
|
||||
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// Type of current policy
|
||||
fn get_name(&self) -> Option<String>;
|
||||
|
||||
///
|
||||
/// # Returns
|
||||
///
|
||||
/// Path to rootfs
|
||||
fn get_path(&self) -> Option<gio::File>;
|
||||
|
||||
/// Reset the security context of `target` based on the SELinux policy.
|
||||
/// ## `path`
|
||||
/// Path string to use for policy lookup
|
||||
/// ## `info`
|
||||
/// File attributes
|
||||
/// ## `target`
|
||||
/// Physical path to target file
|
||||
/// ## `flags`
|
||||
/// Flags controlling behavior
|
||||
/// ## `out_new_label`
|
||||
/// New label, or `None` if unchanged
|
||||
/// ## `cancellable`
|
||||
/// Cancellable
|
||||
fn restorecon<'a, 'b, P: Into<Option<&'a gio::FileInfo>>, Q: IsA<gio::File>, R: Into<Option<&'b gio::Cancellable>>>(&self, path: &str, info: P, target: &Q, flags: SePolicyRestoreconFlags, cancellable: R) -> Result<String, Error>;
|
||||
|
||||
/// ## `path`
|
||||
/// Use this path to determine a label
|
||||
/// ## `mode`
|
||||
/// Used along with `path`
|
||||
fn setfscreatecon(&self, path: &str, mode: u32) -> Result<(), Error>;
|
||||
|
||||
fn get_property_rootfs_dfd(&self) -> i32;
|
||||
|
@ -8,6 +8,8 @@ extern crate gio;
|
||||
extern crate libc;
|
||||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
|
||||
use glib::Error;
|
||||
|
||||
|
1
rust-bindings/rust/sample/Cargo.lock
generated
1
rust-bindings/rust/sample/Cargo.lock
generated
@ -88,6 +88,7 @@ dependencies = [
|
||||
"glib 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"glib-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"gobject-sys 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.43 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libostree-sys 0.2.0",
|
||||
]
|
||||
|
Loading…
Reference in New Issue
Block a user