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

Revision 24167, 3.7 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-session.h"
23#include "sbuild-chroot-facet-source-clonable.h"
24#include "sbuild-chroot-plain.h"
25#ifdef SBUILD_FEATURE_LVMSNAP
26#include "sbuild-chroot-lvm-snapshot.h"
27#endif // SBUILD_FEATURE_LVMSNAP
28#ifdef SBUILD_FEATURE_UNION
29#include "sbuild-chroot-facet-union.h"
30#endif // SBUILD_FEATURE_UNION
31#include "sbuild-format-detail.h"
32
33#include <cassert>
34
35#include <boost/format.hpp>
36
37using boost::format;
38using std::endl;
39using namespace sbuild;
40
41chroot_facet_session::chroot_facet_session ():
42  chroot_facet()
43{
44}
45
46chroot_facet_session::~chroot_facet_session ()
47{
48}
49
50chroot_facet_session::ptr
51chroot_facet_session::create ()
52{
53  return ptr(new chroot_facet_session());
54}
55
56chroot_facet::ptr
57chroot_facet_session::clone () const
58{
59  return ptr(new chroot_facet_session(*this));
60}
61
62std::string const&
63chroot_facet_session::get_name () const
64{
65  static const std::string name("session");
66
67  return name;
68}
69
70void
71chroot_facet_session::setup_env (chroot const& chroot,
72                                     environment&  env) const
73{
74}
75
76chroot::session_flags
77chroot_facet_session::get_session_flags (chroot const& chroot) const
78{
79  return chroot::SESSION_NOFLAGS;
80}
81
82void
83chroot_facet_session::get_details (chroot const&  chroot,
84                                   format_detail& detail) const
85{
86  /// @todo: Replace base chroot session ID with local ID.
87  if (!chroot.get_session_id().empty())
88    detail.add(_("Session ID"), chroot.get_session_id());
89}
90
91void
92chroot_facet_session::get_keyfile (chroot const& chroot,
93                                   keyfile&      keyfile) const
94{
95}
96
97void
98chroot_facet_session::set_keyfile (chroot&        chroot,
99                                   keyfile const& keyfile,
100                                   string_list&   used_keys)
101{
102  // Null methods for obsolete keys.
103  void (sbuild::chroot_facet_session::* nullmethod)(bool) = 0;
104  void (sbuild::chroot_facet_session::* nullvmethod)(string_list const&) = 0;
105
106  // Setting when not clonable is deprecated.  It can't be obsoleted
107  // yet because it is required to allow use and ending of existing
108  // sessions which have set this parameter (even though it's
109  // useless).
110  keyfile::get_object_value(*this, nullmethod,
111                            keyfile, chroot.get_keyfile_name(),
112                            "active",
113                            keyfile::PRIORITY_DEPRECATED);
114  used_keys.push_back("active");
115
116  keyfile::get_object_list_value(*this, nullvmethod,
117                                 keyfile, chroot.get_keyfile_name(),
118                                 "source-users",
119                                 keyfile::PRIORITY_DEPRECATED);
120  used_keys.push_back("source-users");
121
122  keyfile::get_object_list_value(*this, nullvmethod,
123                                 keyfile, chroot.get_keyfile_name(),
124                                 "source-groups",
125                                 keyfile::PRIORITY_DEPRECATED);
126  used_keys.push_back("source-groups");
127
128  keyfile::get_object_list_value(*this, nullvmethod,
129                                 keyfile, chroot.get_keyfile_name(),
130                                 "source-root-users",
131                                 keyfile::PRIORITY_DEPRECATED);
132  used_keys.push_back("source-root-users");
133
134  keyfile::get_object_list_value(*this, nullvmethod,
135                                 keyfile, chroot.get_keyfile_name(),
136                                 "source-root-groups",
137                                 keyfile::PRIORITY_DEPRECATED);
138  used_keys.push_back("source-root-groups");
139}
Note: See TracBrowser for help on using the repository browser.