sbuild  1.7.1
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
sbuild::chroot::facet::custom Class Reference

A chroot stored with custom parameters. More...

#include <custom.h>

+ Inheritance diagram for sbuild::chroot::facet::custom:
+ Collaboration diagram for sbuild::chroot::facet::custom:

Public Types

typedef chroot::error error
 Exception type.
 
typedef std::shared_ptr< customptr
 A shared_ptr to a chroot facet object.
 
typedef std::shared_ptr< const
custom
const_ptr
 A shared_ptr to a const chroot facet object.
 
- Public Types inherited from sbuild::chroot::facet::facet
enum  session_flags { SESSION_NOFLAGS = 0, SESSION_CREATE = 1 << 0, SESSION_CLONE = 1 << 1, SESSION_PURGE = 1 << 2 }
 Chroot session properties. More...
 
typedef std::shared_ptr< facetptr
 A shared_ptr to a chroot facet object.
 
typedef std::shared_ptr< const
facet
const_ptr
 A shared_ptr to a const chroot facet object.
 
- Public Types inherited from sbuild::chroot::facet::storage
typedef std::shared_ptr< storageptr
 A shared_ptr to a chroot storage object.
 
typedef std::shared_ptr< const
storage
const_ptr
 A shared_ptr to a const chroot storage object.
 

Public Member Functions

virtual ~custom ()
 The destructor.
 
virtual std::string const & get_name () const
 Get the name of the chroot facet. More...
 
facet::ptr clone () const
 Copy the chroot facet. More...
 
void set_session_cloneable (bool cloneable)
 Enable or disable cloning of the chroot session. More...
 
void set_session_purgeable (bool purgeable)
 Enable or disable purging of the chroot session. More...
 
bool get_session_purgeable () const
 Get status of chroot session purging. More...
 
void set_source_cloneable (bool cloneable)
 Enable or disable cloning of the source chroot. More...
 
std::string get_path () const
 Get the path to the chroot. More...
 
virtual session_flags get_session_flags () const
 Get the session flags of the chroot. More...
 
- Public Member Functions inherited from sbuild::chroot::facet::facet
virtual ~facet ()
 The destructor.
 
virtual void setup_env (environment &env) const
 Set environment. More...
 
virtual void get_details (format_detail &detail) const
 Get detailed information about the chroot for output. More...
 
- Public Member Functions inherited from sbuild::chroot::facet::storage
virtual ~storage ()
 The destructor.
 

Static Public Member Functions

static ptr create ()
 Create a chroot facet. More...
 

Protected Member Functions

 custom ()
 The constructor.
 
 custom (const custom &rhs)
 The copy constructor.
 
void set_chroot (chroot &chroot, bool copy)
 Set containing chroot. More...
 
virtual void setup_lock (chroot::setup_type type, bool lock, int status)
 
virtual void get_used_keys (string_list &used_keys) const
 Get a list of the keys used during keyfile parsing. More...
 
virtual void get_keyfile (keyfile &keyfile) const
 Copy the chroot properties into a keyfile. More...
 
virtual void set_keyfile (const keyfile &keyfile)
 Set the chroot properties from a keyfile. More...
 
- Protected Member Functions inherited from sbuild::chroot::facet::facet
 facet ()
 The constructor.
 
- Protected Member Functions inherited from sbuild::chroot::facet::storage
 storage ()
 The constructor.
 

Private Attributes

bool purgeable
 

Friends

class chroot
 

Additional Inherited Members

- Protected Attributes inherited from sbuild::chroot::facet::facet
chrootowner
 Chroot owning this facet.
 

Detailed Description

A chroot stored with custom parameters.

This chroot specifies no behaviour or policy. It is entirely configured using user options and setup scripts. The intent is to permit the prototyping of and experimentation with new chroot types without requiring a "full" class definition and associated infrastructural work. It also makes schroot extensible without requiring any C++ coding.

Member Function Documentation

facet::ptr sbuild::chroot::facet::custom::clone ( ) const
virtual

Copy the chroot facet.

This is a virtual copy constructor.

Returns
a shared_ptr to the new copy of the chroot facet.

Implements sbuild::chroot::facet::facet.

References custom().

custom::ptr sbuild::chroot::facet::custom::create ( )
static

Create a chroot facet.

Returns
a shared_ptr to the new chroot facet.

References custom().

void sbuild::chroot::facet::custom::get_keyfile ( keyfile keyfile) const
protectedvirtual

Copy the chroot properties into a keyfile.

The keyfile group with the name of the chroot will be set; if it already exists, it will be removed before setting it.

Parameters
keyfilethe keyfile to use.

Reimplemented from sbuild::chroot::facet::facet.

