osinfo_tree: Libosinfo Reference Manual

## osinfo_tree osinfo_tree — An installation tree for a (guest) OS |

## Functions

GQuark | osinfo_tree_error_quark ()
OsinfoTree * | osinfo_tree_new ()
OsinfoTree * | osinfo_tree_create_from_location ()
void | osinfo_tree_create_from_location_async ()
OsinfoTree * | osinfo_tree_create_from_location_finish ()
OsinfoTree * | osinfo_tree_create_from_treeinfo ()
const gchar * | osinfo_tree_get_architecture ()
const gchar * | osinfo_tree_get_url ()
gboolean | osinfo_tree_has_treeinfo ()
const gchar * | osinfo_tree_get_treeinfo_family ()
const gchar * | osinfo_tree_get_treeinfo_variant ()
const gchar * | osinfo_tree_get_treeinfo_version ()
const gchar * | osinfo_tree_get_treeinfo_arch ()
const gchar * | osinfo_tree_get_boot_iso_path ()
const gchar * | osinfo_tree_get_kernel_path ()
const gchar * | osinfo_tree_get_initrd_path ()
OsinfoOs * | osinfo_tree_get_os ()
void | osinfo_tree_set_os ()
OsinfoOsVariantList * | osinfo_tree_get_os_variants ()
gboolean | osinfo_tree_matches ()

## Types and Values

#define | OSINFO_TREE_ERROR
enum | OsinfoTreeError
#define | OSINFO_TYPE_TREE
#define | OSINFO_TREE_PROP_ARCHITECTURE
#define | OSINFO_TREE_PROP_URL
#define | OSINFO_TREE_PROP_TREEINFO_FAMILY
#define | OSINFO_TREE_PROP_TREEINFO_VARIANT
#define | OSINFO_TREE_PROP_TREEINFO_VERSION
#define | OSINFO_TREE_PROP_TREEINFO_ARCH
#define | OSINFO_TREE_PROP_BOOT_ISO
#define | OSINFO_TREE_PROP_KERNEL
#define | OSINFO_TREE_PROP_INITRD
#define | OSINFO_TREE_PROP_HAS_TREEINFO
#define | OSINFO_TREE_PROP_VARIANT

## Object Hierarchy

        GEnum
        ╰── OsinfoTreeError

## Description

OsinfoTree is an entity representing an installation tree a (guest) operating system.

## Functions

### osinfo_tree_error_quark ()

    GQuark
    osinfo_tree_error_quark (void);

Gets a GQuark representing the string "osinfo-tree-error"

#### Returns

the GQuark representing the string.

Since: 0.1.0

### osinfo_tree_new ()

    OsinfoTree *
    osinfo_tree_new (const gchar *id,
                     const gchar *architecture);

Create a new tree entity

#### Parameters

id | the id of the tree to be created |
architecture | the architecture of the tree to be created |

#### Returns

A tree entity.

[transfer full]

Since: 0.1.0

### osinfo_tree_create_from_location ()

    OsinfoTree *
    osinfo_tree_create_from_location (const gchar *location,
                                      GCancellable *cancellable,
                                      GError **error);

Creates a new OsinfoTree for installation tree at `location` . The `location` could be a http:// or a https:// URI, or a local file.

NOTE: Currently this only works for trees with a .treeinfo file

#### Parameters

location | the location of an installation tree |
cancellable | a GCancellable, or `NULL`. | [allow-none]
error | The location where to store any error, or `NULL` |

#### Returns

a new OsinfoTree , or NULL on error.

[transfer full]

Since: 0.1.0

### osinfo_tree_create_from_location_async ()

    void
    osinfo_tree_create_from_location_async
                                   (const gchar *location,
                                    gint priority,
                                    GCancellable *cancellable,
                                    GAsyncReadyCallback callback,
                                    gpointer user_data);

Asynchronous variant of osinfo_tree_create_from_location.

#### Parameters

location | the location of an installation tree |
priority | the I/O priority of the request |
cancellable | a GCancellable, or `NULL`. | [allow-none]
callback | Function to call when result of this call is ready |
user_data | The user data to pass to `callback` , or `NULL` |

Since: 0.1.0

### osinfo_tree_create_from_location_finish ()

    OsinfoTree *
    osinfo_tree_create_from_location_finish
                                   (GAsyncResult *res,
                                    GError **error);

