1 #include "package_manager/packagemanagerconfig.h" 3 #include <boost/algorithm/string/classification.hpp> 4 #include <boost/algorithm/string/join.hpp> 5 #include <boost/algorithm/string/split.hpp> 6 #include <boost/log/trivial.hpp> 8 void PackageConfig::updateFromPropertyTree(
const boost::property_tree::ptree& pt) {
9 for (
const auto& cp : pt) {
10 if (cp.first ==
"type") {
11 CopyFromConfig(type, cp.first, pt);
12 }
else if (cp.first ==
"os") {
13 CopyFromConfig(os, cp.first, pt);
14 }
else if (cp.first ==
"sysroot") {
15 CopyFromConfig(sysroot, cp.first, pt);
16 }
else if (cp.first ==
"ostree_server") {
17 CopyFromConfig(ostree_server, cp.first, pt);
18 }
else if (cp.first ==
"packages_file") {
19 CopyFromConfig(packages_file, cp.first, pt);
20 }
else if (cp.first ==
"fake_need_reboot") {
21 CopyFromConfig(fake_need_reboot, cp.first, pt);
23 extra[cp.first] = Utils::stripQuotes(cp.second.get_value<std::string>());
28 void PackageConfig::writeToStream(std::ostream& out_stream)
const {
29 writeOption(out_stream, type,
"type");
30 writeOption(out_stream, os,
"os");
31 writeOption(out_stream, sysroot,
"sysroot");
32 writeOption(out_stream, ostree_server,
"ostree_server");
33 writeOption(out_stream, packages_file,
"packages_file");
34 writeOption(out_stream, fake_need_reboot,
"fake_need_reboot");
38 for (
const auto& e : extra) {
39 writeOption(out_stream, e.first, e.second);