diff options
author | Roger Leigh <rleigh@debian.org> | 2013-04-03 22:11:53 +0100 |
---|---|---|
committer | Roger Leigh <rleigh@debian.org> | 2013-04-03 22:11:53 +0100 |
commit | 47f3fcd305a1b7f6d8c9eb90a4a4d5c34e0d3813 (patch) | |
tree | dbcfdd14540388a7f56836f988cbdcf952ea344c /bin/csbuild | |
parent | 54370443f1088305df0c8598656bdaaf43870de7 (diff) | |
download | schroot-47f3fcd305a1b7f6d8c9eb90a4a4d5c34e0d3813.tar.gz |
bin: Remove csbuild and schroot-sbuild
Also remove libschroot-all which is no longer needed.
Diffstat (limited to 'bin/csbuild')
-rw-r--r-- | bin/csbuild/.gitignore | 1 | ||||
-rw-r--r-- | bin/csbuild/Makefile.am | 39 | ||||
-rw-r--r-- | bin/csbuild/csbuild.cc | 49 | ||||
-rw-r--r-- | bin/csbuild/debian-changes.cc | 299 | ||||
-rw-r--r-- | bin/csbuild/debian-changes.h | 866 | ||||
-rw-r--r-- | bin/csbuild/main.cc | 254 | ||||
-rw-r--r-- | bin/csbuild/main.h | 72 | ||||
-rw-r--r-- | bin/csbuild/options.cc | 247 | ||||
-rw-r--r-- | bin/csbuild/options.h | 188 |
9 files changed, 0 insertions, 2015 deletions
diff --git a/bin/csbuild/.gitignore b/bin/csbuild/.gitignore deleted file mode 100644 index c4d7a1a1..00000000 --- a/bin/csbuild/.gitignore +++ /dev/null @@ -1 +0,0 @@ -csbuild diff --git a/bin/csbuild/Makefile.am b/bin/csbuild/Makefile.am deleted file mode 100644 index 45c01e1b..00000000 --- a/bin/csbuild/Makefile.am +++ /dev/null @@ -1,39 +0,0 @@ -# Copyright © 2004-2013 Roger Leigh <rleigh@debian.org> -# -# schroot is free software: you can redistribute it and/or modify it -# under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# schroot is distributed in the hope that it will be useful, but -# WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see -# <http://www.gnu.org/licenses/>. -# -##################################################################### - -if BUILD_CSBUILD -csbuild = bin/csbuild/csbuild -endif - -bin_PROGRAMS += $(csbuild) - -bin_csbuild_csbuild_SOURCES = \ - bin/csbuild/debian-changes.h \ - bin/csbuild/debian-changes.cc \ - bin/csbuild/options.h \ - bin/csbuild/options.cc \ - bin/csbuild/main.h \ - bin/csbuild/main.cc \ - bin/csbuild/csbuild.cc -bin_csbuild_csbuild_LDADD = $(top_builddir)/bin/schroot/libschroot.la - -install-exec-hook:: -# Install setuid root. - if [ -f "$(DESTDIR)$(bindir)/csbuild" ]; then \ - chmod 4755 "$(DESTDIR)$(bindir)/csbuild"; \ - fi diff --git a/bin/csbuild/csbuild.cc b/bin/csbuild/csbuild.cc deleted file mode 100644 index 25455b25..00000000 --- a/bin/csbuild/csbuild.cc +++ /dev/null @@ -1,49 +0,0 @@ -/* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org> - * - * schroot is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * schroot is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * <http://www.gnu.org/licenses/>. - * - *********************************************************************/ - -#include <config.h> - -#include "options.h" -#include "main.h" - -#include <bin-common/run.h> - -#include <boost/format.hpp> - -using std::endl; -using boost::format; -namespace opt = boost::program_options; - -using namespace csbuild; - -/** - * Main routine. - * - * @param argc the number of arguments - * @param argv argument vector - * - * @returns 0 on success, 1 on failure or the exit status of the - * chroot command. - */ -int -main (int argc, - char *argv[]) -{ - return bin_common::run - <csbuild::options, csbuild::main>(argc, argv); -} diff --git a/bin/csbuild/debian-changes.cc b/bin/csbuild/debian-changes.cc deleted file mode 100644 index e065b6b0..00000000 --- a/bin/csbuild/debian-changes.cc +++ /dev/null @@ -1,299 +0,0 @@ -/* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org> - * - * schroot is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * schroot is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * <http://www.gnu.org/licenses/>. - * - *********************************************************************/ - -#include <config.h> - -#include "debian-changes.h" - -#include <fstream> - -#include <boost/format.hpp> - -using sbuild::_; -using sbuild::N_; -using boost::format; -using namespace csbuild; - -template<> -sbuild::error<debian_changes::error_code>::map_type -sbuild::error<debian_changes::error_code>::error_strings = - { - // TRANSLATORS: %1% = file - {debian_changes::BAD_FILE, N_("Can't open file ‘%1%’")}, - // TRANSLATORS: %1% = line number in configuration file - // TRANSLATORS: %4% = key name ("keyname=value" in configuration file) - {debian_changes::DEPRECATED_KEY, N_("line %1%: Deprecated key ‘%4%’ used")}, - // TRANSLATORS: %4% = key name ("keyname=value" in configuration file) - {debian_changes::DEPRECATED_KEY_NL, N_("Deprecated key ‘%4%’ used")}, - // TRANSLATORS: %1% = line number in configuration file - // TRANSLATORS: %4% = key name ("keyname=value" in configuration file) - {debian_changes::DISALLOWED_KEY, N_("line %1%: Disallowed key ‘%4%’ used")}, - // TRANSLATORS: %4% = key name ("keyname=value" in configuration file) - {debian_changes::DISALLOWED_KEY_NL, N_("Disallowed key ‘%4%’ used")}, - // TRANSLATORS: %1% = line number in configuration file - // TRANSLATORS: %4% = key name ("keyname=value" in configuration file) - {debian_changes::DUPLICATE_KEY, N_("line %1%: Duplicate key ‘%4%’")}, - // TRANSLATORS: %1% = line number in configuration file - // TRANSLATORS: %4% = line contents as read from the configuration file - {debian_changes::INVALID_LINE, N_("line %1%: Invalid line: “%4%”")}, - // TRANSLATORS: %1% = line number in configuration file - // TRANSLATORS: %4% = key name ("keyname=value" in configuration file) - {debian_changes::MISSING_KEY, N_("line %1%: Required key ‘%4%’ is missing")}, - // TRANSLATORS: %4% = key name ("keyname=value" in configuration file) - {debian_changes::MISSING_KEY_NL, N_("Required key ‘%4%’ is missing")}, - // TRANSLATORS: %1% = line number in configuration file - // TRANSLATORS: %4% = line contents as read from the configuration file - {debian_changes::NO_KEY, N_("line %1%: No key specified: “%4%”")}, - // TRANSLATORS: %1% = line number in configuration file - // TRANSLATORS: %4% = key name ("keyname=value" in configuration file) - {debian_changes::OBSOLETE_KEY, N_("line %1%: Obsolete key ‘%4%’ used")}, - // TRANSLATORS: %4% = key name ("keyname=value" in configuration file) - {debian_changes::OBSOLETE_KEY_NL, N_("Obsolete key ‘%4%’ used")}, - // TRANSLATORS: %2% = key name ("keyname=value" in configuration file) - // TRANSLATORS: %4% = additional details - {debian_changes::PASSTHROUGH_K, N_("%2%: %4%")}, - // TRANSLATORS: %1% = line number in configuration file - // TRANSLATORS: %3% = key name ("keyname=value" in configuration file) - // TRANSLATORS: %4% = additional details - {debian_changes::PASSTHROUGH_LK, N_("line %1%: %3%: %4%")} - }; - -debian_changes::debian_changes (): - items() -{ -} - -debian_changes::debian_changes (std::string const& file): - items() -{ - std::ifstream fs(file.c_str()); - if (fs) - { - fs.imbue(std::locale::classic()); - fs >> *this; - } - else - { - throw error(file, BAD_FILE); - } -} - -debian_changes::debian_changes (std::istream& stream): - items() -{ - stream >> *this; -} - -debian_changes::~debian_changes() -{ -} - -sbuild::string_list -debian_changes::get_keys () const -{ - sbuild::string_list ret; - - for (const auto& item : items) - ret.push_back(item.first); - - return ret; -} - -bool -debian_changes::has_key (key_type const& key) const -{ - return (find_item(key) != 0); -} - -debian_changes::size_type -debian_changes::get_line (key_type const& key) const -{ - const item_type *found_item = find_item(key); - if (found_item) - return std::get<2>(*found_item); - else - return 0; -} - -bool -debian_changes::get_value (key_type const& key, - value_type& value) const -{ - sbuild::log_debug(sbuild::DEBUG_INFO) - << "Getting debian_changes key=" << key << std::endl; - const item_type *found_item = find_item(key); - if (found_item) - { - value_type const& val(std::get<1>(*found_item)); - value = val; - return true; - } - sbuild::log_debug(sbuild::DEBUG_NOTICE) - << "key not found" << std::endl; - return false; -} - -bool -debian_changes::get_value (key_type const& key, - priority priority, - value_type& value) const -{ - bool status = get_value(key, value); - check_priority(key, priority, status); - return status; -} - -void -debian_changes::set_value (key_type const& key, - value_type const& value, - size_type line) -{ - item_map_type::iterator pos = items.find(key); - if (pos != items.end()) - items.erase(pos); - items.insert - (item_map_type::value_type(key, - item_type(key, value, line))); -} - -void -debian_changes::remove_key (key_type const& key) -{ - item_map_type::iterator pos = items.find(key); - if (pos != items.end()) - items.erase(pos); -} - -debian_changes& -debian_changes::operator += (debian_changes const& rhs) -{ - for (const auto& it : rhs.items) - { - item_type const& item = it.second; - key_type const& key(std::get<0>(item)); - value_type const& value(std::get<1>(item)); - size_type const& line(std::get<2>(item)); - set_value(key, value, line); - } - - return *this; -} - -debian_changes -operator + (debian_changes const& lhs, - debian_changes const& rhs) -{ - debian_changes ret(lhs); - ret += rhs; - return ret; -} - -const debian_changes::item_type * -debian_changes::find_item (key_type const& key) const -{ - item_map_type::const_iterator pos = items.find(key); - if (pos != items.end()) - return &pos->second; - - return 0; -} - -debian_changes::item_type * -debian_changes::find_item (key_type const& key) -{ - item_map_type::iterator pos = items.find(key); - if (pos != items.end()) - return &pos->second; - - return 0; -} - -void -debian_changes::check_priority (key_type const& key, - priority priority, - bool valid) const -{ - if (valid == false) - { - size_type line = get_line(key); - - switch (priority) - { - case PRIORITY_REQUIRED: - { - if (line) - throw error(line, MISSING_KEY, key); - else - throw error(MISSING_KEY_NL, key); - } - break; - default: - break; - } - } - else - { - size_type line = get_line(key); - - switch (priority) - { - case PRIORITY_DEPRECATED: - { - if (line) - { - error e(line, DEPRECATED_KEY, key); - e.set_reason(_("This option will be removed in the future")); - log_exception_warning(e); - } - else - { - error e(DEPRECATED_KEY_NL, key); - e.set_reason(_("This option will be removed in the future")); - log_exception_warning(e); - } - } - break; - case PRIORITY_OBSOLETE: - { - if (line) - { - error e(line, OBSOLETE_KEY, key); - e.set_reason(_("This option has been removed, and no longer has any effect")); - log_exception_warning(e); - } - else - { - error e(OBSOLETE_KEY_NL, key); - e.set_reason(_("This option has been removed, and no longer has any effect")); - log_exception_warning(e); - } - } - break; - case PRIORITY_DISALLOWED: - { - if (line) - throw error(line, DISALLOWED_KEY, key); - else - throw error(DISALLOWED_KEY_NL, key); - } - break; - default: - break; - } - } -} diff --git a/bin/csbuild/debian-changes.h b/bin/csbuild/debian-changes.h deleted file mode 100644 index f35890d2..00000000 --- a/bin/csbuild/debian-changes.h +++ /dev/null @@ -1,866 +0,0 @@ -/* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org> - * - * schroot is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * schroot is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * <http://www.gnu.org/licenses/>. - * - *********************************************************************/ - -#ifndef CSBUILD_DEBIAN_CHANGES_H -#define CSBUILD_DEBIAN_CHANGES_H - -#include <sbuild/i18n.h> -#include <sbuild/log.h> -#include <sbuild/parse-error.h> -#include <sbuild/parse-value.h> -#include <sbuild/types.h> -#include <sbuild/util.h> - -#include <cassert> -#include <map> -#include <string> -#include <sstream> -#include <tuple> - -#include <boost/format.hpp> - -namespace csbuild -{ - - /** - * Debian changes file parser. This class is a generic parser for - * the file format used in Debian changes files for binary and - * source uploads (.changes and .dsc files). - */ - class debian_changes - { - private: - typedef std::string key_type; - typedef std::vector<std::string> value_type; - typedef unsigned int size_type; - - /// Key-value-line tuple. - typedef std::tuple<key_type,value_type,size_type> - item_type; - - /// Map between key name and key-value-comment tuple. - typedef std::map<key_type,item_type> item_map_type; - - public: - /// Configuration parameter priority. - enum priority - { - PRIORITY_OPTIONAL, ///< The parameter is optional. - PRIORITY_REQUIRED, ///< The parameter is required. - PRIORITY_DISALLOWED, ///< The parameter is not allowed in this context. - PRIORITY_DEPRECATED, ///< The parameter is deprecated, but functional. - PRIORITY_OBSOLETE ///< The parameter is obsolete, and not functional. - }; - - /// Error codes. - enum error_code - { - BAD_FILE, ///< The file to parse couldn't be opened. - DEPRECATED_KEY, ///< The key is deprecated. - DEPRECATED_KEY_NL, ///< The key is deprecated (no line specified). - DISALLOWED_KEY, ///< The key is not allowed. - DISALLOWED_KEY_NL, ///< The key is not allowed (no line specified). - DUPLICATE_KEY, ///< The key is a duplicate. - INVALID_LINE, ///< The line is invalid. - MISSING_KEY, ///< The key is missing. - MISSING_KEY_NL, ///< The key is missing (no line specified). - NO_KEY, ///< No key was specified. - OBSOLETE_KEY, ///< The key is obsolete. - OBSOLETE_KEY_NL, ///< The key is obsolete (no line specified). - PASSTHROUGH_K, ///< Pass through exception with key. - PASSTHROUGH_LK ///< Pass through exception with line and key. - }; - - /// Exception type. - typedef sbuild::parse_error<error_code> error; - - /// The constructor. - debian_changes (); - - /** - * The constructor. - * - * @param file the file to load the configuration from. - */ - debian_changes (std::string const& file); - - /** - * The constructor. - * - * @param stream the stream to load the configuration from. - */ - debian_changes (std::istream& stream); - - /// The destructor. - virtual ~debian_changes (); - - /** - * Get a list of keys. - * @returns a list of keys. - */ - sbuild::string_list - get_keys () const; - - /** - * Check if a key exists. - * - * @param key the key to check for. - * @returns true if the key exists, otherwise false. - */ - bool - has_key (key_type const& key) const; - - /** - * Get a key line number. - * - * @param key the key to find. - * @returns the line number, or 0 if not available. - */ - size_type - get_line (key_type const& key) const; - - /** - * Get a key value. - * - * @param key the key to get. - * @param value the value to store the key's value in. This must - * be settable from an istream and be copyable. - * @returns true if the key was found, otherwise false (in which - * case value will be unchanged). - */ - template <typename T> - bool - get_value (key_type const& key, - T& value) const - { - sbuild::log_debug(sbuild::DEBUG_INFO) - << "Getting debian_changes key=" << key << std::endl; - const item_type *found_item = find_item(key); - if (found_item) - { - value_type const& strval(std::get<1>(*found_item)); - try - { - sbuild::parse_value(strval, value); - return true; - } - catch (sbuild::parse_value_error const& e) - { - size_type line = get_line(key); - if (line) - { - error ep(line, key, PASSTHROUGH_LK, e); - log_exception_warning(ep); - } - else - { - error ep(key, PASSTHROUGH_K, e); - log_exception_warning(ep); - } - return false; - } - } - sbuild::log_debug(sbuild::DEBUG_NOTICE) - << "key not found" << std::endl; - return false; - } - - /** - * Get a key value. If the value does not exist, is deprecated or - * obsolete, warn appropriately. - * - * @param key the key to get. - * @param priority the priority of the option. - * @param value the value to store the key's value in. This must - * be settable from an istream and be copyable. - * @returns true if the key was found, otherwise false (in which - * case value will be unchanged). - */ - template <typename T> - bool - get_value (key_type const& key, - priority priority, - T& value) const - { - bool status = get_value(key, value); - check_priority(key, priority, status); - return status; - } - - /** - * Get a key value. - * - * @param key the key to get. - * @param value the value to store the key's value in. - * @returns true if the key was found, otherwise false (in which - * case value will be unchanged). - */ - bool - get_value (key_type const& key, - value_type& value) const; - - /** - * Get a key value. If the value does not exist, is deprecated or - * obsolete, warn appropriately. - * - * @param key the key to get. - * @param priority the priority of the option. - * @param value the value to store the key's value in. - * @returns true if the key was found, otherwise false (in which - * case value will be unchanged). - */ - bool - get_value (key_type const& key, - priority priority, - value_type& value) const; - - /** - * Get a key value as a list. - * - * @param key the key to get. Note that if the key contains - * multiple lines, each line will be split using the separator. - * @param container the container to store the key's value in. - * The value type must be settable from an istream and be - * copyable. The list must be a container with a standard insert - * method. - * @param separator the characters to separate the values. - * @returns true if the key was found, otherwise false (in which - * case value will be undefined). - */ - template <typename C> - bool - get_list_value (key_type const& key, - C& container, - std::string const& separator) const - { - value_type item_value; - if (get_value(key, item_value)) - { - for (value_type::const_iterator vpos = item_value.begin(); - vpos != item_value.end(); - ++vpos) - { - sbuild::string_list items = - sbuild::split_string(*vpos, std::string(1, separator)); - for (sbuild::string_list::const_iterator pos = items.begin(); - pos != items.end(); - ++pos - ) - { - typename C::value_type tmp; - - try - { - sbuild::parse_value(*pos, tmp); - } - catch (sbuild::parse_value_error const& e) - { - size_type line = get_line(key); - if (line) - { - error ep(line, key, PASSTHROUGH_LK, e); - log_exception_warning(ep); - } - else - { - error ep(key, PASSTHROUGH_K, e); - log_exception_warning(ep); - } - return false; - } - - container.push_back(tmp); - } - } - return true; - } - return false; - } - - /** - * Get a key value as a list. If the value does not exist, is - * deprecated or obsolete, warn appropriately. - * - * @param key the key to get. - * @param priority the priority of the option. - * @param container the container to store the key's value in. - * The value type must be settable from an istream and be - * copyable. The list must be a container with a standard insert - * method. - * @returns true if the key was found, otherwise false (in which - * case value will be undefined). - */ - template <typename C> - bool - get_list_value (key_type const& key, - priority priority, - C& container) const - { - bool status = get_list_value(key, container); - check_priority(key, priority, status); - return status; - } - - /** - * Set a key value. - * - * @param key the key to set. - * @param value the value to get the key's value from. This must - * allow output to an ostream. - */ - template <typename T> - void - set_value (key_type const& key, - T const& value) - { - set_value(key, value, 0); - } - - /** - * Set a key value. - * - * @param key the key to set. - * @param value the value to get the key's value from. This must - * allow output to an ostream. - * @param line the line number in the input file, or 0 otherwise. - */ - template <typename T> - void - set_value (key_type const& key, - T const& value, - size_type line) - { - std::ostringstream os; - os.imbue(std::locale::classic()); - os << std::boolalpha << value; - value_type val; - val.push_back(os.str()); - - item_map_type::iterator pos = items.find(key); - if (pos != items.end()) - items.erase(pos); - items.insert - (item_map_type::value_type(key, - item_type(key, val, line))); - } - - /** - * Set a key value. - * - * @param key the key to set. - * @param value the value to get the key's value from. - */ - void - set_value (key_type const& key, - value_type const& value) - { - set_value(key, value, 0); - } - - /** - * Set a key value. - * - * @param key the key to set. - * @param value the value to get the key's value from. - * @param line the line number in the input file, or 0 otherwise. - */ - void - set_value (key_type const& key, - value_type const& value, - size_type line); - - /** - * Set a key value from a list. - * - * @param key the key to set. - * @param begin an iterator referring to the start of the - * list. The value type must allow output to an ostream. - * @param end an iterator referring to the end of the list. - */ - template <typename I> - void - set_list_value (key_type const& key, - I begin, - I end) - { - set_list_value (key, begin, end, 0); - } - - /** - * Set a key value from a list. - * - * @param key the key to set. - * @param begin an iterator referring to the start of the - * list. The value type must allow output to an ostream. - * @param end an iterator referring to the end of the list. - * @param separator the characters to separate the values. - * @param line the line number in the input file, or 0 otherwise. - */ - template <typename I> - void - set_list_value (key_type const& key, - I begin, - I end, - std::string const& separator, - size_type line) - { - std::string strval; - - for (I pos = begin; pos != end; ++ pos) - { - std::ostringstream os; - os.imbue(std::locale::classic()); - os << std::boolalpha << *pos; - if (os) - { - strval += os.str(); - if (pos + 1 != end) - strval += separator; - } - } - - set_value (key, strval, line); - } - - /** - * Remove a key. - * - * @param key the key to remove. - */ - void - remove_key (key_type const& key); - - /** - * Add a debian_changes to the debian_changes. - * - * @param rhs the debian_changes to add. - * @returns the modified debian_changes. - */ - debian_changes& - operator += (debian_changes const& rhs); - - /** - * Add a debian_changes to the debian_changes. - * - * @param lhs the debian_changes to add to. - * @param rhs the values to add. - * @returns the new debian_changes. - */ - friend debian_changes - operator + (debian_changes const& lhs, - debian_changes const& rhs); - - /** - * debian_changes initialisation from an istream. - * - * @param stream the stream to input from. - * @param dc the debian_changes to set. - * @returns the stream. - */ - template <class charT, class traits> - friend - std::basic_istream<charT,traits>& - operator >> (std::basic_istream<charT,traits>& stream, - debian_changes& dc) - { - debian_changes tmp; - size_t linecount = 0; - std::string line; - std::string key; - std::string value; - - while (std::getline(stream, line)) - { - linecount++; - - if (line.length() == 0) - { - // Empty line; do nothing. - } - else // Item - { - std::string::size_type pos = line.find_first_of('='); - if (pos == std::string::npos) - throw error(linecount, INVALID_LINE, line); - if (pos == 0) - throw error(linecount, NO_KEY, line); - key = line.substr(0, pos); - if (pos == line.length() - 1) - value = ""; - else - value = line.substr(pos + 1); - - // Insert item - if (tmp.has_key(key)) - throw error(linecount, DUPLICATE_KEY, key); - else - tmp.set_value(key, value, linecount); - } - } - - dc += tmp; - - return stream; - } - - /** - * debian_changes output to an ostream. - * - * @param stream the stream to output to. - * @param dc the debian_changes to output. - * @returns the stream. - */ - template <class charT, class traits> - friend - std::basic_ostream<charT,traits>& - operator << (std::basic_ostream<charT,traits>& stream, - debian_changes const& dc) - { - size_type group_count = 0; - - for (item_map_type::const_iterator it = dc.items.begin(); - it != dc.items.end(); - ++it) - { - item_type const& item = it->second; - key_type const& key(std::get<0>(item)); - value_type const& value(std::get<1>(item)); - - stream << key << '=' << value << '\n'; - } - - return stream; - } - - private: - /** - * Find a key by its name. - * - * @param key the key to find - * @returns the key, or 0 if not found. - */ - const item_type * - find_item (key_type const& key) const; - - /** - * Find a key by its name. - * - * @param key the key to find - * @returns the key, or 0 if not found. - */ - item_type * - find_item (key_type const& key); - - /** - * Check if a key is missing or present when not permitted. - * - * @param key the key to get. - * @param priority the key priority. - * @param valid true if key exists, false if not existing. - */ - void - check_priority (key_type const& key, - priority priority, - bool valid) const; - - /// The top-level items. - item_map_type items; - - public: - /** - * Set a key value from an object method return value. This is - * the same as calling set_value directly, but handles exceptions - * being thrown by the object method, which are turned into error - * exceptions. - * - * @param object the object to use. - * @param method the object method to call. - * @param debian_changes the debian_changes to use. - * @param key the key to set. - */ - template<class C, typename T> - static void - set_object_value (C const& object, - T (C::* method)() const, - debian_changes& debian_changes, - debian_changes::key_type const& key) - { - try - { - debian_changes.set_value(key, (object.*method)()); - } - catch (std::runtime_error const& e) - { - throw error(key, PASSTHROUGH_K, e); - } - } - - /** - * Set a key value from an object method return value reference. - * This is the same as calling set_value directly, but handles - * exceptions being thrown by the object method, which are turned - * into error exceptions. - * - * @param object the object to use. - * @param method the object method to call. - * @param debian_changes the debian_changes to use. - * @param key the key to set. - */ - template<class C, typename T> - static void - set_object_value (C const& object, - T const& (C::* method)() const, - debian_changes& debian_changes, - debian_changes::key_type const& key) - { - try - { - debian_changes.set_value(key, (object.*method)()); - } - catch (std::runtime_error const& e) - { - throw error(key, PASSTHROUGH_K, e); - } - } - - /** - * Set a key list value from an object method return value. The - * method must return a container with begin() and end() methods - * which return forward iterators. This is the same as calling - * set_list_value directly, but handles exceptions being thrown by - * the object method, which are turned into error exceptions. - * - * @param object the object to use. - * @param method the object method to call. - * @param debian_changes the debian_changes to use. - * @param key the key to set. - */ - template<class C, typename T> - static void - set_object_list_value (C const& object, - T (C::* method)() const, - debian_changes& debian_changes, - debian_changes::key_type const& key) - { - try - { - debian_changes.set_list_value(key, - (object.*method)().begin(), - (object.*method)().end()); - } - catch (std::runtime_error const& e) - { - throw error(key, PASSTHROUGH_K, e); - } - } - - /** - * Set a key list value from an object method return value. The - * method must return a container reference with begin() and end() - * methods which return forward iterators. This is the same as - * calling set_list_value directly, but handles exceptions being - * thrown by the object method, which are turned into error - * exceptions. - * - * @param object the object to use. - * @param method the object method to call. - * @param debian_changes the debian_changes to use. - * @param key the key to set. - */ - template<class C, typename T> - static void - set_object_list_value (C const& object, - T const& (C::* method)() const, - debian_changes& debian_changes, - debian_changes::key_type const& key) - { - try - { - debian_changes.set_list_value(key, - (object.*method)().begin(), - (object.*method)().end()); - } - catch (std::runtime_error const& e) - { - throw error(key, PASSTHROUGH_K, e); - } - } - - /** - * Get a key value and set it in an object using an object method. - * This is the same as calling get_value directly, but handles - * exceptions being thrown by the object method, and - * deserialisation errors, which are turned into error exceptions - * pointing to the key and line number in the input file. - * - * @param object the object to use. - * @param method the object method to call. - * @param debian_changes the debian_changes to use. - * @param key the key to set. - * @param priority the key priority. - */ - template<class C, typename T> - static void - get_object_value (C& object, - void (C::* method)(T param), - debian_changes const& debian_changes, - debian_changes::key_type const& key, - debian_changes::priority priority) - { - try - { - T value; - if (debian_changes.get_value(key, priority, value)) - (object.*method)(value); - } - catch (std::runtime_error const& e) - { - size_type line = debian_changes.get_line(key); - if (line) - throw error(line, key, PASSTHROUGH_LK, e); - else - throw error(key, PASSTHROUGH_K, e); - } - } - - /** - * Get a key value and set it by reference in an object using an - * object method. This is the same as calling get_value directly, - * but handles exceptions being thrown by the object method, and - * deserialisation errors, which are turned into error exceptions - * pointing to the key and line number in the input file. - * - * @param object the object to use. - * @param method the object method to call. - * @param debian_changes the debian_changes to use. - * @param key the key to set. - * @param priority the key priority. - */ - template<class C, typename T> - static void - get_object_value (C& object, - void (C::* method)(T const& param), - debian_changes const& debian_changes, - debian_changes::key_type const& key, - debian_changes::priority priority) - { - try - { - T value; - if (debian_changes.get_value(key, priority, value)) - (object.*method)(value); - } - catch (std::runtime_error const& e) - { - size_type line = debian_changes.get_line(key); - if (line) - throw error(line, key, PASSTHROUGH_LK, e); - else - throw error(key, PASSTHROUGH_K, e); - } - } - - /** - * Get a key list value and set it in an object using an object - * method. This is the same as calling get_list_value directly, - * but handles exceptions being thrown by the object method, and - * deserialisation errors, which are turned into error exceptions - * pointing to the key and line number in the input file. - * - * @param object the object to use. - * @param method the object method to call. - * @param debian_changes the debian_changes to use. - * @param key the key to set. - * @param priority the key priority. - */ - template<class C, typename T> - static void - get_object_list_value (C& object, - void (C::* method)(T param), - debian_changes const& debian_changes, - debian_changes::key_type const& key, - debian_changes::priority priority) - { - try - { - T value; - if (debian_changes.get_list_value(key, priority, value)) - (object.*method)(value); - } - catch (std::runtime_error const& e) - { - size_type line = debian_changes.get_line(key); - if (line) - throw error(line, key, PASSTHROUGH_LK, e); - else - throw error(key, PASSTHROUGH_K, e); - throw error(debian_changes.get_line(key), - key, e); - } - } - - /** - * Get a key list value and set it by reference in an object using - * an object method. This is the same as calling get_list_value - * directly, but handles exceptions being thrown by the object - * method, and deserialisation errors, which are turned into error - * exceptions pointing to the key and line number in the - * input file. - * - * @param object the object to use. - * @param method the object method to call. - * @param debian_changes the debian_changes to use. - * @param key the key to set. - * @param priority the key priority. - */ - template<class C, typename T> - static void - get_object_list_value (C& object, - void (C::* method)(T const& param), - debian_changes const& debian_changes, - debian_changes::key_type const& key, - debian_changes::priority priority) - { - try - { - T value; - if (debian_changes.get_list_value(key, priority, value)) - (object.*method)(value); - } - catch (std::runtime_error const& e) - { - size_type line = debian_changes.get_line(key); - if (line) - throw error(line, key, PASSTHROUGH_LK, e); - else - throw error(key, PASSTHROUGH_K, e); - throw error(debian_changes.get_line(key), - key, e); - } - } - }; - -} - -#endif /* CSBUILD_DEBIAN_CHANGES_H */ - -/* - * Local Variables: - * mode:C++ - * End: - */ diff --git a/bin/csbuild/main.cc b/bin/csbuild/main.cc deleted file mode 100644 index a2783aee..00000000 --- a/bin/csbuild/main.cc +++ /dev/null @@ -1,254 +0,0 @@ -/* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org> - * - * schroot is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * schroot is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * <http://www.gnu.org/licenses/>. - * - *********************************************************************/ - -#include <config.h> - -#include <sbuild/i18n.h> -#include <sbuild/log.h> -#include <sbuild/util.h> - -#include "main.h" - -#include <cerrno> -#include <cstdlib> -#include <ctime> -#include <iostream> -#include <locale> -#include <sstream> - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> - -#include <boost/format.hpp> - -using std::endl; -using boost::format; -using sbuild::_; -using sbuild::N_; -using namespace csbuild; - -main::main (options::ptr& options): - bin_common::main("csbuild", - // TRANSLATORS: '...' is an ellipsis e.g. U+2026, - // and '-' is an em-dash. - _("[OPTION…] — build Debian packages from source"), - options, - false), - opts(options) -{ -} - -main::~main () -{ -} - -void -main::action_build () -{ - sbuild::string_list command; - sbuild::environment env(environ); - - /// @todo Make sbuild binary configurable. - command.push_back("/usr/bin/sbuild"); - - /// @todo Handle incrementing debug level. - if (sbuild::debug_log_level != sbuild::DEBUG_NONE) - command.push_back("--debug"); - - if (opts->nolog) - command.push_back("--nolog"); - - if (opts->batch_mode) - command.push_back("--batch"); - - for (const auto& buildopt : opts->deb_build_options) - { - std::string bopt("--debbuildopt="); - bopt += buildopt; - command.push_back(bopt); - } - - if (!opts->distribution.empty()) - { - std::string dist("--dist="); - dist += opts->distribution; - command.push_back(dist); - } - - if (!opts->archive.empty()) - { - std::string archive("--archive="); - archive += opts->archive; - command.push_back(archive); - } - - if (!opts->build_arch.empty()) - { - std::string arch("--arch="); - arch += opts->build_arch; - command.push_back(arch); - } - - if (opts->build_arch_all) - command.push_back("--arch-all"); - - if (opts->build_source) - command.push_back("--source"); - - if (opts->force_orig_source) - command.push_back("--force-orig-source"); - - if (opts->bin_nmu) - { - std::string binnmu1("--make-binNMU="); - binnmu1 += opts->bin_nmu_changelog; - command.push_back(binnmu1); - - std::ostringstream binnmu2; - binnmu2.imbue(std::locale::classic()); - binnmu2 << "--binNMU="; - binnmu2 << opts->bin_nmu_version; - command.push_back(binnmu2.str()); - } - - if (!opts->append_version.empty()) - { - std::string append("--append-to-version="); - append += opts->append_version; - command.push_back(append); - } - - if (opts->apt_update) - command.push_back("apt-update"); - - if (!opts->chroot.empty()) - { - std::string chroot("--chroot="); - chroot += opts->chroot; - command.push_back(chroot); - } - - if (!opts->purge_string.empty()) - { - std::string purge("--purge="); - purge += opts->purge_string; - command.push_back(purge); - } - - if (!opts->purge_deps_string.empty()) - { - std::string purge_deps("--purge-deps="); - purge_deps += opts->purge_deps_string; - command.push_back(purge_deps); - } - - if (!opts->setup_hook_script.empty()) - { - std::string setup_hook("--setup-hook="); - setup_hook += opts->setup_hook_script; - command.push_back(setup_hook); - } - - if (!opts->keyid.empty()) - { - std::string keyid("--keyid="); - keyid += opts->keyid; - command.push_back(keyid); - } - - if (!opts->maintainer.empty()) - { - std::string maintainer("--maintainer="); - maintainer += opts->maintainer; - command.push_back(maintainer); - } - - if (!opts->uploader.empty()) - { - std::string uploader("--uploader="); - uploader += opts->uploader; - command.push_back(uploader); - } - - for (const auto& bd : opts->build_depends) - { - std::string dep("--add-depends="); - dep += bd; - command.push_back(dep); - } - - for (const auto& bc : opts->build_conflicts) - { - std::string dep("--add-conflicts="); - dep += bc; - command.push_back(dep); - } - - for (const auto& bdi : opts->build_depends_indep) - { - std::string dep("--add-depends="); - dep += bdi; - command.push_back(dep); - } - - for (const auto& bci : opts->build_conflicts_indep) - { - std::string dep("--add-conflicts="); - dep += bci; - command.push_back(dep); - } - - if (!opts->depends_algorithm.empty()) - { - std::string algo("check-depends-algorithm="); - algo += opts->depends_algorithm; - command.push_back(algo); - } - - if (opts->gcc_snapshot) - command.push_back("--use-snapshot"); - - std::copy(opts->packages.begin(), opts->packages.end(), - std::back_inserter(command)); - - sbuild::log_debug(sbuild::DEBUG_NOTICE) - << "command=" - << sbuild::string_list_to_string(command, ", ") - << std::endl; - - exec(command[0], command, env); - - // This should never be reached. - exit(EXIT_FAILURE); -} - -int -main::run_impl () -{ - if (this->opts->action == options::ACTION_HELP) - action_help(std::cerr); - else if (this->opts->action == options::ACTION_VERSION) - action_version(std::cerr); - else if (this->opts->action == options::ACTION_BUILD) - action_build(); - else - assert(0); // Invalid action. - - return EXIT_SUCCESS; -} diff --git a/bin/csbuild/main.h b/bin/csbuild/main.h deleted file mode 100644 index 8dd60395..00000000 --- a/bin/csbuild/main.h +++ /dev/null @@ -1,72 +0,0 @@ -/* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org> - * - * schroot is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * schroot is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * <http://www.gnu.org/licenses/>. - * - *********************************************************************/ - -#ifndef CSBUILD_MAIN_H -#define CSBUILD_MAIN_H - -#include <csbuild/options.h> - -#include <bin-common/main.h> - -namespace csbuild -{ - - /** - * Frontend for schroot. This class is used to "run" schroot. - */ - class main : public bin_common::main - { - public: - /** - * The constructor. - * - * @param options the command-line options to use. - */ - main (options::ptr& options); - - /// The destructor. - virtual ~main (); - - /** - * Build packages. - */ - virtual void - action_build (); - - /** - * Run the program. - * - * @returns 0 on success, 1 on failure or the exit status of the - * chroot command. - */ - virtual int - run_impl (); - - /// The program options. - options::ptr opts; - }; - -} - -#endif /* CSBUILD_MAIN_H */ - -/* - * Local Variables: - * mode:C++ - * End: - */ diff --git a/bin/csbuild/options.cc b/bin/csbuild/options.cc deleted file mode 100644 index b21f1a8a..00000000 --- a/bin/csbuild/options.cc +++ /dev/null @@ -1,247 +0,0 @@ -/* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org> - * - * schroot is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * schroot is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * <http://www.gnu.org/licenses/>. - * - *********************************************************************/ - -#include <config.h> - -#include <sbuild/i18n.h> -#include <sbuild/util.h> - -#include "options.h" - -#include <cstdlib> -#include <iostream> - -#include <boost/format.hpp> -#include <boost/program_options.hpp> - -using std::endl; -using boost::format; -using sbuild::string_list; -using sbuild::_; -namespace opt = boost::program_options; -using namespace csbuild; - -const options::action_type options::ACTION_BUILD ("build"); - -options::options (): - bin_common::options(), - packages(), - nolog(false), - batch_mode(false), - deb_build_options(), - deb_build_options_string(), - distribution(), - archive(), - build_arch(), - build_arch_all(false), - build_source(false), - force_orig_source(false), - bin_nmu(false), - bin_nmu_changelog(), - bin_nmu_version(0), - append_version(), - apt_update(false), - chroot(), - purge_string(), - purge(PURGE_ALWAYS), - purge_deps_string(), - purge_deps(PURGE_ALWAYS), - setup_hook_script(), - keyid(), - maintainer(), - uploader(), - build_depends(), - build_conflicts(), - build_depends_indep(), - build_conflicts_indep(), - depends_algorithm(), - gcc_snapshot(false), - build(_("Build options")), - version(_("Package version options")), - chrootopt(_("Build environment options")), - user(_("User options")), - depends(_("Build dependency override options")), - special(_("Special options")) -{ -} - -options::~options () -{ -} - -void -options::add_options () -{ - // Chain up to add basic options. - bin_common::options::add_options(); - - action.add(ACTION_BUILD); - action.set_default(ACTION_BUILD); - - actions.add_options() - ("build", - _("Build source packages (default)")); - - general.add_options() - ("nolog,n", _("Don't log program output")) - ("batch,b", _("Run in batch mode")); - - build.add_options() - ("debbuildopt", opt::value<sbuild::string_list>(&this->deb_build_options), - _("dpkg-buildpackage option")) - ("debbuildopts", opt::value<std::string>(&this->deb_build_options_string), - _("dpkg-buildpackage options (space-separated)")) - ("dist,d", opt::value<std::string>(&this->distribution), - _("Distribution to build for")) - ("archive", opt::value<std::string>(&this->archive), - _("Archive to build for")) - ("arch", opt::value<std::string>(&this->build_arch), - _("Build architecture")) - ("arch-all,A", - _("Build architecture \"all\" packages")) - ("source,s", - _("Build a source package")) - ("force-orig-source", - _("Force building of a source package, irrespective of Debian version")); - - version.add_options() - ("make-binNMU", opt::value<std::string>(&this->bin_nmu_changelog), - _("Make a binary non-maintainer upload (changelog entry)")) - ("binNMU", opt::value<unsigned int>(&this->bin_nmu_version), - _("Make a binary non-maintainer upload (binNMU number)")) - ("append-to-version", opt::value<std::string>(&this->append_version), - _("Append version suffix")); - - chrootopt.add_options() - ("apt-update", _("Update chroot environment")) - ("chroot,c", opt::value<std::string>(&this->chroot), - _("Chroot environment to build in")) - ("purge,p", opt::value<std::string>(&this->purge_string), - _("Purge build mode")) - ("purge-deps", opt::value<std::string>(&this->purge_deps_string), - _("Purge dependencies mode")) - ("setup-hook", opt::value<std::string>(&this->setup_hook_script), - _("Run setup hook script in chroot prior to building")); - - user.add_options() - ("keyid,k", opt::value<std::string>(&this->keyid), - _("GPG key identifier")) - ("maintainer,m", opt::value<std::string>(&this->maintainer), - _("Package maintainer")) - ("uploader,u", opt::value<std::string>(&this->uploader), - _("Package uploader")); - - depends.add_options() - ("add-depends", opt::value<string_list>(&this->build_depends), - _("Add a build dependency")) - ("add-conflicts", opt::value<string_list>(&this->build_conflicts), - _("Add a build conflict")) - ("add-depends-indep", opt::value<string_list>(&this->build_depends_indep), - _("Add an architecture-independent build dependency")) - ("add-conflicts-indep", opt::value<string_list>(&this->build_conflicts_indep), - _("Add an architecture-independent build conflict")); - - special.add_options() - ("check-depends-algorithm,C", opt::value<std::string>(&this->depends_algorithm), - _("Specify algorithm for dependency checking")) - ("gcc-snapshot,G", - _("Build using the current GCC development snapshot")); - - hidden.add_options() - ("package", opt::value<sbuild::string_list>(&this->packages), - _("Package to build")); - - positional.add("package", -1); -} - -void -options::add_option_groups () -{ - // Chain up to add basic option groups. - bin_common::options::add_option_groups(); - - visible.add(build); - global.add(build); - - visible.add(version); - global.add(version); - - visible.add(chrootopt); - global.add(chrootopt); - - visible.add(user); - global.add(user); - - visible.add(depends); - global.add(depends); - - visible.add(special); - global.add(special); -} - -void -options::check_options () -{ - // Chain up to check basic options. - bin_common::options::check_options(); - - if (vm.count("build")) - this->action = ACTION_BUILD; - - if (vm.count("nolog")) - this->nolog = true; - - if (vm.count("batch")) - this->batch_mode = true; - - if (vm.count("arch-all")) - this->build_arch_all = true; - - if (vm.count("source")) - this->build_source = true; - - if (vm.count("force-orig-source")) - this->force_orig_source = true; - - if (vm.count("binNMU") && vm.count("make-binNMU")) - this->bin_nmu = true; - else if (vm.count("binNMU")) - throw error - (_("--makebinNMU missing")); - else if (vm.count("make-binNMU")) - throw error - (_("--binNMU missing")); - - if (!deb_build_options_string.empty()) - { - string_list bopts = sbuild::split_string(deb_build_options_string, - std::string(1, ' ')); - - for (const auto& bopt : bopts) - { - if (!bopt.empty()) - deb_build_options.push_back(bopt); - } - } - - if (vm.count("apt-update")) - this->apt_update = true; - - if (vm.count("use-snapshot")) - this->gcc_snapshot = true; -} diff --git a/bin/csbuild/options.h b/bin/csbuild/options.h deleted file mode 100644 index da8ae578..00000000 --- a/bin/csbuild/options.h +++ /dev/null @@ -1,188 +0,0 @@ -/* Copyright © 2005-2013 Roger Leigh <rleigh@debian.org> - * - * schroot is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * schroot is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see - * <http://www.gnu.org/licenses/>. - * - *********************************************************************/ - -#ifndef CSBUILD_OPTIONS_H -#define CSBUILD_OPTIONS_H - -#include <bin-common/options.h> - -#include <sbuild/types.h> - -#include <string> - -namespace csbuild -{ - - /** - * csbuild command-line options. - */ - class options : public bin_common::options - { - public: - /// A shared_ptr to an options object. - typedef std::shared_ptr<options> ptr; - - /// Begin, run and end a session. - static const action_type ACTION_BUILD; - - /// The constructor. - options (); - - /// The destructor. - virtual ~options (); - - /// Packages to build - sbuild::string_list packages; - - /// No logging. - bool nolog; - - /// Batch mode. - bool batch_mode; - - /// dpkg-buildpackage options. - sbuild::string_list deb_build_options; - - // dpkg-buildpackage options (space-separated). - std::string deb_build_options_string; - - /// Distribution. - std::string distribution; - - /// Archive. - std::string archive; - - /// Architecture. - std::string build_arch; - - /// Build architecture all packages. - bool build_arch_all; - - /// Build source package. - bool build_source; - - /// Force original source. dpkg-buildpackage -sa. - bool force_orig_source; - - /// Make a binary non-maintainer upload. - bool bin_nmu; - - /// binNMU changelog entry. - std::string bin_nmu_changelog; - - /// binNMU version. - unsigned int bin_nmu_version; - - /// Suffix to append to version. - std::string append_version; - - - /// Update APT in chroot? - bool apt_update; - - /// Build chroot. - std::string chroot; - - /// Purge modes. - enum purge_mode - { - PURGE_ALWAYS, ///< Always purge build. - PURGE_SUCCESS, ///< Purge build on success only. - PURGE_NEVER ///< Never purge build. - }; - - /// Purge build directory. - std::string purge_string; - - /// Purge build directory. - purge_mode purge; - - /// Purge build dependencies. - std::string purge_deps_string; - - /// Purge build dependencies. - purge_mode purge_deps; - - /// Chroot setup hook script. - std::string setup_hook_script; - - /// Key ID. - std::string keyid; - - /// Maintainer. - std::string maintainer; - - /// Uploader. - std::string uploader; - - /// Manual build dependencies. - sbuild::string_list build_depends; - - /// Manual build conflicts. - sbuild::string_list build_conflicts; - - /// Manual architecture-independent build dependencies. - sbuild::string_list build_depends_indep; - - /// Manual architecture-independent build conflicts. - sbuild::string_list build_conflicts_indep; - - // Build dependency checking algorithm. - std::string depends_algorithm; - - /// Use the current GCC snapshot to build. - bool gcc_snapshot; - - protected: - virtual void - add_options (); - - virtual void - add_option_groups (); - - virtual void - check_options (); - - /// Build options group. - boost::program_options::options_description build; - - /// Package version group. - boost::program_options::options_description version; - - /// Chroot group. - boost::program_options::options_description chrootopt; - - /// User options group. - boost::program_options::options_description user; - - /// Manual depdenency options group. - boost::program_options::options_description depends; - - /// Special options group. - boost::program_options::options_description special; - }; - -} - -#endif /* CSBUILD_OPTIONS_H */ - -/* - * Local Variables: - * mode:C++ - * End: - */ |