sbuild  1.6.10
Classes | Typedefs | Enumerations | Functions | Variables
sbuild Namespace Reference

Debian source builder components. More...

Classes

class  auth
 Authentication handler. More...
 
class  auth_null
 Null Authentication handler. More...
 
class  auth_pam
 Authentication handler. More...
 
class  auth_pam_conv
 Authentication conversation handler interface. More...
 
class  auth_pam_conv_tty
 Authentication conversation handler for terminal devices. More...
 
class  auth_pam_message
 Authentication messages. More...
 
class  basic_keyfile
 Configuration file parser. More...
 
class  basic_keyfile_parser
 Basic keyfile parser template. More...
 
class  basic_nbuf
 Null stream buffer. More...
 
class  basic_nostream
 Null output stream. More...
 
class  chroot
 Common chroot data. More...
 
class  chroot_block_device
 A chroot stored on an unmounted block device. More...
 
class  chroot_block_device_base
 A base class for block-device chroots. More...
 
class  chroot_btrfs_snapshot
 A chroot stored on an BTRFS logical volume (LV). More...
 
class  chroot_config
 Chroot configuration. More...
 
class  chroot_custom
 A chroot stored with custom parameters. More...
 
class  chroot_directory
 A chroot located in the filesystem. More...
 
class  chroot_directory_base
 A base class for chroots located in a local directory. More...
 
class  chroot_facet
 Common chroot data. More...
 
class  chroot_facet_mountable
 Chroot support for mountable devices and filesystems. More...
 
class  chroot_facet_personality
 Chroot support for kernel personalities (execution domains). More...
 
class  chroot_facet_session
 Chroot support for sessions. More...
 
class  chroot_facet_session_clonable
 Chroot support for creation of sessions. More...
 
class  chroot_facet_source
 Chroot support for clonable sources. More...
 
class  chroot_facet_source_clonable
 Chroot support for creation of source chroots. More...
 
class  chroot_facet_union
 Chroot support for filesystem union based sessions. More...
 
class  chroot_facet_userdata
 Chroot support for extensible user metadata. More...
 
class  chroot_file
 A chroot stored in a file archive (tar with optional compression). More...
 
class  chroot_loopback
 A chroot stored in a file for loopback mounting. More...
 
class  chroot_lvm_snapshot
 A chroot stored on an LVM logical volume (LV). More...
 
class  chroot_plain
 A chroot located in the filesystem (scripts disabled). More...
 
class  custom_error
 Custom error. More...
 
class  date
 A date representation in local time. More...
 
class  date_base
 A date representation. More...
 
class  environment
 Container of environment variables. More...
 
class  error
 Error exception class. More...
 
class  error_base
 Error exception base class. More...
 
class  feature
 
class  file_lock
 File lock. More...
 
class  format_detail
 Format names and values for output. More...
 
class  gmdate
 A date representation in UTC. More...
 
class  group
 System group database entry. More...
 
class  isodate
 A date representation in ISO-8601 format. More...
 
class  keyfile_base
 Base class for key-value configuration file formats. More...
 
class  keyfile_parser
 Keyfile parser template. More...
 
struct  keyfile_traits
 Traits class for an INI-style configuration file. More...
 
class  lock
 Advisory locking. More...
 
class  mntstream
 Access mounts. More...
 
class  null
 Null. More...
 
class  parse_error
 Parse error. More...
 
class  passwd
 System passwd database entry. More...
 
class  personality
 Chroot personality. More...
 
class  regex
 POSIX extended regular expression. More...
 
class  run_parts
 Run all scripts or programs within a directory. More...
 
class  session
 Session handler. More...
 
class  stat
 Get file status. More...
 

Typedefs

typedef parse_error< ctty_error_codectty_error
 Exception type.
 
typedef boost::iostreams::stream< boost::iostreams::file_descriptor > fdstream
 
typedef boost::iostreams::stream< boost::iostreams::file_descriptor_source > fdistream
 
typedef boost::iostreams::stream< boost::iostreams::file_descriptor_sink > fdostream
 
typedef basic_keyfile< keyfile_traits, keyfile_parser< keyfile_traits > > keyfile
 Configuration file parser. More...
 
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
 Exception type.
 
