From: Martin Vidner Date: Wed, 11 Dec 2019 12:49:54 +0000 (+0100) Subject: Phase::BEFORE and AFTER instead of "todo". X-Git-Tag: v0.8.7^2~9 X-Git-Url: http://git.ipfire.org/gitweb/index.cgi?a=commitdiff_plain;h=0823e65ed6bf975e09516706f2dff014040a1591;p=thirdparty%2Fsnapper.git Phase::BEFORE and AFTER instead of "todo". --- diff --git a/zypp-plugin/snapper_zypp_plugin.cc b/zypp-plugin/snapper_zypp_plugin.cc index 439ad971..28aa2789 100644 --- a/zypp-plugin/snapper_zypp_plugin.cc +++ b/zypp-plugin/snapper_zypp_plugin.cc @@ -169,7 +169,7 @@ public: Message commit_begin(const Message& msg) override { cerr << "INFO:" << "COMMITBEGIN" << endl; - set solvables = get_solvables(msg, true); + set solvables = get_solvables(msg, Phase::BEFORE); cerr << "DEBUG:" << "solvables: " << solvables << endl; bool found, important; @@ -203,7 +203,7 @@ public: cerr << "INFO:" << "COMMITEND" << endl; if (pre_snapshot_num != 0) { - set solvables = get_solvables(msg, false); + set solvables = get_solvables(msg, Phase::AFTER); cerr << "DEBUG:" << "solvables: " << solvables << endl; bool found, important; @@ -281,8 +281,9 @@ private: map get_userdata(const Message&); - // FIXME: what does the todo flag mean? - set get_solvables(const Message&, bool todo); + enum class Phase { BEFORE, AFTER }; + + set get_solvables(const Message&, Phase phase); void match_solvables(const set& solvables, bool& found, bool& important); @@ -314,7 +315,7 @@ map SnapperZyppPlugin::get_userdata(const Message& msg) { return result; } -set SnapperZyppPlugin::get_solvables(const Message& msg, bool todo) { +set SnapperZyppPlugin::get_solvables(const Message& msg, Phase phase) { set result; rapidjson::Document doc; @@ -330,7 +331,7 @@ set SnapperZyppPlugin::get_solvables(const Message& msg, bool todo) { for (Value::ConstValueIterator it = steps.Begin(); it != steps.End(); ++it) { const Value& step = *it; if (step.HasMember("type")) { - if (todo || step.HasMember("stage")) { + if (phase == Phase::BEFORE || step.HasMember("stage")) { const Value& solvable = step["solvable"]; const Value& name = solvable["n"]; // FIXME: what happens when the doc structure is different?