References sbuild::chroot::chroot::get_name(), get_session_purgeable(), sbuild::chroot::facet::facet::owner, and sbuild::keyfile::set_object_value().

std::string const & sbuild::chroot::facet::custom::get_name ( ) const
virtual

Get the name of the chroot facet.

Returns
the chroot facet name.

Implements sbuild::chroot::facet::facet.

std::string sbuild::chroot::facet::custom::get_path ( ) const
virtual

Get the path to the chroot.

This is the absolute path to the root of the chroot, and is typically the same as the mount location and location concatenated together, but is overridden by the chroot type if required.

Returns
the path.

Implements sbuild::chroot::facet::storage.

References sbuild::chroot::chroot::get_mount_location(), and sbuild::chroot::facet::facet::owner.

facet::session_flags sbuild::chroot::facet::custom::get_session_flags ( ) const
virtual

Get the session flags of the chroot.

These determine how the Session controlling the chroot will operate.

Parameters
chrootthe chroot to use.
Returns
the session flags.

Reimplemented from sbuild::chroot::facet::facet.

References sbuild::chroot::chroot::get_facet(), get_session_purgeable(), sbuild::chroot::facet::facet::owner, sbuild::chroot::facet::facet::SESSION_NOFLAGS, and sbuild::chroot::facet::facet::SESSION_PURGE.

bool sbuild::chroot::facet::custom::get_session_purgeable ( ) const

Get status of chroot session purging.

Returns
true if purgeable, false if not.

Referenced by get_keyfile(), and get_session_flags().

+ Here is the caller graph for this function:

void sbuild::chroot::facet::custom::get_used_keys ( string_list used_keys) const
protectedvirtual

Get a list of the keys used during keyfile parsing.

Returns
a list of key names.

Reimplemented from sbuild::chroot::facet::facet.

void sbuild::chroot::facet::custom::set_chroot ( chroot chroot,
bool  copy 
)
protectedvirtual

Set containing chroot.

The copy parameter is used to inform the facet if it is new or a copy; this is intended to allow additional facets to only be added if the facet is new, for example, to avoid re-adding removed facets when copying a chroot.

Parameters
chrootthe chroot containing this facet.
copytrue if the facet has been copied, or false if this is a new instance.

Reimplemented from sbuild::chroot::facet::facet.

References sbuild::chroot::chroot::add_facet(), sbuild::chroot::facet::session_clonable::create(), sbuild::chroot::chroot::get_facet(), sbuild::chroot::facet::facet::owner, and sbuild::chroot::facet::facet::set_chroot().

void sbuild::chroot::facet::custom::set_keyfile ( const keyfile keyfile)
protectedvirtual

Set the chroot properties from a keyfile.

The chroot name must have previously been set, so that the correct keyfile group may be determined.

Parameters
keyfilethe keyfile to get the properties from.

Reimplemented from sbuild::chroot::facet::facet.

References sbuild::chroot::chroot::get_facet(), sbuild::chroot::chroot::get_name(), sbuild::keyfile::get_object_value(), sbuild::chroot::facet::facet::owner, sbuild::keyfile::PRIORITY_DISALLOWED, sbuild::keyfile::PRIORITY_OPTIONAL, set_session_cloneable(), set_session_purgeable(), and set_source_cloneable().

void sbuild::chroot::facet::custom::set_session_cloneable ( bool  cloneable)

Enable or disable cloning of the chroot session.

This simply creates or removes the chroot_facet_session_cloneable facet, hence there is no companion get method.

Parameters
cloneabletrue if cloneable, false if not.

References sbuild::chroot::chroot::add_facet(), sbuild::chroot::facet::session_clonable::create(), sbuild::chroot::facet::facet::owner, and sbuild::chroot::chroot::remove_facet().

Referenced by set_keyfile().

+ Here is the caller graph for this function:

void sbuild::chroot::facet::custom::set_session_purgeable ( bool  purgeable)

Enable or disable purging of the chroot session.

Note that this is only usable if the chroot supports session cloning, otherwise this does nothing.

Parameters
purgeabletrue if purgeable, false if not.

Referenced by set_keyfile().

+ Here is the caller graph for this function:

void sbuild::chroot::facet::custom::set_source_cloneable ( bool  cloneable)

Enable or disable cloning of the source chroot.

This simply creates or removes the chroot_facet_source_cloneable facet, hence there is no companion get method.

Parameters
cloneabletrue if source cloneable, false if not.

References sbuild::chroot::chroot::add_facet(), sbuild::chroot::facet::source_clonable::create(), sbuild::chroot::facet::facet::owner, and sbuild::chroot::chroot::remove_facet().

Referenced by set_keyfile().

+ Here is the caller graph for this function:


The documentation for this class was generated from the following files: