sbuild Namespace Reference


Classes

class  auth_conv_tty
 Authentication conversation handler for terminal devices. More...
class  auth_conv
 Authentication conversation handler interface. More...
class  auth_message
 Authentication messages. More...
class  auth
 Authentication handler. More...
class  chroot_block_device
 A chroot stored on an unmounted block device. More...
class  chroot_config
 Chroot configuration. More...
class  chroot_directory
 A chroot located in the filesystem. More...
class  chroot_file
 A chroot stored in a file archive (tar or zip). More...
class  chroot_lvm_snapshot
 A chroot stored on an LVM logical volume (LV). More...
class  chroot_plain
 A chroot located in the filesystem (mounts disabled). More...
class  chroot_source
 A chroot may offer a "source" chroot in addition to its normal "session" copy, to allow for maintenence of the source data. More...
class  chroot
 Common chroot data. More...
class  custom_error
 Custom error. More...
class  direntry
 An entry in a dirstream. More...
class  dirstream
 Access directories. More...
class  environment
 Container of environment variables. More...
class  error_base
 Error exception base class. More...
class  error
 Error exception class. More...
class  format_detail
 Format names and values for output. More...
class  keyfile
 Configuration file parser. More...
class  lock
 Advisory locking. More...
class  file_lock
 File lock. More...
class  device_lock
 Device lock. More...
class  basic_nbuf
 Null stream buffer. More...
class  basic_nostream
 Null output stream. More...
class  null
 Null. More...
class  parse_error
 Parse error. More...
class  personality
 Chroot personality. More...
class  run_parts
 Run all scripts or programs within a directory. More...
class  session
 Session handler. More...
class  date_base
 A date representation. More...
class  gmdate
 A date representation in UTC. More...
class  date
 A date representation in local time. More...

Typedefs

typedef basic_nostream< char > nostream
 A null ostream.
typedef basic_nostream< wchar_t > wnostream
 A wide null ostream.
typedef parse_error< parse_value_error_codeparse_value_error
typedef std::vector< std::string > string_list
 A string vector.

Enumerations

enum  DebugLevel {
  DEBUG_NONE = -1, DEBUG_NOTICE = 1, DEBUG_INFO = 2, DEBUG_WARNING = 3,
  DEBUG_CRITICAL = 4
}
 Debugging level. More...
enum  parse_value_error_code { BAD_VALUE }

Functions

dirstreamoperator>> (dirstream &stream, direntry &entry)
 The overloaded extraction operator.
std::ostream & log_info ()
 Log an informational message.
std::ostream & log_warning ()
 Log a warning message.
std::ostream & log_error ()
 Log an error message.
std::ostream & log_debug (DebugLevel level)
 Log a debug message.
void log_exception_warning (std::exception const &e)
 Log an exception as a warning.
void log_exception_error (std::exception const &e)
 Log an exception as an error.
void parse_value (std::string const &value, bool &parsed_value)
 Parse a boolean value.
void parse_value (std::string const &value, std::string &parsed_value)
 Parse a string value.
template<typename T>
void parse_value (std::string const &value, T &parsed_value)
 Parse a value of type T.
std::string basename (std::string name, char separator= '/')
 Strip the directory path from a filename.
std::string dirname (std::string name, char separator= '/')
 Strip the fileame from a pathname.
std::string normalname (std::string name, char separator= '/')
 Normalise a pathname.
bool is_absname (std::string const &name)
 Check if a pathname is absolute.
std::string string_list_to_string (string_list const &list, std::string const &separator)
 Convert a string_list into a string.
string_list split_string (std::string const &value, std::string const &separator)
 Split a string into a string_list.
std::wstring widen_string (std::string const &str, std::locale locale)
 Widen a string.
std::string narrow_string (std::wstring const &str, std::locale locale)
 Narrow a string.
std::string find_program_in_path (std::string const &program, std::string const &path, std::string const &prefix)
 Find a program in the PATH search path.
char ** string_list_to_strv (string_list const &str)
 Create a string vector from a string_list.
void strv_delete (char **strv)
 Delete a string vector.
int exec (std::string const &file, string_list const &command, environment const &env)
 execve wrapper.

Variables

DebugLevel debug_level
 The debugging level in use.
nostream cnull
 A null ostream.


Typedef Documentation

typedef basic_nostream<char> sbuild::nostream

A null ostream.

Definition at line 71 of file sbuild-nostream.h.

typedef parse_error<parse_value_error_code> sbuild::parse_value_error

Definition at line 37 of file sbuild-parse-value.h.

