summaryrefslogtreecommitdiff
path: root/sbuild
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2009-07-26 12:03:37 +0100
committerRoger Leigh <rleigh@debian.org>2009-07-26 12:03:37 +0100
commitc37ff4407743e15aa90fde1504cad813e1d85c3c (patch)
tree1ffb2d078e8ac88caf43b4f10687f9e12fb6e680 /sbuild
parentd9931d8c685476ef9b8c6fb8ef316d33109ff8c9 (diff)
downloadschroot-c37ff4407743e15aa90fde1504cad813e1d85c3c.tar.gz
sbuild::chroot_source: Allow setting of source-* properties for non-clonable chroots
Pointless, but needed for backward-compatibility with sessions written out by older schroot versions.
Diffstat (limited to 'sbuild')
-rw-r--r--sbuild/sbuild-chroot-source.cc54
1 files changed, 32 insertions, 22 deletions
diff --git a/sbuild/sbuild-chroot-source.cc b/sbuild/sbuild-chroot-source.cc
index 9589f9e1..8d848c1a 100644
--- a/sbuild/sbuild-chroot-source.cc
+++ b/sbuild/sbuild-chroot-source.cc
@@ -162,6 +162,7 @@ chroot_source::get_keyfile (keyfile& keyfile) const
const chroot *base = dynamic_cast<const chroot *>(this);
assert(base != 0);
+ // Only write out source-* settings if we're clonable.
if (this->get_source_clonable())
{
keyfile::set_object_list_value(*this, &chroot_source::get_source_users,
@@ -186,26 +187,35 @@ chroot_source::set_keyfile (keyfile const& keyfile,
const chroot *base = dynamic_cast<const chroot *>(this);
assert(base != 0);
- if (this->get_source_clonable())
- {
- keyfile::get_object_list_value(*this, &chroot_source::set_source_users,
- keyfile, base->get_keyfile_name(), "source-users",
- keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("source-users");
-
- keyfile::get_object_list_value(*this, &chroot_source::set_source_groups,
- keyfile, base->get_keyfile_name(), "source-groups",
- keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("source-groups");
-
- keyfile::get_object_list_value(*this, &chroot_source::set_source_root_users,
- keyfile, base->get_keyfile_name(), "source-root-users",
- keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("source-root-users");
-
- keyfile::get_object_list_value(*this, &chroot_source::set_source_root_groups,
- keyfile, base->get_keyfile_name(), "source-root-groups",
- keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("source-root-groups");
- }
+ // Setting when not clonable is deprecated. It can't be obsoleted
+ // yet because it is required to allow use and ending of existing
+ // sessions which have set this parameter (even though it's
+ // useless).
+ keyfile::get_object_list_value(*this, &chroot_source::set_source_users,
+ keyfile, base->get_keyfile_name(), "source-users",
+ this->get_source_clonable() ?
+ keyfile::PRIORITY_OPTIONAL :
+ keyfile::PRIORITY_DEPRECATED);
+ used_keys.push_back("source-users");
+
+ keyfile::get_object_list_value(*this, &chroot_source::set_source_groups,
+ keyfile, base->get_keyfile_name(), "source-groups",
+ this->get_source_clonable() ?
+ keyfile::PRIORITY_OPTIONAL :
+ keyfile::PRIORITY_DEPRECATED);
+ used_keys.push_back("source-groups");
+
+ keyfile::get_object_list_value(*this, &chroot_source::set_source_root_users,
+ keyfile, base->get_keyfile_name(), "source-root-users",
+ this->get_source_clonable() ?
+ keyfile::PRIORITY_OPTIONAL :
+ keyfile::PRIORITY_DEPRECATED);
+ used_keys.push_back("source-root-users");
+
+ keyfile::get_object_list_value(*this, &chroot_source::set_source_root_groups,
+ keyfile, base->get_keyfile_name(), "source-root-groups",
+ this->get_source_clonable() ?
+ keyfile::PRIORITY_OPTIONAL :
+ keyfile::PRIORITY_DEPRECATED);
+ used_keys.push_back("source-root-groups");
}