typedef std::vector< std::string > string_list
 A string vector.
 
typedef std::set< std::string > string_set
 A string set.
 
typedef std::map< std::string, std::string > string_map
 A string map.
 

Enumerations

enum  ctty_error_code { CTTY_CLOEXEC, CTTY_DUP }
 Error codes. More...
 
enum  debug_level {
  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 }
 Error codes. More...
 

Functions

chroot::session_flags operator| (chroot::session_flags const &lhs, chroot::session_flags const &rhs)
 Bitwise-OR of specifed session properties. More...
 
chroot::session_flags operator& (chroot::session_flags const &lhs, chroot::session_flags const &rhs)
 Bitwise-AND of specifed session properties. More...
 
const char * gettext (const char *message)
 Get a translated message. More...
 
const char * _ (const char *message)
 Get a translated message. More...
 
const char * gettext_noop (const char *message)
 Get a message with no translation. More...
 
const char * N_ (const char *message)
 Get a message with no translation. More...
 
std::ostream & log_info ()
 Log an informational message. More...
 
std::ostream & log_warning ()
 Log a warning message. More...
 
std::ostream & log_error ()
 Log an error message. More...
 
std::ostream & log_debug (debug_level level)
 Log a debug message. More...
 
std::ostream & log_ctty_info ()
 Log an informational message to the Controlling TTY. More...
 
std::ostream & log_ctty_warning ()
 Log a warning message to the Controlling TTY. More...
 
std::ostream & log_ctty_error ()
 Log an error message to the Controlling TTY. More...
 
void log_exception_warning (std::exception const &e)
 Log an exception as a warning. More...
 
void log_exception_error (std::exception const &e)
 Log an exception as an error. More...
 
void log_ctty_exception_warning (std::exception const &e)
 Log an exception as a warning to the Controlling TTY. More...
 
void log_ctty_exception_error (std::exception const &e)
 Log an exception as an error to the Controlling TTY. More...
 
void log_unknown_exception_error ()
 Log an unknown exception as an error.
 
mntstreamoperator>> (mntstream &stream, mntstream::mntentry &entry)
 The overloaded extraction operator. More...
 
void parse_value (std::string const &value, bool &parsed_value)
 Parse a boolean value. More...
 
void parse_value (std::string const &value, std::string &parsed_value)
 Parse a string value. More...
 
template<typename T >
void parse_value (std::string const &value, T &parsed_value)
 Parse a value of type T. More...
 
bool regex_search (const std::string &str, regex const &regex)
 Search using the regular expression.
 
std::string basename (std::string name)
 Strip the directory path from a filename. More...
 
std::string dirname (std::string name)
 Strip the fileame from a pathname. More...
 
std::string normalname (std::string name)
 Normalise a pathname. More...
 
bool is_absname (std::string const &name)
 Check if a pathname is absolute. More...
 
bool is_valid_sessionname (std::string const &name)
 Check if a filename matches the allowed pattern(s). More...
 
bool is_valid_filename (std::string const &name, bool lsb_mode=true)
 Check if a filename matches the allowed pattern(s). More...
 
std::string getcwd ()
 Get the current working directory. More...
 
std::string unique_identifier ()
 Get a unique string for use as a session identifier. More...
 
std::string string_list_to_string (string_list const &list, std::string const &separator)
 Convert a string_list into a string. More...
 
template<typename S >
std::vector< S > split_string (S const &value, S const &separator)
 Split a string into a string_list. More...
 
std::vector< std::string > split_string (std::string const &value, std::string const &separator)
 Split a string into a string_list. More...
 
template<typename S >
std::vector< S > split_string_strict (S const &value, S const &separator)
 Split a string into a string_list. More...
 
std::vector< std::string > split_string_strict (std::string const &value, std::string const &separator)
 Split a string into a string_list. More...
 
std::wstring widen_string (std::string const &str, std::locale locale)
 Widen a string. More...
 
std::string narrow_string (std::wstring const &str, std::locale locale)
 Narrow a string. More...
 
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. More...
 
char ** string_list_to_strv (string_list const &str)
 Create a string vector from a string_list. More...
 
void strv_delete (char **strv)
 Delete a string vector. More...
 