Finishes an asynchronous tree object creation process started with osinfo_tree_create_from_location_async.

#### Parameters

res | a GAsyncResult |
error | The location where to store any error, or `NULL` |

#### Returns

a new OsinfoTree , or NULL on error.

[transfer full]

Since: 0.1.0

### osinfo_tree_create_from_treeinfo ()

    OsinfoTree *
    osinfo_tree_create_from_treeinfo (const gchar *treeinfo,
                                      const gchar *location,
                                      GError **error);

Creates a new OsinfoTree for installation tree represented by `treeinfo` .

#### Parameters

treeinfo | a string representing the .treeinfo content |
location | the location of the original `treeinfo` |
error | The location where to store any error, or `NULL` |

#### Returns

a new OsinfoTree, or NULL on error.

[transfer full]

Since: 1.7.0

### osinfo_tree_get_architecture ()

    const gchar *
    osinfo_tree_get_architecture (OsinfoTree *tree);

Retrieves the target hardware architecture of the OS `tree` provides.

#### Parameters

tree | an OsinfoTree instance |

#### Returns

the hardware architecture, or NULL.

[transfer none]

Since: 0.1.0

### osinfo_tree_get_url ()

    const gchar *
    osinfo_tree_get_url (OsinfoTree *tree);

The URL to the `tree`

#### Parameters

tree | an OsinfoTree instance |

#### Returns

the URL, or NULL.

[transfer none]

Since: 0.1.0

### osinfo_tree_has_treeinfo ()

    gboolean
    osinfo_tree_has_treeinfo (OsinfoTree *tree);

Return whether a tree has treeinfo or not.

#### Parameters

tree | an OsinfoTree instance |

#### Returns

TRUE if the tree has treeinfo. FALSE otherwise.

Since: 1.3.0

### osinfo_tree_get_treeinfo_family ()

    const gchar *
    osinfo_tree_get_treeinfo_family (OsinfoTree *tree);

If `tree` has treeinfo, this function retrieves the expected family.

Note: In practice, this will usually not be the exact copy of the family but rather a regular expression that matches it.

#### Parameters

tree | an OsinfoTree instance |

#### Returns

the treeinfo family, or NULL.

[transfer none]

Since: 0.1.0

### osinfo_tree_get_treeinfo_variant ()

    const gchar *
    osinfo_tree_get_treeinfo_variant (OsinfoTree *tree);

If `tree` has treeinfo, this function retrieves the expected variant.

Note: In practice, this will usually not be the exact copy of the variant but rather a regular expression that matches it.

#### Parameters

tree | an OsinfoTree instance |

#### Returns

the treeinfo variant, or NULL.

[transfer none]

Since: 0.1.0

### osinfo_tree_get_treeinfo_version ()

    const gchar *
    osinfo_tree_get_treeinfo_version (OsinfoTree *tree);

If `tree` has treeinfo, this function retrieves the expected version.

Note: In practice, this will usually not be the exact copy of version but rather a regular expression that matches it.

#### Parameters

tree | an OsinfoTree instance |

#### Returns

the treeinfo version, or NULL.

[transfer none]

Since: 0.1.0

### osinfo_tree_get_treeinfo_arch ()

    const gchar *
    osinfo_tree_get_treeinfo_arch (OsinfoTree *tree);

If `tree` has treeinfo, this function retrieves the expected architecture.

Note: In practice, this will usually not be the exact copy of the architecture but rather a regular expression that matches it.

#### Parameters

tree | an OsinfoTree instance |

#### Returns

the treeinfo architecture, or NULL.

[transfer none]

Since: 0.1.0

### osinfo_tree_get_boot_iso_path ()

    const gchar *
    osinfo_tree_get_boot_iso_path (OsinfoTree *tree);

Retrieves the path to the boot_iso image in the install tree.

#### Parameters

tree | an OsinfoTree instance |

#### Returns

the path to boot_iso image, or NULL.

[transfer none]

Since: 0.1.0

### osinfo_tree_get_kernel_path ()

    const gchar *
    osinfo_tree_get_kernel_path (OsinfoTree *tree);

Retrieves the path to the kernel image in the install tree.

Note: This only applies to installer trees of 'linux' OS family.

#### Parameters

tree | an OsinfoTree instance |

#### Returns

the path to kernel image, or NULL.

[transfer none]

Since: 0.1.0

### osinfo_tree_get_initrd_path ()

    const gchar *
    osinfo_tree_get_initrd_path (OsinfoTree *tree);

Retrieves the path to the initrd image in the install tree.

Note: This only applies to installer trees of 'linux' OS family.

#### Parameters

tree | an OsinfoTree instance |

#### Returns

the path to initrd image, or NULL.

[transfer none]

Since: 0.1.0

### osinfo_tree_get_os ()

    OsinfoOs *
    osinfo_tree_get_os (OsinfoTree *tree);

#### Parameters

tree | an OsinfoTree instance |

#### Returns

the operating system, or NULL.

[transfer full]

Since: 1.5.0

### osinfo_tree_set_os ()

    void
    osinfo_tree_set_os (OsinfoTree *tree,
                        OsinfoOs *os);

Sets the OsinfoOs associated to the OsinfoTree instance.

#### Parameters

tree | an OsinfoTree instance |
os | an OsinfoOs instance |

Since: 1.5.0

### osinfo_tree_get_os_variants ()

    OsinfoOsVariantList *
    osinfo_tree_get_os_variants (OsinfoTree *tree);

Gets the variants of the associated operating system.

#### Parameters

tree | an OsinfoTree instance |

#### Returns

the operating system variant, or NULL.

[transfer full]

Since: 1.5.0

### osinfo_tree_matches ()

    gboolean
    osinfo_tree_matches (OsinfoTree *tree,
                         OsinfoTree *reference);

Determines whether the metadata for the unidentified `tree` is a match for the `reference` tree.

The metadata in the unidentified `tree` must be literal strings, while the metadata in the `reference` tree must be regular expressions.

#### Parameters

tree | an unidentified OsinfoTree instance |
reference | a reference OsinfoTree instance |

#### Returns

TRUE if `tree` is a match for `reference` . FALSE otherwise

Since: 1.10.0

## Types and Values

### OSINFO_TREE_ERROR

    #define OSINFO_TREE_ERROR (osinfo_tree_error_quark ())

### enum OsinfoTreeError

GError codes used for errors in the OSINFO_TREE_ERROR domain, during reading the treeinfo from a URI.

#### Members

OSINFO_TREE_ERROR_NO_TREEINFO | No treeinfo found; |
OSINFO_TREE_ERROR_NOT_SUPPORTED_PROTOCOL | The URL protocol is not supported. |

Since: 1.6.0

### OSINFO_TYPE_TREE

    #define OSINFO_TYPE_TREE (osinfo_tree_get_type ())

### OSINFO_TREE_PROP_ARCHITECTURE

    #define OSINFO_TREE_PROP_ARCHITECTURE     "architecture"

### OSINFO_TREE_PROP_URL

    #define OSINFO_TREE_PROP_URL              "url"

### OSINFO_TREE_PROP_TREEINFO_FAMILY

    #define OSINFO_TREE_PROP_TREEINFO_FAMILY  "treeinfo-family"

### OSINFO_TREE_PROP_TREEINFO_VARIANT

    #define OSINFO_TREE_PROP_TREEINFO_VARIANT "treeinfo-variant"

### OSINFO_TREE_PROP_TREEINFO_VERSION

    #define OSINFO_TREE_PROP_TREEINFO_VERSION "treeinfo-version"

### OSINFO_TREE_PROP_TREEINFO_ARCH

    #define OSINFO_TREE_PROP_TREEINFO_ARCH    "treeinfo-arch"

### OSINFO_TREE_PROP_BOOT_ISO

    #define OSINFO_TREE_PROP_BOOT_ISO         "boot-iso"

### OSINFO_TREE_PROP_KERNEL

    #define OSINFO_TREE_PROP_KERNEL           "kernel"

### OSINFO_TREE_PROP_INITRD

    #define OSINFO_TREE_PROP_INITRD           "initrd"

### OSINFO_TREE_PROP_HAS_TREEINFO

    #define OSINFO_TREE_PROP_HAS_TREEINFO     "has-treeinfo"

### OSINFO_TREE_PROP_VARIANT

    #define OSINFO_TREE_PROP_VARIANT          "variant"

## See Also

OsinfoOs