SbuildChroot

SbuildChroot — chroot object

Synopsis




            SbuildChroot;
            SbuildChrootClass;
void        (*SbuildChrootPrintDetailsFunc) (SbuildChroot *chroot,
                                             FILE *file);
const gchar* (*SbuildChrootGetChrootTypeFunc)
                                            (const SbuildChroot *chroot);
SbuildChrootSessionFlags (*SbuildChrootGetSessionFlagsFunc)
                                            (const SbuildChroot *chroot);
void        (*SbuildChrootPrintConfigFunc)  (SbuildChroot *chroot,
                                             FILE *file);
void        (*SbuildChrootSetupEnvFunc)     (SbuildChroot *chroot,
                                             GList **env);
gboolean    (*SbuildChrootSetupLockFunc)    (SbuildChroot *chroot,
                                             SbuildChrootSetupType type,
                                             gboolean lock,
                                             GError **error);
enum        SbuildChrootSessionFlags;
enum        SbuildChrootSetupType;
enum        SbuildChrootError;
#define     SBUILD_CHROOT_ERROR
SbuildChroot* sbuild_chroot_new             (void);
SbuildChroot* sbuild_chroot_new_from_keyfile
                                            (GKeyFile *keyfile,
                                             const char *group);
gboolean    sbuild_chroot_set_properties_from_keyfile
                                            (SbuildChroot *chroot,
                                             GKeyFile *keyfile);
const char* sbuild_chroot_get_name          (const SbuildChroot *restrict chroot);
void        sbuild_chroot_set_name          (SbuildChroot *chroot,
                                             const char *name);
const char* sbuild_chroot_get_description   (const SbuildChroot *restrict chroot);
void        sbuild_chroot_set_description   (SbuildChroot *chroot,
                                             const char *description);
guint       sbuild_chroot_get_priority      (const SbuildChroot *restrict chroot);
void        sbuild_chroot_set_priority      (SbuildChroot *chroot,
                                             guint priority);
char**      sbuild_chroot_get_groups        (const SbuildChroot *restrict chroot);
void        sbuild_chroot_set_groups        (SbuildChroot *chroot,
                                             char **groups);
char**      sbuild_chroot_get_root_groups   (const SbuildChroot *restrict chroot);
void        sbuild_chroot_set_root_groups   (SbuildChroot *chroot,
                                             char **groups);
char**      sbuild_chroot_get_aliases       (const SbuildChroot *restrict chroot);
void        sbuild_chroot_set_aliases       (SbuildChroot *chroot,
                                             char **aliases);
gboolean    sbuild_chroot_get_active        (const SbuildChroot *restrict chroot);
void        sbuild_chroot_set_active        (SbuildChroot *chroot,
                                             gboolean active);
gboolean    sbuild_chroot_get_run_setup_scripts
                                            (const SbuildChroot *restrict chroot);
void        sbuild_chroot_set_run_setup_scripts
                                            (SbuildChroot *chroot,
                                             gboolean run_setup_scripts);
gboolean    sbuild_chroot_get_run_session_scripts
                                            (const SbuildChroot *restrict chroot);
void        sbuild_chroot_set_run_session_scripts
                                            (SbuildChroot *chroot,
                                             gboolean run_session_scripts);
const char* sbuild_chroot_get_mount_location
                                            (const SbuildChroot *restrict chroot);
void        sbuild_chroot_set_mount_location
                                            (SbuildChroot *chroot,
                                             const char *location);
const char* sbuild_chroot_get_mount_device  (const SbuildChroot *restrict chroot);
void        sbuild_chroot_set_mount_device  (SbuildChroot *chroot,
                                             const char *device);
void        sbuild_chroot_print_details     (SbuildChroot *chroot,
                                             FILE *file);
void        sbuild_chroot_print_config      (SbuildChroot *chroot,
                                             FILE *file);
const gchar* sbuild_chroot_get_chroot_type  (const SbuildChroot *chroot);
SbuildChrootSessionFlags sbuild_chroot_get_session_flags
                                            (const SbuildChroot *chroot);
void        sbuild_chroot_setup_env         (SbuildChroot *chroot,
                                             GList **env);
gboolean    sbuild_chroot_setup_lock        (SbuildChroot *chroot,
                                             SbuildChrootSetupType type,
                                             gboolean lock,
                                             GError **error);