int exec (std::string const &file, string_list const &command, environment const &env)
 execve wrapper. More...
 
stat::mode_bits operator| (stat::mode_bits const &lhs, stat::mode_bits const &rhs)
 Bitwise-OR of specifed mode bits. More...
 
stat::mode_bits operator| (mode_t const &lhs, stat::mode_bits const &rhs)
 Bitwise-OR of specifed mode bits. More...
 
stat::mode_bits operator| (stat::mode_bits const &lhs, mode_t const &rhs)
 Bitwise-OR of specifed mode bits. More...
 
stat::mode_bits operator& (stat::mode_bits const &lhs, stat::mode_bits const &rhs)
 Bitwise-AND of specifed mode bits. More...
 
stat::mode_bits operator& (mode_t const &lhs, stat::mode_bits const &rhs)
 Bitwise-AND of specifed mode bits. More...
 
stat::mode_bits operator& (stat::mode_bits const &lhs, mode_t const &rhs)
 Bitwise-AND of specifed mode bits. More...
 

Variables

const int CTTY_FILENO
 CTTY fd. More...
 
fdstream cctty
 CTTY stream. More...
 
debug_level debug_log_level = sbuild::DEBUG_NONE
 The debugging level in use.
 
nostream cnull
 A null ostream.
 

Detailed Description

Debian source builder components.

Typedef Documentation

Configuration file parser.

This class loads an INI-style configuration file from a file or stream. The format is documented in schroot.conf(5).

Enumeration Type Documentation

Error codes.

Enumerator
CTTY_CLOEXEC 

The controlling terminal close-on-execute flag could not be set.

CTTY_DUP 

The controlling terminal file descriptor could not be duplicated.

Debugging level.

Enumerator
DEBUG_NONE 

No debugging.

DEBUG_NOTICE 

Notification messages.

DEBUG_INFO 

Informational messages.

DEBUG_WARNING 

Warning messages.

DEBUG_CRITICAL 

Critical messages.

Error codes.

Enumerator
BAD_VALUE 

The value could not be parsed.

Function Documentation

const char* sbuild::_ ( const char *  message)
inline

Get a translated message.

This function is a shorthand for gettext, which also marks up the string for translation.

Parameters
messagethe message to translate.
Returns
the translated message.

References gettext().

Referenced by sbuild::format_detail::add(), sbuild::chroot_config::add(), sbuild::auth_null::authenticate(), sbuild::auth_pam::authenticate(), sbuild::chroot_facet_session_clonable::clone_session_setup(), sbuild::chroot_facet_source_clonable::clone_source_setup(), sbuild::date_base::get_date_format(), sbuild::chroot_directory_base::get_details(), sbuild::chroot_block_device_base::get_details(), sbuild::chroot_facet_personality::get_details(), sbuild::chroot_facet_userdata::get_details(), sbuild::chroot_loopback::get_details(), sbuild::chroot_lvm_snapshot::get_details(), sbuild::chroot_facet_mountable::get_details(), sbuild::chroot_facet_session::get_details(), sbuild::chroot_btrfs_snapshot::get_details(), sbuild::chroot_file::get_details(), sbuild::chroot_facet_union::get_details(), sbuild::chroot_facet_source_clonable::get_details(), sbuild::chroot::get_details(), sbuild::session::get_login_command(), sbuild::personality::get_personalities(), sbuild::format_detail::get_title(), sbuild::session::get_user_command(), log_ctty_error(), log_ctty_info(), log_ctty_warning(), log_debug(), log_error(), log_info(), log_unknown_exception_error(), log_warning(), sbuild::null::null_output(), sbuild::chroot_config::print_chroot_list_simple(), sbuild::chroot::print_details(), sbuild::session::restore_termios(), sbuild::run_parts::run_child(), sbuild::session::run_child(), sbuild::session::run_chroot(), sbuild::session::save_termios(), sbuild::chroot::set_aliases(), sbuild::chroot_facet_userdata::set_data(), sbuild::chroot::set_keyfile(), sbuild::chroot::set_name(), sbuild::chroot_facet_userdata::set_system_data(), sbuild::session::setup_chroot(), sbuild::chroot_facet_userdata::setup_env(), and sbuild::session::wait_for_child().

