summaryrefslogtreecommitdiff
path: root/sbuild
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2012-11-01 23:42:11 +0000
committerRoger Leigh <rleigh@debian.org>2012-11-03 13:09:28 +0000
commitfb3d06f7e39835fd0843f9db55914ff1941e17ed (patch)
tree4e0943d8bd4af537d7a6f0a7673f70858781915e /sbuild
parent8ca23e847dead20240f3262e2cb90289721afd4d (diff)
downloadschroot-fb3d06f7e39835fd0843f9db55914ff1941e17ed.tar.gz
sbuild::chroot: Add get_used_keys method
This splits out the used_keys functionality from set_keyfile. This is so that the keys used may be queried separately from keyfile loading.
Diffstat (limited to 'sbuild')
-rw-r--r--sbuild/sbuild-chroot-block-device-base.cc14
-rw-r--r--sbuild/sbuild-chroot-block-device-base.h6
-rw-r--r--sbuild/sbuild-chroot-block-device.cc11
-rw-r--r--sbuild/sbuild-chroot-block-device.h6
-rw-r--r--sbuild/sbuild-chroot-btrfs-snapshot.cc18
-rw-r--r--sbuild/sbuild-chroot-btrfs-snapshot.h6
-rw-r--r--sbuild/sbuild-chroot-custom.cc18
-rw-r--r--sbuild/sbuild-chroot-custom.h6
-rw-r--r--sbuild/sbuild-chroot-directory-base.cc16
-rw-r--r--sbuild/sbuild-chroot-directory-base.h6
-rw-r--r--sbuild/sbuild-chroot-directory.cc11
-rw-r--r--sbuild/sbuild-chroot-directory.h6
-rw-r--r--sbuild/sbuild-chroot-facet-mountable.cc14
-rw-r--r--sbuild/sbuild-chroot-facet-mountable.h6
-rw-r--r--sbuild/sbuild-chroot-facet-personality.cc10
-rw-r--r--sbuild/sbuild-chroot-facet-personality.h6
-rw-r--r--sbuild/sbuild-chroot-facet-session-clonable.cc8
-rw-r--r--sbuild/sbuild-chroot-facet-session-clonable.h6
-rw-r--r--sbuild/sbuild-chroot-facet-session.cc22
-rw-r--r--sbuild/sbuild-chroot-facet-session.h6
-rw-r--r--sbuild/sbuild-chroot-facet-source-clonable.cc18
-rw-r--r--sbuild/sbuild-chroot-facet-source-clonable.h6
-rw-r--r--sbuild/sbuild-chroot-facet-source.cc8
-rw-r--r--sbuild/sbuild-chroot-facet-source.h6
-rw-r--r--sbuild/sbuild-chroot-facet-union.cc18
-rw-r--r--sbuild/sbuild-chroot-facet-union.h6
-rw-r--r--sbuild/sbuild-chroot-facet-userdata.cc12
-rw-r--r--sbuild/sbuild-chroot-facet.h11
-rw-r--r--sbuild/sbuild-chroot-file.cc18
-rw-r--r--sbuild/sbuild-chroot-file.h6
-rw-r--r--sbuild/sbuild-chroot-loopback.cc14
-rw-r--r--sbuild/sbuild-chroot-loopback.h6
-rw-r--r--sbuild/sbuild-chroot-lvm-snapshot.cc16
-rw-r--r--sbuild/sbuild-chroot-lvm-snapshot.h6
-rw-r--r--sbuild/sbuild-chroot.cc93
-rw-r--r--sbuild/sbuild-chroot.h14
36 files changed, 304 insertions, 156 deletions
diff --git a/sbuild/sbuild-chroot-block-device-base.cc b/sbuild/sbuild-chroot-block-device-base.cc
index be7e5ccc..d3c45723 100644
--- a/sbuild/sbuild-chroot-block-device-base.cc
+++ b/sbuild/sbuild-chroot-block-device-base.cc
@@ -106,6 +106,14 @@ chroot_block_device_base::get_details (chroot const& chroot,
}
void
+chroot_block_device_base::get_used_keys (string_list& used_keys) const
+{
+ chroot::get_used_keys(used_keys);
+
+ used_keys.push_back("device");
+}
+
+void
chroot_block_device_base::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -117,13 +125,11 @@ chroot_block_device_base::get_keyfile (chroot const& chroot,
void
chroot_block_device_base::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
- chroot::set_keyfile(chroot, keyfile, used_keys);
+ chroot::set_keyfile(chroot, keyfile);
keyfile::get_object_value(*this, &chroot_block_device_base::set_device,
keyfile, get_name(), "device",
keyfile::PRIORITY_REQUIRED);
- used_keys.push_back("device");
}
diff --git a/sbuild/sbuild-chroot-block-device-base.h b/sbuild/sbuild-chroot-block-device-base.h
index 74642359..66221e05 100644
--- a/sbuild/sbuild-chroot-block-device-base.h
+++ b/sbuild/sbuild-chroot-block-device-base.h
@@ -84,13 +84,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
/// The block device to use.
std::string device;
diff --git a/sbuild/sbuild-chroot-block-device.cc b/sbuild/sbuild-chroot-block-device.cc
index cb0ceba6..94cdece5 100644
--- a/sbuild/sbuild-chroot-block-device.cc
+++ b/sbuild/sbuild-chroot-block-device.cc
@@ -208,6 +208,12 @@ chroot_block_device::get_details (chroot const& chroot,
}
void
+chroot_block_device::get_used_keys (string_list& used_keys) const
+{
+ chroot_block_device_base::get_used_keys(used_keys);
+}
+
+void
chroot_block_device::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -216,8 +222,7 @@ chroot_block_device::get_keyfile (chroot const& chroot,
void
chroot_block_device::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
- chroot_block_device_base::set_keyfile(chroot, keyfile, used_keys);
+ chroot_block_device_base::set_keyfile(chroot, keyfile);
}
diff --git a/sbuild/sbuild-chroot-block-device.h b/sbuild/sbuild-chroot-block-device.h
index 45316ae3..edafa6f2 100644
--- a/sbuild/sbuild-chroot-block-device.h
+++ b/sbuild/sbuild-chroot-block-device.h
@@ -92,13 +92,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
};
}
diff --git a/sbuild/sbuild-chroot-btrfs-snapshot.cc b/sbuild/sbuild-chroot-btrfs-snapshot.cc
index 55c77bb6..d18c156b 100644
--- a/sbuild/sbuild-chroot-btrfs-snapshot.cc
+++ b/sbuild/sbuild-chroot-btrfs-snapshot.cc
@@ -202,6 +202,16 @@ chroot_btrfs_snapshot::get_details (chroot const& chroot,
}
void
+chroot_btrfs_snapshot::get_used_keys (string_list& used_keys) const
+{
+ chroot::get_used_keys(used_keys);
+
+ used_keys.push_back("btrfs-source-subvolume");
+ used_keys.push_back("btrfs-snapshot-directory");
+ used_keys.push_back("btrfs-snapshot-name");
+}
+
+void
chroot_btrfs_snapshot::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -230,10 +240,9 @@ chroot_btrfs_snapshot::get_keyfile (chroot const& chroot,
void
chroot_btrfs_snapshot::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
- chroot::set_keyfile(chroot, keyfile, used_keys);
+ chroot::set_keyfile(chroot, keyfile);
bool session = static_cast<bool>(get_facet<chroot_facet_session>());
@@ -243,7 +252,6 @@ chroot_btrfs_snapshot::set_keyfile (chroot& chroot,
keyfile::PRIORITY_DISALLOWED :
keyfile::PRIORITY_REQUIRED
); // Only needed for creating snapshot, not using snapshot
- used_keys.push_back("btrfs-source-subvolume");
keyfile::get_object_value(*this, &chroot_btrfs_snapshot::set_snapshot_directory,
keyfile, get_name(), "btrfs-snapshot-directory",
@@ -251,12 +259,10 @@ chroot_btrfs_snapshot::set_keyfile (chroot& chroot,
keyfile::PRIORITY_DISALLOWED :
keyfile::PRIORITY_REQUIRED
); // Only needed for creating snapshot, not using snapshot
- used_keys.push_back("btrfs-snapshot-directory");
keyfile::get_object_value(*this, &chroot_btrfs_snapshot::set_snapshot_name,
keyfile, get_name(), "btrfs-snapshot-name",
session ?
keyfile::PRIORITY_REQUIRED :
keyfile::PRIORITY_DISALLOWED);
- used_keys.push_back("btrfs-snapshot-name");
}
diff --git a/sbuild/sbuild-chroot-btrfs-snapshot.h b/sbuild/sbuild-chroot-btrfs-snapshot.h
index b7d9488f..7354f2c2 100644
--- a/sbuild/sbuild-chroot-btrfs-snapshot.h
+++ b/sbuild/sbuild-chroot-btrfs-snapshot.h
@@ -132,13 +132,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
private:
/// Btrfs source subvolume
diff --git a/sbuild/sbuild-chroot-custom.cc b/sbuild/sbuild-chroot-custom.cc
index 59163ddc..dcfc001a 100644
--- a/sbuild/sbuild-chroot-custom.cc
+++ b/sbuild/sbuild-chroot-custom.cc
@@ -177,6 +177,16 @@ chroot_custom::get_details (chroot const& chroot,
}
void
+chroot_custom::get_used_keys (string_list& used_keys) const
+{
+ chroot::get_used_keys(used_keys);
+
+ used_keys.push_back("custom-cloneable");
+ used_keys.push_back("custom-purgeable");
+ used_keys.push_back("custom-source-cloneable");
+}
+
+void
chroot_custom::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -190,10 +200,9 @@ chroot_custom::get_keyfile (chroot const& chroot,
void
chroot_custom::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
- chroot::set_keyfile(chroot, keyfile, used_keys);
+ chroot::set_keyfile(chroot, keyfile);
bool session = static_cast<bool>(get_facet<chroot_facet_session>());
@@ -202,17 +211,14 @@ chroot_custom::set_keyfile (chroot& chroot,
session ?
keyfile::PRIORITY_DISALLOWED :
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("custom-cloneable");
keyfile::get_object_value(*this, &chroot_custom::set_session_purgeable,
keyfile, get_name(), "custom-session-purgeable",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("custom-purgeable");
keyfile::get_object_value(*this, &chroot_custom::set_source_cloneable,
keyfile, get_name(), "custom-source-cloneable",
session ?
keyfile::PRIORITY_DISALLOWED :
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("custom-source-cloneable");
}
diff --git a/sbuild/sbuild-chroot-custom.h b/sbuild/sbuild-chroot-custom.h
index 2b46b0ce..e0b321d6 100644
--- a/sbuild/sbuild-chroot-custom.h
+++ b/sbuild/sbuild-chroot-custom.h
@@ -123,13 +123,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
private:
bool purgeable;
diff --git a/sbuild/sbuild-chroot-directory-base.cc b/sbuild/sbuild-chroot-directory-base.cc
index 77bc7c8c..a0d9a66b 100644
--- a/sbuild/sbuild-chroot-directory-base.cc
+++ b/sbuild/sbuild-chroot-directory-base.cc
@@ -87,6 +87,15 @@ chroot_directory_base::get_details (chroot const& chroot,
}
void
+chroot_directory_base::get_used_keys (string_list& used_keys) const
+{
+ chroot::get_used_keys(used_keys);
+
+ used_keys.push_back("directory");
+ used_keys.push_back("location");
+}
+
+void
chroot_directory_base::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -98,10 +107,9 @@ chroot_directory_base::get_keyfile (chroot const& chroot,
void
chroot_directory_base::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
- chroot::set_keyfile(chroot, keyfile, used_keys);
+ chroot::set_keyfile(chroot, keyfile);
// "directory" should be required, but we also accept "location" as
// an alternative (but deprecated) variant. Therefore, ensure by
@@ -125,10 +133,8 @@ chroot_directory_base::set_keyfile (chroot& chroot,
keyfile::get_object_value(*this, &chroot_directory_base::set_directory,
keyfile, get_name(), "directory",
directory_priority);
- used_keys.push_back("directory");
keyfile::get_object_value(*this, &chroot_directory_base::set_directory,
keyfile, get_name(), "location",
location_priority);
- used_keys.push_back("location");
}
diff --git a/sbuild/sbuild-chroot-directory-base.h b/sbuild/sbuild-chroot-directory-base.h
index 29ce1d1e..7ec0b6a4 100644
--- a/sbuild/sbuild-chroot-directory-base.h
+++ b/sbuild/sbuild-chroot-directory-base.h
@@ -80,13 +80,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
private:
/// The directory to use.
diff --git a/sbuild/sbuild-chroot-directory.cc b/sbuild/sbuild-chroot-directory.cc
index 613fd2c4..56bee0c6 100644
--- a/sbuild/sbuild-chroot-directory.cc
+++ b/sbuild/sbuild-chroot-directory.cc
@@ -152,6 +152,12 @@ chroot_directory::get_details (chroot const& chroot,
}
void
+chroot_directory::get_used_keys (string_list& used_keys) const
+{
+ chroot_directory_base::get_used_keys(used_keys);
+}
+
+void
chroot_directory::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -160,8 +166,7 @@ chroot_directory::get_keyfile (chroot const& chroot,
void
chroot_directory::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
- chroot_directory_base::set_keyfile(chroot, keyfile, used_keys);
+ chroot_directory_base::set_keyfile(chroot, keyfile);
}
diff --git a/sbuild/sbuild-chroot-directory.h b/sbuild/sbuild-chroot-directory.h
index cae17e9e..5e7f9aa0 100644
--- a/sbuild/sbuild-chroot-directory.h
+++ b/sbuild/sbuild-chroot-directory.h
@@ -91,13 +91,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
};
}
diff --git a/sbuild/sbuild-chroot-facet-mountable.cc b/sbuild/sbuild-chroot-facet-mountable.cc
index ade3eb45..e39680c9 100644
--- a/sbuild/sbuild-chroot-facet-mountable.cc
+++ b/sbuild/sbuild-chroot-facet-mountable.cc
@@ -129,6 +129,14 @@ chroot_facet_mountable::get_details (chroot const& chroot,
}
void
+chroot_facet_mountable::get_used_keys (string_list& used_keys) const
+{
+ used_keys.push_back("mount-device");
+ used_keys.push_back("mount-options");
+ used_keys.push_back("location");
+}
+
+void
chroot_facet_mountable::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -150,8 +158,7 @@ chroot_facet_mountable::get_keyfile (chroot const& chroot,
void
chroot_facet_mountable::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
bool session = static_cast<bool>(chroot.get_facet<chroot_facet_session>());
@@ -161,17 +168,14 @@ chroot_facet_mountable::set_keyfile (chroot& chroot,
session ?
keyfile::PRIORITY_REQUIRED :
keyfile::PRIORITY_DISALLOWED);
- used_keys.push_back("mount-device");
keyfile::get_object_value(*this, &chroot_facet_mountable::set_mount_options,
keyfile, chroot.get_name(),
"mount-options",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("mount-options");
keyfile::get_object_value(*this, &chroot_facet_mountable::set_location,
keyfile, chroot.get_name(),
"location",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("location");
}
diff --git a/sbuild/sbuild-chroot-facet-mountable.h b/sbuild/sbuild-chroot-facet-mountable.h
index 73e63379..703cd63e 100644
--- a/sbuild/sbuild-chroot-facet-mountable.h
+++ b/sbuild/sbuild-chroot-facet-mountable.h
@@ -128,13 +128,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
private:
/// The device to mount.
diff --git a/sbuild/sbuild-chroot-facet-personality.cc b/sbuild/sbuild-chroot-facet-personality.cc
index ce6a1c07..c9114d46 100644
--- a/sbuild/sbuild-chroot-facet-personality.cc
+++ b/sbuild/sbuild-chroot-facet-personality.cc
@@ -90,6 +90,12 @@ chroot_facet_personality::get_details (chroot const& chroot,
}
void
+chroot_facet_personality::get_used_keys (string_list& used_keys) const
+{
+ used_keys.push_back("personality");
+}
+
+void
chroot_facet_personality::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -101,11 +107,9 @@ chroot_facet_personality::get_keyfile (chroot const& chroot,
void
chroot_facet_personality::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
keyfile::get_object_value(*this, &chroot_facet_personality::set_persona,
keyfile, chroot.get_name(), "personality",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("personality");
}
diff --git a/sbuild/sbuild-chroot-facet-personality.h b/sbuild/sbuild-chroot-facet-personality.h
index e72c59e2..f6d856c5 100644
--- a/sbuild/sbuild-chroot-facet-personality.h
+++ b/sbuild/sbuild-chroot-facet-personality.h
@@ -87,13 +87,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
private:
/// Process execution domain (Linux only).
diff --git a/sbuild/sbuild-chroot-facet-session-clonable.cc b/sbuild/sbuild-chroot-facet-session-clonable.cc
index c6dbb07e..dcf3e5ce 100644
--- a/sbuild/sbuild-chroot-facet-session-clonable.cc
+++ b/sbuild/sbuild-chroot-facet-session-clonable.cc
@@ -235,6 +235,11 @@ chroot_facet_session_clonable::get_details (chroot const& chroot,
}
void
+chroot_facet_session_clonable::get_used_keys (string_list& used_keys) const
+{
+}
+
+void
chroot_facet_session_clonable::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -242,7 +247,6 @@ chroot_facet_session_clonable::get_keyfile (chroot const& chroot,
void
chroot_facet_session_clonable::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
}
diff --git a/sbuild/sbuild-chroot-facet-session-clonable.h b/sbuild/sbuild-chroot-facet-session-clonable.h
index 08618b9b..19040813 100644
--- a/sbuild/sbuild-chroot-facet-session-clonable.h
+++ b/sbuild/sbuild-chroot-facet-session-clonable.h
@@ -91,13 +91,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
};
}
diff --git a/sbuild/sbuild-chroot-facet-session.cc b/sbuild/sbuild-chroot-facet-session.cc
index 7b134142..df115fcd 100644
--- a/sbuild/sbuild-chroot-facet-session.cc
+++ b/sbuild/sbuild-chroot-facet-session.cc
@@ -129,6 +129,18 @@ chroot_facet_session::get_details (chroot const& chroot,
}
void
+chroot_facet_session::get_used_keys (string_list& used_keys) const
+{
+ used_keys.push_back("active");
+ used_keys.push_back("source-users");
+ used_keys.push_back("source-groups");
+ used_keys.push_back("source-root-users");
+ used_keys.push_back("source-root-groups");
+ used_keys.push_back("original-name");
+ used_keys.push_back("selected-name");
+}
+
+void
chroot_facet_session::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -143,8 +155,7 @@ chroot_facet_session::get_keyfile (chroot const& chroot,
void
chroot_facet_session::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
// Null methods for obsolete keys.
void (chroot_facet_session::* nullmethod)(bool) = 0;
@@ -158,41 +169,34 @@ chroot_facet_session::set_keyfile (chroot& chroot,
keyfile, chroot.get_name(),
"active",
keyfile::PRIORITY_OBSOLETE);
- used_keys.push_back("active");
keyfile::get_object_list_value(*this, nullvmethod,
keyfile, chroot.get_name(),
"source-users",
keyfile::PRIORITY_OBSOLETE);
- used_keys.push_back("source-users");
keyfile::get_object_list_value(*this, nullvmethod,
keyfile, chroot.get_name(),
"source-groups",
keyfile::PRIORITY_OBSOLETE);
- used_keys.push_back("source-groups");
keyfile::get_object_list_value(*this, nullvmethod,
keyfile, chroot.get_name(),
"source-root-users",
keyfile::PRIORITY_OBSOLETE);
- used_keys.push_back("source-root-users");
keyfile::get_object_list_value(*this, nullvmethod,
keyfile, chroot.get_name(),
"source-root-groups",
keyfile::PRIORITY_OBSOLETE);
- used_keys.push_back("source-root-groups");
keyfile::get_object_value(*this, &chroot_facet_session::set_original_name,
keyfile, chroot.get_name(),
"original-name",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("original-name");
keyfile::get_object_value(*this, &chroot_facet_session::set_selected_name,
keyfile, chroot.get_name(),
"selected-name",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("selected-name");
}
diff --git a/sbuild/sbuild-chroot-facet-session.h b/sbuild/sbuild-chroot-facet-session.h
index 57c2af26..f6b469f8 100644
--- a/sbuild/sbuild-chroot-facet-session.h
+++ b/sbuild/sbuild-chroot-facet-session.h
@@ -108,13 +108,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
private:
/// Original chroot name prior to session cloning.
diff --git a/sbuild/sbuild-chroot-facet-source-clonable.cc b/sbuild/sbuild-chroot-facet-source-clonable.cc
index d4373564..411f6c54 100644
--- a/sbuild/sbuild-chroot-facet-source-clonable.cc
+++ b/sbuild/sbuild-chroot-facet-source-clonable.cc
@@ -164,6 +164,16 @@ chroot_facet_source_clonable::get_session_flags (chroot const& chroot) const
}
void
+chroot_facet_source_clonable::get_used_keys (string_list& used_keys) const
+{
+ used_keys.push_back("source-clone");
+ used_keys.push_back("source-users");
+ used_keys.push_back("source-groups");
+ used_keys.push_back("source-root-users");
+ used_keys.push_back("source-root-groups");
+}
+
+void
chroot_facet_source_clonable::get_details (chroot const& chroot,
format_detail& detail) const
{
@@ -201,36 +211,30 @@ chroot_facet_source_clonable::get_keyfile (chroot const& chroot,
void
chroot_facet_source_clonable::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
keyfile::get_object_value(*this, &chroot_facet_source_clonable::set_source_clone,
keyfile, chroot.get_name(),
"source-clone",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("source-clone");
keyfile::get_object_list_value(*this, &chroot_facet_source_clonable::set_source_users,
keyfile, chroot.get_name(),
"source-users",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("source-users");
keyfile::get_object_list_value(*this, &chroot_facet_source_clonable::set_source_groups,
keyfile, chroot.get_name(),
"source-groups",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("source-groups");
keyfile::get_object_list_value(*this, &chroot_facet_source_clonable::set_source_root_users,
keyfile, chroot.get_name(),
"source-root-users",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("source-root-users");
keyfile::get_object_list_value(*this, &chroot_facet_source_clonable::set_source_root_groups,
keyfile, chroot.get_name(),
"source-root-groups",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("source-root-groups");
}
diff --git a/sbuild/sbuild-chroot-facet-source-clonable.h b/sbuild/sbuild-chroot-facet-source-clonable.h
index a9b0fad5..c93d9a75 100644
--- a/sbuild/sbuild-chroot-facet-source-clonable.h
+++ b/sbuild/sbuild-chroot-facet-source-clonable.h
@@ -175,13 +175,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
private:
/// Is source chroot cloning permitted?
diff --git a/sbuild/sbuild-chroot-facet-source.cc b/sbuild/sbuild-chroot-facet-source.cc
index 757c4069..0d624e08 100644
--- a/sbuild/sbuild-chroot-facet-source.cc
+++ b/sbuild/sbuild-chroot-facet-source.cc
@@ -75,6 +75,11 @@ chroot_facet_source::get_details (chroot const& chroot,
}
void
+chroot_facet_source::get_used_keys (string_list& used_keys) const
+{
+}
+
+void
chroot_facet_source::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -82,7 +87,6 @@ chroot_facet_source::get_keyfile (chroot const& chroot,
void
chroot_facet_source::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
}
diff --git a/sbuild/sbuild-chroot-facet-source.h b/sbuild/sbuild-chroot-facet-source.h
index 134d7052..2f26c12a 100644
--- a/sbuild/sbuild-chroot-facet-source.h
+++ b/sbuild/sbuild-chroot-facet-source.h
@@ -75,13 +75,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
};
}
diff --git a/sbuild/sbuild-chroot-facet-union.cc b/sbuild/sbuild-chroot-facet-union.cc
index c446b775..263fabc9 100644
--- a/sbuild/sbuild-chroot-facet-union.cc
+++ b/sbuild/sbuild-chroot-facet-union.cc
@@ -215,6 +215,15 @@ chroot_facet_union::get_details (chroot const& chroot,
}
void
+chroot_facet_union::get_used_keys (string_list& used_keys) const
+{
+ used_keys.push_back("union-type");
+ used_keys.push_back("union-mount-options");
+ used_keys.push_back("union-overlay-directory");
+ used_keys.push_back("union-underlay-directory");
+}
+
+void
chroot_facet_union::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -242,27 +251,24 @@ chroot_facet_union::get_keyfile (chroot const& chroot,
void
chroot_facet_union::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
bool session = static_cast<bool>(chroot.get_facet<chroot_facet_session>());
keyfile::get_object_value(*this, &chroot_facet_union::set_union_type,
keyfile, chroot.get_name(), "union-type",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("union-type");
// If we are a union, add specific source options here.
chroot_facet_source_clonable::ptr psrc
(chroot.get_facet<chroot_facet_source_clonable>());
if (psrc)
- psrc->set_keyfile(chroot, keyfile, used_keys);
+ psrc->set_keyfile(chroot, keyfile);
keyfile::get_object_value(*this,
&chroot_facet_union::set_union_mount_options,
keyfile, chroot.get_name(), "union-mount-options",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("union-mount-options");
keyfile::get_object_value(*this,
&chroot_facet_union::set_union_overlay_directory,
@@ -271,7 +277,6 @@ chroot_facet_union::set_keyfile (chroot& chroot,
(session && get_union_configured())?
keyfile::PRIORITY_REQUIRED :
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("union-overlay-directory");
keyfile::get_object_value(*this,
&chroot_facet_union::set_union_underlay_directory,
@@ -280,5 +285,4 @@ chroot_facet_union::set_keyfile (chroot& chroot,
(session && get_union_configured())?
keyfile::PRIORITY_REQUIRED :
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("union-underlay-directory");
}
diff --git a/sbuild/sbuild-chroot-facet-union.h b/sbuild/sbuild-chroot-facet-union.h
index c1dd5344..1f3e7dc9 100644
--- a/sbuild/sbuild-chroot-facet-union.h
+++ b/sbuild/sbuild-chroot-facet-union.h
@@ -171,13 +171,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
private:
/// filesystem union type.
diff --git a/sbuild/sbuild-chroot-facet-userdata.cc b/sbuild/sbuild-chroot-facet-userdata.cc
index 4cd37c27..d100eca2 100644
--- a/sbuild/sbuild-chroot-facet-userdata.cc
+++ b/sbuild/sbuild-chroot-facet-userdata.cc
@@ -334,6 +334,13 @@ chroot_facet_userdata::set_root_modifiable_keys (string_set const& keys)
}
void
+chroot_facet_userdata::get_used_keys (string_list& used_keys) const
+{
+ used_keys.push_back("user-modifiable-keys");
+ used_keys.push_back("root-modifiable-keys");
+}
+
+void
chroot_facet_userdata::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -359,20 +366,17 @@ chroot_facet_userdata::get_keyfile (chroot const& chroot,
void
chroot_facet_userdata::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
keyfile::get_object_set_value(*this,
&chroot_facet_userdata::set_user_modifiable_keys,
keyfile, chroot.get_name(),
"user-modifiable-keys",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("user-modifiable-keys");
keyfile::get_object_set_value(*this,
&chroot_facet_userdata::set_root_modifiable_keys,
keyfile, chroot.get_name(),
"root-modifiable-keys",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("root-modifiable-keys");
}
diff --git a/sbuild/sbuild-chroot-facet.h b/sbuild/sbuild-chroot-facet.h
index b0075d8f..1e3654ea 100644
--- a/sbuild/sbuild-chroot-facet.h
+++ b/sbuild/sbuild-chroot-facet.h
@@ -115,6 +115,14 @@ namespace sbuild
format_detail& detail) const = 0;
/**
+ * Get a list of the keys used during keyfile parsing.
+ *
+ * @returns a list of key names.
+ */
+ virtual void
+ get_used_keys (string_list& used_keys) const = 0;
+
+ /**
* Copy the chroot properties into a keyfile. The keyfile group
* with the name of the chroot will be set; if it already exists,
* it will be removed before setting it.
@@ -137,8 +145,7 @@ namespace sbuild
*/
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys) = 0;
+ keyfile const& keyfile) = 0;
protected:
/// Chroot owning this facet.
diff --git a/sbuild/sbuild-chroot-file.cc b/sbuild/sbuild-chroot-file.cc
index 44f534d7..e6a7827b 100644
--- a/sbuild/sbuild-chroot-file.cc
+++ b/sbuild/sbuild-chroot-file.cc
@@ -222,6 +222,16 @@ chroot_file::get_details (chroot const& chroot,
}
void
+chroot_file::get_used_keys (string_list& used_keys) const
+{
+ chroot::get_used_keys(used_keys);
+
+ used_keys.push_back("file");
+ used_keys.push_back("location");
+ used_keys.push_back("file-repack");
+}
+
+void
chroot_file::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -243,28 +253,24 @@ chroot_file::get_keyfile (chroot const& chroot,
void
chroot_file::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
- chroot::set_keyfile(chroot, keyfile, used_keys);
+ chroot::set_keyfile(chroot, keyfile);
bool session = static_cast<bool>(get_facet<chroot_facet_session>());
keyfile::get_object_value(*this, &chroot_file::set_file,
keyfile, get_name(), "file",
keyfile::PRIORITY_REQUIRED);
- used_keys.push_back("file");
keyfile::get_object_value(*this, &chroot_file::set_location,
keyfile, chroot.get_name(),
"location",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("location");
keyfile::get_object_value(*this, &chroot_file::set_file_repack,
keyfile, get_name(), "file-repack",
session ?
keyfile::PRIORITY_REQUIRED :
keyfile::PRIORITY_DISALLOWED);
- used_keys.push_back("file-repack");
}
diff --git a/sbuild/sbuild-chroot-file.h b/sbuild/sbuild-chroot-file.h
index b32f92ca..7b6ad05f 100644
--- a/sbuild/sbuild-chroot-file.h
+++ b/sbuild/sbuild-chroot-file.h
@@ -133,13 +133,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
private:
/// The file to use.
diff --git a/sbuild/sbuild-chroot-loopback.cc b/sbuild/sbuild-chroot-loopback.cc
index 69de3f05..a3417caa 100644
--- a/sbuild/sbuild-chroot-loopback.cc
+++ b/sbuild/sbuild-chroot-loopback.cc
@@ -185,6 +185,14 @@ chroot_loopback::get_details (chroot const& chroot,
}
void
+chroot_loopback::get_used_keys (string_list& used_keys) const
+{
+ chroot::get_used_keys(used_keys);
+
+ used_keys.push_back("file");
+}
+
+void
chroot_loopback::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -196,13 +204,11 @@ chroot_loopback::get_keyfile (chroot const& chroot,
void
chroot_loopback::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
- chroot::set_keyfile(chroot, keyfile, used_keys);
+ chroot::set_keyfile(chroot, keyfile);
keyfile::get_object_value(*this, &chroot_loopback::set_file,
keyfile, get_name(), "file",
keyfile::PRIORITY_REQUIRED);
- used_keys.push_back("file");
}
diff --git a/sbuild/sbuild-chroot-loopback.h b/sbuild/sbuild-chroot-loopback.h
index ee3b03bd..722a95d3 100644
--- a/sbuild/sbuild-chroot-loopback.h
+++ b/sbuild/sbuild-chroot-loopback.h
@@ -101,13 +101,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
private:
/// The file to use.
diff --git a/sbuild/sbuild-chroot-lvm-snapshot.cc b/sbuild/sbuild-chroot-lvm-snapshot.cc
index 629b502b..d41853f8 100644
--- a/sbuild/sbuild-chroot-lvm-snapshot.cc
+++ b/sbuild/sbuild-chroot-lvm-snapshot.cc
@@ -239,6 +239,15 @@ chroot_lvm_snapshot::get_details (chroot const& chroot,
}
void
+chroot_lvm_snapshot::get_used_keys (string_list& used_keys) const
+{
+ chroot_block_device_base::get_used_keys(used_keys);
+
+ used_keys.push_back("lvm-snapshot-device");
+ used_keys.push_back("lvm-snapshot-options");
+}
+
+void
chroot_lvm_snapshot::get_keyfile (chroot const& chroot,
keyfile& keyfile) const
{
@@ -261,10 +270,9 @@ chroot_lvm_snapshot::get_keyfile (chroot const& chroot,
void
chroot_lvm_snapshot::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
- chroot_block_device_base::set_keyfile(chroot, keyfile, used_keys);
+ chroot_block_device_base::set_keyfile(chroot, keyfile);
bool session = static_cast<bool>(get_facet<chroot_facet_session>());
@@ -273,12 +281,10 @@ chroot_lvm_snapshot::set_keyfile (chroot& chroot,
session ?
keyfile::PRIORITY_REQUIRED :
keyfile::PRIORITY_DISALLOWED);
- used_keys.push_back("lvm-snapshot-device");
keyfile::get_object_value(*this, &chroot_lvm_snapshot::set_snapshot_options,
keyfile, get_name(), "lvm-snapshot-options",
session ?
keyfile::PRIORITY_DEPRECATED :
keyfile::PRIORITY_REQUIRED); // Only needed for creating snapshot, not using snapshot
- used_keys.push_back("lvm-snapshot-options");
}
diff --git a/sbuild/sbuild-chroot-lvm-snapshot.h b/sbuild/sbuild-chroot-lvm-snapshot.h
index b955fbe0..d4a04049 100644
--- a/sbuild/sbuild-chroot-lvm-snapshot.h
+++ b/sbuild/sbuild-chroot-lvm-snapshot.h
@@ -113,13 +113,15 @@ namespace sbuild
format_detail& detail) const;
virtual void
+ get_used_keys (string_list& used_keys) const;
+
+ virtual void
get_keyfile (chroot const& chroot,
keyfile& keyfile) const;
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys);
+ keyfile const& keyfile);
private:
/// LVM snapshot device name for lvcreate.
diff --git a/sbuild/sbuild-chroot.cc b/sbuild/sbuild-chroot.cc
index 8e64346a..01e4a63a 100644
--- a/sbuild/sbuild-chroot.cc
+++ b/sbuild/sbuild-chroot.cc
@@ -713,6 +713,51 @@ sbuild::chroot::print_details (std::ostream& stream) const
stream << fmt;
}
+string_list
+sbuild::chroot::get_used_keys () const
+{
+ string_list used_keys;
+
+ get_used_keys(used_keys);
+
+ for (facet_list::const_iterator pos = facets.begin();
+ pos != facets.end();
+ ++pos)
+ {
+ (*pos)->get_used_keys(used_keys);
+ }
+
+ return used_keys;
+}
+
+void
+sbuild::chroot::get_used_keys (string_list& used_keys) const
+{
+ // Keys which are used elsewhere, but should be counted as "used".
+ used_keys.push_back("type");
+
+ used_keys.push_back("active");
+ used_keys.push_back("run-setup-scripts");
+ used_keys.push_back("run-session-scripts");
+ used_keys.push_back("run-exec-scripts");
+ used_keys.push_back("profile");
+ used_keys.push_back("script-config");
+ used_keys.push_back("priority");
+ used_keys.push_back("aliases");
+ used_keys.push_back("environment-filter");
+ used_keys.push_back("description");
+ used_keys.push_back("users");
+ used_keys.push_back("groups");
+ used_keys.push_back("root-users");
+ used_keys.push_back("root-groups");
+ used_keys.push_back("mount-location");
+ used_keys.push_back("name");
+ used_keys.push_back("command-prefix");
+ used_keys.push_back("message-verbosity");
+ used_keys.push_back("preserve-environment");
+ used_keys.push_back("shell");
+}
+
void
sbuild::chroot::get_keyfile (keyfile& keyfile) const
{
@@ -805,15 +850,13 @@ sbuild::chroot::get_keyfile (chroot const& chroot,
void
sbuild::chroot::set_keyfile (keyfile const& keyfile)
{
- string_list used_keys;
-
- set_keyfile(*this, keyfile, used_keys);
+ set_keyfile(*this, keyfile);
for (facet_list::const_iterator pos = facets.begin();
pos != facets.end();
++pos)
{
- (*pos)->set_keyfile(*this, keyfile, used_keys);
+ (*pos)->set_keyfile(*this, keyfile);
}
// Check for keys which weren't set above. These may be either
@@ -821,6 +864,7 @@ sbuild::chroot::set_keyfile (keyfile const& keyfile)
// separated with one or more periods. These may be later
// overridden by the user on the commandline.
{
+ string_list used_keys = get_used_keys();
std::string const& group = this->get_name();
const string_list total(keyfile.get_keys(group));
@@ -840,6 +884,11 @@ sbuild::chroot::set_keyfile (keyfile const& keyfile)
pos != unused.end();
++pos)
{
+ // Skip language-specific key variants.
+ static regex description_keys("\\[.*\\]$");
+ if (regex_search(*pos, description_keys))
+ continue;
+
if (userdata)
{
try
@@ -882,32 +931,17 @@ sbuild::chroot::set_keyfile (keyfile const& keyfile)
void
sbuild::chroot::set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys)
+ keyfile const& keyfile)
{
// Null method for obsolete keys.
void (sbuild::chroot::* nullmethod)(bool) = 0;
bool session = static_cast<bool>(get_facet<chroot_facet_session>());
- // Keys which are used elsewhere, but should be counted as "used".
- used_keys.push_back("type");
-
- string_list keys = keyfile.get_keys(chroot.get_name());
- for (string_list::const_iterator pos = keys.begin();
- pos != keys.end();
- ++pos)
- {
- static regex description_keys("^description\\[.*\\]$");
- if (regex_search(*pos, description_keys))
- used_keys.push_back(*pos);
- }
-
keyfile::get_object_value(chroot, nullmethod,
keyfile, chroot.get_name(),
"active",
keyfile::PRIORITY_OBSOLETE);
- used_keys.push_back("active");
// Setup scripts are run depending on the chroot type in use, and is
// no longer user-configurable. They need to run for all types
@@ -916,7 +950,6 @@ sbuild::chroot::set_keyfile (chroot& chroot,
keyfile, chroot.get_name(),
"run-setup-scripts",
keyfile::PRIORITY_OBSOLETE);
- used_keys.push_back("run-setup-scripts");
// Exec scripts have been removed, so these two calls do nothing
// except to warn the user that the options are no longer used.
@@ -924,18 +957,15 @@ sbuild::chroot::set_keyfile (chroot& chroot,
keyfile, chroot.get_name(),
"run-session-scripts",
keyfile::PRIORITY_OBSOLETE);
- used_keys.push_back("run-session-scripts");
keyfile::get_object_value(chroot, nullmethod,
keyfile, chroot.get_name(),
"run-exec-scripts",
keyfile::PRIORITY_OBSOLETE);
- used_keys.push_back("run-exec-scripts");
keyfile::get_object_value(chroot, &chroot::set_profile,
keyfile, chroot.get_name(),
"profile",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("profile");
keyfile::get_object_value(chroot, &chroot::set_script_config,
keyfile, chroot.get_name(),
@@ -943,7 +973,6 @@ sbuild::chroot::set_keyfile (chroot& chroot,
session ?
keyfile::PRIORITY_OPTIONAL :
keyfile::PRIORITY_DEPRECATED);
- used_keys.push_back("script-config");
keyfile::get_object_value(chroot, nullmethod,
keyfile, chroot.get_name(),
@@ -951,49 +980,41 @@ sbuild::chroot::set_keyfile (chroot& chroot,
session ?
keyfile::PRIORITY_OPTIONAL :
keyfile::PRIORITY_OBSOLETE);
- used_keys.push_back("priority");
keyfile::get_object_list_value(chroot, &chroot::set_aliases,
keyfile, chroot.get_name(),
"aliases",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("aliases");
keyfile::get_object_value(chroot, &chroot::set_environment_filter,
keyfile, chroot.get_name(),
"environment-filter",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("environment-filter");
keyfile::get_object_value(chroot, &chroot::set_description,
keyfile, chroot.get_name(),
"description",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("description");
keyfile::get_object_list_value(chroot, &chroot::set_users,
keyfile, chroot.get_name(),
"users",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("users");
keyfile::get_object_list_value(chroot, &chroot::set_groups,
keyfile, chroot.get_name(),
"groups",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("groups");
keyfile::get_object_list_value(chroot, &chroot::set_root_users,
keyfile, chroot.get_name(),
"root-users",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("root-users");
keyfile::get_object_list_value(chroot, &chroot::set_root_groups,
keyfile, chroot.get_name(),
"root-groups",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("root-groups");
keyfile::get_object_value(chroot, &chroot::set_mount_location,
keyfile, chroot.get_name(),
@@ -1001,7 +1022,6 @@ sbuild::chroot::set_keyfile (chroot& chroot,
session ?
keyfile::PRIORITY_REQUIRED :
keyfile::PRIORITY_DISALLOWED);
- used_keys.push_back("mount-location");
keyfile::get_object_value(chroot, &chroot::set_name,
keyfile, chroot.get_name(),
@@ -1009,29 +1029,24 @@ sbuild::chroot::set_keyfile (chroot& chroot,
session ?
keyfile::PRIORITY_OPTIONAL :
keyfile::PRIORITY_DISALLOWED);
- used_keys.push_back("name");
keyfile::get_object_list_value(chroot, &chroot::set_command_prefix,
keyfile, chroot.get_name(),
"command-prefix",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("command-prefix");
keyfile::get_object_value(chroot, &chroot::set_verbosity,
keyfile, chroot.get_name(),
"message-verbosity",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("message-verbosity");
keyfile::get_object_value(chroot, &chroot::set_preserve_environment,
keyfile, chroot.get_name(),
"preserve-environment",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("preserve-environment");
keyfile::get_object_value(chroot, &chroot::set_default_shell,
keyfile, chroot.get_name(),
"shell",
keyfile::PRIORITY_OPTIONAL);
- used_keys.push_back("shell");
}
diff --git a/sbuild/sbuild-chroot.h b/sbuild/sbuild-chroot.h
index ea325667..ab3fb0c9 100644
--- a/sbuild/sbuild-chroot.h
+++ b/sbuild/sbuild-chroot.h
@@ -776,7 +776,18 @@ namespace sbuild
void
set_keyfile (keyfile const& keyfile);
+ /**
+ * Get a list of the keys used during keyfile parsing.
+ *
+ * @returns a list of key names.
+ */
+ string_list
+ get_used_keys () const;
+
protected:
+ virtual void
+ get_used_keys (string_list& used_keys) const = 0;
+
/**
* Set the chroot properties from a keyfile. The chroot name must
* have previously been set, so that the correct keyfile group may
@@ -788,8 +799,7 @@ namespace sbuild
*/
virtual void
set_keyfile (chroot& chroot,
- keyfile const& keyfile,
- string_list& used_keys) = 0;
+ keyfile const& keyfile) = 0;
private:
/// Chroot name.