Merge lp:~fginther/unity/revert-libxpathselect1.4 into lp:unity

Proposed by Francis Ginther
Status: Merged
Approved by: Christopher Townsend
Approved revision: no longer in the source branch.
Merged at revision: 3586
Proposed branch: lp:~fginther/unity/revert-libxpathselect1.4
Merge into: lp:unity
Diff against target: 218 lines (+41/-60)
3 files modified
CMakeLists.txt (+1/-1)
debian/control (+2/-2)
unity-shared/DebugDBusInterface.cpp (+38/-57)
To merge this branch: bzr merge lp:~fginther/unity/revert-libxpathselect1.4
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Christopher Townsend Approve
Timo Jyrinki Approve
Review via email: mp+193137@code.launchpad.net

Commit message

Reverting support for libxpathselect1.4.

Description of the change

Reverting support for libxpathselect1.4.

libxpathselect 1.4 and autopilot 1.4 are blocked from landing until all the autopilot tests are ready. As a result, this support needs to wait a little bit longer.

The build issue identified in https://bugs.launchpad.net/bugs/1243529 should be corrected by the removal of libxpathselect1.4 from the daily-build ppa.

To post a comment you must log in.
Revision history for this message
Timo Jyrinki (timo-jyrinki) wrote :

Looks good. This is a revert of the http://bazaar.launchpad.net/~unity-team/unity/trunk/revision/3581 until AP 1.4 migration approved.

review: Approve
Revision history for this message
Christopher Townsend (townsend) wrote :