+ Here is the caller graph for this function:

std::string sbuild::basename ( std::string  name)

Strip the directory path from a filename.

This is similar to basename(3).

Parameters
namethe filename to strip of its path.
Returns
the base name.

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

+ Here is the caller graph for this function:

std::string sbuild::dirname ( std::string  name)

Strip the fileame from a pathname.

This is similar to dirname(3).

Parameters
namethe path to strip of its filename.
Returns
the directory name.

Referenced by sbuild::chroot_facet_session_clonable::clone_session_setup().

+ 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
filethe program to execute.
commandthe arguments to pass to the executable.
envthe environment.
Returns
the return value of the execve system call on failure.

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

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

+ 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
programthe program to search for.
paththe search path; typically the value of $PATH.
prefixa 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.

References sbuild::stat::is_regular(), and split_string().

Referenced by sbuild::session::get_user_command(), sbuild::session::run_child(), and split_string_strict().

+ Here is the caller graph for this function:

std::string sbuild::getcwd ( )

Get the current working directory.

If it can't be found, fall back to root.

Returns
the current working directory.

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

+ Here is the caller graph for this function:

const char* sbuild::gettext ( const char *  message)
inline

Get a translated message.

Parameters
messagethe message to translate.
Returns
the translated message.

Referenced by _().

+ Here is the caller graph for this function:

const char* sbuild::gettext_noop ( const char *  message)
inline

Get a message with no translation.

Parameters
messagethe message to not translate.
Returns
the message.

Referenced by N_().

+ Here is the caller graph for this function:

bool sbuild::is_absname ( std::string const &  name)
bool sbuild::is_valid_filename ( std::string const &  name,
bool  lsb_mode = true 
)

Check if a filename matches the allowed pattern(s).

This will not match dotfiles, backup files, dpkg configuration backup files, etc. This uses the same rules as run-parts(8).

Parameters
namethe filename to check.
lsb_modetrue to use LSB mode, otherwise false.
Returns
true if it matches, false if not.

References regex_search().

Referenced by sbuild::run_parts::run_parts().

+ Here is the caller graph for this function:

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

Check if a filename matches the allowed pattern(s).

This will not match dotfiles, backup files, dpkg configuration backup files, etc.

Parameters
namethe filename to check.
Returns
true if it matches, false if not.

References regex_search().

Referenced by sbuild::chroot_config::add_config_directory(), sbuild::chroot::set_aliases(), and sbuild::chroot::set_name().

+ Here is the caller graph for this function:

std::ostream & sbuild::log_ctty_error ( )

Log an error message to the Controlling TTY.

Returns
an ostream.

References _(), and cctty.

Referenced by sbuild::auth_pam_conv_tty::conversation(), and log_ctty_exception_error().

+ Here is the caller graph for this function:

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

Log an exception as an error to the Controlling TTY.

Parameters
ethe exception to log.

References log_ctty_error().

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

Log an exception as a warning to the Controlling TTY.

Parameters
ethe exception to log.

References log_ctty_warning().

Referenced by sbuild::auth_pam_conv_tty::get_delay().

+ Here is the caller graph for this function:

std::ostream & sbuild::log_ctty_info ( )

Log an informational message to the Controlling TTY.

Returns
an ostream.

References _(), and cctty.

Referenced by sbuild::auth_pam_conv_tty::conversation().

+ Here is the caller graph for this function:

std::ostream & sbuild::log_ctty_warning ( )

Log a warning message to the Controlling TTY.

Returns
an ostream.

References _(), and cctty.

Referenced by log_ctty_exception_warning().

+ Here is the caller graph for this function:

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

Log a debug message.

Parameters
levelthe 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.

References _(), cnull, and debug_log_level.

