Hello community, here is the log from the commit of package libstorage-ng for openSUSE:Factory checked in at 2020-10-29 09:21:22 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/libstorage-ng (Old) and /work/SRC/openSUSE:Factory/.libstorage-ng.new.3463 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libstorage-ng" Thu Oct 29 09:21:22 2020 rev:96 rq:843604 version:4.3.52 Changes: -------- --- /work/SRC/openSUSE:Factory/libstorage-ng/libstorage-ng.changes 2020-10-22 14:23:13.158800719 +0200 +++ /work/SRC/openSUSE:Factory/.libstorage-ng.new.3463/libstorage-ng.changes 2020-10-29 09:21:22.930634595 +0100 @@ -1,0 +2,10 @@ +Fri Oct 23 12:00:28 UTC 2020 - aschn...@suse.com + +- merge gh#openSUSE/libstorage-ng#775 +- allow to specify view in utils +- coding style +- fixed sanity check during btrfs probing +- allow views to also filter devices +- 4.3.52 + +-------------------------------------------------------------------- Old: ---- libstorage-ng-4.3.51.tar.xz New: ---- libstorage-ng-4.3.52.tar.xz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ libstorage-ng.spec ++++++ --- /var/tmp/diff_new_pack.OQUqu5/_old 2020-10-29 09:21:23.386635033 +0100 +++ /var/tmp/diff_new_pack.OQUqu5/_new 2020-10-29 09:21:23.390635037 +0100 @@ -18,7 +18,7 @@ %define libname %{name}1 Name: libstorage-ng -Version: 4.3.51 +Version: 4.3.52 Release: 0 Summary: Library for storage management License: GPL-2.0-only ++++++ libstorage-ng-4.3.51.tar.xz -> libstorage-ng-4.3.52.tar.xz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.3.51/VERSION new/libstorage-ng-4.3.52/VERSION --- old/libstorage-ng-4.3.51/VERSION 2020-10-19 12:40:34.000000000 +0200 +++ new/libstorage-ng-4.3.52/VERSION 2020-10-23 14:00:28.000000000 +0200 @@ -1 +1 @@ -4.3.51 +4.3.52 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.3.51/storage/ActiongraphImpl.cc new/libstorage-ng-4.3.52/storage/ActiongraphImpl.cc --- old/libstorage-ng-4.3.51/storage/ActiongraphImpl.cc 2020-10-19 12:40:34.000000000 +0200 +++ new/libstorage-ng-4.3.52/storage/ActiongraphImpl.cc 2020-10-23 14:00:28.000000000 +0200 @@ -140,7 +140,7 @@ Stopwatch stopwatch; - get_actions(); + get_device_actions(); remove_duplicates(); set_special_actions(); add_dependencies(); @@ -270,7 +270,7 @@ { if (actions.size() > 1) { - Actiongraph::Impl::vertex_descriptor vertex = actions[0]; + vertex_descriptor vertex = actions[0]; for (size_t i = 1; i < actions.size(); ++i) { add_edge(vertex, actions[i]); @@ -283,7 +283,7 @@ void Actiongraph::Impl::add_chain(const vector<vector<vertex_descriptor>>& vert_vectors) { - vector<vector<Actiongraph::Impl::vertex_descriptor>> non_empty_vectors; + vector<vector<vertex_descriptor>> non_empty_vectors; for (const vector<vertex_descriptor>& vector : vert_vectors) if (!vector.empty()) @@ -355,7 +355,7 @@ void - Actiongraph::Impl::get_actions() + Actiongraph::Impl::get_device_actions() { const set<sid_t> lhs_sids = lhs->get_impl().get_device_sids(); const set<sid_t> rhs_sids = rhs->get_impl().get_device_sids(); @@ -487,9 +487,11 @@ for (vertex_descriptor vertex : vertices()) { - graph[vertex]->add_dependencies(vertex, *this); + const Action::Base* action = graph[vertex].get(); - const Action::Mount* mount = dynamic_cast<const Action::Mount*>(graph[vertex].get()); + action->add_dependencies(vertex, *this); + + const Action::Mount* mount = dynamic_cast<const Action::Mount*>(action); if (mount && mount->get_path(*this) != "swap") mounts.push_back(vertex); } @@ -609,7 +611,7 @@ { const CommitData commit_data(*this, Tense::SIMPLE_PRESENT); - for (const vertex_descriptor& vertex : order) + for (const vertex_descriptor vertex : order) { const Action::Base* action = graph[vertex].get(); cout << action->text(commit_data).native << '\n'; @@ -624,7 +626,7 @@ { vector<const Action::Base*> commit_actions; - for (const vertex_descriptor& vertex : order) + for (const vertex_descriptor vertex : order) { const Action::Base* action = graph[vertex].get(); @@ -644,7 +646,7 @@ CommitData commit_data(*this, Tense::PRESENT_CONTINUOUS); - for (const vertex_descriptor& vertex : order) + for (const vertex_descriptor vertex : order) { const Action::Base* action = graph[vertex].get(); @@ -700,10 +702,11 @@ const CommitData commit_data(*this, Tense::SIMPLE_PRESENT); - for (vertex_descriptor v : vertices()) + for (const vertex_descriptor vertex : vertices()) { - string text = "[ " + graph[v]->text(commit_data).translated + " ]"; - boost::put(my_vertex_name_map, v, text); + const Action::Base* action = graph[vertex].get(); + string text = "[ " + action->text(commit_data).native + " ]"; + boost::put(my_vertex_name_map, vertex, text); } boost::print_graph(graph, my_vertex_name_map); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.3.51/storage/ActiongraphImpl.h new/libstorage-ng-4.3.52/storage/ActiongraphImpl.h --- old/libstorage-ng-4.3.51/storage/ActiongraphImpl.h 2020-10-19 12:40:34.000000000 +0200 +++ new/libstorage-ng-4.3.52/storage/ActiongraphImpl.h 2020-10-23 14:00:28.000000000 +0200 @@ -187,7 +187,7 @@ void set_gpt_undersized(); - void get_actions(); + void get_device_actions(); void remove_duplicates(); void set_special_actions(); void add_dependencies(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.3.51/storage/DevicegraphImpl.cc new/libstorage-ng-4.3.52/storage/DevicegraphImpl.cc --- old/libstorage-ng-4.3.51/storage/DevicegraphImpl.cc 2020-10-19 12:40:34.000000000 +0200 +++ new/libstorage-ng-4.3.52/storage/DevicegraphImpl.cc 2020-10-23 14:00:28.000000000 +0200 @@ -217,7 +217,8 @@ { // Look for cycles in the classic view. With btrfs snapshots cycles are possible. - filtered_graph_t filtered_graph(graph, make_edge_filter(View::CLASSIC)); + filtered_graph_t filtered_graph(graph, make_edge_filter(View::CLASSIC), + make_vertex_filter(View::CLASSIC)); VertexIndexMapGenerator<filtered_graph_t> vertex_index_map_generator(filtered_graph); @@ -500,7 +501,7 @@ size_t Devicegraph::Impl::num_children(vertex_descriptor vertex, View view) const { - filtered_graph_t filtered_graph(graph, make_edge_filter(view)); + filtered_graph_t filtered_graph(graph, make_edge_filter(view), make_vertex_filter(view)); return boost::out_degree(vertex, filtered_graph); } @@ -509,7 +510,7 @@ size_t Devicegraph::Impl::num_parents(vertex_descriptor vertex, View view) const { - filtered_graph_t filtered_graph(graph, make_edge_filter(view)); + filtered_graph_t filtered_graph(graph, make_edge_filter(view), make_vertex_filter(view)); return boost::in_degree(vertex, filtered_graph); } @@ -577,7 +578,7 @@ vector<Devicegraph::Impl::vertex_descriptor> Devicegraph::Impl::descendants(vertex_descriptor vertex, bool itself, View view) const { - filtered_graph_t filtered_graph(graph, make_edge_filter(view)); + filtered_graph_t filtered_graph(graph, make_edge_filter(view), make_vertex_filter(view)); VertexIndexMapGenerator<filtered_graph_t> vertex_index_map_generator(filtered_graph); @@ -599,7 +600,7 @@ { typedef boost::reverse_graph<filtered_graph_t> reverse_graph_t; - filtered_graph_t filtered_graph(graph, make_edge_filter(view)); + filtered_graph_t filtered_graph(graph, make_edge_filter(view), make_vertex_filter(view)); reverse_graph_t reverse_graph(filtered_graph); VertexIndexMapGenerator<reverse_graph_t> vertex_index_map_generator(reverse_graph); @@ -620,7 +621,7 @@ vector<Devicegraph::Impl::vertex_descriptor> Devicegraph::Impl::leaves(vertex_descriptor vertex, bool itself, View view) const { - filtered_graph_t filtered_graph(graph, make_edge_filter(view)); + filtered_graph_t filtered_graph(graph, make_edge_filter(view), make_vertex_filter(view)); VertexIndexMapGenerator<filtered_graph_t> vertex_index_map_generator(filtered_graph); @@ -642,7 +643,7 @@ { typedef boost::reverse_graph<filtered_graph_t> reverse_graph_t; - filtered_graph_t filtered_graph(graph, make_edge_filter(view)); + filtered_graph_t filtered_graph(graph, make_edge_filter(view), make_vertex_filter(view)); reverse_graph_t reverse_graph(filtered_graph); VertexIndexMapGenerator<reverse_graph_t> vertex_index_map_generator(filtered_graph); @@ -663,7 +664,7 @@ Devicegraph::Impl::edge_descriptor Devicegraph::Impl::in_edge(vertex_descriptor vertex, View view) const { - filtered_graph_t filtered_graph(graph, make_edge_filter(view)); + filtered_graph_t filtered_graph(graph, make_edge_filter(view), make_vertex_filter(view)); boost::iterator_range<filtered_graph_t::in_edge_iterator> range = boost::make_iterator_range(boost::in_edges(vertex, filtered_graph)); @@ -679,7 +680,7 @@ Devicegraph::Impl::edge_descriptor Devicegraph::Impl::out_edge(vertex_descriptor vertex, View view) const { - filtered_graph_t filtered_graph(graph, make_edge_filter(view)); + filtered_graph_t filtered_graph(graph, make_edge_filter(view), make_vertex_filter(view)); boost::iterator_range<filtered_graph_t::out_edge_iterator> range = boost::make_iterator_range(boost::out_edges(vertex, filtered_graph)); @@ -695,7 +696,7 @@ vector<Devicegraph::Impl::edge_descriptor> Devicegraph::Impl::in_edges(vertex_descriptor vertex, View view) const { - filtered_graph_t filtered_graph(graph, make_edge_filter(view)); + filtered_graph_t filtered_graph(graph, make_edge_filter(view), make_vertex_filter(view)); boost::iterator_range<filtered_graph_t::in_edge_iterator> range = boost::make_iterator_range(boost::in_edges(vertex, filtered_graph)); @@ -707,7 +708,7 @@ vector<Devicegraph::Impl::edge_descriptor> Devicegraph::Impl::out_edges(vertex_descriptor vertex, View view) const { - filtered_graph_t filtered_graph(graph, make_edge_filter(view)); + filtered_graph_t filtered_graph(graph, make_edge_filter(view), make_vertex_filter(view)); boost::iterator_range<filtered_graph_t::out_edge_iterator> range = boost::make_iterator_range(boost::out_edges(vertex, filtered_graph)); @@ -879,7 +880,7 @@ { ST_CHECK_PTR(style_callbacks); - filtered_graph_t filtered_graph(graph, make_edge_filter(view)); + filtered_graph_t filtered_graph(graph, make_edge_filter(view), make_vertex_filter(view)); ofstream fout(filename); @@ -912,6 +913,17 @@ } + Devicegraph::Impl::vertex_filter_t + Devicegraph::Impl::make_vertex_filter(View view) const + { + // graph is needed by reference and view by value + return [&, view](Devicegraph::Impl::vertex_descriptor vertex) { + const Device* device = graph[vertex].get(); + return device->get_impl().is_in_view(view); + }; + } + + Devicegraph::Impl::edge_filter_t Devicegraph::Impl::make_edge_filter(View view) const { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.3.51/storage/DevicegraphImpl.h new/libstorage-ng-4.3.52/storage/DevicegraphImpl.h --- old/libstorage-ng-4.3.51/storage/DevicegraphImpl.h 2020-10-19 12:40:34.000000000 +0200 +++ new/libstorage-ng-4.3.52/storage/DevicegraphImpl.h 2020-10-23 14:00:28.000000000 +0200 @@ -76,9 +76,10 @@ typedef graph_t::vertices_size_type vertices_size_type; + typedef std::function<bool(Devicegraph::Impl::vertex_descriptor)> vertex_filter_t; typedef std::function<bool(Devicegraph::Impl::edge_descriptor)> edge_filter_t; - typedef boost::filtered_graph<graph_t, edge_filter_t> filtered_graph_t; + typedef boost::filtered_graph<graph_t, edge_filter_t, vertex_filter_t> filtered_graph_t; Impl(Storage* storage) : storage(storage) {} @@ -289,6 +290,7 @@ private: + vertex_filter_t make_vertex_filter(View view) const; edge_filter_t make_edge_filter(View view) const; Storage* storage; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.3.51/storage/Devices/DeviceImpl.h new/libstorage-ng-4.3.52/storage/Devices/DeviceImpl.h --- old/libstorage-ng-4.3.51/storage/Devices/DeviceImpl.h 2020-10-19 12:40:34.000000000 +0200 +++ new/libstorage-ng-4.3.52/storage/Devices/DeviceImpl.h 2020-10-23 14:00:28.000000000 +0200 @@ -101,6 +101,8 @@ virtual string get_name_sort_key() const { return ""; } + virtual bool is_in_view(View view) const { return true; } + virtual void save(xmlNode* node) const = 0; virtual void check(const CheckCallbacks* check_callbacks) const; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.3.51/storage/Filesystems/BtrfsImpl.cc new/libstorage-ng-4.3.52/storage/Filesystems/BtrfsImpl.cc --- old/libstorage-ng-4.3.51/storage/Filesystems/BtrfsImpl.cc 2020-10-19 12:40:34.000000000 +0200 +++ new/libstorage-ng-4.3.52/storage/Filesystems/BtrfsImpl.cc 2020-10-23 14:00:28.000000000 +0200 @@ -512,7 +512,7 @@ ST_THROW(Exception("parent subvolume not found by uuid")); const BtrfsSubvolume* child = subvolumes_by_uuid[subvolume.uuid]; - if (!parent) + if (!child) ST_THROW(Exception("child subvolume not found by uuid")); Snapshot::create(prober.get_system(), parent, child); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.3.51/storage/GraphvizImpl.cc new/libstorage-ng-4.3.52/storage/GraphvizImpl.cc --- old/libstorage-ng-4.3.51/storage/GraphvizImpl.cc 2020-10-19 12:40:34.000000000 +0200 +++ new/libstorage-ng-4.3.52/storage/GraphvizImpl.cc 2020-10-23 14:00:28.000000000 +0200 @@ -340,8 +340,7 @@ map<string, string> - AdvancedActiongraphStyleCallbacks::node(const CommitData& commit_data, - const Action::Base* action) + AdvancedActiongraphStyleCallbacks::node(const CommitData& commit_data, const Action::Base* action) { map<string, string> ret; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.3.51/storage/Holders/Snapshot.h new/libstorage-ng-4.3.52/storage/Holders/Snapshot.h --- old/libstorage-ng-4.3.51/storage/Holders/Snapshot.h 2020-10-19 12:40:34.000000000 +0200 +++ new/libstorage-ng-4.3.52/storage/Holders/Snapshot.h 2020-10-23 14:00:28.000000000 +0200 @@ -34,6 +34,8 @@ * Relationship between origin and snapshot. The origin is the source and the * snapshot the target. Used for LVM and btrfs snapshot. * + * Not included in the classic view. + * * @see Holder */ class Snapshot : public Holder diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.3.51/utils/display.cc new/libstorage-ng-4.3.52/utils/display.cc --- old/libstorage-ng-4.3.51/utils/display.cc 2020-10-19 12:40:34.000000000 +0200 +++ new/libstorage-ng-4.3.52/utils/display.cc 2020-10-23 14:00:28.000000000 +0200 @@ -2,6 +2,7 @@ #include <stdlib.h> #include <unistd.h> #include <getopt.h> +#include <string.h> #include <iostream> #include <boost/algorithm/string.hpp> @@ -12,6 +13,7 @@ #include "storage/Utils/Logger.h" #include "storage/Utils/AppUtil.h" #include "storage/Utils/StorageDefines.h" +#include "storage/Utils/Format.h" #include "storage/Actiongraph.h" @@ -24,6 +26,7 @@ bool keep_gv = false; bool keep_svg = false; +View view = View::ALL; void @@ -63,7 +66,7 @@ string filename_gv = keep_gv ? name + ".gv" : tmp_dir.get_fullname() + "/" + name + ".gv"; string filename_svg = keep_svg ? name + ".svg" : tmp_dir.get_fullname() + "/" + name + ".svg"; - probed->write_graphviz(filename_gv, get_debug_devicegraph_style_callbacks(), View::ALL); + probed->write_graphviz(filename_gv, get_debug_devicegraph_style_callbacks(), view); helper(filename_gv, filename_svg); } @@ -105,7 +108,7 @@ void usage() { - cerr << "display [--devicegraph] [--keep-gv] [--keep-svg] filename\n" + cerr << "display [--devicegraph] [--keep-gv] [--keep-svg] [--view view] filename\n" << "display --actiongraph [--keep-gv] [--keep-svg] filename filename\n"; exit(EXIT_FAILURE); @@ -116,10 +119,11 @@ main(int argc, char **argv) { const struct option options[] = { - { "devicegraph", no_argument, 0, 1 }, - { "actiongraph", no_argument, 0, 2 }, - { "keep-gv", no_argument, 0, 3 }, - { "keep-svg", no_argument, 0, 4 }, + { "devicegraph", no_argument, 0, 1 }, + { "actiongraph", no_argument, 0, 2 }, + { "keep-gv", no_argument, 0, 3 }, + { "keep-svg", no_argument, 0, 4 }, + { "view", required_argument, 0, 5 }, { 0, 0, 0, 0 } }; @@ -151,6 +155,20 @@ keep_svg = true; break; + case 5: + if (strcmp(optarg, "all") == 0) + view = View::ALL; + else if (strcmp(optarg, "classic") == 0) + view = View::CLASSIC; + else if (strcmp(optarg, "remove") == 0) + view = View::REMOVE; + else + { + cerr << sformat("Unknown view '%s'.", optarg) << endl; + usage(); + } + break; + default: usage(); } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/libstorage-ng-4.3.51/utils/probe.cc new/libstorage-ng-4.3.52/utils/probe.cc --- old/libstorage-ng-4.3.51/utils/probe.cc 2020-10-19 12:40:34.000000000 +0200 +++ new/libstorage-ng-4.3.52/utils/probe.cc 2020-10-23 14:00:28.000000000 +0200 @@ -2,6 +2,7 @@ #include <stdlib.h> #include <unistd.h> #include <getopt.h> +#include <string.h> #include <iostream> #include "storage/StorageImpl.h" @@ -10,6 +11,7 @@ #include "storage/Utils/SystemCmd.h" #include "storage/Utils/Logger.h" #include "storage/Utils/StorageDefines.h" +#include "storage/Utils/Format.h" using namespace std; @@ -21,6 +23,7 @@ bool save_mockup = false; bool load_mockup = false; bool ignore_probe_errors = false; +View view = View::ALL; class MyProbeCallbacks : public ProbeCallbacks @@ -82,7 +85,7 @@ const TmpDir& tmp_dir = storage.get_impl().get_tmp_dir(); probed->write_graphviz(tmp_dir.get_fullname() + "/probe.gv", - get_debug_devicegraph_style_callbacks(), View::ALL); + get_debug_devicegraph_style_callbacks(), view); system(string(DOT_BIN " -Tsvg < " + quote(tmp_dir.get_fullname() + "/probe.gv") + " > " + quote(tmp_dir.get_fullname() + "/probe.svg")).c_str()); unlink(string(tmp_dir.get_fullname() + "/probe.gv").c_str()); @@ -98,7 +101,7 @@ usage() { cerr << "probe [--display-devicegraph] [--save-devicegraph] [--save-mockup] [--load-mockup] " - "[--ignore-probe-errors]\n"; + "[--ignore-probe-errors] [--view view]\n"; exit(EXIT_FAILURE); } @@ -107,11 +110,12 @@ main(int argc, char **argv) { const struct option options[] = { - { "display-devicegraph", no_argument, 0, 1 }, - { "save-devicegraph", no_argument, 0, 2 }, - { "save-mockup", no_argument, 0, 3 }, - { "load-mockup", no_argument, 0, 4 }, - { "ignore-probe-errors", no_argument, 0, 5 }, + { "display-devicegraph", no_argument, 0, 1 }, + { "save-devicegraph", no_argument, 0, 2 }, + { "save-mockup", no_argument, 0, 3 }, + { "load-mockup", no_argument, 0, 4 }, + { "ignore-probe-errors", no_argument, 0, 5 }, + { "view", required_argument, 0, 6 }, { 0, 0, 0, 0 } }; @@ -147,6 +151,20 @@ ignore_probe_errors = true; break; + case 6: + if (strcmp(optarg, "all") == 0) + view = View::ALL; + else if (strcmp(optarg, "classic") == 0) + view = View::CLASSIC; + else if (strcmp(optarg, "remove") == 0) + view = View::REMOVE; + else + { + cerr << sformat("Unknown view '%s'.", optarg) << endl; + usage(); + } + break; + default: usage(); }