~ubuntu-branches/ubuntu/maverick/schroot/maverick-updates

« back to all changes in this revision

Viewing changes to sbuild/sbuild-chroot-source.cc

  • Committer: Bazaar Package Importer
  • Author(s): Roger Leigh
  • Date: 2008-01-20 22:51:04 UTC
  • mfrom: (1.1.15 upstream)
  • Revision ID: james.westby@ubuntu.com-20080120225104-3zhs8gk9byqigato
Tags: 1.1.6-1
* New upstream development release.
* Acknowledge NMU.  Thanks to Lucas Nussbaum for fixing the Boost
  library names following another incompatible change in Boost
  (Closes: #439215).
* debian/control: Suggest lvm2 instead of lvm-common (Closes: #452263).
* debian/copyright:
  - Update with new GIT source code repository location.
  - Update licence to GPLv3.
* debian/schroot.init: Update licence to GPLv3.
* bin/schroot/setup/20network, bin/schroot/setup/30passwd: For files to
  copy, compare file device, inode and contents to avoid copying
  identical files (Closes: #428808).
* If unknown keys are present in the configuration file, print a warning
  message to alert the user (Closes: #459658).
* The filesystems to mount in the chroot may be customised by the system
  administrator through the use of an fstab file on a per-chroot basis,
  and a new helper utility, schroot-mount (Closes: #395062, #427047).
  Thanks for your patience while we took the time to implement this the
  right way.
* Update Vietnamese translation (Closes: #461531).  Thanks to Clytie
  Siddall.
* debian/schroot.preinst: Add rm_conffile function to remove
  /etc/schroot/setup.d/20network and /etc/schroot/setup.d/30passwd for
  versions prior to this.  These are replaced by
  /etc/schroot/setup.d/20copyfiles.
* debian/schroot.NEWS: Document conffile changes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright © 2005-2007  Roger Leigh <rleigh@debian.org>
 
1
/* Copyright © 2005-2008  Roger Leigh <rleigh@debian.org>
2
2
 *
3
 
 * schroot is free software; you can redistribute it and/or modify it
 
3
 * schroot is free software: you can redistribute it and/or modify it
4
4
 * under the terms of the GNU General Public License as published by
5
 
 * the Free Software Foundation; either version 2 of the License, or
 
5
 * the Free Software Foundation, either version 3 of the License, or
6
6
 * (at your option) any later version.
7
7
 *
8
8
 * schroot is distributed in the hope that it will be useful, but
11
11
 * General Public License for more details.
12
12
 *
13
13
 * You should have received a copy of the GNU General Public License
14
 
 * along with this program; if not, write to the Free Software
15
 
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
16
 
 * MA  02111-1307  USA
 
14
 * along with this program.  If not, see
 
15
 * <http://www.gnu.org/licenses/>.
17
16
 *
18
17
 *********************************************************************/
19
18
 
31
30
using namespace sbuild;
32
31
 
33
32
chroot_source::chroot_source ():
34
 
  chroot()
 
33
  chroot(),
 
34
  is_source(false),
 
35
  source_users(),
 
36
  source_groups(),
 
37
  source_root_users(),
 
38
  source_root_groups()
35
39
{
36
40
}
37
41
 
57
61
       ++alias)
58
62
    source_aliases.push_back(*alias + "-source");
59
63
  clone->set_aliases(source_aliases);
 
64
 
 
65
  std::tr1::shared_ptr<chroot_source> source(std::tr1::dynamic_pointer_cast<chroot_source>(clone));
 
66
  if (source)
 
67
    source->is_source = true;
60
68
}
61
69
 
62
70
string_list const&
112
120
{
113
121
}
114
122
 
 
123
sbuild::chroot::session_flags
 
124
chroot_source::get_session_flags () const
 
125
{
 
126
  if (this->is_source)
 
127
    // -source chroots are not clonable.
 
128
    return SESSION_NOFLAGS;
 
129
  else if (get_active())
 
130
    //Active chroots are already cloned, but need purging.
 
131
    return SESSION_PURGE;
 
132
  else // Inactive, not -source.
 
133
    // Inactive chroots are clonable.
 
134
    return SESSION_CLONE;
 
135
}
 
136
 
115
137
void
116
138
chroot_source::get_details (format_detail& detail) const
117
139
{
118
 
  detail
119
 
    .add(_("Source Users"), get_source_users())
120
 
    .add(_("Source Groups"), get_source_groups())
121
 
    .add(_("Source Root Users"), get_source_root_users())
122
 
    .add(_("Source Root Groups"), get_source_root_groups());
 
140
  if (!this->is_source)
 
141
    detail
 
142
      .add(_("Source Users"), get_source_users())
 
143
      .add(_("Source Groups"), get_source_groups())
 
144
      .add(_("Source Root Users"), get_source_root_users())
 
145
      .add(_("Source Root Groups"), get_source_root_groups());
123
146
}
124
147
 
125
148
void
126
149
chroot_source::get_keyfile (keyfile& keyfile) const
127
150
{
128
 
  keyfile::set_object_list_value(*this, &chroot_source::get_source_users,
129
 
                                 keyfile, get_name(), "source-users");
130
 
 
131
 
  keyfile::set_object_list_value(*this, &chroot_source::get_source_groups,
132
 
                                 keyfile, get_name(), "source-groups");
133
 
 
134
 
  keyfile::set_object_list_value(*this, &chroot_source::get_source_root_users,
135
 
                                 keyfile, get_name(), "source-root-users");
136
 
 
137
 
  keyfile::set_object_list_value(*this, &chroot_source::get_source_root_groups,
138
 
                                 keyfile, get_name(), "source-root-groups");
 
151
  if (!this->is_source)
 
152
    {
 
153
      keyfile::set_object_list_value(*this, &chroot_source::get_source_users,
 
154
                                     keyfile, get_name(), "source-users");
 
155
 
 
156
      keyfile::set_object_list_value(*this, &chroot_source::get_source_groups,
 
157
                                     keyfile, get_name(), "source-groups");
 
158
 
 
159
      keyfile::set_object_list_value(*this, &chroot_source::get_source_root_users,
 
160
                                     keyfile, get_name(), "source-root-users");
 
161
 
 
162
      keyfile::set_object_list_value(*this, &chroot_source::get_source_root_groups,
 
163
                                     keyfile, get_name(), "source-root-groups");
 
164
    }
139
165
}
140
166
 
141
167
void
142
 
chroot_source::set_keyfile (keyfile const& keyfile)
 
168
chroot_source::set_keyfile (keyfile const& keyfile,
 
169
                            string_list&   used_keys)
143
170
{
144
 
  keyfile::get_object_list_value(*this, &chroot_source::set_source_users,
145
 
                                 keyfile, get_name(), "source-users",
146
 
                                 keyfile::PRIORITY_OPTIONAL);
147
 
 
148
 
  keyfile::get_object_list_value(*this, &chroot_source::set_source_groups,
149
 
                                 keyfile, get_name(), "source-groups",
150
 
                                 keyfile::PRIORITY_OPTIONAL);
151
 
 
152
 
  keyfile::get_object_list_value(*this, &chroot_source::set_source_root_users,
153
 
                                 keyfile, get_name(), "source-root-users",
154
 
                                 keyfile::PRIORITY_OPTIONAL);
155
 
 
156
 
  keyfile::get_object_list_value(*this, &chroot_source::set_source_root_groups,
157
 
                                 keyfile, get_name(), "source-root-groups",
158
 
                                 keyfile::PRIORITY_OPTIONAL);
 
171
  if (!this->is_source)
 
172
    {
 
173
      keyfile::get_object_list_value(*this, &chroot_source::set_source_users,
 
174
                                     keyfile, get_name(), "source-users",
 
175
                                     keyfile::PRIORITY_OPTIONAL);
 
176
      used_keys.push_back("source-users");
 
177
 
 
178
      keyfile::get_object_list_value(*this, &chroot_source::set_source_groups,
 
179
                                     keyfile, get_name(), "source-groups",
 
180
                                     keyfile::PRIORITY_OPTIONAL);
 
181
      used_keys.push_back("source-groups");
 
182
 
 
183
      keyfile::get_object_list_value(*this, &chroot_source::set_source_root_users,
 
184
                                     keyfile, get_name(), "source-root-users",
 
185
                                     keyfile::PRIORITY_OPTIONAL);
 
186
      used_keys.push_back("source-root-users");
 
187
 
 
188
      keyfile::get_object_list_value(*this, &chroot_source::set_source_root_groups,
 
189
                                     keyfile, get_name(), "source-root-groups",
 
190
                                     keyfile::PRIORITY_OPTIONAL);
 
191
      used_keys.push_back("source-root-groups");
 
192
    }
159
193
}