Referenced by sbuild::auth_pam::account(), sbuild::format_detail::add(), sbuild::environment::add(), sbuild::chroot_config::add_config_directory(), sbuild::chroot_config::add_config_file(), sbuild::auth_null::authenticate(), sbuild::auth_pam::authenticate(), sbuild::chroot_facet_session_clonable::clone_session_setup(), sbuild::auth_pam::close_session(), sbuild::auth_pam_conv_tty::conversation(), sbuild::auth_pam::cred_delete(), sbuild::auth_pam::cred_establish(), sbuild::chroot_config::find_alias(), sbuild::chroot_config::find_chroot_in_namespace(), sbuild::environment::get(), sbuild::session::get_chroot_membership(), sbuild::session::get_login_command(), sbuild::session::get_user_command(), sbuild::basic_keyfile< K, P >::get_value(), sbuild::chroot::get_verbosity_string(), sbuild::session::is_group_member(), sbuild::chroot_config::load_data(), sbuild::chroot_config::load_keyfile(), sbuild::chroot_config::lookup_alias(), sbuild::auth_pam::open_session(), parse_value(), sbuild::run_parts::run_child(), sbuild::session::run_child(), sbuild::session::run_impl(), sbuild::auth::set_ruser(), sbuild::auth::set_user(), sbuild::session::setup_chroot(), sbuild::auth_pam::setupenv(), sbuild::auth_null::start(), sbuild::auth_pam::start(), and sbuild::auth_pam::stop().

+ Here is the caller graph for this function:

std::ostream & sbuild::log_error ( )

Log an error message.

Returns
an ostream.

References _().

Referenced by log_exception_error(), log_unknown_exception_error(), 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
ethe exception to log.

References log_error().

Referenced by sbuild::run_parts::run_child(), sbuild::session::run_chroot(), sbuild::session::setup_chroot(), sbuild::session::wait_for_child(), sbuild::auth::~auth(), sbuild::auth_null::~auth_null(), and sbuild::auth_pam::~auth_pam().

+ Here is the caller graph for this function:

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

Log an informational message.

Returns
an ostream.

References _().

Referenced by sbuild::session::get_login_command(), sbuild::session::get_user_command(), 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.

References _().

Referenced by sbuild::environment::get(), log_exception_warning(), sbuild::session::restore_termios(), and sbuild::session::save_termios().

+ Here is the caller graph for this function:

const char* sbuild::N_ ( const char *  message)
inline

Get a message with no translation.

This macro is a shorthand for gettext_noop, which also marks up the string for translation.

Parameters
messagethe message to not translate.
Returns
the message.

References gettext_noop().

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
strthe string to narrow.
localethe locale to use for the conversion.
Returns
a narrow string.

Referenced by split_string_strict().

+ Here is the caller graph for this function:

std::string sbuild::normalname ( std::string  name)

Normalise a pathname.

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

Parameters
namethe path to normalise.
Returns
the normalised name.

Referenced by sbuild::chroot::setup_env().

+ Here is the caller graph for this function:

stat::mode_bits sbuild::operator& ( stat::mode_bits const &  lhs,
stat::mode_bits const &  rhs 
)
inline

Bitwise-AND of specifed mode bits.

Parameters
lhsmode bits
rhsmode bits
Returns
result of AND.
stat::mode_bits sbuild::operator& ( mode_t const &  lhs,
stat::mode_bits const &  rhs 
)
inline

Bitwise-AND of specifed mode bits.

Parameters
lhsmode bits
rhsmode bits
Returns
result of AND.
stat::mode_bits sbuild::operator& ( stat::mode_bits const &  lhs,
mode_t const &  rhs 
)
inline

Bitwise-AND of specifed mode bits.

Parameters
lhsmode bits
rhsmode bits
Returns
result of AND.
chroot::session_flags sbuild::operator& ( chroot::session_flags const &  lhs,
chroot::session_flags const &  rhs 
)
inline

Bitwise-AND of specifed session properties.

Parameters
lhssession properties
rhssession properties
Returns
result of AND.
mntstream & sbuild::operator>> ( mntstream stream,
mntstream::mntentry entry 
)

The overloaded extraction operator.

This is used to pull mntentries from a mntstream.

Parameters
streamthe mntstream to get input from.
entrythe mntentry to set.
Returns
the mntstream.

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

stat::mode_bits sbuild::operator| ( stat::mode_bits const &  lhs,
stat::mode_bits const &  rhs 
)
inline

Bitwise-OR of specifed mode bits.

Parameters
lhsmode bits
rhsmode bits
Returns
result of OR.
stat::mode_bits sbuild::operator| ( mode_t const &  lhs,
stat::mode_bits const &  rhs 
)
inline

