00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include <config.h>
00021
00022 #include "sbuild-chroot-source.h"
00023 #include "sbuild-format-detail.h"
00024 #include "sbuild-lock.h"
00025
00026 #include <algorithm>
00027
00028 #include <boost/format.hpp>
00029
00030 using boost::format;
00031 using namespace sbuild;
00032
00033 chroot_source::chroot_source ():
00034 chroot()
00035 {
00036 }
00037
00038 chroot_source::~chroot_source ()
00039 {
00040 }
00041
00042 void
00043 chroot_source::clone_source_setup (chroot::ptr& clone) const
00044 {
00045 clone->set_name(clone->get_name() + "-source");
00046 clone->set_description
00047 (clone->get_description() + ' ' + _("(source chroot)"));
00048 clone->set_original(false);
00049 clone->set_users(this->get_source_users());
00050 clone->set_groups(this->get_source_groups());
00051 clone->set_root_users(this->get_source_root_users());
00052 clone->set_root_groups(this->get_source_root_groups());
00053 string_list const& aliases = clone->get_aliases();
00054 string_list source_aliases;
00055 for (string_list::const_iterator alias = aliases.begin();
00056 alias != aliases.end();
00057 ++alias)
00058 source_aliases.push_back(*alias + "-source");
00059 clone->set_aliases(source_aliases);
00060 }
00061
00062 string_list const&
00063 chroot_source::get_source_users () const
00064 {
00065 return this->source_users;
00066 }
00067
00068 void
00069 chroot_source::set_source_users (string_list const& source_users)
00070 {
00071 this->source_users = source_users;
00072 }
00073
00074 string_list const&
00075 chroot_source::get_source_groups () const
00076 {
00077 return this->source_groups;
00078 }
00079
00080 void
00081 chroot_source::set_source_groups (string_list const& source_groups)
00082 {
00083 this->source_groups = source_groups;
00084 }
00085
00086 string_list const&
00087 chroot_source::get_source_root_users () const
00088 {
00089 return this->source_root_users;
00090 }
00091
00092 void
00093 chroot_source::set_source_root_users (string_list const& users)
00094 {
00095 this->source_root_users = users;
00096 }
00097
00098 string_list const&
00099 chroot_source::get_source_root_groups () const
00100 {
00101 return this->source_root_groups;
00102 }
00103
00104 void
00105 chroot_source::set_source_root_groups (string_list const& groups)
00106 {
00107 this->source_root_groups = groups;
00108 }
00109
00110 void
00111 chroot_source::setup_env (environment& env)
00112 {
00113 }
00114
00115 void
00116 chroot_source::get_details (format_detail& detail) const
00117 {
00118 detail
00119 .add(_("Source Users"), get_source_users())
00120 .add(_("Source Groups"), get_source_groups())
00121 .add(_("Source Root Users"), get_source_root_users())
00122 .add(_("Source Root Groups"), get_source_root_groups());
00123 }
00124
00125 void
00126 chroot_source::get_keyfile (keyfile& keyfile) const
00127 {
00128 keyfile::set_object_list_value(*this, &chroot_source::get_source_users,
00129 keyfile, get_name(), "source-users");
00130
00131 keyfile::set_object_list_value(*this, &chroot_source::get_source_groups,
00132 keyfile, get_name(), "source-groups");
00133
00134 keyfile::set_object_list_value(*this, &chroot_source::get_source_root_users,
00135 keyfile, get_name(), "source-root-users");
00136
00137 keyfile::set_object_list_value(*this, &chroot_source::get_source_root_groups,
00138 keyfile, get_name(), "source-root-groups");
00139 }
00140
00141 void
00142 chroot_source::set_keyfile (keyfile const& keyfile)
00143 {
00144 keyfile::get_object_list_value(*this, &chroot_source::set_source_users,
00145 keyfile, get_name(), "source-users",
00146 keyfile::PRIORITY_OPTIONAL);
00147
00148 keyfile::get_object_list_value(*this, &chroot_source::set_source_groups,
00149 keyfile, get_name(), "source-groups",
00150 keyfile::PRIORITY_OPTIONAL);
00151
00152 keyfile::get_object_list_value(*this, &chroot_source::set_source_root_users,
00153 keyfile, get_name(), "source-root-users",
00154 keyfile::PRIORITY_OPTIONAL);
00155
00156 keyfile::get_object_list_value(*this, &chroot_source::set_source_root_groups,
00157 keyfile, get_name(), "source-root-groups",
00158 keyfile::PRIORITY_OPTIONAL);
00159 }