source: trunk/debathena/third/schroot/sbuild/sbuild-chroot-facet-personality.cc @ 24167

Revision 24167, 2.8 KB checked in by broder, 15 years ago (diff)
Import schroot upstream into subversion.
Line 
1/* Copyright © 2005-2009  Roger Leigh <rleigh@debian.org>
2 *
3 * schroot is free software: you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by
5 * the Free Software Foundation, either version 3 of the License, or
6 * (at your option) any later version.
7 *
8 * schroot is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
11 * General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program.  If not, see
15 * <http://www.gnu.org/licenses/>.
16 *
17 *********************************************************************/
18
19#include <config.h>
20
21#include "sbuild-chroot.h"
22#include "sbuild-chroot-facet-personality.h"
23
24#include <boost/format.hpp>
25
26using boost::format;
27using namespace sbuild;
28
29chroot_facet_personality::chroot_facet_personality ():
30  chroot_facet(),
31  persona(
32#ifdef __linux__
33          personality("linux")
34#else
35          personality("undefined")
36#endif
37          )
38{
39}
40
41chroot_facet_personality::~chroot_facet_personality ()
42{
43}
44
45chroot_facet_personality::ptr
46chroot_facet_personality::create ()
47{
48  return ptr(new chroot_facet_personality());
49}
50
51chroot_facet::ptr
52chroot_facet_personality::clone () const
53{
54  return ptr(new chroot_facet_personality(*this));
55}
56
57std::string const&
58chroot_facet_personality::get_name () const
59{
60  static const std::string name("personality");
61
62  return name;
63}
64
65personality const&
66chroot_facet_personality::get_persona () const
67{
68  return this->persona;
69}
70
71void
72chroot_facet_personality::set_persona (personality const& persona)
73{
74  this->persona = persona;
75}
76
77void
78chroot_facet_personality::setup_env (chroot const& chroot,
79                                     environment&  env) const
80{
81}
82
83chroot::session_flags
84chroot_facet_personality::get_session_flags (chroot const& chroot) const
85{
86  return sbuild::chroot::SESSION_NOFLAGS;
87}
88
89void
90chroot_facet_personality::get_details (chroot const&  chroot,
91                                       format_detail& detail) const
92{
93  // TRANSLATORS: "Personality" is the Linux kernel personality
94  // (process execution domain).  See schroot.conf(5).
95  detail.add(_("Personality"), get_persona().get_name());
96}
97
98void
99chroot_facet_personality::get_keyfile (chroot const& chroot,
100                                       keyfile&      keyfile) const
101{
102  keyfile::set_object_value(*this, &chroot_facet_personality::get_persona,
103                            keyfile, chroot.get_keyfile_name(), "personality");
104}
105
106void
107chroot_facet_personality::set_keyfile (chroot&        chroot,
108                                       keyfile const& keyfile,
109                                       string_list&   used_keys)
110{
111  keyfile::get_object_value(*this, &chroot_facet_personality::set_persona,
112                            keyfile, chroot.get_keyfile_name(), "personality",
113                            keyfile::PRIORITY_OPTIONAL);
114  used_keys.push_back("personality");
115}
Note: See TracBrowser for help on using the repository browser.