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

A base class for chroots located in a local directory. More...

#include <directory-base.h>

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

Public Types

typedef chroot::error error
 Exception type.
 
- 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 ~directory_base ()
 The destructor.
 
std::string const & get_directory () const
 Get the directory containing the chroot. More...
 
void set_directory (const std::string &directory)
 Set the directory containing the chroot. More...
 
virtual void setup_env (environment &env) const
 Set environment. More...
 
- Public Member Functions inherited from sbuild::chroot::facet::facet
virtual ~facet ()
 The destructor.
 
virtual ptr clone () const =0
 Copy the chroot facet. More...
 
virtual std::string const & get_name () const =0
 Get the name of the chroot facet. More...
 
virtual session_flags get_session_flags () const
 Get the session flags of the chroot. More...
 
- Public Member Functions inherited from sbuild::chroot::facet::storage
virtual ~storage ()
 The destructor.
 
virtual std::string get_path () const =0
 Get the path to the chroot. More...
 
virtual void setup_lock (chroot::setup_type type, bool lock, int status)
 

Protected Member Functions

 directory_base ()
 The constructor.
 
 directory_base (const directory_base &rhs)
 The copy constructor.
 
virtual void get_details (format_detail &detail) const
 Get detailed information about the chroot for output. More...
 
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.
 
virtual void set_chroot (chroot &chroot, bool copy=false)
 Set containing chroot. More...
 
- Protected Member Functions inherited from sbuild::chroot::facet::storage
 storage ()
 The constructor.
 

Protected Attributes

std::string directory
 The directory to use.
 
- Protected Attributes inherited from sbuild::chroot::facet::facet
chrootowner
 Chroot owning this facet.
 

Friends

class chroot
 

Detailed Description

A base class for chroots located in a local directory.

This class doesn't implement a chroot (get_chroot_type is not implemented). plain and directory chroots inherit from this class.

Originally plain inherited from the directory chroot, but this had to be changed when union support was introduced. As plain chroots don't run any setup scripts and basically just call 'chroot' on a directory, they can't support union based sessions.

Member Function Documentation

void sbuild::chroot::facet::directory_base::get_details ( format_detail detail) const
protectedvirtual

Get detailed information about the chroot for output.

Parameters
detailthe details to output to.

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

References sbuild::_(), sbuild::format_detail::add(), and get_directory().

std::string const & sbuild::chroot::facet::directory_base::get_directory ( ) const

Get the directory containing the chroot.

Returns
the location.

References directory.

Referenced by get_details(), get_keyfile(), sbuild::chroot::facet::plain::get_path(), and setup_env().

+ Here is the caller graph for this function:

void sbuild::chroot::facet::directory_base::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 get_directory(), sbuild::chroot::chroot::get_name(), sbuild::chroot::facet::facet::owner, and sbuild::keyfile::set_object_value().

void sbuild::chroot::facet::directory_base::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::directory_base::set_directory ( const std::string &  directory)

Set the directory containing the chroot.

Parameters
directorythe directory.

References directory, sbuild::chroot::chroot::DIRECTORY_ABS, and sbuild::is_absname().

Referenced by sbuild::chroot::facet::directory::directory(), and set_keyfile().

+ Here is the caller graph for this function:

void sbuild::chroot::facet::directory_base::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_name(), sbuild::keyfile::get_object_value(), sbuild::keyfile::has_key(), sbuild::keyfile::MISSING_KEY_NL, sbuild::chroot::facet::facet::owner, sbuild::keyfile::PRIORITY_DISALLOWED, sbuild::keyfile::PRIORITY_OBSOLETE, sbuild::keyfile::PRIORITY_OPTIONAL, and set_directory().

void sbuild::chroot::facet::directory_base::setup_env ( environment env) const
virtual

Set environment.

Set the environment that the setup scripts will see during execution.

Parameters
envthe environment to set.

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

References sbuild::environment::add(), and get_directory().


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