Object Hierarchy


  GObject
   +----SbuildChroot
         +----SbuildChrootPlain
         +----SbuildChrootBlockDevice

Properties


  "active"               gboolean              : Read / Write / Construct
  "aliases"              GStrv                 : Read / Write / Construct
  "description"          gchararray            : Read / Write / Construct
  "groups"               GStrv                 : Read / Write / Construct
  "mount-device"         gchararray            : Read / Write
  "mount-location"       gchararray            : Read / Write
  "name"                 gchararray            : Read / Write / Construct
  "priority"             guint                 : Read / Write / Construct
  "root-groups"          GStrv                 : Read / Write / Construct
  "run-session-scripts"  gboolean              : Read / Write / Construct
  "run-setup-scripts"    gboolean              : Read / Write / Construct

Description

This object contains all of the metadata associated with a single chroot. This is the in-core representation of a chroot definition in the configuration file, and may be initialised directly from an open GKeyFile.

This object is a container of information only. The only things it can do are satisfying requests for information and printing its details.

Details

SbuildChroot

typedef struct _SbuildChroot SbuildChroot;

SbuildChroot object.


SbuildChrootClass

typedef struct {
  GObjectClass                    parent;
  SbuildChrootPrintDetailsFunc    print_details;
  SbuildChrootPrintConfigFunc     print_config;
  SbuildChrootSetupEnvFunc        setup_env;
  SbuildChrootGetChrootTypeFunc   get_chroot_type;
  SbuildChrootSetupLockFunc       setup_lock;
  SbuildChrootGetSessionFlagsFunc get_session_flags;
} SbuildChrootClass;

SbuildChroot class.

GObjectClass parent; the parent class
SbuildChrootPrintDetailsFunc print_details; vfunc to print additional chroot details
SbuildChrootPrintConfigFunc print_config; vfunc to print the config file group for this chroot
SbuildChrootSetupEnvFunc setup_env; vfunc to set the environment that the setup scripts will see during execution
SbuildChrootGetChrootTypeFunc get_chroot_type; vfunc to get the user visible chroot type name
SbuildChrootSetupLockFunc setup_lock; vfunc to lock a chroot during setup
SbuildChrootGetSessionFlagsFunc get_session_flags; vfunc to get the session flags for this chroot type

SbuildChrootPrintDetailsFunc ()

void        (*SbuildChrootPrintDetailsFunc) (SbuildChroot *chroot,
                                             FILE *file);

Print detailed information about chroot to file. The information is printed in plain text with one line per property. This should print additional detail in derived SbuildChroot classes.

chroot : an SbuildChroot
file : the file to output to.

SbuildChrootGetChrootTypeFunc ()

const gchar* (*SbuildChrootGetChrootTypeFunc)
                                            (const SbuildChroot *chroot);

This function is used to get the name of the chroot type subclassed from this type. This is a user-friendly form of the registered type name of the class, for use in messages and configuration files.

chroot : an SbuildChroot
Returns : the type name

SbuildChrootGetSessionFlagsFunc ()

SbuildChrootSessionFlags (*SbuildChrootGetSessionFlagsFunc)
                                            (const SbuildChroot *chroot);

This function is used to get the session flags of the chroot. These determine how the SbuildSession controlling the chroot will operate.

chroot : an SbuildChroot
Returns : the SbuildChrootSessionFlags

SbuildChrootPrintConfigFunc ()

void        (*SbuildChrootPrintConfigFunc)  (SbuildChroot *chroot,
                                             FILE *file);

Print the configuration group for a chroot in the format required by schroot.conf.

chroot : an SbuildChroot.
file : the file to output to.

SbuildChrootSetupEnvFunc ()

void        (*SbuildChrootSetupEnvFunc)     (SbuildChroot *chroot,
                                             GList **env);

This function is used to set the environment that the setup scripts will see during execution. Environment variables should be added to env as "key=value" strings (the format expected by execve envp). These strings should be allocated with g_free (or related allocation functions such as g_strdup), and they must not be freed.

chroot : an SbuildChroot.
env : the environment to set.

SbuildChrootSetupLockFunc ()