typedef std::vector<std::string> sbuild::string_list

A string vector.

Definition at line 34 of file sbuild-types.h.

typedef basic_nostream<wchar_t> sbuild::wnostream

A wide null ostream.

Definition at line 73 of file sbuild-nostream.h.


Enumeration Type Documentation

enum sbuild::DebugLevel

Debugging level.

Enumerator:
DEBUG_NONE  No debugging.
DEBUG_NOTICE  Notification messages.
DEBUG_INFO  Informational messages.
DEBUG_WARNING  Warning messages.
DEBUG_CRITICAL  Critical messages.

Definition at line 29 of file sbuild-log.h.

enum sbuild::parse_value_error_code

Enumerator:
BAD_VALUE  The value could not be parsed.

Definition at line 32 of file sbuild-parse-value.h.


Function Documentation

std::string sbuild::basename ( std::string  name,
char  separator = '/' 
)

Strip the directory path from a filename.

This is similar to basename(3).

Parameters:
name the filename to strip of its path.
separator the separation delimiting directories.
Returns:
the base name.

Definition at line 65 of file sbuild-util.cc.

References remove_duplicates().

Referenced by sbuild::session::get_login_command(), and sbuild::chroot_lvm_snapshot::setup_env().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string sbuild::dirname ( std::string  name,
char  separator = '/' 
)

Strip the fileame from a pathname.

This is similar to dirname(3).

Parameters:
name the path to strip of its filename.
separator the separation delimiting directories.
Returns:
the directory name.

Definition at line 89 of file sbuild-util.cc.

References remove_duplicates().

Referenced by sbuild::session::run_impl().

Here is the call graph for this function:

Here is the caller graph for this function:

int sbuild::exec ( std::string const &  file,
string_list const &  command,
environment const &  env 
)

execve wrapper.

Run the command specified by file (an absolute pathname), using command and env as the argv and environment, respectively.

Parameters:
file the program to execute.
command the arguments to pass to the executable.
env the environment.
Returns:
the return value of the execve system call on failure.

Definition at line 333 of file sbuild-util.cc.

References sbuild::environment::get_strv(), string_list_to_strv(), and strv_delete().

Referenced by sbuild::session::run_child(), and sbuild::run_parts::run_child().

Here is the call graph for this function:

Here is the caller graph for this function:

std::string sbuild::find_program_in_path ( std::string const &  program,
std::string const &  path,
std::string const &  prefix 
)

Find a program in the PATH search path.

Parameters:
program the program to search for.
path the search path; typically the value of $PATH.
prefix a directory prefix the add to the search path. This may be left empty to search the root filesystem.
Returns:
the absolute path of the program, or an empty string if the program could not be found.

Definition at line 271 of file sbuild-util.cc.

References split_string().

Referenced by sbuild::session::get_user_command().

Here is the call graph for this function:

Here is the caller graph for this function:

bool sbuild::is_absname ( std::string const &  name  ) 

Check if a pathname is absolute.

Parameters:
name the path to check.
Returns:
true if the name is absolute or false if it is not, or if name is empty.

Definition at line 126 of file sbuild-util.cc.

Referenced by dchroot_dsa::options::check_options(), dchroot_dsa::session::get_user_command(), sbuild::chroot_block_device::set_device(), sbuild::chroot_file::set_file(), sbuild::chroot::set_location(), sbuild::chroot_directory::set_location(), sbuild::chroot_block_device::set_location(), sbuild::chroot::set_mount_device(), sbuild::chroot::set_mount_location(), and sbuild::chroot_lvm_snapshot::set_snapshot_device().

Here is the caller graph for this function:

std::ostream & sbuild::log_debug ( DebugLevel  level  ) 

Log a debug message.

Parameters:
level the debug level of the message being logged.
Returns:
an ostream. This will be a valid stream if level is greater or equal to debug_level, or else a null stream will be returned, resulting in no output.

Definition at line 56 of file sbuild-log.cc.

References _, cnull, and debug_level.

