diff --git a/rust-bindings/rust/Cargo.toml b/rust-bindings/rust/Cargo.toml
index bb293dbb..557805bb 100644
--- a/rust-bindings/rust/Cargo.toml
+++ b/rust-bindings/rust/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "ostree"
-version = "0.2.0"
+version = "0.3.0"
authors = ["Felix Krull"]
license = "MIT"
@@ -36,7 +36,7 @@ gio = "0.5"
glib-sys = "0.7"
gobject-sys = "0.7"
gio-sys = "0.7"
-ostree-sys = { version = "0.2", path = "sys" }
+ostree-sys = { version = "0.3", path = "sys" }
[dev-dependencies]
tempfile = "3"
diff --git a/rust-bindings/rust/gir-files/OSTree-1.0.gir b/rust-bindings/rust/gir-files/OSTree-1.0.gir
index f5ba7245..6257837a 100644
--- a/rust-bindings/rust/gir-files/OSTree-1.0.gir
+++ b/rust-bindings/rust/gir-files/OSTree-1.0.gir
@@ -550,8 +550,8 @@ Any watchers of the #OstreeAsyncProgress will be notified of the change if
-
-
+
+
@@ -562,6 +562,11 @@ Any watchers of the #OstreeAsyncProgress will be notified of the change if
+
+
+
+
+
@@ -1120,7 +1125,8 @@ that should have been under an explicit group.
+ c:identifier="ostree_deployment_unlocked_state_to_string"
+ version="2016.4">
@@ -1264,7 +1270,8 @@ or concatenate it with the full ostree_sysroot_get_path().
+ c:identifier="ostree_deployment_get_unlocked"
+ version="2016.4">
@@ -1790,6 +1797,7 @@ If no match is found, the function returns %FALSE and leaves
Checks if the result contains at least one signature from the
trusted keyring. You can call this function immediately after
@@ -1885,18 +1893,39 @@ signature from trusted keyring, otherwise %FALSE
- Maximum permitted size in bytes of metadata objects. This is an
-arbitrary number, but really, no one should be putting humongous
-data in metadata.
+ Default limit for maximum permitted size in bytes of metadata objects fetched
+over HTTP (including repo/config files, refs, and commit/dirtree/dirmeta
+objects). This is an arbitrary number intended to mitigate disk space
+exhaustion attacks.
- Objects committed above this size will be allowed, but a warning
-will be emitted.
+ This variable is no longer meaningful, it is kept only for compatibility.
+
+ GVariant type `s`. This key can be used in the repo metadata which is stored
+in OSTREE_REPO_METADATA_REF as well as in the summary. The semantics of this
+are that the remote repository wants clients to update their remote config
+to add this collection ID (clients can't do P2P operations involving a
+remote without a collection ID configured on it, even if one is configured
+on the server side). Clients must never change or remove a collection ID
+already set in their remote config.
+
+Currently, OSTree does not implement changing a remote config based on this
+key, but it may do so in a later release, and until then clients such as
+Flatpak may implement it.
+
+This is a replacement for the similar metadata key implemented by flatpak,
+`xa.collection-id`, which is now deprecated as clients which supported it had
+bugs with their P2P implementations.
+
+
+ c:identifier="ostree_mutable_tree_new_from_checksum"
+ version="2018.7">
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.
@@ -2012,7 +2042,8 @@ exist.
+ c:identifier="ostree_mutable_tree_fill_empty_from_dirtree"
+ version="2018.7">
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
@@ -2113,6 +2144,29 @@ the contents will be loaded only when needed.
+
+ Remove the file or subdirectory named @name from the mutable tree @self.
+
+
+
+
+
+ Tree
+
+
+
+ Name of file or subdirectory to remove
+
+
+
+ If @FALSE, an error will be thrown if @name does not exist in the tree
+
+
+
+
@@ -2250,7 +2304,7 @@ content, the other types are metadata.
ostree release version component (e.g. 2 if %OSTREE_VERSION is 2017.2)
@@ -2395,6 +2449,7 @@ instead of assuming "/".
This is a file-descriptor relative version of ostree_repo_create().
Create the underlying structure on disk for the repository, and call
@@ -2453,7 +2508,10 @@ The @options dict may contain:
-
+ This combines ostree_repo_new() (but using fd-relative access) with
ostree_repo_open(). Use this when you know you should be operating on an
already extant repository. If you want to create one, use ostree_repo_create_at().
@@ -2648,6 +2706,7 @@ transaction will do nothing and return successfully.
Similar to ostree_repo_checkout_tree(), but uses directory-relative
paths for the destination, uses a new `OstreeRepoCheckoutAtOptions`,
@@ -3026,7 +3085,7 @@ The following @options are currently defined:
provided.
* `n-network-retries` (`u`): Number of times to retry each download on
receiving a transient network error, such as a socket timeout; default is
- 5, 0 means return errors without retrying.
+ 5, 0 means return errors without retrying. Since: 2018.6
@finders must be a non-empty %NULL-terminated array of the #OstreeRepoFinder
instances to use, or %NULL to use the system default set of finders, which
@@ -3154,6 +3213,22 @@ traverse metadata objects for example.
+
+ Get the bootloader configured. See the documentation for the
+"sysroot.bootloader" config key.
+
+ bootloader configuration for the sysroot
+
+
+
+
+ an #OstreeRepo
+
+
+
+
@@ -3180,7 +3255,28 @@ traverse metadata objects for example.
-
+
+ Get the set of default repo finders configured. See the documentation for
+the "core.default-repo-finders" config key.
+
+
+ %NULL-terminated array of strings.
+
+
+
+
+
+
+ an #OstreeRepo
+
+
+
+
+ In some cases it's useful for applications to access the repository
directly; for example, writing content into `repo/tmp` ensures it's
on the same filesystem. Another case is detecting the mtime on the
@@ -3210,6 +3306,29 @@ repository (to see whether a ref was written).
+
+ It can be used to query the value (in bytes) of min-free-space-* config option.
+
+ %TRUE on success, %FALSE otherwise.
+
+
+
+
+ Repo
+
+
+
+ Location to store the result
+
+
+
+
@@ -3251,6 +3370,7 @@ that API. In general, you should avoid use of this API.
OSTree remotes are represented by keyfile groups, formatted like:
`[remote "remotename"]`. This function returns a value named @option_name
@@ -3289,6 +3409,7 @@ error is returned, @out_value will be set to %FALSE.OSTree remotes are represented by keyfile groups, formatted like:
`[remote "remotename"]`. This function returns a value named @option_name
@@ -3327,6 +3448,7 @@ to %NULL.OSTree remotes are represented by keyfile groups, formatted like:
`[remote "remotename"]`. This function returns a value named @option_name
@@ -3367,6 +3489,7 @@ option name. If an error is returned, @out_value will be set to %NULL.Verify @signatures for @data using GPG keys in the keyring for
@remote_name, and return an #OstreeGpgVerifyResult.
@@ -3563,11 +3686,12 @@ Otherwise, a copy will be performed.Copy object named by @objtype and @checksum into @self from the
-source repository @source. If both repositories are of the same
-type and on the same filesystem, this will simply be a fast Unix
-hard link operation.
+source repository @source. If @trusted is %TRUE and both
+repositories are of the same type and on the same filesystem,
+this will simply be a fast Unix hard link operation.
Otherwise, a copy will be performed.
@@ -3646,7 +3770,9 @@ collection ID is configured for the repository
(ostree_repo_get_collection_id()).
If you want to exclude refs from `refs/remotes`, use
-%OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES in @flags.
+%OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES in @flags. Similarly use
+%OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_MIRRORS to exclude refs from
+`refs/mirrors`.
%TRUE on success, %FALSE otherwise
@@ -3812,6 +3938,7 @@ removed as a prefix from the hash table keys.
If @refspec_prefix is %NULL, list all local and remote refspecs,
with their current values in @out_all_refs. Otherwise, only list
@@ -4245,6 +4372,7 @@ Locking: exclusiveDelete content from the repository. This function is the "backend"
half of the higher level ostree_repo_prune(). To use this function,
@@ -4425,7 +4553,18 @@ The following @options are currently defined:
* `subdirs` (`as`): Pull just these subdirectories
* `update-frequency` (`u`): Frequency to call the async progress callback in
milliseconds, if any; only values higher than 0 are valid
- * `append-user-agent` (`s`): Additional string to append to the user agent
+ * `append-user-agent` (`s`): Additional string to append to the user agent
+ * `n-network-retries` (`u`): Number of times to retry each download on receiving
+ a transient network error, such as a socket timeout; default is 5, 0
+ means return errors without retrying. Since: 2018.6
+ * `ref-keyring-map` (`a(sss)`): Array of (collection ID, ref name, keyring
+ remote name) tuples specifying which remote's keyring should be used when
+ doing GPG verification of each collection-ref. This is useful to prevent a
+ remote from serving malicious updates to refs which did not originate from
+ it. This can be a subset or superset of the refs being pulled; any ref
+ not being pulled will be ignored and any ref without a keyring remote
+ will be verified with the keyring of the remote being pulled from.
+ Since: 2019.2
@@ -4573,6 +4712,7 @@ The following are currently defined:
* require-static-deltas (b): Require static deltas
* override-commit-ids (as): Array of specific commit IDs to fetch for refs
* timestamp-check (b): Verify commit timestamps are newer than current (when pulling via ref); Since: 2017.11
+ * metadata-size-restriction (t): Restrict metadata objects to a maximum number of bytes; 0 to disable. Since: 2018.9
* dry-run (b): Only print information on what will be downloaded (requires static deltas)
* override-url (s): Fetch objects from this URL if remote specifies no metalink in options
* inherit-transaction (b): Don't initiate, finish or abort a transaction, useful to do multiple pulls in one transaction.
@@ -4582,7 +4722,15 @@ The following are currently defined:
* append-user-agent (s): Additional string to append to the user agent
* n-network-retries (u): Number of times to retry each download on receiving
a transient network error, such as a socket timeout; default is 5, 0
- means return errors without retrying
+ means return errors without retrying. Since: 2018.6
+ * ref-keyring-map (a(sss)): Array of (collection ID, ref name, keyring
+ remote name) tuples specifying which remote's keyring should be used when
+ doing GPG verification of each collection-ref. This is useful to prevent a
+ remote from serving malicious updates to refs which did not originate from
+ it. This can be a subset or superset of the refs being pulled; any ref
+ not being pulled will be ignored and any ref without a keyring remote
+ will be verified with the keyring of the remote being pulled from.
+ Since: 2019.2
@@ -4772,6 +4920,7 @@ Locking: exclusive
By default, an #OstreeRepo will cache the remote configuration and its
own repo/config data. This API can be used to reload it.
@@ -4969,6 +5118,7 @@ with #OSTREE_SUMMARY_GVARIANT_FORMAT as the format string.
Like ostree_repo_remote_fetch_summary(), but supports an extensible set of flags.
The following are currently defined:
@@ -5288,7 +5438,9 @@ returned and @out_rev will be set to %NULL. If @allow_noent is %FALSE and
the given @ref cannot be found, a %G_IO_ERROR_NOT_FOUND error will be
returned.
-There are currently no @flags which affect the behaviour of this function.
+If you want to check only local refs, not remote or mirrored ones, use the
+flag %OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY. This is analogous to using
+ostree_repo_resolve_rev_ext() but for collection-refs.
%TRUE on success, %FALSE on failure
@@ -5402,11 +5554,15 @@ find the given refspec in local.
Look up the given refspec, returning the checksum it references in
the parameter @out_rev. Differently from ostree_repo_resolve_rev(),
this will not fall back to searching through remote repos if a
-local ref is specified but not found.
+local ref is specified but not found.
+
+The flag %OSTREE_REPO_RESOLVE_REV_EXT_LOCAL_ONLY is implied so
+using it has no effect.
@@ -5476,6 +5632,7 @@ Multithreading: This function is *not* MT safe.
Like ostree_repo_set_ref_immediate(), but creates an alias.
@@ -5515,6 +5672,7 @@ Multithreading: This function is *not* MT safe.
Set a custom location for the cache directory used for e.g.
per-remote summary caches. Setting this manually is useful when
@@ -6201,6 +6359,7 @@ checksum @commit_checksum.Read GPG signature(s) on the commit named by the ASCII checksum
@commit_checksum and return detailed results, based on the keyring
@@ -7056,8 +7215,11 @@ ostree_repo_checkout_tree() and ostree_repo_checkout_tree_at().
+
+
+
-
+
@@ -7090,7 +7252,8 @@ ostree_repo_checkout_tree() and ostree_repo_checkout_tree_at().
+ c:identifier="ostree_repo_checkout_at_options_set_devino"
+ version="2017.13">
This function simply assigns @cache to the `devino_to_csum_cache` member of
@opts; it's only useful for introspection.
@@ -8863,6 +9026,11 @@ Note that enabling pathname translation will always override the setting for
c:identifier="OSTREE_REPO_LIST_REFS_EXT_EXCLUDE_REMOTES">
Exclude remote refs. Since: 2017.11
+
+ Exclude mirrored refs. Since: 2019.2
+ See the documentation of #OstreeRepo for more information about the
@@ -8984,15 +9152,25 @@ possible modes.
c:identifier="OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS">
Delete a remote, do nothing if the remote does not exist
+
+ Add or replace a remote (Since: 2019.2)
+
-
-
+ No flags.
-
+
+ Exclude remote and mirrored refs. Since: 2019.2
+
+
in bytes, counting only content objects.
+
+
+ reserved
-
+ reserved
@@ -9123,6 +9304,7 @@ in bytes, counting only content objects.
An accessor object for SELinux policy in root located at @rootfs_dfd
@@ -9158,7 +9340,9 @@ in bytes, counting only content objects.
-
+ Checksum of current policy
@@ -9626,6 +9810,7 @@ the staged deployment (as it's not in the bootloader entries).
Configure the target deployment @deployment such that it
is writable. There are multiple modes, essentially differing
@@ -9838,7 +10023,8 @@ the first one in the current deployment list which matches osname.
+ c:identifier="ostree_sysroot_get_staged_deployment"
+ version="2018.5">
The currently staged deployment, or %NULL if none
@@ -9863,6 +10049,7 @@ the first one in the current deployment list which matches osname.
Initialize the directory structure for an "osname", which is a
group of operating system deployments, with a shared `/var`. One
@@ -9910,6 +10097,7 @@ rootfs @self.
@@ -10081,7 +10269,7 @@ we're not looking at the booted deployment.
-
+ This function is a variant of ostree_sysroot_get_repo() that cannot fail, and
returns a cached repository. Can only be called after ostree_sysroot_load()
has been invoked successfully.
@@ -10163,6 +10351,7 @@ later, instead.
Like ostree_sysroot_deploy_tree(), but "finalization" only occurs at OS
shutdown time.
@@ -10312,6 +10501,7 @@ version will perform post-deployment cleanup by default.
Assuming @new_deployments have already been deployed in place on disk via
ostree_sysroot_deploy_tree(), atomically update bootloader configuration. By
@@ -10820,14 +11010,14 @@ users who had been using zero before.
disguised="1">
ostree version.ostree version, encoded as a string, useful for printing and
@@ -10835,7 +11025,7 @@ concatenation.ostree year version component (e.g. 2017 if %OSTREE_VERSION is 2017.2)
@@ -10883,7 +11073,9 @@ care of synchronization.
-
+ %TRUE if current libostree has at least the requested version, %FALSE otherwise
@@ -10900,7 +11092,8 @@ care of synchronization.
+ c:identifier="ostree_checksum_b64_from_bytes"
+ version="2016.8">
Modified base64 encoding of @csum
@@ -10960,7 +11153,8 @@ character is used.
+ c:identifier="ostree_checksum_b64_to_bytes"
+ version="2016.8">
Binary version of @checksum.
@@ -11411,7 +11605,8 @@ must be %NULL-terminated; it may be empty, but must not be %NULL.
+ c:identifier="ostree_commit_get_content_checksum"
+ version="2018.2">
There are use cases where one wants a checksum just of the content of a
commit. OSTree commits by default capture the current timestamp, and may have
additional metadata, which means that re-committing identical content
@@ -11687,6 +11882,7 @@ sets of #OstreeDiffItem in @modified, @removed, and @added.Compute the difference between directory @a and @b as 3 separate
sets of #OstreeDiffItem in @modified, @removed, and @added.
@@ -11774,7 +11970,9 @@ sets of #OstreeDiffItem in @modified, @removed, and @added.
-
+
@@ -11960,6 +12158,7 @@ will be `gnome-ostree/buildmaster`. In both cases, %TRUE will be returned.
Convert from a "bare" file representation into an
OSTREE_OBJECT_TYPE_FILE stream suitable for ostree pull.
diff --git a/rust-bindings/rust/src/auto/constants.rs b/rust-bindings/rust/src/auto/constants.rs
index a215cb26..f5707eab 100644
--- a/rust-bindings/rust/src/auto/constants.rs
+++ b/rust-bindings/rust/src/auto/constants.rs
@@ -38,6 +38,10 @@ lazy_static! {
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_9", feature = "dox"))]
+lazy_static! {
+ pub static ref META_KEY_DEPLOY_COLLECTION_ID: &'static str = unsafe{CStr::from_ptr(ffi::OSTREE_META_KEY_DEPLOY_COLLECTION_ID).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()};
diff --git a/rust-bindings/rust/src/auto/enums.rs b/rust-bindings/rust/src/auto/enums.rs
index 03bdfe7b..191c1330 100644
--- a/rust-bindings/rust/src/auto/enums.rs
+++ b/rust-bindings/rust/src/auto/enums.rs
@@ -237,6 +237,7 @@ pub enum RepoRemoteChange {
AddIfNotExists,
Delete,
DeleteIfExists,
+ Replace,
#[doc(hidden)]
__Unknown(i32),
}
@@ -251,6 +252,7 @@ impl ToGlib for RepoRemoteChange {
RepoRemoteChange::AddIfNotExists => ffi::OSTREE_REPO_REMOTE_CHANGE_ADD_IF_NOT_EXISTS,
RepoRemoteChange::Delete => ffi::OSTREE_REPO_REMOTE_CHANGE_DELETE,
RepoRemoteChange::DeleteIfExists => ffi::OSTREE_REPO_REMOTE_CHANGE_DELETE_IF_EXISTS,
+ RepoRemoteChange::Replace => ffi::OSTREE_REPO_REMOTE_CHANGE_REPLACE,
RepoRemoteChange::__Unknown(value) => value
}
}
@@ -264,41 +266,12 @@ impl FromGlib for RepoRemoteChange {
1 => RepoRemoteChange::AddIfNotExists,
2 => RepoRemoteChange::Delete,
3 => RepoRemoteChange::DeleteIfExists,
+ 4 => RepoRemoteChange::Replace,
value => RepoRemoteChange::__Unknown(value),
}
}
}
-#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
-#[derive(Clone, Copy)]
-pub enum RepoResolveRevExtFlags {
- RepoResolveRevExtNone,
- #[doc(hidden)]
- __Unknown(i32),
-}
-
-#[doc(hidden)]
-impl ToGlib for RepoResolveRevExtFlags {
- type GlibType = ffi::OstreeRepoResolveRevExtFlags;
-
- fn to_glib(&self) -> ffi::OstreeRepoResolveRevExtFlags {
- match *self {
- RepoResolveRevExtFlags::RepoResolveRevExtNone => ffi::OSTREE_REPO_RESOLVE_REV_EXT_NONE,
- RepoResolveRevExtFlags::__Unknown(value) => value
- }
- }
-}
-
-#[doc(hidden)]
-impl FromGlib for RepoResolveRevExtFlags {
- fn from_glib(value: ffi::OstreeRepoResolveRevExtFlags) -> Self {
- match value {
- 0 => RepoResolveRevExtFlags::RepoResolveRevExtNone,
- value => RepoResolveRevExtFlags::__Unknown(value),
- }
- }
-}
-
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[derive(Clone, Copy)]
pub enum StaticDeltaGenerateOpt {
diff --git a/rust-bindings/rust/src/auto/flags.rs b/rust-bindings/rust/src/auto/flags.rs
index 407d630e..ccbad10f 100644
--- a/rust-bindings/rust/src/auto/flags.rs
+++ b/rust-bindings/rust/src/auto/flags.rs
@@ -36,6 +36,7 @@ bitflags! {
const NONE = 0;
const ALIASES = 1;
const EXCLUDE_REMOTES = 2;
+ const EXCLUDE_MIRRORS = 4;
}
}
@@ -82,6 +83,29 @@ impl FromGlib for RepoPullFlags {
}
}
+bitflags! {
+ pub struct RepoResolveRevExtFlags: u32 {
+ const NONE = 0;
+ const LOCAL_ONLY = 1;
+ }
+}
+
+#[doc(hidden)]
+impl ToGlib for RepoResolveRevExtFlags {
+ type GlibType = ffi::OstreeRepoResolveRevExtFlags;
+
+ fn to_glib(&self) -> ffi::OstreeRepoResolveRevExtFlags {
+ self.bits()
+ }
+}
+
+#[doc(hidden)]
+impl FromGlib for RepoResolveRevExtFlags {
+ fn from_glib(value: ffi::OstreeRepoResolveRevExtFlags) -> RepoResolveRevExtFlags {
+ RepoResolveRevExtFlags::from_bits_truncate(value)
+ }
+}
+
bitflags! {
pub struct SePolicyRestoreconFlags: u32 {
const NONE = 0;
diff --git a/rust-bindings/rust/src/auto/functions.rs b/rust-bindings/rust/src/auto/functions.rs
index 52017ed6..b197a355 100644
--- a/rust-bindings/rust/src/auto/functions.rs
+++ b/rust-bindings/rust/src/auto/functions.rs
@@ -24,12 +24,14 @@ pub fn break_hardlink<'a, P: Into