gboolean    (*SbuildChrootSetupLockFunc)    (SbuildChroot *chroot,
                                             SbuildChrootSetupType type,
                                             gboolean lock,
                                             GError **error);

Lock a chroot during setup. The locking technique (if any) may vary depending upon the chroot type and setup stage. For example, during creation a block device might require locking, but afterwards this will change to the new block device or directory.

chroot : an SbuildChroot.
type : the type of setup being performed
lock : TRUE to lock, FALSE to unlock
error : a GError
Returns : TRUE on success, FALSE on failure

enum SbuildChrootSessionFlags

typedef enum
{
  SBUILD_CHROOT_SESSION_CREATE = 1 << 0
} SbuildChrootSessionFlags;

The session options for a given chroot type

SBUILD_CHROOT_SESSION_CREATE The session persists once schroot terminates, so a session file must be created.

enum SbuildChrootSetupType

typedef enum
{
  SBUILD_CHROOT_SETUP_START,
  SBUILD_CHROOT_SETUP_RECOVER,
  SBUILD_CHROOT_SETUP_STOP,
  SBUILD_CHROOT_RUN_START,
  SBUILD_CHROOT_RUN_STOP
} SbuildChrootSetupType;

The type of chroot setup operation

SBUILD_CHROOT_SETUP_START Set up a new chroot, preparing it for use
SBUILD_CHROOT_SETUP_RECOVER Recover an existing, but inactive, chroot
SBUILD_CHROOT_SETUP_STOP Clean up an existing chroot, possibly deleting it
SBUILD_CHROOT_RUN_START Start running a command in an existing chroot
SBUILD_CHROOT_RUN_STOP Stop running a command in an existing chroot

enum SbuildChrootError

typedef enum
{
  SBUILD_CHROOT_ERROR_LOCK
} SbuildChrootError;

The errors which can occur during chroot operations.

SBUILD_CHROOT_ERROR_LOCK A locking operation failed.

SBUILD_CHROOT_ERROR

#define SBUILD_CHROOT_ERROR sbuild_chroot_error_quark()

The error domain for sbuild chroot errors.


sbuild_chroot_new ()

SbuildChroot* sbuild_chroot_new             (void);

Creates a new SbuildChroot.

Returns : the newly created SbuildChroot.

sbuild_chroot_new_from_keyfile ()

SbuildChroot* sbuild_chroot_new_from_keyfile
                                            (GKeyFile *keyfile,
                                             const char *group);

Creates a new SbuildChroot.

keyfile : the GKeyFile containing the chroot configuration
group : the group in keyfile to use
Returns : the newly created SbuildChroot.

sbuild_chroot_set_properties_from_keyfile ()

gboolean    sbuild_chroot_set_properties_from_keyfile
                                            (SbuildChroot *chroot,
                                             GKeyFile *keyfile);

Sets the properties of an existing SbuildChroot from a GKeyFile.

chroot : an SbuildChroot.
keyfile : the GKeyFile containing the chroot configuration
Returns : TRUE on success, FALSE on failure.

sbuild_chroot_get_name ()

const char* sbuild_chroot_get_name          (const SbuildChroot *restrict chroot);

Get the name of the chroot.

chroot : an SbuildChroot
Returns : a string. This string points to internally allocated storage in the chroot and must not be freed, modified or stored.

sbuild_chroot_set_name ()

void        sbuild_chroot_set_name          (SbuildChroot *chroot,
                                             const char *name);

Set the name of a chroot.

chroot : an SbuildChroot.
name : the name to set.

sbuild_chroot_get_description ()

const char* sbuild_chroot_get_description   (const SbuildChroot *restrict chroot);

Get the description of the chroot.

chroot : an SbuildChroot
Returns : a string. This string points to internally allocated storage in the chroot and must not be freed, modified or stored.

sbuild_chroot_set_description ()

void        sbuild_chroot_set_description   (SbuildChroot *chroot,
                                             const char *description);

Set the description of a chroot.

chroot : an SbuildChroot.
description : the description to set.

sbuild_chroot_get_priority ()

guint       sbuild_chroot_get_priority      (const SbuildChroot *restrict chroot);

Get the priority of the chroot. This is a number indicating whether than a ditribution is older than another.

chroot : an SbuildChroot
Returns : the priority.

sbuild_chroot_set_priority ()

