OSTree.Repo¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
Path |
||
r/w/co |
|||
r/w/co |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted during a pull operation upon GPG verification (if enabled). |
Fields¶
- Inherited:
Class Details¶
- class OSTree.Repo(**kwargs)¶
- Bases:
- Abstract:
No
- classmethod create_at(dfd, path, mode, options, cancellable)¶
- Parameters:
dfd (
int
) – Directory fdpath (
str
) – Pathmode (
OSTree.RepoMode
) – The mode to store the repository inoptions (
GLib.Variant
orNone
) – a{sv}: See below for accepted keyscancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
A new OSTree repository reference
- Return type:
This is a file-descriptor relative version of
OSTree.Repo.create
(). Create the underlying structure on disk for the repository, and callOSTree.Repo.open_at
() on the result, preparing it for use.If a repository already exists at dfd + path (defined by an
objects/
subdirectory existing), then this function will simply callOSTree.Repo.open_at
(). In other words, this function cannot be used to change the mode or configuration (repo/config
) of an existing repo.The options dict may contain:
collection-id: s: Set as collection ID in repo/config (Since 2017.9)
New in version 2017.10.
- classmethod mode_from_string(mode)¶
- Parameters:
mode (
str
) – a repo mode as a string- Raises:
- Returns:
- out_mode:
the corresponding
OSTree.RepoMode
- Return type:
(
bool
, out_mode:OSTree.RepoMode
)
- classmethod new(path)¶
- Parameters:
path (
Gio.File
) – Path to a repository- Returns:
An accessor object for an OSTree repository located at path
- Return type:
- classmethod new_default()¶
- Returns:
An accessor object for an OSTree repository located at /ostree/repo
- Return type:
If the current working directory appears to be an OSTree repository, create a new
OSTree.Repo
object for accessing it. Otherwise use the path in the OSTREE_REPO environment variable (if defined) or else the default system repository located at /ostree/repo.
- classmethod new_for_sysroot_path(repo_path, sysroot_path)¶
- Parameters:
- Returns:
An accessor object for the OSTree repository located at repo_path.
- Return type:
Creates a new
OSTree.Repo
instance, taking the system root path explicitly instead of assuming “/”.
- classmethod open_at(dfd, path, cancellable)¶
- Parameters:
dfd (
int
) – Directory fdpath (
str
) – Pathcancellable (
Gio.Cancellable
orNone
) –
- Raises:
- Returns:
An accessor object for an OSTree repository located at dfd + path
- Return type:
This combines
OSTree.Repo.new
() (but using fd-relative access) withOSTree.Repo.open
(). Use this when you know you should be operating on an already extant repository. If you want to create one, useOSTree.Repo.create_at
().New in version 2017.10.
- classmethod pull_default_console_progress_changed(progress, user_data)¶
- Parameters:
progress (
OSTree.AsyncProgress
) – Async progress
Convenient “changed” callback for use with ostree_async_progress_new_and_connect() when pulling from a remote repository.
Depending on the state of the
OSTree.AsyncProgress
, either displays a custom status message, or else outstanding fetch progress in bytes/sec, or else outstanding content or metadata writes to the repository in number of objects.Compatibility note: this function previously assumed that user_data was a pointer to a #GSConsole instance. This is no longer the case, and user_data is ignored.
- classmethod traverse_new_parents()¶
- Returns:
A new hash table
- Return type:
This hash table is a mapping from
GLib.Variant
which can be accessed viaOSTree.object_name_deserialize
() to aGLib.Variant
containing either a similarGLib.Variant
or and array of them, listing the parents of the key.New in version 2018.5.
- classmethod traverse_new_reachable()¶
- Returns:
A new hash table
- Return type:
This hash table is a set of
GLib.Variant
which can be accessed viaOSTree.object_name_deserialize
().
- classmethod traverse_parents_get_commits(parents, object)¶
- Parameters:
object (
GLib.Variant
) –
- Returns:
An array of checksums for the commits the key belongs to.
- Return type:
[
str
]
Gets all the commits that a certain object belongs to, as recorded by a parents table gotten from ostree_repo_traverse_commit_union_with_parents.
New in version 2018.5.
- abort_transaction(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – Cancellable- Raises:
- Return type:
Abort the active transaction; any staged objects and ref changes will be discarded. You *must* invoke this if you have chosen not to invoke
OSTree.Repo.commit_transaction
(). Calling this function when not in a transaction will do nothing and return successfully.
- add_gpg_signature_summary(key_id, homedir, cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
- Raises:
- Return type:
Add a GPG signature to a summary file.
- append_gpg_signature(commit_checksum, signature_bytes, cancellable)¶
- Parameters:
commit_checksum (
str
) – SHA256 of given commit to signsignature_bytes (
GLib.Bytes
) – Signature datacancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
- Raises:
- Return type:
Append a GPG signature to a commit.
- checkout_at(options, destination_dfd, destination_path, commit, cancellable)¶
- Parameters:
options (
OSTree.RepoCheckoutAtOptions
orNone
) – Optionsdestination_dfd (
int
) – Directory FD for destinationdestination_path (
str
) – Directory for destinationcommit (
str
) – Checksum for commitcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Similar to
OSTree.Repo.checkout_tree
(), but uses directory-relative paths for the destination, uses a newOstreeRepoCheckoutAtOptions
, and takes a commit checksum and optional subpath pair, rather than requiring use ofGFile
APIs for the caller.It also replaces
OSTree.Repo.checkout_at
() which was not safe to use withGObject.Object
introspection.Note in addition that unlike
OSTree.Repo.checkout_tree
(), the default is not to use the repository-internal uncompressed objects cache.New in version 2016.8.
- checkout_composefs(options, destination_dfd, destination_path, checksum, cancellable)¶
- Parameters:
options (
GLib.Variant
orNone
) – Future expansion space; must currently beNone
destination_dfd (
int
) – Parent directory fddestination_path (
str
) – Filenamechecksum (
str
) – OStree commit digestcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Create a composefs filesystem metadata blob from an OSTree commit.
- checkout_gc(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – Cancellable- Raises:
- Return type:
Call this after finishing a succession of checkout operations; it will delete any currently-unused uncompressed objects from the cache.
- checkout_tree(mode, overwrite_mode, destination, source, source_info, cancellable)¶
- Parameters:
mode (
OSTree.RepoCheckoutMode
) – Options controlling all filesoverwrite_mode (
OSTree.RepoCheckoutOverwriteMode
) – Whether or not to overwrite filesdestination (
Gio.File
) – Place tree heresource (
OSTree.RepoFile
) – Source treesource_info (
Gio.FileInfo
) – Source infocancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Check out source into destination, which must live on the physical filesystem. source may be any subdirectory of a given commit. The mode and overwrite_mode allow control over how the files are checked out.
- commit_add_composefs_metadata(format_version, dict, repo_root, cancellable)¶
- Parameters:
format_version (
int
) – Must be zerodict (
GLib.VariantDict
) – AGLib.Variant
builder of type a{sv}repo_root (
OSTree.RepoFile
) – the target filesystem treecancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Compute the composefs digest for a filesystem tree and insert it into metadata for a commit object. The composefs digest covers the entire filesystem tree and can be verified by the composefs mount tooling.
- commit_transaction(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – Cancellable- Raises:
- Returns:
- out_stats:
A set of statistics of things that happened during this transaction.
- Return type:
(
bool
, out_stats:OSTree.RepoTransactionStats
)
Complete the transaction. Any refs set with
OSTree.Repo.transaction_set_ref
() orOSTree.Repo.transaction_set_refspec
() will be written out.Note that if multiple threads are performing writes, all such threads must have terminated before this function is invoked.
Locking: Releases
shared
lock acquired byostree_repo_prepare_transaction()
Multithreading: This function is *not* MT safe; only one transaction can be active at a time.
- copy_config()¶
- Returns:
A newly-allocated copy of the repository config
- Return type:
- create(mode, cancellable)¶
- Parameters:
mode (
OSTree.RepoMode
) – The mode to store the repository incancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Create the underlying structure on disk for the repository, and call
OSTree.Repo.open
() on the result, preparing it for use.Since version 2016.8, this function will succeed on an existing repository, and finish creating any necessary files in a partially created repository. However, this function cannot change the mode of an existing repository, and will silently ignore an attempt to do so.
Since 2017.9, “existing repository” is defined by the existence of an
objects
subdirectory.This function predates
OSTree.Repo.create_at
(). It is an error to call this function on a repository initialized viaOSTree.Repo.open_at
().
- delete_object(objtype, sha256, cancellable)¶
- Parameters:
objtype (
OSTree.ObjectType
) – Object typesha256 (
str
) – Checksumcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Remove the object of type objtype with checksum sha256 from the repository. An error of type
Gio.IOErrorEnum.NOT_FOUND
is thrown if the object does not exist.
- equal(b)¶
- Parameters:
b (
OSTree.Repo
) – anOSTree.Repo
- Returns:
True
if self and b are the same repository on disk,False
otherwise- Return type:
Check whether two opened repositories are the same on disk: if their root directories are the same inode. If self or b are not open yet (due to
OSTree.Repo.open
() not being called on them yet),False
will be returned.New in version 2017.12.
- find_remotes_async(refs, options, finders, progress, cancellable, callback, *user_data)¶
- Parameters:
refs ([
OSTree.CollectionRef
]) – non-empty array of collection–ref pairs to find remotes foroptions (
GLib.Variant
orNone
) – aGLib.Variant
a{sv}
with an extensible set of flagsfinders ([
OSTree.RepoFinder
]) – non-empty array ofOSTree.RepoFinder
instances to use, orNone
to use the system defaultsprogress (
OSTree.AsyncProgress
orNone
) – anOSTree.AsyncProgress
to update with the operation’s progress, orNone
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – asynchronous completion callback
Find reachable remote URIs which claim to provide any of the given named refs. This will search for configured remotes (
OSTree.RepoFinderConfig
), mounted volumes (OSTree.RepoFinderMount
) and (if enabled at compile time) local network peers (OSTree.RepoFinderAvahi
). In order to use a custom configuration ofOSTree.RepoFinder
instances, callOSTree.RepoFinder.resolve_all_async
() on them individually.Any remote which is found and which claims to support any of the given refs will be returned in the results. It is possible that a remote claims to support a given ref, but turns out not to — it is not possible to verify this until
OSTree.Repo.pull_from_remotes_async
() is called.The returned results will be sorted with the most useful first — this is typically the remote which claims to provide the most of refs, at the lowest latency.
Each result contains a list of the subset of refs it claims to provide. It is possible for a non-empty list of results to be returned, but for some of refs to not be listed in any of the results. Callers must check for this.
Pass the results to
OSTree.Repo.pull_from_remotes_async
() to pull the given refs from those remotes.The following options are currently defined:
override-commit-ids
(as
): Array of specific commit IDs to fetch. The nth commit ID applies to the nth ref, so this must be the same length as refs, if 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. Since: 2018.6
finders must be a non-empty
None
-terminated array of theOSTree.RepoFinder
instances to use, orNone
to use the system default set of finders, which will typically be all available finders using their default options (but this is not guaranteed).GPG verification of commits will be used unconditionally.
This will use the thread-default
GLib.MainContext
, but will not iterate it.New in version 2018.6.
- find_remotes_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – the asynchronous result- Raises:
- Returns:
a potentially empty array of
OSTree.RepoFinderResults
, followed by aNone
terminator element; orNone
on error- Return type:
Finish an asynchronous pull operation started with
OSTree.Repo.find_remotes_async
().New in version 2018.6.
- fsck_object(objtype, sha256, cancellable)¶
- Parameters:
objtype (
OSTree.ObjectType
) – Object typesha256 (
str
) – Checksumcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Verify consistency of the object; this performs checks only relevant to the immediate object itself, such as checksumming. This API call will not itself traverse metadata objects for example.
New in version 2017.15.
- get_bootloader()¶
- Returns:
bootloader configuration for the sysroot
- Return type:
Get the bootloader configured. See the documentation for the “sysroot.bootloader” config key.
New in version 2019.2.
- get_collection_id()¶
-
Get the collection ID of this repository. See ‘collection IDs [collection-ids]’.
New in version 2018.6.
- get_config()¶
- Returns:
The repository configuration; do not modify
- Return type:
- get_default_repo_finders()¶
-
Get the set of default repo finders configured. See the documentation for the “core.default-repo-finders” config key.
New in version 2018.9.
- get_dfd()¶
- Returns:
File descriptor for repository root - owned by self
- Return type:
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 repository (to see whether a ref was written).New in version 2016.4.
- get_disable_fsync()¶
- Returns:
Whether or not fsync() is enabled for this repo.
- Return type:
For more information see
OSTree.Repo.set_disable_fsync
().
- get_min_free_space_bytes()¶
- Raises:
- Returns:
True
on success,False
otherwise.- out_reserved_bytes:
Location to store the result
- Return type:
Determine the number of bytes of free disk space that are reserved according to the repo config and return that number in out_reserved_bytes. See the documentation for the core.min-free-space-size and core.min-free-space-percent repo config options.
New in version 2018.9.
- get_mode()¶
- Return type:
- get_parent()¶
- Returns:
Parent repository, or
None
if none- Return type:
OSTree.Repo
orNone
Before this function can be used, ostree_repo_init() must have been called.
- get_path()¶
- Returns:
Path to repo
- Return type:
Note that since the introduction of
OSTree.Repo.open_at
(), this function may return a process-specific path in/proc
if the repository was created using that API. In general, you should avoid use of this API.
- get_remote_boolean_option(remote_name, option_name, default_value)¶
- Parameters:
- Raises:
- Returns:
True
on success, otherwiseFalse
with error set- out_value:
location to store the result.
- Return type:
OSTree remotes are represented by keyfile groups, formatted like:
[remote "remotename"]
. This function returns a value named option_name underneath that group, and returns it as a boolean. If the option is not set, out_value will be set to default_value. If an error is returned, out_value will be set toFalse
.New in version 2016.5.
- get_remote_list_option(remote_name, option_name)¶
- Parameters:
- Raises:
- Returns:
True
on success, otherwiseFalse
with error set- out_value:
location to store the list of strings. The list should be freed with
GLib.strfreev
().
- Return type:
OSTree remotes are represented by keyfile groups, formatted like:
[remote "remotename"]
. This function returns a value named option_name underneath that group, and returns it as a zero terminated array of strings. If the option is not set, or if an error is returned, out_value will be set toNone
.New in version 2016.5.
- get_remote_option(remote_name, option_name, default_value)¶
- Parameters:
- Raises:
- Returns:
True
on success, otherwiseFalse
with error set- out_value:
Return location for value
- Return type:
OSTree remotes are represented by keyfile groups, formatted like:
[remote "remotename"]
. This function returns a value named option_name underneath that group, or default_value if the remote exists but not the option name. If an error is returned, out_value will be set toNone
.New in version 2016.5.
- gpg_sign_data(data, old_signatures, key_id, homedir, cancellable)¶
- Parameters:
data (
GLib.Bytes
) – Data as aGLib.Bytes
old_signatures (
GLib.Bytes
orNone
) – Existing signatures to append to (orNone
)cancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
- Raises:
- Returns:
True
if data has been signed successfully,False
in case of error (error will contain the reason).- out_signatures:
in case of success will contain signature
- Return type:
(
bool
, out_signatures:GLib.Bytes
)
Sign the given data with the specified keys in key_id. Similar to
OSTree.Repo.add_gpg_signature_summary
() but can be used on any data.You can use
OSTree.Repo.gpg_verify_data
() to verify the signatures.New in version 2020.8.
- gpg_verify_data(remote_name, data, signatures, keyringdir, extra_keyring, cancellable)¶
- Parameters:
data (
GLib.Bytes
) – Data as aGLib.Bytes
signatures (
GLib.Bytes
) – Signatures as aGLib.Bytes
keyringdir (
Gio.File
orNone
) – Path to directory GPG keyrings; overrides built-in default if givenextra_keyring (
Gio.File
orNone
) – Path to additional keyring file (not a directory)cancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
an
OSTree.GpgVerifyResult
, orNone
on error- Return type:
Verify signatures for data using GPG keys in the keyring for remote_name, and return an
OSTree.GpgVerifyResult
.The remote_name parameter can be
None
. In that case it will do the verifications using GPG keys in the keyrings of all remotes.New in version 2016.6.
- has_object(objtype, checksum, cancellable)¶
- Parameters:
objtype (
OSTree.ObjectType
) – Object typechecksum (
str
) – ASCII SHA256 checksumcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
False
if an unexpected error occurred,True
otherwise- out_have_object:
True
if repository contains object
- Return type:
Set out_have_object to
True
if self contains the given object;False
otherwise.
- hash()¶
- Returns:
hash value for the
OSTree.Repo
- Return type:
Calculate a hash value for the given open repository, suitable for use when putting it into a hash table. It is an error to call this on an
OSTree.Repo
which is not yet open, as a persistent hash value cannot be calculated until the repository is open and the inode of its root directory has been loaded.This function does no I/O.
New in version 2017.12.
- import_object_from(source, objtype, checksum, cancellable)¶
- Parameters:
source (
OSTree.Repo
) – Source repoobjtype (
OSTree.ObjectType
) – Object typechecksum (
str
) – checksumcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
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.
Otherwise, a copy will be performed.
- import_object_from_with_trust(source, objtype, checksum, trusted, cancellable)¶
- Parameters:
source (
OSTree.Repo
) – Source repoobjtype (
OSTree.ObjectType
) – Object typechecksum (
str
) – checksumtrusted (
bool
) – IfTrue
, assume the source repo is valid and trustedcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Copy object named by objtype and checksum into self from the 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.
New in version 2016.5.
- is_system()¶
- is_writable()¶
- Raises:
- Returns:
True
if this repository is writable- Return type:
Returns whether the repository is writable by the current user. If the repository is not writable, the error indicates why.
- list_collection_refs(match_collection_id, flags, cancellable)¶
- Parameters:
match_collection_id (
str
orNone
) – If non-None
, only list refs from this collectionflags (
OSTree.RepoListRefsExtFlags
) – Options controlling listing behaviorcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
True
on success,False
otherwise- out_all_refs:
Mapping from collection–ref to checksum
- Return type:
(
bool
, out_all_refs: {OSTree.CollectionRef
:str
})
List all local, mirrored, and remote refs, mapping them to the commit checksums they currently point to in out_all_refs. If match_collection_id is specified, the results will be limited to those with an equal collection ID.
OSTree.CollectionRefs
are guaranteed to be returned with their collection ID set to a non-None
value; so no refs fromrefs/heads
will be listed if no collection ID is configured for the repository (OSTree.Repo.get_collection_id
()).If you want to exclude refs from
refs/remotes
, useOSTree.RepoListRefsExtFlags.EXCLUDE_REMOTES
in flags. Similarly useOSTree.RepoListRefsExtFlags.EXCLUDE_MIRRORS
to exclude refs fromrefs/mirrors
.New in version 2018.6.
- list_commit_objects_starting_with(start, cancellable)¶
- Parameters:
start (
str
) – List commits starting with this checksum (empty string for all)cancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
True
on success,False
on error, and error will be set- out_commits:
Map of serialized commit name to variant data
- Return type:
(
bool
, out_commits: {GLib.Variant
:GLib.Variant
})
This function synchronously enumerates all commit objects starting with start, returning data in out_commits.
To list all commit objects, provide the empty string
""
for start.
- list_objects(flags, cancellable)¶
- Parameters:
flags (
OSTree.RepoListObjectsFlags
) – Flags controlling enumerationcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
True
on success,False
on error, and error will be set- out_objects:
Map of serialized object name to variant data
- Return type:
(
bool
, out_objects: {GLib.Variant
:GLib.Variant
})
This function synchronously enumerates all objects in the repository, returning data in out_objects. out_objects maps from keys returned by
OSTree.object_name_serialize
() toGLib.Variant
values of type %OSTREE_REPO_LIST_OBJECTS_VARIANT_TYPE.
- list_refs(refspec_prefix, cancellable)¶
- Parameters:
refspec_prefix (
str
orNone
) – Only list refs which match this prefixcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_all_refs:
Mapping from refspec to checksum
- Return type:
If refspec_prefix is
None
, list all local and remote refspecs, with their current values in out_all_refs. Otherwise, only list refspecs which have refspec_prefix as a prefix.out_all_refs will be returned as a mapping from refspecs (including the remote name) to checksums. If refspec_prefix is non-
None
, it will be removed as a prefix from the hash table keys.
- list_refs_ext(refspec_prefix, flags, cancellable)¶
- Parameters:
refspec_prefix (
str
orNone
) – Only list refs which match this prefixflags (
OSTree.RepoListRefsExtFlags
) – Options controlling listing behaviorcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_all_refs:
Mapping from refspec to checksum
- Return type:
If refspec_prefix is
None
, list all local and remote refspecs, with their current values in out_all_refs. Otherwise, only list refspecs which have refspec_prefix as a prefix.out_all_refs will be returned as a mapping from refspecs (including the remote name) to checksums. Differently from
OSTree.Repo.list_refs
(), the refspec_prefix will not be removed from the refspecs in the hash table.New in version 2016.4.
- list_static_delta_indexes(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – Cancellable- Raises:
- Returns:
- out_indexes:
String name of delta indexes (checksum)
- Return type:
This function synchronously enumerates all static delta indexes in the repository, returning its result in out_indexes.
New in version 2020.8.
- list_static_delta_names(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – Cancellable- Raises:
- Returns:
- out_deltas:
String name of deltas (checksum-checksum.delta)
- Return type:
This function synchronously enumerates all static deltas in the repository, returning its result in out_deltas.
- load_commit(checksum)¶
- Parameters:
checksum (
str
) – Commit checksum- Raises:
- Returns:
- out_commit:
Commit
- out_state:
Commit state
- Return type:
(
bool
, out_commit:GLib.Variant
, out_state:OSTree.RepoCommitState
)
A version of
OSTree.Repo.load_variant
() specialized to commits, capable of returning extended state information. Currently the only extended state isOSTree.RepoCommitState.PARTIAL
, which means that only a sub-path of the commit is available.
- load_file(checksum, cancellable)¶
- Parameters:
checksum (
str
) – ASCII SHA256 checksumcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_input:
File content
- out_file_info:
File information
- out_xattrs:
Extended attributes
- Return type:
(
bool
, out_input:Gio.InputStream
orNone
, out_file_info:Gio.FileInfo
orNone
, out_xattrs:GLib.Variant
orNone
)
Load content object, decomposing it into three parts: the actual content (for regular files), the metadata, and extended attributes.
- load_object_stream(objtype, checksum, cancellable)¶
- Parameters:
objtype (
OSTree.ObjectType
) – Object typechecksum (
str
) – ASCII SHA256 checksumcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_input:
Stream for object
- out_size:
Length of out_input
- Return type:
(
bool
, out_input:Gio.InputStream
, out_size:int
)
Load object as a stream; useful when copying objects between repositories.
- load_variant(objtype, sha256)¶
- Parameters:
objtype (
OSTree.ObjectType
) – Expected object typesha256 (
str
) – Checksum string
- Raises:
- Returns:
- out_variant:
Metadata object
- Return type:
(
bool
, out_variant:GLib.Variant
)
Load the metadata object sha256 of type objtype, storing the result in out_variant.
- load_variant_if_exists(objtype, sha256)¶
- Parameters:
objtype (
OSTree.ObjectType
) – Object typesha256 (
str
) – ASCII checksum
- Raises:
- Returns:
- out_variant:
Metadata
- Return type:
(
bool
, out_variant:GLib.Variant
orNone
)
Attempt to load the metadata object sha256 of type objtype if it exists, storing the result in out_variant. If it doesn’t exist, out_variant will be set to
None
and the function will still returnTrue
.
- lock_pop(lock_type, cancellable)¶
- Parameters:
lock_type (
OSTree.RepoLockType
) – the type of lock to releasecancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
- Raises:
- Returns:
- Return type:
Release a lock of type lock_type from the lock state. If the lock state becomes empty, the repository is unlocked. Otherwise, the lock state only changes when transitioning from an exclusive lock back to a shared lock. The requested lock_type must be the same type that was requested in the call to
OSTree.Repo.lock_push
(). It is a programmer error if these do not match and the program may abort if the lock would reach an invalid state.OSTree.Repo.lock_pop
() waits for the lock depending on the repository’s lock-timeout-secs configuration. When lock-timeout-secs is -1, a blocking lock is attempted. Otherwise, the lock is removed non-blocking andOSTree.Repo.lock_pop
() will sleep synchronously up to lock-timeout-secs seconds attempting to remove the lock. If the lock cannot be removed within the timeout, aGio.IOErrorEnum.WOULD_BLOCK
error is returned.If self is not writable by the user, then no unlocking is attempted and
True
is returned.New in version 2021.3.
- lock_push(lock_type, cancellable)¶
- Parameters:
lock_type (
OSTree.RepoLockType
) – the type of lock to acquirecancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
- Raises:
- Returns:
- Return type:
Takes a lock on the repository and adds it to the lock state. If lock_type is
OSTree.RepoLockType.SHARED
, a shared lock is taken. If lock_type isOSTree.RepoLockType.EXCLUSIVE
, an exclusive lock is taken. The actual lock state is only changed when locking a previously unlocked repository or upgrading the lock from shared to exclusive. If the requested lock type is unchanged or would represent a downgrade (exclusive to shared), the lock state is not changed.OSTree.Repo.lock_push
() waits for the lock depending on the repository’s lock-timeout-secs configuration. When lock-timeout-secs is -1, a blocking lock is attempted. Otherwise, the lock is taken non-blocking andOSTree.Repo.lock_push
() will sleep synchronously up to lock-timeout-secs seconds attempting to acquire the lock. If the lock cannot be acquired within the timeout, aGio.IOErrorEnum.WOULD_BLOCK
error is returned.If self is not writable by the user, then no locking is attempted and
True
is returned.New in version 2021.3.
- mark_commit_partial(checksum, is_partial)¶
- Parameters:
- Raises:
- Return type:
Commits in the “partial” state do not have all their child objects written. This occurs in various situations, such as during a pull, but also if a “subpath” pull is used, as well as “commit only” pulls.
This function is used by
OSTree.Repo.pull_with_options
(); you should use this if you are implementing a different type of transport.New in version 2017.15.
- mark_commit_partial_reason(checksum, is_partial, in_state)¶
- Parameters:
checksum (
str
) – Commit SHA-256is_partial (
bool
) – Whether or not this commit is partialin_state (
OSTree.RepoCommitState
) – Reason bitmask for partial commit
- Raises:
- Return type:
Allows the setting of a reason code for a partial commit. Presently it only supports setting reason bitmask to
OSTree.RepoCommitState.FSCK_PARTIAL
, orOSTree.RepoCommitState.NORMAL
. This will allow successive ostree fsck operations to exit properly with an error code if the repository has been truncated as a result of fsck trying to repair it.New in version 2019.4.
- open(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) –- Raises:
- Return type:
- prepare_transaction(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – Cancellable- Raises:
- Returns:
- out_transaction_resume:
Whether this transaction is resuming from a previous one. This is a legacy state, now OSTree pulls use per-commit
state/.commitpartial
files.
- Return type:
Starts or resumes a transaction. In order to write to a repo, you need to start a transaction. You can complete the transaction with
OSTree.Repo.commit_transaction
(), or abort the transaction withOSTree.Repo.abort_transaction
().Currently, transactions may result in partial commits or data in the target repository if interrupted during
OSTree.Repo.commit_transaction
(), and further writing refs is also not currently atomic.There can be at most one transaction active on a repo at a time per instance of
OstreeRepo
; however, it is safe to have multiple threads writing objects on a singleOstreeRepo
instance as long as their lifetime is bounded by the transaction.Locking: Acquires a
shared
lock; release via commit or abort Multithreading: This function is *not* MT safe; only one transaction can be active at a time.
- prune(flags, depth, cancellable)¶
- Parameters:
flags (
OSTree.RepoPruneFlags
) – Options controlling prune processdepth (
int
) – Stop traversal after this many iterations (-1 for unlimited)cancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_objects_total:
Number of objects found
- out_objects_pruned:
Number of objects deleted
- out_pruned_object_size_total:
Storage size in bytes of objects deleted
- Return type:
(
bool
, out_objects_total:int
, out_objects_pruned:int
, out_pruned_object_size_total:int
)
Delete content from the repository. By default, this function will only delete “orphaned” objects not referred to by any commit. This can happen during a local commit operation, when we have written content objects but not saved the commit referencing them.
However, if
OSTree.RepoPruneFlags.REFS_ONLY
is provided, instead of traversing all commits, only refs will be used. Particularly when combined with depth, this is a convenient way to delete history from the repository.Use the
OSTree.RepoPruneFlags.NO_PRUNE
to just determine statistics on objects that would be deleted, without actually deleting them.Locking: exclusive
- prune_from_reachable(options, cancellable)¶
- Parameters:
options (
OSTree.RepoPruneOptions
) – Options controlling prune processcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_objects_total:
Number of objects found
- out_objects_pruned:
Number of objects deleted
- out_pruned_object_size_total:
Storage size in bytes of objects deleted
- Return type:
(
bool
, out_objects_total:int
, out_objects_pruned:int
, out_pruned_object_size_total:int
)
Delete content from the repository. This function is the “backend” half of the higher level
OSTree.Repo.prune
(). To use this function, you determine the root set yourself, and this function finds all other unreferenced objects and deletes them.Use this API when you want to perform more selective pruning - for example, retain all commits from a production branch, but just GC some history from your dev branch.
The
OSTree.RepoPruneFlags.NO_PRUNE
flag may be specified to just determine statistics on objects that would be deleted, without actually deleting them.Locking: exclusive
New in version 2017.1.
- prune_static_deltas(commit, cancellable)¶
- Parameters:
commit (
str
orNone
) – ASCII SHA256 checksum for commit, orNone
for each non existing commitcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Prune static deltas, if COMMIT is specified then delete static delta files only targeting that commit; otherwise any static delta of non existing commits are deleted.
Locking: exclusive
- pull(remote_name, refs_to_fetch, flags, progress, cancellable)¶
- Parameters:
remote_name (
str
) – Name of remoterefs_to_fetch ([
str
] orNone
) – Optional list of refs; ifNone
, fetch all configured refsflags (
OSTree.RepoPullFlags
) – Options controlling fetch behaviorprogress (
OSTree.AsyncProgress
orNone
) – Progresscancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Connect to the remote repository, fetching the specified set of refs refs_to_fetch. For each ref that is changed, download the commit, all metadata, and all content objects, storing them safely on disk in self.
If flags contains
OSTree.RepoPullFlags.MIRROR
, and the refs_to_fetch isNone
, and the remote repository contains a summary file, then all refs will be fetched.If flags contains
OSTree.RepoPullFlags.COMMIT_ONLY
, then only the metadata for the commits in refs_to_fetch is pulled.Warning: This API will iterate the thread default main context, which is a bug, but kept for compatibility reasons. If you want to avoid this, use
GLib.MainContext.push_thread_default
() to push a new one around this call.
- pull_from_remotes_async(results, options, progress, cancellable, callback, *user_data)¶
- Parameters:
results ([
OSTree.RepoFinderResult
]) –None
-terminated array of remotes to pull from, including the refs to pull from eachoptions (
GLib.Variant
orNone
) – AGLib.Variant
a{sv}
with an extensible set of flagsprogress (
OSTree.AsyncProgress
orNone
) – anOSTree.AsyncProgress
to update with the operation’s progress, orNone
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
, orNone
callback (
Gio.AsyncReadyCallback
orNone
) – asynchronous completion callback
Pull refs from multiple remotes which have been found using
OSTree.Repo.find_remotes_async
().results are expected to be in priority order, with the best remotes to pull from listed first.
OSTree.Repo.pull_from_remotes_async
() will generally pull from the remotes in order, but may parallelise its downloads.If an error is encountered when pulling from a given remote, that remote will be ignored and another will be tried instead. If any refs have not been downloaded successfully after all remotes have been tried,
Gio.IOErrorEnum.FAILED
will be returned. The results of any successful downloads will remain cached in the local repository.If cancellable is cancelled,
Gio.IOErrorEnum.CANCELLED
will be returned immediately. The results of any successfully completed downloads at that point will remain cached in the local repository.GPG verification of commits will be used unconditionally.
The following options are currently defined:
flags
(i
):OSTree.RepoPullFlags
to apply to the pull operationinherit-transaction
(b
):True
to inherit an ongoing transaction on theOSTree.Repo
, rather than encapsulating the pull in a new onedepth
(i
): How far in the history to traverse; default is 0, -1 means infinitedisable-static-deltas
(b
): Do not use static deltashttp-headers
(a(ss)
): Additional headers to add to all HTTP requestssubdirs
(as
): Pull just these subdirectoriesupdate-frequency
(u
): Frequency to call the async progress callback in milliseconds, if any; only values higher than 0 are validappend-user-agent
(s
): Additional string to append to the user agentn-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.6ref-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
New in version 2018.6.
- pull_from_remotes_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – the asynchronous result- Raises:
- Returns:
- Return type:
Finish an asynchronous pull operation started with
OSTree.Repo.pull_from_remotes_async
().New in version 2018.6.
- pull_one_dir(remote_name, dir_to_pull, refs_to_fetch, flags, progress, cancellable)¶
- Parameters:
remote_name (
str
) – Name of remotedir_to_pull (
str
) – Subdirectory pathrefs_to_fetch ([
str
] orNone
) – Optional list of refs; ifNone
, fetch all configured refsflags (
OSTree.RepoPullFlags
) – Options controlling fetch behaviorprogress (
OSTree.AsyncProgress
orNone
) – Progresscancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
This is similar to
OSTree.Repo.pull
(), but only fetches a single subpath.
- pull_with_options(remote_name_or_baseurl, options, progress, cancellable)¶
- Parameters:
remote_name_or_baseurl (
str
) – Name of remote or file:// urloptions (
GLib.Variant
) – AGLib.Variant
a{sv} with an extensible set of flags.progress (
OSTree.AsyncProgress
orNone
) – Progresscancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Like
OSTree.Repo.pull
(), but supports an extensible set of flags. The following are currently defined:refs
(as
): Array of string refscollection-refs
(a(sss)
): Array of (collection ID, ref name, checksum) tuples to pull; mutually exclusive withrefs
andoverride-commit-ids
. Checksums may be the empty string to pull the latest commit for that refflags
(i
): An instance ofOSTree.RepoPullFlags
subdir
(s
): Pull just this subdirectorysubdirs
(as
): Pull just these subdirectoriesoverride-remote-name
(s
): If local, add this remote to refspecgpg-verify
(b
): GPG verify commitsgpg-verify-summary
(b
): GPG verify summarydisable-sign-verify
(b
): Disable signapi verification of commitsdisable-sign-verify-summary
(b
): Disable signapi verification of the summarydepth
(i
): How far in the history to traverse; default is 0, -1 means infiniteper-object-fsync
(b
): Perform disk writes more slowly, avoiding a single large I/O syncdisable-static-deltas
(b
): Do not use static deltasrequire-static-deltas
(b
): Require static deltasoverride-commit-ids
(as
): Array of specific commit IDs to fetch for refstimestamp-check
(b
): Verify commit timestamps are newer than current (when pulling via ref); *timestamp-check-from-rev
(s
): Verify that all fetched commit timestamps are newer than timestamp of given rev; *max-metadata-size
(t
): Restrict metadata objects to a maximum number of bytes; 0 to disable. *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 optionsinherit-transaction
(b
): Don’t initiate, finish or abort a transaction, useful to do multiple pulls in one transaction.http-headers
(a(ss)
): Additional headers to add to all HTTP requestsupdate-frequency
(u
): Frequency to call the async progress callback in milliseconds, if any; only values higher than 0 are validlocalcache-repos
(as
): File paths for local repos to use as caches when doing remote fetchesappend-user-agent
(s
): Additional string to append to the user agentn-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. *low-speed-limit-bytes
(u
): The average transfer speed per second of a transfer during the time set via “low-speed-time-seconds” for libcurl to abort.low-speed-time-seconds
(u
): The time in number seconds that the transfer speed should be below the “low-speed-limit-bytes” setting for libcurl to abort.retry-all-network-errors
(b
): Retry when network issues happen, instead of failing automatically. Currently only affects libcurl. (Default set to true)max-outstanding-fetcher-requests
(u
): The max amount of concurrent connections allowed.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. *summary-bytes
(ay'): Contents of the ``summary
file to use. If this is specified,summary-sig-bytes
must also be specified. This is useful if doing multiple pull operations in a transaction, using ostree_repo_remote_fetch_summary_with_options() beforehand to download thesummary
andsummary.sig
once for the entire transaction. If not specified, thesummary
will be downloaded from the remote. *summary-sig-bytes
(ay
): Contents of thesummary.sig
file. If this is specified,summary-bytes
must also be specified. *disable-verify-bindings
(``b`): Disable verification of commit bindings.
New in version 2020.9.
- query_object_storage_size(objtype, sha256, cancellable)¶
- Parameters:
objtype (
OSTree.ObjectType
) – Object typesha256 (
str
) – Checksumcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_size:
Size in bytes object occupies physically
- Return type:
Return the size in bytes of object with checksum sha256, after any compression has been applied.
- read_commit(ref, cancellable)¶
- Parameters:
ref (
str
) – Ref or ASCII checksumcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_root:
An
OSTree.RepoFile
corresponding to the root- out_commit:
The resolved commit checksum
- Return type:
Load the content for rev into out_root.
- read_commit_detached_metadata(checksum, cancellable)¶
- Parameters:
checksum (
str
) – ASCII SHA256 commit checksumcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_metadata:
Metadata associated with commit in with format “a{sv}”, or
None
if none exists
- Return type:
(
bool
, out_metadata:GLib.Variant
orNone
)
OSTree commits can have arbitrary metadata associated; this function retrieves them. If none exists, out_metadata will be set to
None
.
- regenerate_metadata(additional_metadata, options, cancellable)¶
- Parameters:
additional_metadata (
GLib.Variant
orNone
) – AGLib.Variant
a{sv}
, orNone
options (
GLib.Variant
orNone
) – AGLib.Variant
a{sv}
with an extensible set of flagscancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Regenerate the OSTree repository metadata used by clients to describe available branches and other metadata.
The repository metadata currently consists of the
summary
file. SeeOSTree.Repo.regenerate_summary
() and %OSTREE_SUMMARY_GVARIANT_FORMAT for additional details on its contents.Additionally, if the
core/collection-id
key is set in the configuration, aOSTree.REPO_METADATA_REF
commit will be created.The following options are currently defined:
gpg-key-ids
(as
): Array of GPG key IDs to sign the metadata with.gpg-homedir
(s
): GPG home directory.sign-keys
(av
): Array of keys to sign the metadata with. The key type is specific to the sign engine used.sign-type
(s
): Sign engine type to use. If not specified,OSTree.SIGN_NAME_ED25519
is used.
Locking: shared
New in version 2023.1.
- regenerate_summary(additional_metadata, cancellable)¶
- Parameters:
additional_metadata (
GLib.Variant
orNone
) – AGLib.Variant
of type a{sv}, orNone
cancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
An OSTree repository can contain a high level “summary” file that describes the available branches and other metadata.
If the timetable for making commits and updating the summary file is fairly regular, setting the
ostree.summary.expires
key in additional_metadata will aid clients in working out when to check for updates.It is regenerated automatically after any ref is added, removed, or updated if
core/auto-update-summary
is set.If the
core/collection-id
key is set in the configuration, it will be included as %OSTREE_SUMMARY_COLLECTION_ID in the summary file. Refs that have associated collection IDs will be included in the generated summary file, listed under the %OSTREE_SUMMARY_COLLECTION_MAP key. Collection IDs and refs in %OSTREE_SUMMARY_COLLECTION_MAP are guaranteed to be in lexicographic order.Locking: shared (Prior to 2021.7, this was exclusive)
- reload_config(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – cancellable- Raises:
- Return type:
By default, an
OSTree.Repo
will cache the remote configuration and its own repo/config data. This API can be used to reload it.New in version 2017.2.
- remote_add(name, url, options, cancellable)¶
- Parameters:
name (
str
) – Name of remoteurl (
str
orNone
) – URL for remote (if URL begins with metalink=, it will be used as such)options (
GLib.Variant
orNone
) –GLib.Variant
of type a{sv}cancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Create a new remote named name pointing to url. If options is provided, then it will be mapped to
GLib.KeyFile
entries, where theGLib.Variant
dictionary key is an option string, and the value is mapped as follows:
- remote_change(sysroot, changeop, name, url, options, cancellable)¶
- Parameters:
changeop (
OSTree.RepoRemoteChange
) – Operation to performname (
str
) – Name of remoteurl (
str
orNone
) – URL for remote (if URL begins with metalink=, it will be used as such)options (
GLib.Variant
orNone
) –GLib.Variant
of type a{sv}cancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
A combined function handling the equivalent of
OSTree.Repo.remote_add
(),OSTree.Repo.remote_delete
(), with more options.
- remote_delete(name, cancellable)¶
- Parameters:
name (
str
) – Name of remotecancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Delete the remote named name. It is an error if the provided remote does not exist.
- remote_fetch_summary(name, cancellable)¶
- Parameters:
name (
str
) – name of a remotecancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
- Raises:
- Returns:
- Return type:
(
bool
, out_summary:GLib.Bytes
, out_signatures:GLib.Bytes
)
Tries to fetch the summary file and any GPG signatures on the summary file over HTTP, and returns the binary data in out_summary and out_signatures respectively.
If no summary file exists on the remote server, out_summary is set to
None
. Likewise if the summary file is not signed, out_signatures is set toNone
. In either case the function still returnsTrue
.This method does not verify the signature of the downloaded summary file. Use
OSTree.Repo.verify_summary
() for that.Parse the summary data into a
GLib.Variant
usingGLib.Variant.new_from_bytes
() with #OSTREE_SUMMARY_GVARIANT_FORMAT as the format string.
- remote_fetch_summary_with_options(name, options, cancellable)¶
- Parameters:
name (
str
) – name of a remoteoptions (
GLib.Variant
orNone
) – AGLib.Variant
a{sv} with an extensible set of flagscancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
- Raises:
- Returns:
- Return type:
(
bool
, out_summary:GLib.Bytes
, out_signatures:GLib.Bytes
)
Like
OSTree.Repo.remote_fetch_summary
(), but supports an extensible set of flags. The following are currently defined:override-url (s): Fetch summary from this URL if remote specifies no metalink in options
http-headers (a(ss)): Additional headers to add to all HTTP requests
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
New in version 2016.6.
- remote_get_gpg_keys(name, key_ids, cancellable)¶
- Parameters:
- Raises:
- Returns:
True
if the GPG keys could be enumerated,False
otherwise- out_keys:
return location for a
GLib.PtrArray
of the remote’s trusted GPG keys, orNone
- Return type:
(
bool
, out_keys: [GLib.Variant
])
Enumerate the trusted GPG keys for the remote name. If name is
None
, the global GPG keys will be returned. The keys will be returned in the out_keysGLib.PtrArray
. Each element in the array is aGLib.Variant
of format %OSTREE_GPG_KEY_GVARIANT_FORMAT. The key_ids array can be used to limit which keys are included. If key_ids isNone
, then all keys are included.New in version 2021.4.
- remote_get_gpg_verify(name)¶
- Parameters:
name (
str
) – Name of remote- Raises:
- Returns:
True
on success,False
on failure- out_gpg_verify:
Remote’s GPG option
- Return type:
Return whether GPG verification is enabled for the remote named name through out_gpg_verify. It is an error if the provided remote does not exist.
- remote_get_gpg_verify_summary(name)¶
- Parameters:
name (
str
) – Name of remote- Raises:
- Returns:
True
on success,False
on failure- out_gpg_verify_summary:
Remote’s GPG option
- Return type:
Return whether GPG verification of the summary is enabled for the remote named name through out_gpg_verify_summary. It is an error if the provided remote does not exist.
- remote_get_url(name)¶
- Parameters:
name (
str
) – Name of remote- Raises:
- Returns:
True
on success,False
on failure- out_url:
Remote’s URL
- Return type:
Return the URL of the remote named name through out_url. It is an error if the provided remote does not exist.
- remote_gpg_import(name, source_stream, key_ids, cancellable)¶
- Parameters:
name (
str
) – name of a remotesource_stream (
Gio.InputStream
orNone
) – aGio.InputStream
, orNone
key_ids ([
str
] orNone
) – aNone
-terminated array of GPG key IDs, orNone
cancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
- Raises:
- Returns:
True
on success,False
on failure- out_imported:
return location for the number of imported keys, or
None
- Return type:
Imports one or more GPG keys from the open source_stream, or from the user’s personal keyring if source_stream is
None
. The key_ids array can optionally restrict which keys are imported. If key_ids isNone
, then all keys are imported.The imported keys will be used to conduct GPG verification when pulling from the remote named name.
- remote_list()¶
-
List available remote names in an
OSTree.Repo
. Remote names are sorted alphabetically. If no remotes are available the function returnsNone
.
- remote_list_collection_refs(remote_name, cancellable)¶
- Parameters:
remote_name (
str
) – Name of the remote.cancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_all_refs:
Mapping from collection–ref to checksum
- Return type:
(
bool
, out_all_refs: {OSTree.CollectionRef
:str
})
List refs advertised by remote_name, including refs which are part of collections. If the repository at remote_name has a collection ID set, its refs will be returned with that collection ID; otherwise, they will be returned with a
None
collection ID in eachOSTree.CollectionRef
key in out_all_refs. Any refs for other collections stored in the repository will also be returned. No filtering is performed.New in version 2018.6.
- remote_list_refs(remote_name, cancellable)¶
- Parameters:
remote_name (
str
) – Name of the remote.cancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_all_refs:
Mapping from ref to checksum
- Return type:
- resolve_collection_ref(ref, allow_noent, flags, cancellable)¶
- Parameters:
ref (
OSTree.CollectionRef
) – a collection–ref to resolveallow_noent (
bool
) –True
to not throw an error if ref doesn’t existflags (
OSTree.RepoResolveRevExtFlags
) – options controlling behaviourcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
, orNone
- Raises:
- Returns:
- Return type:
Look up the checksum for the given collection–ref, returning it in out_rev. This will search through the mirrors and remote refs.
If allow_noent is
True
and the given ref cannot be found,True
will be returned and out_rev will be set toNone
. If allow_noent isFalse
and the given ref cannot be found, aGio.IOErrorEnum.NOT_FOUND
error will be returned.If you want to check only local refs, not remote or mirrored ones, use the flag
OSTree.RepoResolveRevExtFlags.LOCAL_ONLY
. This is analogous to usingOSTree.Repo.resolve_rev_ext
() but for collection-refs.New in version 2018.6.
- resolve_keyring_for_collection(collection_id, cancellable)¶
- Parameters:
collection_id (
str
) – the collection ID to look up a keyring forcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
, orNone
- Raises:
- Returns:
OSTree.Remote
containing the GPG keyring for collection_id- Return type:
Find the GPG keyring for the given collection_id, using the local configuration from the given
OSTree.Repo
. This will search the configured remotes for ones whosecollection-id
key matches collection_id, and will return the first matching remote.If multiple remotes match and have different keyrings, a debug message will be emitted, and the first result will be returned. It is expected that the keyrings should match.
If no match can be found, a
Gio.IOErrorEnum.NOT_FOUND
error will be returned.New in version 2018.6.
- resolve_rev(refspec, allow_noent)¶
- Parameters:
- Raises:
- Returns:
- out_rev:
A checksum,or
None
if allow_noent is true and it does not exist
- Return type:
Look up the given refspec, returning the checksum it references in the parameter out_rev. Will fall back on remote directory if cannot find the given refspec in local.
- resolve_rev_ext(refspec, allow_noent, flags)¶
- Parameters:
refspec (
str
) – A refspecallow_noent (
bool
) – Do not throw an error if refspec does not existflags (
OSTree.RepoResolveRevExtFlags
) – Options controlling behavior
- Raises:
- Returns:
- out_rev:
A checksum,or
None
if allow_noent is true and it does not exist
- Return type:
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.The flag
OSTree.RepoResolveRevExtFlags.LOCAL_ONLY
is implied so using it has no effect.New in version 2016.7.
- scan_hardlinks(cancellable)¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – Cancellable- Raises:
- Return type:
This function is deprecated in favor of using
OSTree.RepoDevInoCache.new
(), which allows a precise mapping to be built up between hardlink checkout files and their checksums betweenostree_repo_checkout_at()
andostree_repo_write_directory_to_mtree()
.When invoking
OSTree.Repo.write_directory_to_mtree
(), it has to compute the checksum of all files. If your commit contains hardlinks from a checkout, this functions builds a mapping of device numbers and inodes to their checksum.There is an upfront cost to creating this mapping, as this will scan the entire objects directory. If your commit is composed of mostly hardlinks to existing ostree objects, then this will speed up considerably, so call it before you call
OSTree.Repo.write_directory_to_mtree
() or similar. However,OSTree.RepoDevInoCache.new
() is better as it avoids scanning all objects.Multithreading: This function is *not* MT safe.
- set_alias_ref_immediate(remote, ref, target, cancellable)¶
- Parameters:
ref (
str
) – The ref to writetarget (
str
orNone
) – The ref target to point it to, orNone
to unsetcancellable (
Gio.Cancellable
orNone
) –Gio.Cancellable
- Raises:
- Return type:
Like
OSTree.Repo.set_ref_immediate
(), but creates an alias.New in version 2017.10.
- set_cache_dir(dfd, path, cancellable)¶
- Parameters:
dfd (
int
) – directory fdpath (
str
) – subpath in dfdcancellable (
Gio.Cancellable
orNone
) – aGio.Cancellable
- Raises:
- Return type:
Set a custom location for the cache directory used for e.g. per-remote summary caches. Setting this manually is useful when doing operations on a system repo as a user because you don’t have write permissions in the repo, where the cache is normally stored.
New in version 2016.5.
- set_collection_id(collection_id)¶
- Parameters:
collection_id (
str
orNone
) – new collection ID, orNone
to unset it- Raises:
- Returns:
- Return type:
Set or clear the collection ID of this repository. See ‘collection IDs [collection-ids]’. The update will be made in memory, but must be written out to the repository configuration on disk using
OSTree.Repo.write_config
().New in version 2018.6.
- set_collection_ref_immediate(ref, checksum, cancellable)¶
- Parameters:
ref (
OSTree.CollectionRef
) – The collection–ref to writechecksum (
str
orNone
) – The checksum to point it to, orNone
to unsetcancellable (
Gio.Cancellable
orNone
) –Gio.Cancellable
- Raises:
- Returns:
- Return type:
This is like
OSTree.Repo.transaction_set_collection_ref
(), except it may be invoked outside of a transaction. This is presently safe for the case where we’re creating or overwriting an existing ref.New in version 2018.6.
- set_disable_fsync(disable_fsync)¶
-
Disable requests to fsync() to stable storage during commits. This option should only be used by build system tools which are creating disposable virtual machines, or have higher level mechanisms for ensuring data consistency.
- set_ref_immediate(remote, ref, checksum, cancellable)¶
- Parameters:
ref (
str
) – The ref to writechecksum (
str
orNone
) – The checksum to point it to, orNone
to unsetcancellable (
Gio.Cancellable
orNone
) –Gio.Cancellable
- Raises:
- Return type:
This is like
OSTree.Repo.transaction_set_ref
(), except it may be invoked outside of a transaction. This is presently safe for the case where we’re creating or overwriting an existing ref.Multithreading: This function is MT safe.
- sign_commit(commit_checksum, key_id, homedir, cancellable)¶
- Parameters:
commit_checksum (
str
) – SHA256 of given commit to signkey_id (
str
) – Use this GPG key idcancellable (
Gio.Cancellable
orNone
) – AGio.Cancellable
- Raises:
- Return type:
Add a GPG signature to a commit.
- sign_delta(from_commit, to_commit, key_id, homedir, cancellable)¶
- Parameters:
- Raises:
- Return type:
This function is deprecated, sign the summary file instead. Add a GPG signature to a static delta.
- signature_verify_commit_data(remote_name, commit_data, commit_metadata, flags)¶
- Parameters:
remote_name (
str
) – Name of remotecommit_data (
GLib.Bytes
) – Commit object data (GLib.Variant
)commit_metadata (
GLib.Bytes
) – Commit metadata (GLib.Variant
a{sv}
), must contain at least one valid signatureflags (
OSTree.RepoVerifyFlags
) – Optionally disable GPG or signapi
- Raises:
- Returns:
- out_results:
Textual description of results
- Return type:
Validate the commit data using the commit metadata which must contain at least one valid signature. If GPG and signapi are both enabled, then both must find at least one valid signature.
- static_delta_execute_offline(dir_or_file, skip_validation, cancellable)¶
- Parameters:
dir_or_file (
Gio.File
) – Path to a directory containing static delta data, or directly to the superblockcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Given a directory representing an already-downloaded static delta on disk, apply it, generating a new commit. The directory must be named with the form “FROM-TO”, where both are checksums, and it must contain a file named “superblock”, along with at least one part.
- static_delta_execute_offline_with_signature(dir_or_file, sign, skip_validation, cancellable)¶
- Parameters:
dir_or_file (
Gio.File
) – Path to a directory containing static delta data, or directly to the superblocksign (
OSTree.Sign
) – Signature engine used to check superblockcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Given a directory representing an already-downloaded static delta on disk, apply it, generating a new commit. If sign is passed, the static delta signature is verified. If sign-verify-deltas configuration option is set and static delta is signed, signature verification will be mandatory before apply the static delta. The directory must be named with the form “FROM-TO”, where both are checksums, and it must contain a file named “superblock”, along with at least one part.
New in version 2020.7.
- static_delta_generate(opt, from_, to, metadata, params, cancellable)¶
- Parameters:
opt (
OSTree.StaticDeltaGenerateOpt
) – High level optimization choicefrom (
str
orNone
) – ASCII SHA256 checksum of origin, orNone
to (
str
) – ASCII SHA256 checksum of targetmetadata (
GLib.Variant
orNone
) – Optional metadataparams (
GLib.Variant
orNone
) – Parameters, see belowcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Generate a lookaside “static delta” from from (
None
means from-empty) which can generate the objects in to. This delta is an optimization over fetching individual objects, and can be conveniently stored and applied offline.The params argument should be an a{sv}. The following attributes are known:
min-fallback-size: u: Minimum uncompressed size in megabytes to use fallback, 0 to disable fallbacks
max-chunk-size: u: Maximum size in megabytes of a delta part
max-bsdiff-size: u: Maximum size in megabytes to consider bsdiff compression for input files
compression: y: Compression type: 0=none, x=lzma, g=gzip
bsdiff-enabled: b: Enable bsdiff compression. Default
True
.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 (
GLib.BIG_ENDIAN
orGLib.LITTLE_ENDIAN
)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:
None
-terminated array of keys used to sign delta superblock.
- static_delta_reindex(flags, opt_to_commit, cancellable)¶
- Parameters:
flags (
OSTree.StaticDeltaIndexFlags
) – Flags affecting the indexing operationopt_to_commit (
str
) – ASCII SHA256 checksum of target commit, orNone
to index all targetscancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
The delta index for a particular commit lists all the existing deltas that can be used when downloading that commit. This operation regenerates these indexes, either for a particular commit (if opt_to_commit is non-
None
), or for all commits that are reachable by an existing delta (if opt_to_commit isNone
).This is normally called automatically when the summary is updated in
OSTree.Repo.regenerate_summary
().Locking: shared
New in version 2020.8.
- static_delta_verify_signature(delta_id, sign)¶
- Parameters:
delta_id (
str
) – delta pathsign (
OSTree.Sign
) – Signature engine used to check superblock
- Raises:
- Returns:
True
if the signature of static delta file is valid using the signature engine provided,False
otherwise.- out_success_message:
success message
- Return type:
Verify static delta file signature.
New in version 2020.7.
- transaction_set_collection_ref(ref, checksum)¶
- Parameters:
ref (
OSTree.CollectionRef
) – The collection–ref to write
If checksum is not
None
, then record it as the target of local ref named ref.Otherwise, if checksum is
None
, then record that the ref should be deleted.The change will not be written out immediately, but when the transaction is completed with
OSTree.Repo.commit_transaction
(). If the transaction is instead aborted withOSTree.Repo.abort_transaction
(), no changes will be made to the repository.Multithreading: Since v2017.15 this function is MT safe.
New in version 2018.6.
- transaction_set_ref(remote, ref, checksum)¶
- Parameters:
If checksum is not
None
, then record it as the target of ref named ref; if remote is provided, the ref will appear to originate from that remote.Otherwise, if checksum is
None
, then record that the ref should be deleted.The change will be written when the transaction is completed with
OSTree.Repo.commit_transaction
(); that function takes care of writing all of the objects (such as the commit referred to by checksum) before updating the refs. If the transaction is instead aborted withOSTree.Repo.abort_transaction
(), no changes to the ref will be made to the repository.Note however that currently writing *multiple* refs is not truly atomic; if the process or system is terminated during
OSTree.Repo.commit_transaction
(), it is possible that just some of the refs will have been updated. Your application should take care to handle this case.Multithreading: Since v2017.15 this function is MT safe.
- transaction_set_refspec(refspec, checksum)¶
- Parameters:
Like
OSTree.Repo.transaction_set_ref
(), but takes concatenated refspec format as input instead of separate remote and name arguments.Multithreading: Since v2017.15 this function is MT safe.
- traverse_commit(commit_checksum, maxdepth, cancellable)¶
- Parameters:
commit_checksum (
str
) – ASCII SHA256 checksummaxdepth (
int
) – Traverse this many parent commits, -1 for unlimitedcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_reachable:
Set of reachable objects
- Return type:
(
bool
, out_reachable: {GLib.Variant
:GLib.Variant
})
Create a new set out_reachable containing all objects reachable from commit_checksum, traversing maxdepth parent commits.
- traverse_reachable_refs(depth, reachable, cancellable)¶
- Parameters:
depth (
int
) – Depth of traversalreachable ({
GLib.Variant
:GLib.Variant
}) – Set of reachable objects (will be modified)cancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Add all commit objects directly reachable via a ref to reachable.
Locking: shared
New in version 2018.6.
- verify_commit(commit_checksum, keyringdir, extra_keyring, cancellable)¶
- Parameters:
- Raises:
- Returns:
True
if there was a GPG signature from a trusted keyring, otherwiseFalse
- Return type:
Check for a valid GPG signature on commit named by the ASCII checksum commit_checksum.
- verify_commit_ext(commit_checksum, keyringdir, extra_keyring, cancellable)¶
- Parameters:
- Raises:
- Returns:
an
OSTree.GpgVerifyResult
, orNone
on error- Return type:
Read GPG signature(s) on the commit named by the ASCII checksum commit_checksum and return detailed results.
- verify_commit_for_remote(commit_checksum, remote_name, cancellable)¶
- Parameters:
commit_checksum (
str
) – ASCII SHA256 checksumremote_name (
str
) – OSTree remote to use for configurationcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
an
OSTree.GpgVerifyResult
, orNone
on error- Return type:
Read GPG signature(s) on the commit named by the ASCII checksum commit_checksum and return detailed results, based on the keyring configured for remote.
New in version 2016.14.
- verify_summary(remote_name, summary, signatures, cancellable)¶
- Parameters:
remote_name (
str
) – Name of remotesummary (
GLib.Bytes
) – Summary data as aGLib.Bytes
signatures (
GLib.Bytes
) – Summary signatures as aGLib.Bytes
cancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
an
OSTree.GpgVerifyResult
, orNone
on error- Return type:
Verify signatures for summary data using GPG keys in the keyring for remote_name, and return an
OSTree.GpgVerifyResult
.
- write_archive_to_mtree(archive, mtree, modifier, autocreate_parents, cancellable)¶
- Parameters:
archive (
Gio.File
) – A path to an archive filemtree (
OSTree.MutableTree
) – TheOSTree.MutableTree
to write tomodifier (
OSTree.RepoCommitModifier
orNone
) – Optional commit modifierautocreate_parents (
bool
) – Autocreate parent directoriescancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Import an archive file archive into the repository, and write its file structure to mtree.
- write_archive_to_mtree_from_fd(fd, mtree, modifier, autocreate_parents, cancellable)¶
- Parameters:
fd (
int
) – A file descriptor to read the archive frommtree (
OSTree.MutableTree
) – TheOSTree.MutableTree
to write tomodifier (
OSTree.RepoCommitModifier
orNone
) – Optional commit modifierautocreate_parents (
bool
) – Autocreate parent directoriescancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Read an archive from fd and import it into the repository, writing its file structure to mtree.
- write_commit(parent, subject, body, metadata, root, cancellable)¶
- Parameters:
parent (
str
orNone
) – ASCII SHA256 checksum for parent, orNone
for nonemetadata (
GLib.Variant
orNone
) –GLib.Variant
of type a{sv}, orNone
for noneroot (
OSTree.RepoFile
) – The tree to point the commit tocancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_commit:
Resulting ASCII SHA256 checksum for commit
- Return type:
Write a commit metadata object, referencing root_contents_checksum and root_metadata_checksum. This uses the current time as the commit timestamp, but it can be overridden with an explicit timestamp via the standard
SOURCE_DATE_EPOCH
environment flag.
- write_commit_detached_metadata(checksum, metadata, cancellable)¶
- Parameters:
checksum (
str
) – ASCII SHA256 commit checksummetadata (
GLib.Variant
orNone
) – Metadata to associate with commit in with format “a{sv}”, orNone
to deletecancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Replace any existing metadata associated with commit referred to by checksum with metadata. If metadata is
None
, then existing data will be deleted.
- write_commit_with_time(parent, subject, body, metadata, root, time, cancellable)¶
- Parameters:
parent (
str
orNone
) – ASCII SHA256 checksum for parent, orNone
for nonemetadata (
GLib.Variant
orNone
) –GLib.Variant
of type a{sv}, orNone
for noneroot (
OSTree.RepoFile
) – The tree to point the commit totime (
int
) – The time to use to stamp the commitcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_commit:
Resulting ASCII SHA256 checksum for commit
- Return type:
Write a commit metadata object, referencing root_contents_checksum and root_metadata_checksum.
- write_config(new_config)¶
- Parameters:
new_config (
GLib.KeyFile
) – Overwrite the config file with this data- Raises:
- Return type:
Save new_config in place of this repository’s config file.
- write_content(expected_checksum, object_input, length, cancellable)¶
- Parameters:
expected_checksum (
str
orNone
) – If provided, validate content against this checksumobject_input (
Gio.InputStream
) – Content object streamlength (
int
) – Length of object_inputcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_csum:
Binary checksum
- Return type:
Store the content object streamed as object_input, with total length length. The actual checksum will be returned as out_csum.
- write_content_async(expected_checksum, object, length, cancellable, callback, *user_data)¶
- Parameters:
expected_checksum (
str
orNone
) – If provided, validate content against this checksumobject (
Gio.InputStream
) – Inputlength (
int
) – Length of objectcancellable (
Gio.Cancellable
orNone
) – Cancellablecallback (
Gio.AsyncReadyCallback
orNone
) – Invoked when content is writed
Asynchronously store the content object object. If provided, the checksum expected_checksum will be verified.
- write_content_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – aGio.AsyncResult
- Raises:
- Returns:
- out_csum:
A binary SHA256 checksum of the content object
- Return type:
Completes an invocation of
OSTree.Repo.write_content_async
().
- write_content_trusted(checksum, object_input, length, cancellable)¶
- Parameters:
checksum (
str
) – Store content using this ASCII SHA256 checksumobject_input (
Gio.InputStream
) – Content streamlength (
int
) – Length of object_inputcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Store the content object streamed as object_input, with total length length. The given checksum will be treated as trusted.
This function should be used when importing file objects from local disk, for example.
- write_dfd_to_mtree(dfd, path, mtree, modifier, cancellable)¶
- Parameters:
dfd (
int
) – Directory file descriptorpath (
str
) – Pathmtree (
OSTree.MutableTree
) – Overlay directory contents into this treemodifier (
OSTree.RepoCommitModifier
orNone
) – Optional modifiercancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Store as objects all contents of the directory referred to by dfd and path all children into the repository self, overlaying the resulting filesystem hierarchy into mtree.
- write_directory_to_mtree(dir, mtree, modifier, cancellable)¶
- Parameters:
dir (
Gio.File
) – Path to a directorymtree (
OSTree.MutableTree
) – Overlay directory contents into this treemodifier (
OSTree.RepoCommitModifier
orNone
) – Optional modifiercancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Store objects for dir and all children into the repository self, overlaying the resulting filesystem hierarchy into mtree.
- write_metadata(objtype, expected_checksum, object, cancellable)¶
- Parameters:
objtype (
OSTree.ObjectType
) – Object typeexpected_checksum (
str
orNone
) – If provided, validate content against this checksumobject (
GLib.Variant
) – Metadatacancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_csum:
Binary checksum
- Return type:
Store the metadata object object. Return the checksum as out_csum.
If expected_checksum is not
None
, verify it against the computed checksum.
- write_metadata_async(objtype, expected_checksum, object, cancellable, callback, *user_data)¶
- Parameters:
objtype (
OSTree.ObjectType
) – Object typeexpected_checksum (
str
orNone
) – If provided, validate content against this checksumobject (
GLib.Variant
) – Metadatacancellable (
Gio.Cancellable
orNone
) – Cancellablecallback (
Gio.AsyncReadyCallback
orNone
) – Invoked when metadata is writed
Asynchronously store the metadata object variant. If provided, the checksum expected_checksum will be verified.
- write_metadata_finish(result)¶
- Parameters:
result (
Gio.AsyncResult
) – Result- Raises:
- Returns:
- out_csum:
Binary checksum value
- Return type:
Complete a call to
OSTree.Repo.write_metadata_async
().
- write_metadata_stream_trusted(objtype, checksum, object_input, length, cancellable)¶
- Parameters:
objtype (
OSTree.ObjectType
) – Object typechecksum (
str
) – Store object with this ASCII SHA256 checksumobject_input (
Gio.InputStream
) – Metadata object streamlength (
int
) – Length, may be 0 for unknowncancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Store the metadata object variant; the provided checksum is trusted.
- write_metadata_trusted(objtype, checksum, variant, cancellable)¶
- Parameters:
objtype (
OSTree.ObjectType
) – Object typechecksum (
str
) – Store object with this ASCII SHA256 checksumvariant (
GLib.Variant
) – Metadata objectcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Return type:
Store the metadata object variant; the provided checksum is trusted.
- write_mtree(mtree, cancellable)¶
- Parameters:
mtree (
OSTree.MutableTree
) – Mutable treecancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
- out_file:
An
OSTree.RepoFile
representing mtree's root.
- Return type:
Write all metadata objects for mtree to repo; the resulting out_file points to the
OSTree.ObjectType.DIR_TREE
object that the mtree represented.
- write_regfile(expected_checksum, uid, gid, mode, content_len, xattrs)¶
- Parameters:
expected_checksum (
str
orNone
) – Expected checksum (SHA-256 hex string)uid (
int
) – user idgid (
int
) – group idmode (
int
) – Unix file modecontent_len (
int
) – Expected content lengthxattrs (
GLib.Variant
orNone
) – Extended attributes (GLib.Variant
type(ayay)
)
- Raises:
- Returns:
A new writer, or
None
on error- Return type:
Create an
OstreeContentWriter
that allows streaming output into the repository.New in version 2021.2.
- write_regfile_inline(expected_checksum, uid, gid, mode, xattrs, buf, cancellable)¶
- Parameters:
uid (
int
) – User idgid (
int
) – Group idmode (
int
) – File modexattrs (
GLib.Variant
orNone
) – Extended attributes,GLib.Variant
of type (ayay)buf (
bytes
) – File contentscancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
Checksum (as a hex string) of the committed file
- Return type:
Synchronously create a file object from the provided content. This API is intended for small files where it is reasonable to buffer the entire content in memory.
Unlike
ostree_repo_write_content()
, if expected_checksum is provided, this function will not check for the presence of the object beforehand.New in version 2021.2.
- write_symlink(expected_checksum, uid, gid, xattrs, symlink_target, cancellable)¶
- Parameters:
uid (
int
) – User idgid (
int
) – Group idxattrs (
GLib.Variant
orNone
) – Extended attributes,GLib.Variant
of type (ayay)symlink_target (
str
) – Target of the symbolic linkcancellable (
Gio.Cancellable
orNone
) – Cancellable
- Raises:
- Returns:
Checksum (as a hex string) of the committed file
- Return type:
Synchronously create a symlink object.
Unlike
ostree_repo_write_content()
, if expected_checksum is provided, this function will not check for the presence of the object beforehand.New in version 2021.2.
Signal Details¶
- OSTree.Repo.signals.gpg_verify_result(repo, checksum, result)¶
- Signal Name:
gpg-verify-result
- Flags:
- Parameters:
repo (
OSTree.Repo
) – The object which received the signalchecksum (
str
) – checksum of the signed objectresult (
OSTree.GpgVerifyResult
) – anOSTree.GpgVerifyResult
Emitted during a pull operation upon GPG verification (if enabled). Applications can connect to this signal to output the verification results if desired.
The signal will be emitted from whichever
GLib.MainContext
is the thread-default at the point whenOSTree.Repo.pull_with_options
() is called.
Property Details¶
- OSTree.Repo.props.path¶
- Name:
path
- Type:
- Default Value:
- Flags:
Path to repository. Note that if this repository was created via
ostree_repo_new_at()
, this value will refer to a value in the Linux kernel’s/proc/self/fd
directory. Generally, you should avoid using this property at all; you can gain a reference to the repository’s directory fd viaostree_repo_get_dfd()
and use file-descriptor relative operations.
- OSTree.Repo.props.remotes_config_dir¶
- Name:
remotes-config-dir
- Type:
- Default Value:
- Flags:
Path to directory containing remote definitions. The default is
NULL
. If asysroot-path
property is defined, this value will default to${sysroot_path}/etc/ostree/remotes.d
.This value will only be used for system repositories.
- OSTree.Repo.props.sysroot_path¶
- Name:
sysroot-path
- Type:
- Default Value:
- Flags:
A system using libostree for the host has a “system” repository; this property will be set for repositories referenced via
ostree_sysroot_repo()
for example.You should avoid using this property; if your code is operating on a system repository, use
OstreeSysroot
and access the repository object viaostree_sysroot_repo()
.