Referenced by sbuild::auth::account(), sbuild::format_detail::add(), sbuild::chroot_config::add_config_directory(), sbuild::chroot_config::add_config_file(), auth_conv_hook(), sbuild::auth::authenticate(), sbuild::auth::close_session(), sbuild::auth_conv_tty::conversation(), schroot::main::create_session(), dchroot::main::create_session(), dchroot_dsa::main::create_session(), sbuild::auth::cred_delete(), sbuild::auth::cred_establish(), sbuild::environment::get(), sbuild::session::get_chroot_auth_status(), sbuild::session::get_login_command(), sbuild::session::get_user_command(), dchroot::session::get_user_command(), dchroot_dsa::session::get_user_command(), sbuild::keyfile::get_value(), sbuild::chroot_config::load_data(), sbuild::auth::open_session(), parse_value(), sbuild::session::restore_termios(), sbuild::auth::run(), sbuild::session::run_child(), sbuild::run_parts::run_child(), sbuild::session::run_impl(), sbuild::session::save_termios(), sbuild::auth::set_user(), sbuild::session::setup_chroot(), sbuild::auth::setupenv(), sbuild::auth::start(), and sbuild::auth::stop().

Here is the caller graph for this function:

std::ostream & sbuild::log_error (  ) 

Log an error message.

Returns:
an ostream.

Definition at line 49 of file sbuild-log.cc.

References _.

Referenced by auth_conv_hook(), sbuild::auth_conv_tty::conversation(), log_exception_error(), schroot_base::run(), sbuild::run_parts::run_child(), sbuild::session::run_chroot(), and sbuild::session::setup_chroot().

Here is the caller graph for this function:

void sbuild::log_exception_error ( std::exception const &  e  ) 

Log an exception as an error.

Parameters:
e the exception to log.

Definition at line 87 of file sbuild-log.cc.

References log_error(), log_info(), split_string(), and sbuild::error_base::why().

Referenced by auth_conv_hook(), sbuild::chroot_config::print_chroot_config(), sbuild::chroot_config::print_chroot_info(), sbuild::chroot_config::print_chroot_location(), schroot_base::run(), schroot_base::main::run(), sbuild::run_parts::run_child(), sbuild::session::run_chroot(), schroot::main_base::run_impl(), sbuild::session::setup_chroot(), sbuild::session::wait_for_child(), and sbuild::auth::~auth().

Here is the call graph for this function:

Here is the caller graph for this function:

void sbuild::log_exception_warning ( std::exception const &  e  ) 

Log an exception as a warning.

Parameters:
e the exception to log.

Definition at line 68 of file sbuild-log.cc.

References log_info(), log_warning(), split_string(), and sbuild::error_base::why().

Referenced by sbuild::chroot_config::add(), sbuild::chroot_config::add_config_directory(), sbuild::keyfile::check_priority(), sbuild::session::get_auth_status(), sbuild::auth_conv_tty::get_delay(), sbuild::keyfile::get_list_value(), sbuild::session::get_shell(), sbuild::keyfile::get_value(), is_group_member(), sbuild::session::run_child(), and schroot::main_base::run_impl().

Here is the call graph for this function:

Here is the caller graph for this function:

std::ostream & sbuild::log_info (  ) 

Log an informational message.

Returns:
an ostream.

Definition at line 35 of file sbuild-log.cc.

References _.

Referenced by schroot::options_base::check_actions(), dchroot::main_base::check_dchroot_conf(), dchroot::options::check_options(), dchroot::main_base::compat_check(), sbuild::auth_conv_tty::conversation(), sbuild::session::get_login_command(), sbuild::session::get_user_command(), dchroot::session::get_user_command(), dchroot_dsa::session::get_user_command(), log_exception_error(), log_exception_warning(), schroot_base::main::run(), and sbuild::run_parts::run_child().

Here is the caller graph for this function:

std::ostream & sbuild::log_warning (  ) 

Log a warning message.

Returns:
an ostream.

Definition at line 42 of file sbuild-log.cc.

References _.

Referenced by schroot_releaselock::main::action_releaselock(), schroot::options_base::check_actions(), dchroot::main_base::check_dchroot_conf(), dchroot::options::check_options(), dchroot::main_base::compat_check(), sbuild::environment::get(), log_exception_warning(), sbuild::session::restore_termios(), and sbuild::session::save_termios().

Here is the caller graph for this function:

std::string sbuild::narrow_string ( std::wstring const &  str,
std::locale  locale 
)

Narrow a string.

The wide string is converted into a narrow string. Note that any conversion error will cause the string to be clipped at the point of error.

Parameters:
str the string to narrow.
locale the locale to use for the conversion.
Returns:
a narrow string.

Definition at line 224 of file sbuild-util.cc.

std::string sbuild::normalname ( std::string  name,
char  separator = '/' 
)

Normalise a pathname.

This strips all trailing separators, and duplicate separators within a path.

Parameters:
name the path to normalise.
separator the separation delimiting directories.
Returns:
the normalised name.

Definition at line 113 of file sbuild-util.cc.

References remove_duplicates().

Referenced by schroot_listmounts::main::list_mounts().