void        sbuild_chroot_set_priority      (SbuildChroot *chroot,
                                             guint priority);

Set the priority of a chroot. This is a number indicating whether a distribution is older than another. For example, "oldstable" and "oldstable-security" might be 0, while "stable" and "stable-security" 1, "testing" 2 and "unstable" 3. The values are not important, but the difference between them is.

chroot : an SbuildChroot.
priority : the priority to set.

sbuild_chroot_get_groups ()

char**      sbuild_chroot_get_groups        (const SbuildChroot *restrict chroot);

Get the groups of the chroot.

chroot : an SbuildChroot
Returns : a string. This string points to internally allocated storage in the chroot and must not be freed, modified or stored.

sbuild_chroot_set_groups ()

void        sbuild_chroot_set_groups        (SbuildChroot *chroot,
                                             char **groups);

Set the groups of a chroot.

chroot : an SbuildChroot.
groups : the groups to set.

sbuild_chroot_get_root_groups ()

char**      sbuild_chroot_get_root_groups   (const SbuildChroot *restrict chroot);

Get the root groups of the chroot.

chroot : an SbuildChroot
Returns : a string. This string points to internally allocated storage in the chroot and must not be freed, modified or stored.

sbuild_chroot_set_root_groups ()

void        sbuild_chroot_set_root_groups   (SbuildChroot *chroot,
                                             char **groups);

Set the groups of a chroot.

chroot : an SbuildChroot.
groups : the groups to set.

sbuild_chroot_get_aliases ()

char**      sbuild_chroot_get_aliases       (const SbuildChroot *restrict chroot);

Get the aliases of the chroot.

chroot : an SbuildChroot
Returns : a string. This string points to internally allocated storage in the chroot and must not be freed, modified or stored.

sbuild_chroot_set_aliases ()

void        sbuild_chroot_set_aliases       (SbuildChroot *chroot,
                                             char **aliases);

Set the aliases of a chroot.

chroot : an SbuildChroot.
aliases : the aliases to set.

sbuild_chroot_get_active ()

gboolean    sbuild_chroot_get_active        (const SbuildChroot *restrict chroot);

Get the activity status of the chroot.

chroot : an SbuildChroot
Returns : TRUE if active, FALSE if inactive.

sbuild_chroot_set_active ()

void        sbuild_chroot_set_active        (SbuildChroot *chroot,
                                             gboolean active);

Set the activity status of the chroot.

chroot : an SbuildChroot.
active : TRUE if active, FALSE if inactive.

sbuild_chroot_get_run_setup_scripts ()

gboolean    sbuild_chroot_get_run_setup_scripts
                                            (const SbuildChroot *restrict chroot);

Check if chroot setup scripts will be run.

chroot : an SbuildChroot
Returns : TRUE if setup scripts will be run, otherwise FALSE.

sbuild_chroot_set_run_setup_scripts ()

void        sbuild_chroot_set_run_setup_scripts
                                            (SbuildChroot *chroot,
                                             gboolean run_setup_scripts);

Set whether chroot setup scripts should be run or not.

chroot : an SbuildChroot.
run_setup_scripts : TRUE to run setup scripts, otherwise FALSE.

sbuild_chroot_get_run_session_scripts ()

gboolean    sbuild_chroot_get_run_session_scripts
                                            (const SbuildChroot *restrict chroot);

Check if chroot session scripts will be run.

chroot : an SbuildChroot
Returns : TRUE if session scripts will be run, otherwise FALSE.

sbuild_chroot_set_run_session_scripts ()

void        sbuild_chroot_set_run_session_scripts
                                            (SbuildChroot *chroot,
                                             gboolean run_session_scripts);

Set whether chroot session scripts should be run or not.

chroot : an SbuildChroot.
run_session_scripts : TRUE to run session scripts, otherwise FALSE.

sbuild_chroot_get_mount_location ()

const char* sbuild_chroot_get_mount_location
                                            (const SbuildChroot *restrict chroot);

Get the mount location of the chroot.

chroot : an SbuildChroot
Returns : a string. This string points to internally allocated storage in the chroot and must not be freed, modified or stored.

sbuild_chroot_set_mount_location ()

void        sbuild_chroot_set_mount_location
                                            (SbuildChroot *chroot,
                                             const char *location);

