diff options
-rw-r--r-- | Makefile.am | 2 | ||||
-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 | ||||
-rw-r--r-- | bin/schroot-sbuild/.gitignore | 1 | ||||
-rw-r--r-- | bin/schroot-sbuild/Makefile.am | 35 | ||||
-rw-r--r-- | bin/schroot-sbuild/main.cc | 57 | ||||
-rw-r--r-- | bin/schroot-sbuild/main.h | 59 | ||||
-rw-r--r-- | bin/schroot-sbuild/schroot-sbuild.cc | 44 | ||||
-rw-r--r-- | bin/schroot-sbuild/session.cc | 68 | ||||
-rw-r--r-- | bin/schroot-sbuild/session.h | 60 | ||||
-rw-r--r-- | bin/schroot/Makefile.am | 12 | ||||
-rw-r--r-- | configure.ac | 13 | ||||
-rw-r--r-- | man/Makefile.am | 8 | ||||
-rw-r--r-- | man/csbuild.1.man | 293 | ||||
-rw-r--r-- | man/po4a.cfg | 4 | ||||
-rw-r--r-- | po/POTFILES.in | 4 | ||||
-rw-r--r-- | scripts/global.mk | 4 |
24 files changed, 6 insertions, 2673 deletions
diff --git a/Makefile.am b/Makefile.am index 8be35386..e9896223 100644 --- a/Makefile.am +++ b/Makefile.am @@ -37,10 +37,8 @@ man_MANS = CLEANFILES = EXTRA_DIST = -include bin/csbuild/Makefile.am include bin/dchroot-dsa/Makefile.am include bin/dchroot/Makefile.am -include bin/schroot-sbuild/Makefile.am include bin/schroot/Makefile.am include contrib/setup.d/Makefile.am include doc/Makefile.am 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: - */ diff --git a/bin/schroot-sbuild/.gitignore b/bin/schroot-sbuild/.gitignore deleted file mode 100644 index 29cd6e4b..00000000 --- a/bin/schroot-sbuild/.gitignore +++ /dev/null @@ -1 +0,0 @@ -schroot-sbuild diff --git a/bin/schroot-sbuild/Makefile.am b/bin/schroot-sbuild/Makefile.am deleted file mode 100644 index 75881544..00000000 --- a/bin/schroot-sbuild/Makefile.am +++ /dev/null @@ -1,35 +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/>. -# -##################################################################### - -schroot_sbuild = bin/schroot-sbuild/schroot-sbuild - -bin_PROGRAMS += $(schroot_sbuild) - -bin_schroot_sbuild_schroot_sbuild_SOURCES = \ - bin/schroot-sbuild/session.h \ - bin/schroot-sbuild/session.cc \ - bin/schroot-sbuild/main.h \ - bin/schroot-sbuild/main.cc \ - bin/schroot-sbuild/schroot-sbuild.cc -bin_schroot_sbuild_schroot_sbuild_LDADD = $(top_builddir)/bin/schroot/libschroot-all.la - -install-exec-hook:: -# Install setuid root. - if [ -f "$(DESTDIR)$(bindir)/schroot-sbuild" ]; then \ - chmod 4755 "$(DESTDIR)$(bindir)/schroot-sbuild"; \ - fi diff --git a/bin/schroot-sbuild/main.cc b/bin/schroot-sbuild/main.cc deleted file mode 100644 index b5c0e347..00000000 --- a/bin/schroot-sbuild/main.cc +++ /dev/null @@ -1,57 +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 "main.h" -#include "session.h" - -#include <cstdlib> -#include <iostream> -#include <locale> - -#include <sys/types.h> -#include <sys/stat.h> -#include <termios.h> -#include <unistd.h> - -#include <boost/format.hpp> - -using std::endl; -using sbuild::_; -using boost::format; -using schroot::options_base; -using namespace schroot_sbuild; - -main::main (schroot::options_base::ptr& options): - schroot::main(options) -{ -} - -main::~main () -{ -} - -void -main::add_session_auth () -{ - schroot::main::add_session_auth(); - - if (this->session->is_group_member("sbuild")) - this->session->get_auth()->set_ruser(std::string("sbuild")); -} diff --git a/bin/schroot-sbuild/main.h b/bin/schroot-sbuild/main.h deleted file mode 100644 index 10d3d598..00000000 --- a/bin/schroot-sbuild/main.h +++ /dev/null @@ -1,59 +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 SCHROOT_SBUILD_MAIN_H -#define SCHROOT_SBUILD_MAIN_H - -#include <schroot/main.h> - -/** - * schroot-sbuild program components. - */ -namespace schroot_sbuild -{ - - /** - * Frontend for schroot-sbuild. This class is used to "run" schroot-sbuild. - */ - class main : public schroot::main - { - public: - /** - * The constructor. - * - * @param options the command-line options to use. - */ - main (schroot::options_base::ptr& options); - - /// The destructor. - virtual ~main (); - - protected: - virtual void - add_session_auth (); - }; - -} - -#endif /* SCHROOT_SBUILD_MAIN_H */ - -/* - * Local Variables: - * mode:C++ - * End: - */ diff --git a/bin/schroot-sbuild/schroot-sbuild.cc b/bin/schroot-sbuild/schroot-sbuild.cc deleted file mode 100644 index c6d4c966..00000000 --- a/bin/schroot-sbuild/schroot-sbuild.cc +++ /dev/null @@ -1,44 +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 "main.h" -#include <schroot/options.h> - -#include <bin-common/run.h> - -using std::endl; -using boost::format; -using namespace schroot_sbuild; - -/** - * 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<schroot::options, schroot_sbuild::main>(argc, argv); -} diff --git a/bin/schroot-sbuild/session.cc b/bin/schroot-sbuild/session.cc deleted file mode 100644 index 0b8bae53..00000000 --- a/bin/schroot-sbuild/session.cc +++ /dev/null @@ -1,68 +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/util.h> - -#include "session.h" - -#include <cassert> -#include <cerrno> -#include <cstdlib> -#include <cstring> -#include <iostream> -#include <memory> - -#include <unistd.h> - -#include <syslog.h> - -#include <boost/format.hpp> - -using std::cout; -using std::endl; -using sbuild::_; -using sbuild::auth; -using boost::format; -using namespace schroot_sbuild; - -session::session (std::string const& service, - operation operation, - sbuild::session::chroot_list const& chroots): - sbuild::session(service, operation, chroots) -{ -} - -session::~session () -{ -} - -sbuild::auth::status -session::get_chroot_auth_status (sbuild::auth::status status, - sbuild::chroot::ptr const& chroot) const -{ - sbuild::passwd pwent("sbuild"); - - - status = auth::change_auth(status, - sbuild::session::get_chroot_auth_status(status, - chroot)); - - return status; -} diff --git a/bin/schroot-sbuild/session.h b/bin/schroot-sbuild/session.h deleted file mode 100644 index 9be0cec6..00000000 --- a/bin/schroot-sbuild/session.h +++ /dev/null @@ -1,60 +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 SCHROOT_SBUILD_SESSION_H -#define SCHROOT_SBUILD_SESSION_H - -#include <sbuild/session.h> - -namespace schroot_sbuild -{ - - /** - * Session handler for schroot-sbuild sessions. - */ - class session : public sbuild::session - { - public: - /** - * The constructor. - * - * @param service the PAM service name. - * @param operation the session operation to perform. - * @param chroots the chroots to act upon. - */ - session (std::string const& service, - operation operation, - sbuild::session::chroot_list const& chroots); - - /// The destructor. - virtual ~session (); - - virtual sbuild::auth::status - get_chroot_auth_status (sbuild::auth::status status, - sbuild::chroot::ptr const& chroot) const; - }; - -} - -#endif /* SCHROOT_SBUILD_SESSION_H */ - -/* - * Local Variables: - * mode:C++ - * End: - */ diff --git a/bin/schroot/Makefile.am b/bin/schroot/Makefile.am index 0ef2c181..e675220a 100644 --- a/bin/schroot/Makefile.am +++ b/bin/schroot/Makefile.am @@ -17,8 +17,7 @@ ##################################################################### noinst_LTLIBRARIES += \ - bin/schroot/libschroot.la \ - bin/schroot/libschroot-all.la + bin/schroot/libschroot.la bin_PROGRAMS += bin/schroot/schroot @@ -31,14 +30,11 @@ bin_schroot_libschroot_la_SOURCES = \ bin/schroot/main.cc bin_schroot_libschroot_la_LIBADD = $(top_builddir)/lib/bin-common/libbin-common.la -bin_schroot_libschroot_all_la_SOURCES = \ +bin_schroot_schroot_SOURCES = \ + bin/schroot/schroot.cc \ bin/schroot/options.h \ bin/schroot/options.cc -bin_schroot_libschroot_all_la_LIBADD = bin/schroot/libschroot.la - -bin_schroot_schroot_SOURCES = \ - bin/schroot/schroot.cc -bin_schroot_schroot_LDADD = bin/schroot/libschroot-all.la +bin_schroot_schroot_LDADD = bin/schroot/libschroot.la install-exec-hook:: # Install setuid root. diff --git a/configure.ac b/configure.ac index 640e94de..71275da9 100644 --- a/configure.ac +++ b/configure.ac @@ -119,19 +119,6 @@ AC_MSG_RESULT([$enable_dchroot_dsa_compat]) AM_CONDITIONAL([BUILD_DCHROOT_DSA], [test "$enable_dchroot_dsa_compat" = "yes"]) AM_CONDITIONAL([BUILD_LIBDCHROOT], [test "$enable_dchroot_compat" = "yes" || test "$enable_dchroot_dsa_compat" = "yes"]) -AC_MSG_CHECKING([whether to enable csbuild]) -AC_ARG_ENABLE([csbuild], [AS_HELP_STRING([--enable-csbuild], [Enable csbuild])], - [ case "${enableval}" in - yes) enable_csbuild_compat="yes" ;; - no) enable_csbuild_compat="no" ;; - *) AC_MSG_RESULT([unknown]) - AC_MSG_ERROR([bad value ${enableval} for --enable-csbuild]) ;; - esac ], - [ enable_csbuild_compat="no" ]) - -AC_MSG_RESULT([$enable_csbuild_compat]) -AM_CONDITIONAL([BUILD_CSBUILD], [test "$enable_csbuild_compat" = "yes"]) - AC_MSG_CHECKING([whether to enable debugging messages]) AC_ARG_ENABLE([debug], [AS_HELP_STRING([--enable-debug], [Enable debugging messages])], [ case "${enableval}" in diff --git a/man/Makefile.am b/man/Makefile.am index 7e8d691e..bf953df5 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -41,12 +41,7 @@ if BUILD_DCHROOT_DSA dchroot_dsa_mans = man/dchroot-dsa.1 endif -if BUILD_CSBUILD -csbuild_mans = man/csbuild.1 -endif - MAN_FILES = \ - man/csbuild.1.man \ man/dchroot.1.man \ man/dchroot-dsa.1.man \ man/schroot.1.man \ @@ -67,8 +62,7 @@ man_MANS += \ man/schroot-script-config.5 \ man/schroot-faq.7 \ $(dchroot_mans) \ - $(dchroot_dsa_mans) \ - $(csbuild_mans) + $(dchroot_dsa_mans) EXTRA_DIST += \ $(MAN_FILES) \ diff --git a/man/csbuild.1.man b/man/csbuild.1.man deleted file mode 100644 index e8994947..00000000 --- a/man/csbuild.1.man +++ /dev/null @@ -1,293 +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/>. -.\" -.so config.man -.ds PROGRAM csbuild -.TH CSBUILD 1 "\*[RELEASE_DATE]" "Version \*[VERSION]" "Debian sbuild" -.SH NAME -csbuild \- build debian packages from source -.SH SYNOPSIS -.B csbuild -.RB [ \-h \[or] \-\-help " \[or] " \-V \[or] \-\-version -.RB " \[or] " \-l \[or] \-\-list " \[or] " \-i \[or] \-\-info -.RB " \[or] " \-\-config " \[or] " \-\-location ] -.RB [ "\-\-directory=\fIdirectory\fP" ] -.RB [ \-d \[or] \-\-preserve\-environment ] -.RB [ \-q \[or] \-\-quiet " \[or] " \-v \[or] \-\-verbose ] -.RB [ "\-c \fIchroot\fP" \[or] "\-\-chroot=\fIchroot\fP" -.RB " \[or] " \-\-all ] -.RB [ COMMAND " [ " ARG1 " [ " ARG2 " [ " ARGn ]]]] -.SH DESCRIPTION -\fBcsbuild\fP allows the user to run a command or a login shell in a chroot -environment. If no command is specified, a login shell will be started in the -user's home directory inside the chroot. -.PP -The command is one or more arguments which will be run in the user's default -shell using its \fI\-c\fP option. As a result, shell code may be embedded -in this argument. If multiple command options are used, they are concatenated -together, separated by spaces. Users should be aware of the shell quoting -issues this presents, and should use \fBschroot\fP if necessary, which does not -have any quoting issues. -.PP -The directory the command or login shell is run in depends upon the context. -See \fI\-\-directory\fP option below for a complete description. -.PP -This version of csbuild is a compatibility wrapper around the -.BR schroot (1) -program. It is provided for backward compatibility with the csbuild -command-line options, but schroot is recommended for future use. See the -section \[lq]\fIMigration\fP\[rq] below for help migrating an existing csbuild -configuration to schroot. See the section \[lq]\fIIncompatibilities\fP\[rq] -below for known incompatibilities with older versions of csbuild. -.PP -If no chroot is specified, the chroot name or alias \[oq]default\[cq] will be -used as a fallback. If using the configuration in \fI\*[CSBUILD_CONF]\fP, the -first chroot in the file is the default. -.SH OPTIONS -\fBcsbuild\fP accepts the following options: -.SS Basic options -.TP -.BR \-h ", " \-\-help -Show help summary. -.TP -.BR \-a ", " \-\-all -Select all chroots. -.TP -.BR \-c ", " \-\-chroot=\fIchroot\fP -Specify a chroot to use. This option may be used multiple times to specify -more than one chroot, in which case its effect is similar to \fI\-\-all\fP. -.TP -.BR \-l ", " \-\-list -List all available chroots. -.TP -.BR \-i ", " \-\-info -Print detailed information about the specified chroots. Note that earlier -versions of csbuild did not include this option. -.TP -.BR \-p ", " \-\-path -Print location (path) of the specified chroots. -.TP -.BR \-\-config -Print configuration of the specified chroots. This is useful for testing that -the configuration in use is the same as the configuration file. Any comments -in the original file will be missing. Note that earlier versions of csbuild -did not include this option. -.TP -.BR \-d ", " \-\-directory=\fIdirectory\fP -Change to \fIdirectory\fP inside the chroot before running the command or login -shell. If \fIdirectory\fP is not available, csbuild will exit with an error -status. -.IP -The default behaviour is as follows (all directory paths are inside the -chroot). Unless the \fI\-\-preserve\-environment\fP option is used to preserve -the environment, the login shell or command will run in the user's home -directory, or \fI/\fP if the home directory is not available. When the -\fI\-\-preserve\-environment\fP option is used, it will attempt to use the -current working directory, again falling back to \fI/\fP if it is not -accessible. If none of the directories are available, csbuild will exit with -an error status. -.TP -.BR \-d ", " \-\-preserve\-environment -Preserve the user's environment inside the chroot environment. The default is -to use a clean environment; this option copies the entire user environment and -sets it in the session. -.TP -.BR \-q ", " \-\-quiet -Print only essential messages. -.TP -.BR \-v ", " \-\-verbose -Print all messages. Note that earlier versions of csbuild did not include this -option. -.TP -.BR \-V ", " \-\-version -Print version information. -.PP -Note that earlier versions of csbuild did not provide long options. -.SH CONFIGURATION -The csbuild configuration file, \fI\*[CSBUILD_CONF]\fP, used by earlier versions -of csbuild, has the following format: -.IP \[bu] -\[oq]#\[cq] starts a comment line. -.IP \[bu] -Blank lines are ignored. -.IP \[bu] -Chroot definitions are a single line containing an \f[CBI]identifier\fP, -\f[CBI]path\fP, and an optional \f[CBI]personality\fP separated by whitespace. -.IP \[bu] -The first chroot is also the default chroot. -.PP -An example file: -.PP -.RS -.EX -# Example comment - -sarge /srv/chroot/sarge -sid /srv/chroot/sid linux32 -.EE -.RE -.PP -This file defines a chroot called \[oq]sarge\[cq], located at -\fI/srv/chroot/sarge\fP, and a second chroot called \[oq]sid\[cq], located at -\fI/srv/chroot/sid\fP. The second chroot uses the \[oq]linux32\[cq] -personality, which allows a 32-bit chroot to be used on a 64-bit system. -\[oq]sarge\[cq] is the default chroot, because it was listed first, which means -if the \fI\-c\fP option is omitted this chroot will be used. -.SH INCOMPATIBILITIES -.SS Debian csbuild prior to version 0.99.0 -.IP \[bu] -Log messages are worded and formatted differently. -.IP \[bu] -The parsing of \fI\*[CSBUILD_CONF]\fP uses a smaller list of allowed whitespace -characters (space and tab), which may cause a parse error during tokenising if -the file contains odd characters as separators, such as carriage returns, -vertical tabs and form feeds. -.IP \[bu] -.BR su (1) -is no longer used to run commands in the chroot; this is done by csbuild -internally. This change may cause subtle differences. If you find an -incompatibility, please report it so it may be corrected. -.IP \[bu] -csbuild provides a restricted subset of the functionality implemented by -\fBschroot\fP, but is still schroot underneath. Thus csbuild is still subject -to schroot security checking, including PAM authentication and authorisation, -and session management, for example, and hence may behave slightly differently -to older csbuild versions in some circumstances. -.SS DSA csbuild -Machines run by the Debian System Administrators for the Debian Project have a -\fBcsbuild-dsa\fP package which provides an alternate csbuild implementation. -.IP \[bu] -All the above incompatibilities apply. -.IP \[bu] -This version of csbuild has incompatible command-line options, and while some -of those options are supported or have equivalent options by a different name, -the \fI\-c\fP option is not required to specify a chroot, and this version of -csbuild cannot implement this behaviour in a backward-compatible manner -(because if \fI\-c\fP is omitted, the default chroot is used). DSA csbuild -uses the first non-option as the chroot to use, only allowing one chroot to be -used at once. -.IP \[bu] -This version of csbuild has an incompatible format for \fIcsbuild.conf\fP. -While the first two fields are the same, the remaining fields are an optional -\f[CBI]users\fP, a list of users permitted to access the chroot, instead of the -\f[CI]personality\fP field allowed by this version. If access restrictions are -needed, please use \fI\*[SCHROOT_CONF]\fP and add the allowed users there, as -shown in \[lq]\fIMigration\fP\[rq] below. -.SH MIGRATION -To migrate an existing \fBcsbuild\fP configuration to \fBschroot\fP, perform -the following steps: -.IP 1 -Dump the csbuild configuration in schroot keyfile format to -\fI\*[SCHROOT_CONF]\fP. -.PP -.RS -.EX -# \f[CB]csbuild --config >> \*[SCHROOT_CONF]\fP\[CR] -.EE -.RE -.PP -.IP 2 -Edit \fI\*[SCHROOT_CONF]\fP to add access to the users and/or groups which are to -be allowed to access the chroots, and make any other desired changes to the -configuration. See -.BR schroot.conf (5). -.IP 3 -Remove \fI\*[CSBUILD_CONF]\fP, so that csbuild will subsequently use -\fI\*[SCHROOT_CONF]\fP for its configuration. -.SH EXAMPLES -.EX -$ \f[CB]csbuild \-l\fP\[CR] -Available chroots: sarge [default], sid - -$ \f[CB]csbuild \-p sid\fP\[CR] -/srv/chroot/sid - -$ \f[CB]csbuild \-q \-c sid \-\- uname \-smr\fP\[CR] -Linux 2.6.16.17 ppc -$ \f[CB]csbuild \-q \-c sid \-\- "uname \-smr"\fP\[CR] -Linux 2.6.16.17 ppc - -$ \f[CB]csbuild -q -c sid "ls -1 / | tac | head -n 4"\fP\[CR] -var -usr -tmp -sys - -$ \f[CB]csbuild \-c sid\fP\[CR] -I: [sid chroot] Running login shell: \[lq]/bin/bash\[rq] -$ -.EE -.LP -Use \fI\-\-\fP to allow options beginning with \[oq]\-\[cq] or \[oq]\-\-\[cq] -in the command to run in the chroot. This prevents them being interpreted as -options for csbuild itself. Note that the top line was echoed to standard -error, and the remaining lines to standard output. This is intentional, so -that program output from commands run in the chroot may be piped and redirected -as required; the data will be the same as if the command was run directly on -the host system. -.SH TROUBLESHOOTING -If something is not working, and it's not clear from the error messages what is -wrong, try using the \fB\-\-debug=\fP\fIlevel\fP option to turn on debugging -messages. This gives a great deal more information. Valid debug levels are -\[oq]none\[cq], and \[oq]notice\[cq], \[oq]info\[cq], \[oq]warning\[cq] and -\[oq]critical\[cq] in order of increasing severity. The lower the severity -level, the more output. -.PP -If you are still having trouble, the developers may be contacted on the mailing -list: -.br -\f[CR]Debian\ buildd-tools\ Developers -.br -<buildd-tools-devel@lists.alioth.debian.org>\fP -.SH BUGS -On the \fBmips\fP and \fBmipsel\fP architectures, Linux kernels up to and -including at least version 2.6.17 have broken -.BR personality (2) -support, which results in a failure to set the personality. This will be seen -as an \[lq]Operation not permitted\[rq] (EPERM) error. To work around this -problem, set \f[CI]personality\fP to \[oq]undefined\[cq], or upgrade to a more -recent kernel. -.SH FILES -.TP -\f[BI]\*[CSBUILD_CONF]\fP -The system-wide \fBcsbuild\fP chroot definition file. This file must be owned -by the root user, and not be writable by other. If present, this file will be -used in preference to \fI\*[SCHROOT_CONF]\fP. -.TP -\f[BI]\*[SCHROOT_CONF]\fP -The system-wide \fBschroot\fP definition file. This file must be owned by the -root user, and not be writable by other. It is recommended that this file be -used in preference to \fI\*[CSBUILD_CONF]\fP, because the chroots can be used -interchangeably with schroot, and the user and group security policies provided -by schroot are also enforced. -.so authors.man -.PP -This implementation of csbuild uses the same command-line options as the -original \fBsbuild\fP by David Kimdon \f[CR]<dwhedon@debian.org>\fP, but is an -independent implementation. -.so copyright.man -.SH SEE ALSO -.BR schroot (1), -.BR sbuild (1), -.BR chroot (2), -.BR schroot-setup (5), -.BR schroot.conf (5). -.\"# -.\"# The following sets edit modes for GNU EMACS -.\"# Local Variables: -.\"# mode:nroff -.\"# fill-column:79 -.\"# End: diff --git a/man/po4a.cfg b/man/po4a.cfg index 07d627b6..747c5025 100644 --- a/man/po4a.cfg +++ b/man/po4a.cfg @@ -20,7 +20,3 @@ [type: man] man/dchroot-dsa.1.man $lang:man/translated/$lang/dchroot-dsa.1.man \ add_$lang:?add/$lang.add -# The following files could also be offered for translation, maybe separately -#[type: man] csbuild.1.man $lang:man/translated/$lang/csbuild.1.man \ -# add_$lang:?add/$lang.add - diff --git a/po/POTFILES.in b/po/POTFILES.in index 88610147..b04d76b8 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,7 +1,3 @@ -bin/csbuild/csbuild.cc -bin/csbuild/debian-changes.cc -bin/csbuild/main.cc -bin/csbuild/options.cc bin/dchroot-dsa/dchroot-dsa.cc bin/dchroot-dsa/main.cc bin/dchroot-dsa/options.cc diff --git a/scripts/global.mk b/scripts/global.mk index dd34d6f1..03d6dcfb 100644 --- a/scripts/global.mk +++ b/scripts/global.mk @@ -27,7 +27,6 @@ schroot_sysconf_setupdir=$(schroot_sysconfdir)/setup.d schroot_setupdatadir=$(pkgdatadir)/setup SCHROOT_CONF=$(schroot_sysconfdir)/schroot.conf -CSBUILD_CONF=$(sysconfdir)/csbuild.conf # Global options for use in all Makefiles. AM_CXXFLAGS = -I$(top_builddir)/lib -I$(top_srcdir)/lib -I$(top_srcdir)/bin $(LOCAL_CXXFLAGS) $(PTHREAD_CFLAGS) -pedantic -Wall -Wcast-align -Wwrite-strings -Wswitch-default -Wcast-qual -Wunused-variable -Wredundant-decls -Wctor-dtor-privacy -Wnon-virtual-dtor -Wreorder -Wold-style-cast -Woverloaded-virtual -fstrict-aliasing @@ -50,5 +49,4 @@ DEFS = -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE \ -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \ -DSCHROOT_DATA_DIR=\"$(schroot_datadir)\" \ -DSCHROOT_MODULE_DIR=\"$(schroot_moduledir)\" \ --DLOCALEDIR=\"$(localedir)\" \ --DCSBUILD_CONF=\"$(CSBUILD_CONF)\" +-DLOCALEDIR=\"$(localedir)\" |