Here is the call graph for this function:

Here is the caller graph for this function:

dirstream & sbuild::operator>> ( dirstream stream,
direntry entry 
)

The overloaded extraction operator.

This is used to pull direntries from a dirstream.

Parameters:
stream the dirstream to get input from.
entry the direntry to set.
Returns:
the dirstream.

Definition at line 157 of file sbuild-dirstream.cc.

References sbuild::dirstream::data, sbuild::dirstream::eof_status, and sbuild::dirstream::read().

Here is the call graph for this function:

template<typename T>
void sbuild::parse_value ( std::string const &  value,
T &  parsed_value 
)

Parse a value of type T.

Parameters:
value the value to parse.
parsed_value the variable to store the parsed value.
Returns:
true on success, false on failure.

Definition at line 67 of file sbuild-parse-value.h.

References BAD_VALUE, DEBUG_NOTICE, and log_debug().

Here is the call graph for this function:

void sbuild::parse_value ( std::string const &  value,
std::string &  parsed_value 
)

Parse a string value.

Parameters:
value the value to parse.
parsed_value the variable to store the parsed value.
Returns:
true on success, false on failure.

Definition at line 67 of file sbuild-parse-value.cc.

References DEBUG_NOTICE, and log_debug().

Here is the call graph for this function:

void sbuild::parse_value ( std::string const &  value,
bool &  parsed_value 
)

Parse a boolean value.

Parameters:
value the value to parse.
parsed_value the variable to store the parsed value.
Returns:
true on success, false on failure.

Definition at line 50 of file sbuild-parse-value.cc.

References BAD_VALUE, DEBUG_NOTICE, and log_debug().

Referenced by sbuild::environment::get(), sbuild::keyfile::get_list_value(), and sbuild::keyfile::get_value().

Here is the call graph for this function:

Here is the caller graph for this function:

string_list sbuild::split_string ( std::string const &  value,
std::string const &  separator 
)

Split a string into a string_list.

The string is split using separator as a delimiter.

Parameters:
value the string to split.
separator the delimiting character or characters.
Returns:
a string_list.
Todo:
Provide an alternative that splits the string in place using an iterator interface.

Definition at line 153 of file sbuild-util.cc.

Referenced by find_program_in_path(), sbuild::keyfile::get_list_value(), log_exception_error(), log_exception_warning(), and dchroot_dsa::chroot_config::parse_data().

Here is the caller graph for this function:

std::string sbuild::string_list_to_string ( string_list const &  list,
std::string const &  separator 
)

Convert a string_list into a string.

The strings are concatenated using separator as a delimiter.

Parameters:
list the list to concatenate.
separator the delimiting character.
Returns:
a string.

Definition at line 135 of file sbuild-util.cc.

Referenced by sbuild::format_detail::add(), sbuild::session::get_user_command(), dchroot::session::get_user_command(), dchroot_dsa::session::get_user_command(), sbuild::session::run_child(), and sbuild::run_parts::run_child().

Here is the caller graph for this function:

char ** sbuild::string_list_to_strv ( string_list const &  str  ) 

Create a string vector from a string_list.

The strings in the vector, as well as the vector itself, are allocated with new, and should be freed as a whole with strv_delete.

Parameters:
str the string_list to use.

Definition at line 307 of file sbuild-util.cc.

Referenced by exec().

Here is the caller graph for this function:

void sbuild::strv_delete ( char **  strv  ) 

Delete a string vector.

The strings in the vector, as well as the vector itself, must have been previously allocated with new, for example sbuild::environment::get_strv.

Parameters:
strv the string vector to delete.

Definition at line 325 of file sbuild-util.cc.

Referenced by exec().

Here is the caller graph for this function:

std::wstring sbuild::widen_string ( std::string const &  str,
std::locale  locale 
)

Widen a string.

The narrow string is converted into a wide string. Note that any conversion error will cause the string to be clipped at the point of error.

Parameters:
str the string to widen.
locale the locale to use for the conversion.
Returns:
a wide string.

Definition at line 177 of file sbuild-util.cc.


Variable Documentation

sbuild::nostream sbuild::cnull

A null ostream.

Definition at line 22 of file sbuild-nostream.cc.

Referenced by log_debug().

sbuild::DebugLevel sbuild::debug_level

The debugging level in use.

Definition at line 105 of file sbuild-log.cc.

Referenced by schroot_base::options::check_options(), log_debug(), and schroot_base::main::run().


Generated on Sat Jan 27 16:12:47 2007 for schroot by  doxygen 1.5.1