Set the mount location of a chroot.

chroot : an SbuildChroot.
location : the mount location to set.

sbuild_chroot_get_mount_device ()

const char* sbuild_chroot_get_mount_device  (const SbuildChroot *restrict chroot);

Get the mount device of the chroot.

chroot : an SbuildChroot
Returns : a string. This string points to internally allocated storage in the chroot and must not be freed, modified or stored.

sbuild_chroot_set_mount_device ()

void        sbuild_chroot_set_mount_device  (SbuildChroot *chroot,
                                             const char *device);

Set the mount device of a chroot.

chroot : an SbuildChroot.
device : the mount device to set.

sbuild_chroot_print_details ()

void        sbuild_chroot_print_details     (SbuildChroot *chroot,
                                             FILE *file);

Print detailed information about chroot to file. The information is printed in plain text with one line per property.

chroot : an SbuildChroot.
file : the file to output to.

sbuild_chroot_print_config ()

void        sbuild_chroot_print_config      (SbuildChroot *chroot,
                                             FILE *file);

Print the configuration group for a chroot in the format required by schroot.conf.

chroot : an SbuildChroot.
file : the file to output to.

sbuild_chroot_get_chroot_type ()

const gchar* sbuild_chroot_get_chroot_type  (const SbuildChroot *chroot);

Get the type of the chroot. This returns a user-readable string which is equivalant to the type name of the subclassed SbuildChroot.

chroot : an SbuildChroot
Returns : a string. This string points to internally allocated storage in the chroot and must not be freed, modified or stored.

sbuild_chroot_get_session_flags ()

SbuildChrootSessionFlags sbuild_chroot_get_session_flags
                                            (const SbuildChroot *chroot);

Get the session flags of the chroot. These determine how the SbuildSession controlling the chroot will operate.

chroot : an SbuildChroot
Returns : the SbuildChrootSessionFlags.

sbuild_chroot_setup_env ()

void        sbuild_chroot_setup_env         (SbuildChroot *chroot,
                                             GList **env);

This function is used to set the environment that the setup scripts will see during execution. Environment variables should be added to env as "key=value" strings (the format expected by execve envp). These strings should be allocated with g_free (or related allocation functions such as g_strdup), and they must not be freed.

chroot : an SbuildChroot.
env : the environment to set.

sbuild_chroot_setup_lock ()

gboolean    sbuild_chroot_setup_lock        (SbuildChroot *chroot,
                                             SbuildChrootSetupType type,
                                             gboolean lock,
                                             GError **error);

Lock a chroot during setup. The locking technique (if any) may vary depending upon the chroot type and setup stage. For example, during creation a block device might require locking, but afterwards this will change to the new block device or directory.

chroot : an SbuildChroot
type : the type of setup being performed
lock : TRUE to lock, FALSE to unlock
error : a GError.
Returns : TRUE on success, FALSE on failure.

Properties

The "active" property

  "active"               gboolean              : Read / Write / Construct

Is the chroot currently in use?.

Default value: FALSE


The "aliases" property

  "aliases"              GStrv                 : Read / Write / Construct

Alternate names for this chroot.


The "description" property

  "description"          gchararray            : Read / Write / Construct

The description of the chroot.

Default value: ""


The "groups" property

  "groups"               GStrv                 : Read / Write / Construct

The groups allowed to use this chroot.


The "mount-device" property

  "mount-device"         gchararray            : Read / Write

The block device for of the chroot.

Default value: ""


The "mount-location" property

  "mount-location"       gchararray            : Read / Write

The mounted location (path) of the chroot.

Default value: ""


The "name" property

  "name"                 gchararray            : Read / Write / Construct

The name of the chroot.

Default value: ""


The "priority" property

  "priority"             guint                 : Read / Write / Construct

The priority of the chroot distribution, the lower the older the distribution.

Default value: 0


The "root-groups" property

  "root-groups"          GStrv                 : Read / Write / Construct

The groups allowed to use this chroot as root.


The "run-session-scripts" property

  "run-session-scripts"  gboolean              : Read / Write / Construct

Run chroot session scripts?.

Default value: FALSE


The "run-setup-scripts" property

  "run-setup-scripts"    gboolean              : Read / Write / Construct

Run chroot setup scripts?.

Default value: FALSE