Bitwise-OR of specifed mode bits.

Parameters
lhsmode bits
rhsmode bits
Returns
result of OR.
stat::mode_bits sbuild::operator| ( stat::mode_bits const &  lhs,
mode_t const &  rhs 
)
inline

Bitwise-OR of specifed mode bits.

Parameters
lhsmode bits
rhsmode bits
Returns
result of OR.
chroot::session_flags sbuild::operator| ( chroot::session_flags const &  lhs,
chroot::session_flags const &  rhs 
)
inline

Bitwise-OR of specifed session properties.

Parameters
lhssession properties
rhssession properties
Returns
result of OR.
void sbuild::parse_value ( std::string const &  value,
bool &  parsed_value 
)

Parse a boolean value.

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

References BAD_VALUE, DEBUG_NOTICE, and log_debug().

Referenced by sbuild::environment::get(), sbuild::basic_keyfile< K, P >::get_list_value(), sbuild::basic_keyfile< K, P >::get_set_value(), and sbuild::basic_keyfile< K, P >::get_value().

+ Here is the caller graph for this function:

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

Parse a string value.

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

References DEBUG_NOTICE, and log_debug().

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

Parse a value of type T.

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

References BAD_VALUE, DEBUG_NOTICE, and log_debug().

template<typename S >
std::vector<S> sbuild::split_string ( S const &  value,
S const &  separator 
)

Split a string into a string_list.

The string is split using separator as a delimiter. Note that only non-zero-length strings are preserved, so multiple concatenated delimiters or delimiters at the beginning and end of the string will not result in empty strings in the list.

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

Referenced by find_program_in_path(), sbuild::basic_keyfile< K, P >::get_list_value(), and sbuild::basic_keyfile< K, P >::get_set_value().

+ 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. Multiple delimiters, or delimiters at the start of the start or end of the string will be discarded and not result in empty strings being returned (see split_string_strict).

Parameters
valuethe string to split.
separatorthe delimiting character or characters.
Returns
a string_list.
template<typename S >
std::vector<S> sbuild::split_string_strict ( S const &  value,
S const &  separator 
)

Split a string into a string_list.

The string is split using separator as a delimiter. All delimiters are used as string separators, so delimiters at the beginning or end of a string, or which are concatenated together, will result in empty strings in the string list (use split_string to avoid this).

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

References exec(), find_program_in_path(), narrow_string(), string_list_to_strv(), strv_delete(), and widen_string().

Referenced by sbuild::run_parts::run_child().

+ Here is the caller graph for this function:

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

Split a string into a string_list.

The string is split using separator as a delimiter. All delimiters are used as string separators, so delimiters at the beginning or end of a string, or which are concatenated together, will result in empty strings in the string list.

Parameters
valuethe string to split.
separatorthe delimiting character or characters.
Returns
a string_list.
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
listthe list to concatenate.
separatorthe delimiting character.
Returns
a string.

Referenced by sbuild::format_detail::add(), sbuild::session::get_user_command(), sbuild::run_parts::run_child(), sbuild::session::run_child(), and sbuild::chroot_config::validate_chroots().

+ 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
strthe string_list to use.
Returns
a string vector.

Referenced by exec(), and split_string_strict().

+ 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
strvthe string vector to delete.

Referenced by exec(), and split_string_strict().

+ Here is the caller graph for this function:

std::string sbuild::unique_identifier ( )

Get a unique string for use as a session identifier.

Depending upon the available facilities, this may be a UUID or a combinatin of the process ID and system time.

Returns
a session identifier.

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

+ 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
strthe string to widen.
localethe locale to use for the conversion.
Returns
a wide string.

Referenced by split_string_strict().

+ Here is the caller graph for this function:

Variable Documentation

fdstream sbuild::cctty

CTTY stream.

A stream to the Controlling TTY, or standard input if not available.

Referenced by log_ctty_error(), log_ctty_info(), log_ctty_warning(), and sbuild::auth_pam_conv_tty::read_string().

const int sbuild::CTTY_FILENO

CTTY fd.

The fd number of the Controlling TTY, or -1 if not available.

Referenced by sbuild::auth_pam_conv_tty::read_string(), sbuild::session::restore_termios(), and sbuild::session::save_termios().