This is fine, but it would have been nice to have removed xpathselect1.4 sooner when we were trying to fix https://bugs.launchpad.net/unity/+bug/1243529...

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'CMakeLists.txt'
2--- CMakeLists.txt 2013-10-23 17:52:12 +0000
3+++ CMakeLists.txt 2013-10-29 20:53:15 +0000
4@@ -233,7 +233,7 @@
5 nux-4.0>=4.0.1
6 sigc++-2.0
7 unity-misc>=0.4.0
8- xpathselect=1.4
9+ xpathselect>=1.2
10 zeitgeist-2.0
11 )
12
13
14=== modified file 'debian/control'
15--- debian/control 2013-10-23 17:52:12 +0000
16+++ debian/control 2013-10-29 20:53:15 +0000
17@@ -48,7 +48,7 @@
18 libxcb-icccm4-dev,
19 libxfixes-dev (>= 1:5.0.1-1),
20 libxi-dev (>= 2:1.7.1.901),
21- libxpathselect-dev (>=1.4),
22+ libxpathselect-dev (>=1.3),
23 libzeitgeist-2.0-dev,
24 pkg-config,
25 python (>= 2.7),
26@@ -178,7 +178,7 @@
27 python-testtools,
28 python-xdg,
29 python-xlib,
30- libxpathselect1.4 (>= 1.4),
31+ libxpathselect1.3 (>= 1.3),
32 Description: Autopiloted tests for Unity
33 We test Unity automatically through autopilot, a framework which enables us
34 to trigger keyboard and mouse events on the fly as well as introspecting
35
36=== modified file 'unity-shared/DebugDBusInterface.cpp'
37--- unity-shared/DebugDBusInterface.cpp 2013-10-23 17:52:12 +0000
38+++ unity-shared/DebugDBusInterface.cpp 2013-10-29 20:53:15 +0000
39@@ -17,11 +17,18 @@
40 * Authored by: Alex Launi <alex.launi@canonical.com>
41 */
42
43+#include <queue>
44+#include <iostream>
45 #include <fstream>
46 #include <sstream>
47+#include <iostream>
48 #include <boost/algorithm/string.hpp>
49+#include <boost/algorithm/string/split.hpp>
50+#include <boost/algorithm/string/classification.hpp>
51+#include <boost/bind.hpp>
52 #include <NuxCore/Logger.h>
53 #include <NuxCore/LoggingWriter.h>
54+#include <xpathselect/node.h>
55 #include <xpathselect/xpathselect.h>
56 #include <dlfcn.h>
57
58@@ -39,21 +46,16 @@
59 namespace local
60 {
61 std::ofstream output_file;
62- void* xpathselect_driver_ = nullptr;
63+ void* xpathselect_driver_ = NULL;
64
65- class IntrospectableAdapter : public std::enable_shared_from_this<IntrospectableAdapter>, public xpathselect::Node
66+ class IntrospectableAdapter: public xpathselect::Node
67 {
68 public:
69 typedef std::shared_ptr<IntrospectableAdapter> Ptr;
70- IntrospectableAdapter(Introspectable* node, IntrospectableAdapter::Ptr const& parent = nullptr)
71- : node_(node)
72- , parent_(parent)
73- , full_path_((parent_ ? parent_->GetPath() : "") + "/" + GetName())
74- {}
75-
76- int32_t GetId() const
77+ IntrospectableAdapter(Introspectable* node, std::string const& parent_path)
78+ : node_(node)
79 {
80- return GPOINTER_TO_INT(node_);
81+ full_path_ = parent_path + "/" + GetName();
82 }
83
84 std::string GetName() const
85@@ -66,27 +68,6 @@
86 return full_path_;
87 }
88
89- Node::Ptr GetParent() const
90- {
91- return parent_;
92- }
93-
94- virtual bool MatchBooleanProperty(const std::string& name, bool value) const
95- {
96- return false;
97- }
98-
99- virtual bool MatchIntegerProperty(const std::string& name, int32_t value) const
100- {
101- return false;
102- }
103-
104- virtual bool MatchStringProperty(const std::string& name, const std::string& value) const
105- {
106- return false;
107- }
108-
109-
110 bool MatchProperty(const std::string& name, const std::string& value) const
111 {
112 bool matches = false;
113@@ -96,7 +77,7 @@
114 g_variant_builder_add(&child_builder, "{sv}", "id", g_variant_new_uint64(node_->GetIntrospectionId()));
115 node_->AddProperties(&child_builder);
116 GVariant* prop_dict = g_variant_builder_end(&child_builder);
117- GVariant* prop_value = g_variant_lookup_value(prop_dict, name.c_str(), NULL);
118+ GVariant *prop_value = g_variant_lookup_value(prop_dict, name.c_str(), NULL);
119
120 if (prop_value != NULL)
121 {
122@@ -119,7 +100,10 @@
123 case G_VARIANT_CLASS_BOOLEAN:
124 {
125 std::string value = boost::to_upper_copy(value);
126- bool p = value == "TRUE" || value == "ON" || value == "YES" || value == "1";
127+ bool p = value == "TRUE" ||
128+ value == "ON" ||
129+ value == "YES" ||
130+ value == "1";
131 matches = (g_variant_get_boolean(prop_value) == p);
132 }
133 break;
134@@ -199,34 +183,30 @@
135 std::vector<xpathselect::Node::Ptr> Children() const
136 {
137 std::vector<xpathselect::Node::Ptr> children;
138- auto const& this_ptr = std::const_pointer_cast<IntrospectableAdapter>(shared_from_this());
139- for(auto const& child: node_->GetIntrospectableChildren())
140- children.push_back(std::make_shared<IntrospectableAdapter>(child, this_ptr));
141-
142+ for(auto child: node_->GetIntrospectableChildren())
143+ {
144+ children.push_back(std::make_shared<IntrospectableAdapter>(child, GetPath() ));
145+ }
146 return children;
147- }
148-
149- Introspectable* Node() const
150- {
151- return node_;
152- }
153-
154+
155+ }
156+
157+ Introspectable* node_;
158 private:
159- Introspectable* node_;
160- IntrospectableAdapter::Ptr parent_;
161 std::string full_path_;
162 };
163
164- xpathselect::NodeVector select_nodes(IntrospectableAdapter::Ptr const& root, std::string const& query)
165+ xpathselect::NodeList select_nodes(local::IntrospectableAdapter::Ptr root,
166+ std::string const& query)
167 {
168- if (!xpathselect_driver_)
169- xpathselect_driver_ = dlopen("libxpathselect.so.1.4", RTLD_LAZY);
170+ if (xpathselect_driver_ == NULL)
171+ xpathselect_driver_ = dlopen("libxpathselect.so.1.3", RTLD_LAZY);
172
173 if (xpathselect_driver_)
174 {
175- typedef decltype(&xpathselect::SelectNodes) select_nodes_t;
176+ typedef decltype(&xpathselect::SelectNodes) entry_t;
177 dlerror();
178- auto SelectNodes = reinterpret_cast<select_nodes_t>(dlsym(xpathselect_driver_, "SelectNodes"));
179+ entry_t entry_point = (entry_t) dlsym(xpathselect_driver_, "SelectNodes");
180 const char* err = dlerror();
181 if (err)
182 {
183@@ -234,7 +214,7 @@
184 }
185 else
186 {
187- return SelectNodes(root, query);
188+ return entry_point(root, query);
189 }
190 }
191 else
192@@ -243,7 +223,7 @@
193 }
194
195 // Fallen through here as we've hit an error
196- return xpathselect::NodeVector();
197+ return xpathselect::NodeList();
198 }
199
200 // This needs to be called at destruction to cleanup the dlopen
201@@ -375,12 +355,13 @@
202 GVariantBuilder builder;
203 g_variant_builder_init(&builder, G_VARIANT_TYPE("a(sv)"));
204
205- auto root_node = std::make_shared<local::IntrospectableAdapter>(_parent_introspectable);
206- for (auto const& n : local::select_nodes(root_node, query))
207+ local::IntrospectableAdapter::Ptr root_node = std::make_shared<local::IntrospectableAdapter>(_parent_introspectable, std::string());
208+ auto nodes = local::select_nodes(root_node, query);
209+ for (auto n : nodes)
210 {
211- auto p = std::static_pointer_cast<local::IntrospectableAdapter const>(n);
212+ auto p = std::static_pointer_cast<local::IntrospectableAdapter>(n);
213 if (p)
214- g_variant_builder_add(&builder, "(sv)", p->GetPath().c_str(), p->Node()->Introspect());
215+ g_variant_builder_add(&builder, "(sv)", p->GetPath().c_str(), p->node_->Introspect());
216 }
217
218 return g_variant_new("(a(sv))", &builder);