diff options
author | Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | 2024-10-24 15:51:26 +0200 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2024-10-24 07:06:31 -0700 |
commit | 9626e8a2c8f20c7ff81a336e0adebd1b74bb9ac7 (patch) | |
tree | eee5a6b3d8975aca36d8d1c2c3ddf94ffd730c27 /meta-oe | |
parent | 38b782183848a1257a45099dfb65282726c3d6c1 (diff) | |
download | meta-openembedded-9626e8a2c8f20c7ff81a336e0adebd1b74bb9ac7.tar.gz |
libgpiod: update to v2.2
This is a big update for libgpiod bringing in the D-Bus daemon and its
command-line client. This is why the patch is pretty hefty. The majority
of the line count comes from the removed patch that is now upstream but
the v2.2 recipe also now contains a lot of bits and pieces that make the
D-Bus daemon work both with system as well as sysvinit.
The project now packages the systemd service and udev rules that allow
the manager to run under its own user in a well sandboxed environment
but the sysvsinit script is carried in the recipe as I don't want to
put support for legacy systems in libgpiod repo.
The patch also updates the ptests for libgpiod to run three new
test-suites: one for GLib bindings, one for the command-line D-Bus
client and finally one testing some daemon corner-cases not supported by
the client.
Build tested with various config options with systemd and sysvinit (the
latter with glibc and musl) on 32- and 64-bit architectures.
The complete changelog since v2.1 (taken verbatim from the NEWS file) is
below:
libgpiod v2.2
=============
New features:
- add GObject bindings with introspection
- add a D-Bus interface to libgpiod together with a daemon implementing it and
a command-line client
- split out the common shell test code for gpio-tools into a reusable test
harness for GPIO command-line tools
- add minutes as a new supported time unit for tools and allow longer periods
for timeouts, line holding, etc.
- add a script for generating sdist and wheels for python bindings
- migrate C++ tests to using Catch2 v3
Improvements:
- relicense C++ bindings under LGPL-2.1-or-later in order to make the project
more attractive to users with GPL-3.0 restrictions
- remove dependency on grep from tools' tests
- make shell scripts pass shellcheck treewide
- use ppoll() in tools to actually achieve the advertised microsecond
granularity of timeouts
- documentation improvements
- improve typing info in python bindings
- improve __repr__() implementations in python bindings
- make reconfiguring lines more flexible in python bindings by relaxing the
requirement to carry the ordering of the config entries from the request
- support casting of line.Value to bool in python bindings
- various new test-cases for improved coverage treewide
- align the test cases with the current kernel requirement for specifying
direction explicitly when reconfiguring lines
Bug fixes:
- fix C++ bindings build using slibtool
- accept the new style automatic GPIO chip labels from gpio-sim in bash tests
- fix C++ tests with recent kernels which introduced stricter reconfigure
behavior
- fix a use-after-free bug in python bindings
- fix passing the event clock property to line requests in python bindings
- fix a memory leak in tools
- make sure the string buffers in line-info and chip-info are big enough to not
truncate the strings they hold below the size accepted by the kernel
- remove buggy and unnecessary flags sanitization from line-config
- fix python bindings installation with Makefile build
- sanitize the return values of GPIO ioctl()s which in some cases may be
erroneously positive
- fix requesting lines by name with multiple entries in python bindings
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-oe')
5 files changed, 206 insertions, 575 deletions
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-bindings-cxx-Migrate-C-tests-to-use-Catch2-v3.patch b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-bindings-cxx-Migrate-C-tests-to-use-Catch2-v3.patch deleted file mode 100644 index ac1eff510..000000000 --- a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/0001-bindings-cxx-Migrate-C-tests-to-use-Catch2-v3.patch +++ /dev/null | |||
@@ -1,530 +0,0 @@ | |||
1 | From 0d3e1b3923a1fac80e9d75d8b5e33cd36f4fe659 Mon Sep 17 00:00:00 2001 | ||
2 | From: Khem Raj <raj.khem@gmail.com> | ||
3 | Date: Fri, 31 May 2024 09:03:22 -0700 | ||
4 | Subject: [PATCH] bindings: cxx: Migrate C++ tests to use Catch2 v3 | ||
5 | |||
6 | Catch2 v3.x has API changes which needs to be addressed | ||
7 | in the tests themselves, hence this changeset is to fix | ||
8 | those. | ||
9 | |||
10 | Upstream-Status: Submitted [https://lore.kernel.org/linux-gpio/20240531184223.3949069-1-raj.khem@gmail.com/T/#u] | ||
11 | Signed-off-by: Khem Raj <raj.khem@gmail.com> | ||
12 | Cc: Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | ||
13 | --- | ||
14 | bindings/cxx/tests/Makefile.am | 2 +- | ||
15 | bindings/cxx/tests/gpiod-cxx-test-main.cpp | 3 +-- | ||
16 | bindings/cxx/tests/helpers.hpp | 8 +++--- | ||
17 | bindings/cxx/tests/tests-chip-info.cpp | 30 ++++++++++----------- | ||
18 | bindings/cxx/tests/tests-chip.cpp | 14 +++++----- | ||
19 | bindings/cxx/tests/tests-edge-event.cpp | 2 +- | ||
20 | bindings/cxx/tests/tests-info-event.cpp | 2 +- | ||
21 | bindings/cxx/tests/tests-line-config.cpp | 2 +- | ||
22 | bindings/cxx/tests/tests-line-info.cpp | 22 +++++++-------- | ||
23 | bindings/cxx/tests/tests-line-request.cpp | 16 +++++------ | ||
24 | bindings/cxx/tests/tests-line-settings.cpp | 2 +- | ||
25 | bindings/cxx/tests/tests-line.cpp | 2 +- | ||
26 | bindings/cxx/tests/tests-misc.cpp | 2 +- | ||
27 | bindings/cxx/tests/tests-request-config.cpp | 10 +++---- | ||
28 | configure.ac | 4 +-- | ||
29 | 15 files changed, 60 insertions(+), 61 deletions(-) | ||
30 | |||
31 | diff --git a/bindings/cxx/tests/Makefile.am b/bindings/cxx/tests/Makefile.am | ||
32 | index fbf80a1..d9284da 100644 | ||
33 | --- a/bindings/cxx/tests/Makefile.am | ||
34 | +++ b/bindings/cxx/tests/Makefile.am | ||
35 | @@ -4,7 +4,7 @@ | ||
36 | AM_CXXFLAGS = -I$(top_srcdir)/bindings/cxx/ -I$(top_srcdir)/include | ||
37 | AM_CXXFLAGS += -I$(top_srcdir)/tests/gpiosim/ | ||
38 | AM_CXXFLAGS += -Wall -Wextra -g -std=gnu++17 $(CATCH2_CFLAGS) | ||
39 | -AM_LDFLAGS = -pthread | ||
40 | +AM_LDFLAGS = -pthread $(CATCH2_LIBS) | ||
41 | LDADD = $(top_builddir)/bindings/cxx/libgpiodcxx.la | ||
42 | LDADD += $(top_builddir)/tests/gpiosim/libgpiosim.la | ||
43 | |||
44 | diff --git a/bindings/cxx/tests/gpiod-cxx-test-main.cpp b/bindings/cxx/tests/gpiod-cxx-test-main.cpp | ||
45 | index 11bf8e5..ec48286 100644 | ||
46 | --- a/bindings/cxx/tests/gpiod-cxx-test-main.cpp | ||
47 | +++ b/bindings/cxx/tests/gpiod-cxx-test-main.cpp | ||
48 | @@ -1,5 +1,4 @@ | ||
49 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
50 | // SPDX-FileCopyrightText: 2017-2021 Bartosz Golaszewski <bartekgola@gmail.com> | ||
51 | |||
52 | -#define CATCH_CONFIG_MAIN | ||
53 | -#include <catch2/catch.hpp> | ||
54 | +#include <catch2/catch_all.hpp> | ||
55 | diff --git a/bindings/cxx/tests/helpers.hpp b/bindings/cxx/tests/helpers.hpp | ||
56 | index 62d9827..62bbdf5 100644 | ||
57 | --- a/bindings/cxx/tests/helpers.hpp | ||
58 | +++ b/bindings/cxx/tests/helpers.hpp | ||
59 | @@ -4,13 +4,13 @@ | ||
60 | #ifndef __GPIOD_CXX_TEST_HELPERS_HPP__ | ||
61 | #define __GPIOD_CXX_TEST_HELPERS_HPP__ | ||
62 | |||
63 | -#include <catch2/catch.hpp> | ||
64 | +#include <catch2/catch_all.hpp> | ||
65 | #include <regex> | ||
66 | #include <string> | ||
67 | #include <sstream> | ||
68 | #include <system_error> | ||
69 | |||
70 | -class system_error_matcher : public Catch::MatcherBase<::std::system_error> | ||
71 | +class system_error_matcher : public Catch::Matchers::MatcherBase<::std::system_error> | ||
72 | { | ||
73 | public: | ||
74 | explicit system_error_matcher(int expected_errno); | ||
75 | @@ -21,7 +21,7 @@ private: | ||
76 | ::std::error_condition _m_cond; | ||
77 | }; | ||
78 | |||
79 | -class regex_matcher : public Catch::MatcherBase<::std::string> | ||
80 | +class regex_matcher : public Catch::Matchers::MatcherBase<::std::string> | ||
81 | { | ||
82 | public: | ||
83 | explicit regex_matcher(const ::std::string& pattern); | ||
84 | @@ -33,7 +33,7 @@ private: | ||
85 | ::std::string _m_repr; | ||
86 | }; | ||
87 | |||
88 | -template<class T> class stringify_matcher : public Catch::MatcherBase<T> | ||
89 | +template<class T> class stringify_matcher : public Catch::Matchers::MatcherBase<T> | ||
90 | { | ||
91 | public: | ||
92 | explicit stringify_matcher(const ::std::string& expected) : _m_expected(expected) | ||
93 | diff --git a/bindings/cxx/tests/tests-chip-info.cpp b/bindings/cxx/tests/tests-chip-info.cpp | ||
94 | index 717c387..2c54f53 100644 | ||
95 | --- a/bindings/cxx/tests/tests-chip-info.cpp | ||
96 | +++ b/bindings/cxx/tests/tests-chip-info.cpp | ||
97 | @@ -1,7 +1,7 @@ | ||
98 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
99 | // SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
100 | |||
101 | -#include <catch2/catch.hpp> | ||
102 | +#include <catch2/catch_all.hpp> | ||
103 | #include <gpiod.hpp> | ||
104 | #include <sstream> | ||
105 | |||
106 | @@ -24,12 +24,12 @@ TEST_CASE("chip_info properties can be read", "[chip-info][chip]") | ||
107 | |||
108 | SECTION("get chip name") | ||
109 | { | ||
110 | - REQUIRE_THAT(info.name(), Catch::Equals(sim.name())); | ||
111 | + REQUIRE_THAT(info.name(), Catch::Matchers::Equals(sim.name())); | ||
112 | } | ||
113 | |||
114 | SECTION("get chip label") | ||
115 | { | ||
116 | - REQUIRE_THAT(info.label(), Catch::Equals("foobar")); | ||
117 | + REQUIRE_THAT(info.label(), Catch::Matchers::Equals("foobar")); | ||
118 | } | ||
119 | |||
120 | SECTION("get num_lines") | ||
121 | @@ -52,12 +52,12 @@ TEST_CASE("chip_info can be copied and moved", "[chip-info]") | ||
122 | { | ||
123 | auto copy(info); | ||
124 | |||
125 | - REQUIRE_THAT(copy.name(), Catch::Equals(sim.name())); | ||
126 | - REQUIRE_THAT(copy.label(), Catch::Equals("foobar")); | ||
127 | + REQUIRE_THAT(copy.name(), Catch::Matchers::Equals(sim.name())); | ||
128 | + REQUIRE_THAT(copy.label(), Catch::Matchers::Equals("foobar")); | ||
129 | REQUIRE(copy.num_lines() == 4); | ||
130 | |||
131 | - REQUIRE_THAT(info.name(), Catch::Equals(sim.name())); | ||
132 | - REQUIRE_THAT(info.label(), Catch::Equals("foobar")); | ||
133 | + REQUIRE_THAT(info.name(), Catch::Matchers::Equals(sim.name())); | ||
134 | + REQUIRE_THAT(info.label(), Catch::Matchers::Equals("foobar")); | ||
135 | REQUIRE(info.num_lines() == 4); | ||
136 | } | ||
137 | |||
138 | @@ -67,12 +67,12 @@ TEST_CASE("chip_info can be copied and moved", "[chip-info]") | ||
139 | |||
140 | copy = info; | ||
141 | |||
142 | - REQUIRE_THAT(copy.name(), Catch::Equals(sim.name())); | ||
143 | - REQUIRE_THAT(copy.label(), Catch::Equals("foobar")); | ||
144 | + REQUIRE_THAT(copy.name(), Catch::Matchers::Equals(sim.name())); | ||
145 | + REQUIRE_THAT(copy.label(), Catch::Matchers::Equals("foobar")); | ||
146 | REQUIRE(copy.num_lines() == 4); | ||
147 | |||
148 | - REQUIRE_THAT(info.name(), Catch::Equals(sim.name())); | ||
149 | - REQUIRE_THAT(info.label(), Catch::Equals("foobar")); | ||
150 | + REQUIRE_THAT(info.name(), Catch::Matchers::Equals(sim.name())); | ||
151 | + REQUIRE_THAT(info.label(), Catch::Matchers::Equals("foobar")); | ||
152 | REQUIRE(info.num_lines() == 4); | ||
153 | } | ||
154 | |||
155 | @@ -80,8 +80,8 @@ TEST_CASE("chip_info can be copied and moved", "[chip-info]") | ||
156 | { | ||
157 | auto moved(std::move(info)); | ||
158 | |||
159 | - REQUIRE_THAT(moved.name(), Catch::Equals(sim.name())); | ||
160 | - REQUIRE_THAT(moved.label(), Catch::Equals("foobar")); | ||
161 | + REQUIRE_THAT(moved.name(), Catch::Matchers::Equals(sim.name())); | ||
162 | + REQUIRE_THAT(moved.label(), Catch::Matchers::Equals("foobar")); | ||
163 | REQUIRE(moved.num_lines() == 4); | ||
164 | } | ||
165 | |||
166 | @@ -91,8 +91,8 @@ TEST_CASE("chip_info can be copied and moved", "[chip-info]") | ||
167 | |||
168 | moved = ::std::move(info); | ||
169 | |||
170 | - REQUIRE_THAT(moved.name(), Catch::Equals(sim.name())); | ||
171 | - REQUIRE_THAT(moved.label(), Catch::Equals("foobar")); | ||
172 | + REQUIRE_THAT(moved.name(), Catch::Matchers::Equals(sim.name())); | ||
173 | + REQUIRE_THAT(moved.label(), Catch::Matchers::Equals("foobar")); | ||
174 | REQUIRE(moved.num_lines() == 4); | ||
175 | } | ||
176 | } | ||
177 | diff --git a/bindings/cxx/tests/tests-chip.cpp b/bindings/cxx/tests/tests-chip.cpp | ||
178 | index c5ec19b..1ab7add 100644 | ||
179 | --- a/bindings/cxx/tests/tests-chip.cpp | ||
180 | +++ b/bindings/cxx/tests/tests-chip.cpp | ||
181 | @@ -1,7 +1,7 @@ | ||
182 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
183 | // SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
184 | |||
185 | -#include <catch2/catch.hpp> | ||
186 | +#include <catch2/catch_all.hpp> | ||
187 | #include <gpiod.hpp> | ||
188 | #include <sstream> | ||
189 | #include <system_error> | ||
190 | @@ -48,9 +48,9 @@ TEST_CASE("chip constructor works", "[chip]") | ||
191 | .build(); | ||
192 | |||
193 | ::gpiod::chip first(sim.dev_path()); | ||
194 | - REQUIRE_THAT(first.get_info().label(), Catch::Equals("foobar")); | ||
195 | + REQUIRE_THAT(first.get_info().label(), Catch::Matchers::Equals("foobar")); | ||
196 | ::gpiod::chip second(::std::move(first)); | ||
197 | - REQUIRE_THAT(second.get_info().label(), Catch::Equals("foobar")); | ||
198 | + REQUIRE_THAT(second.get_info().label(), Catch::Matchers::Equals("foobar")); | ||
199 | } | ||
200 | } | ||
201 | |||
202 | @@ -70,9 +70,9 @@ TEST_CASE("chip operators work", "[chip]") | ||
203 | |||
204 | ::gpiod::chip moved_chip(moved_sim.dev_path()); | ||
205 | |||
206 | - REQUIRE_THAT(chip.get_info().label(), Catch::Equals("foobar")); | ||
207 | + REQUIRE_THAT(chip.get_info().label(), Catch::Matchers::Equals("foobar")); | ||
208 | chip = ::std::move(moved_chip); | ||
209 | - REQUIRE_THAT(chip.get_info().label(), Catch::Equals("moved")); | ||
210 | + REQUIRE_THAT(chip.get_info().label(), Catch::Matchers::Equals("moved")); | ||
211 | } | ||
212 | |||
213 | SECTION("boolean operator") | ||
214 | @@ -94,7 +94,7 @@ TEST_CASE("chip properties can be read", "[chip]") | ||
215 | |||
216 | SECTION("get device path") | ||
217 | { | ||
218 | - REQUIRE_THAT(chip.path(), Catch::Equals(sim.dev_path())); | ||
219 | + REQUIRE_THAT(chip.path(), Catch::Matchers::Equals(sim.dev_path())); | ||
220 | } | ||
221 | |||
222 | SECTION("get file descriptor") | ||
223 | @@ -169,7 +169,7 @@ TEST_CASE("stream insertion operator works for chip", "[chip]") | ||
224 | "\", label=\"foobar\", num_lines=4))"; | ||
225 | |||
226 | buf << chip; | ||
227 | - REQUIRE_THAT(buf.str(), Catch::Equals(expected.str())); | ||
228 | + REQUIRE_THAT(buf.str(), Catch::Matchers::Equals(expected.str())); | ||
229 | } | ||
230 | |||
231 | SECTION("closed chip") | ||
232 | diff --git a/bindings/cxx/tests/tests-edge-event.cpp b/bindings/cxx/tests/tests-edge-event.cpp | ||
233 | index 19a6ab3..db387be 100644 | ||
234 | --- a/bindings/cxx/tests/tests-edge-event.cpp | ||
235 | +++ b/bindings/cxx/tests/tests-edge-event.cpp | ||
236 | @@ -1,7 +1,7 @@ | ||
237 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
238 | // SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
239 | |||
240 | -#include <catch2/catch.hpp> | ||
241 | +#include <catch2/catch_all.hpp> | ||
242 | #include <chrono> | ||
243 | #include <gpiod.hpp> | ||
244 | #include <sstream> | ||
245 | diff --git a/bindings/cxx/tests/tests-info-event.cpp b/bindings/cxx/tests/tests-info-event.cpp | ||
246 | index 21c0ef0..f7ae309 100644 | ||
247 | --- a/bindings/cxx/tests/tests-info-event.cpp | ||
248 | +++ b/bindings/cxx/tests/tests-info-event.cpp | ||
249 | @@ -1,7 +1,7 @@ | ||
250 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
251 | // SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
252 | |||
253 | -#include <catch2/catch.hpp> | ||
254 | +#include <catch2/catch_all.hpp> | ||
255 | #include <chrono> | ||
256 | #include <filesystem> | ||
257 | #include <gpiod.hpp> | ||
258 | diff --git a/bindings/cxx/tests/tests-line-config.cpp b/bindings/cxx/tests/tests-line-config.cpp | ||
259 | index 5e439a1..2f510fb 100644 | ||
260 | --- a/bindings/cxx/tests/tests-line-config.cpp | ||
261 | +++ b/bindings/cxx/tests/tests-line-config.cpp | ||
262 | @@ -1,7 +1,7 @@ | ||
263 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
264 | // SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
265 | |||
266 | -#include <catch2/catch.hpp> | ||
267 | +#include <catch2/catch_all.hpp> | ||
268 | #include <gpiod.hpp> | ||
269 | |||
270 | #include "gpiosim.hpp" | ||
271 | diff --git a/bindings/cxx/tests/tests-line-info.cpp b/bindings/cxx/tests/tests-line-info.cpp | ||
272 | index 21211f2..8589da3 100644 | ||
273 | --- a/bindings/cxx/tests/tests-line-info.cpp | ||
274 | +++ b/bindings/cxx/tests/tests-line-info.cpp | ||
275 | @@ -1,7 +1,7 @@ | ||
276 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
277 | // SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
278 | |||
279 | -#include <catch2/catch.hpp> | ||
280 | +#include <catch2/catch_all.hpp> | ||
281 | #include <gpiod.hpp> | ||
282 | #include <string> | ||
283 | |||
284 | @@ -35,9 +35,9 @@ TEST_CASE("get_line_info() works", "[chip][line-info]") | ||
285 | auto info = chip.get_line_info(0); | ||
286 | |||
287 | REQUIRE(info.offset() == 0); | ||
288 | - REQUIRE_THAT(info.name(), Catch::Equals("foobar")); | ||
289 | + REQUIRE_THAT(info.name(), Catch::Matchers::Equals("foobar")); | ||
290 | REQUIRE(info.used()); | ||
291 | - REQUIRE_THAT(info.consumer(), Catch::Equals("hog")); | ||
292 | + REQUIRE_THAT(info.consumer(), Catch::Matchers::Equals("hog")); | ||
293 | REQUIRE(info.direction() == ::gpiod::line::direction::OUTPUT); | ||
294 | REQUIRE_FALSE(info.active_low()); | ||
295 | REQUIRE(info.bias() == ::gpiod::line::bias::UNKNOWN); | ||
296 | @@ -74,9 +74,9 @@ TEST_CASE("line properties can be retrieved", "[line-info]") | ||
297 | auto info6 = chip.get_line_info(6); | ||
298 | |||
299 | REQUIRE(info4.offset() == 4); | ||
300 | - REQUIRE_THAT(info4.name(), Catch::Equals("baz")); | ||
301 | + REQUIRE_THAT(info4.name(), Catch::Matchers::Equals("baz")); | ||
302 | REQUIRE(info4.used()); | ||
303 | - REQUIRE_THAT(info4.consumer(), Catch::Equals("hog4")); | ||
304 | + REQUIRE_THAT(info4.consumer(), Catch::Matchers::Equals("hog4")); | ||
305 | REQUIRE(info4.direction() == direction::OUTPUT); | ||
306 | REQUIRE(info4.edge_detection() == edge::NONE); | ||
307 | REQUIRE_FALSE(info4.active_low()); | ||
308 | @@ -102,10 +102,10 @@ TEST_CASE("line_info can be copied and moved") | ||
309 | { | ||
310 | auto copy(info); | ||
311 | REQUIRE(copy.offset() == 2); | ||
312 | - REQUIRE_THAT(copy.name(), Catch::Equals("foobar")); | ||
313 | + REQUIRE_THAT(copy.name(), Catch::Matchers::Equals("foobar")); | ||
314 | /* info can still be used */ | ||
315 | REQUIRE(info.offset() == 2); | ||
316 | - REQUIRE_THAT(info.name(), Catch::Equals("foobar")); | ||
317 | + REQUIRE_THAT(info.name(), Catch::Matchers::Equals("foobar")); | ||
318 | } | ||
319 | |||
320 | SECTION("assignment operator works") | ||
321 | @@ -113,17 +113,17 @@ TEST_CASE("line_info can be copied and moved") | ||
322 | auto copy = chip.get_line_info(0); | ||
323 | copy = info; | ||
324 | REQUIRE(copy.offset() == 2); | ||
325 | - REQUIRE_THAT(copy.name(), Catch::Equals("foobar")); | ||
326 | + REQUIRE_THAT(copy.name(), Catch::Matchers::Equals("foobar")); | ||
327 | /* info can still be used */ | ||
328 | REQUIRE(info.offset() == 2); | ||
329 | - REQUIRE_THAT(info.name(), Catch::Equals("foobar")); | ||
330 | + REQUIRE_THAT(info.name(), Catch::Matchers::Equals("foobar")); | ||
331 | } | ||
332 | |||
333 | SECTION("move constructor works") | ||
334 | { | ||
335 | auto copy(::std::move(info)); | ||
336 | REQUIRE(copy.offset() == 2); | ||
337 | - REQUIRE_THAT(copy.name(), Catch::Equals("foobar")); | ||
338 | + REQUIRE_THAT(copy.name(), Catch::Matchers::Equals("foobar")); | ||
339 | } | ||
340 | |||
341 | SECTION("move assignment operator works") | ||
342 | @@ -131,7 +131,7 @@ TEST_CASE("line_info can be copied and moved") | ||
343 | auto copy = chip.get_line_info(0); | ||
344 | copy = ::std::move(info); | ||
345 | REQUIRE(copy.offset() == 2); | ||
346 | - REQUIRE_THAT(copy.name(), Catch::Equals("foobar")); | ||
347 | + REQUIRE_THAT(copy.name(), Catch::Matchers::Equals("foobar")); | ||
348 | } | ||
349 | } | ||
350 | |||
351 | diff --git a/bindings/cxx/tests/tests-line-request.cpp b/bindings/cxx/tests/tests-line-request.cpp | ||
352 | index 9632ae0..af8b979 100644 | ||
353 | --- a/bindings/cxx/tests/tests-line-request.cpp | ||
354 | +++ b/bindings/cxx/tests/tests-line-request.cpp | ||
355 | @@ -1,7 +1,7 @@ | ||
356 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
357 | // SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
358 | |||
359 | -#include <catch2/catch.hpp> | ||
360 | +#include <catch2/catch_all.hpp> | ||
361 | #include <gpiod.hpp> | ||
362 | #include <sstream> | ||
363 | #include <stdexcept> | ||
364 | @@ -20,7 +20,7 @@ using pull = ::gpiosim::chip::pull; | ||
365 | |||
366 | namespace { | ||
367 | |||
368 | -class value_matcher : public Catch::MatcherBase<value> | ||
369 | +class value_matcher : public Catch::Matchers::MatcherBase<value> | ||
370 | { | ||
371 | public: | ||
372 | value_matcher(pull pull, bool active_low = false) | ||
373 | @@ -117,7 +117,7 @@ TEST_CASE("consumer string is set correctly", "[line-request]") | ||
374 | auto info = chip.get_line_info(2); | ||
375 | |||
376 | REQUIRE(info.used()); | ||
377 | - REQUIRE_THAT(info.consumer(), Catch::Equals("foobar")); | ||
378 | + REQUIRE_THAT(info.consumer(), Catch::Matchers::Equals("foobar")); | ||
379 | } | ||
380 | |||
381 | SECTION("empty consumer") | ||
382 | @@ -130,7 +130,7 @@ TEST_CASE("consumer string is set correctly", "[line-request]") | ||
383 | auto info = chip.get_line_info(2); | ||
384 | |||
385 | REQUIRE(info.used()); | ||
386 | - REQUIRE_THAT(info.consumer(), Catch::Equals("?")); | ||
387 | + REQUIRE_THAT(info.consumer(), Catch::Matchers::Equals("?")); | ||
388 | } | ||
389 | } | ||
390 | |||
391 | @@ -380,7 +380,7 @@ TEST_CASE("line_request can be moved", "[line-request]") | ||
392 | auto moved(::std::move(request)); | ||
393 | |||
394 | REQUIRE(moved.fd() == fd); | ||
395 | - REQUIRE_THAT(moved.offsets(), Catch::Equals(offs)); | ||
396 | + REQUIRE_THAT(moved.offsets(), Catch::Matchers::Equals(offs)); | ||
397 | } | ||
398 | |||
399 | SECTION("move assignment operator works") | ||
400 | @@ -388,7 +388,7 @@ TEST_CASE("line_request can be moved", "[line-request]") | ||
401 | another = ::std::move(request); | ||
402 | |||
403 | REQUIRE(another.fd() == fd); | ||
404 | - REQUIRE_THAT(another.offsets(), Catch::Equals(offs)); | ||
405 | + REQUIRE_THAT(another.offsets(), Catch::Matchers::Equals(offs)); | ||
406 | } | ||
407 | } | ||
408 | |||
409 | @@ -484,7 +484,7 @@ TEST_CASE("line_request stream insertion operator works", "[line-request]") | ||
410 | { | ||
411 | buf << request; | ||
412 | |||
413 | - REQUIRE_THAT(buf.str(), Catch::Equals(expected.str())); | ||
414 | + REQUIRE_THAT(buf.str(), Catch::Matchers::Equals(expected.str())); | ||
415 | } | ||
416 | |||
417 | SECTION("request released") | ||
418 | @@ -493,7 +493,7 @@ TEST_CASE("line_request stream insertion operator works", "[line-request]") | ||
419 | |||
420 | buf << request; | ||
421 | |||
422 | - REQUIRE_THAT(buf.str(), Catch::Equals("gpiod::line_request(released)")); | ||
423 | + REQUIRE_THAT(buf.str(), Catch::Matchers::Equals("gpiod::line_request(released)")); | ||
424 | } | ||
425 | } | ||
426 | |||
427 | diff --git a/bindings/cxx/tests/tests-line-settings.cpp b/bindings/cxx/tests/tests-line-settings.cpp | ||
428 | index dc821bb..2690331 100644 | ||
429 | --- a/bindings/cxx/tests/tests-line-settings.cpp | ||
430 | +++ b/bindings/cxx/tests/tests-line-settings.cpp | ||
431 | @@ -1,7 +1,7 @@ | ||
432 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
433 | // SPDX-FileCopyrightText: 2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
434 | |||
435 | -#include <catch2/catch.hpp> | ||
436 | +#include <catch2/catch_all.hpp> | ||
437 | #include <gpiod.hpp> | ||
438 | |||
439 | #include "helpers.hpp" | ||
440 | diff --git a/bindings/cxx/tests/tests-line.cpp b/bindings/cxx/tests/tests-line.cpp | ||
441 | index 319012a..abd0e08 100644 | ||
442 | --- a/bindings/cxx/tests/tests-line.cpp | ||
443 | +++ b/bindings/cxx/tests/tests-line.cpp | ||
444 | @@ -1,7 +1,7 @@ | ||
445 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
446 | // SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
447 | |||
448 | -#include <catch2/catch.hpp> | ||
449 | +#include <catch2/catch_all.hpp> | ||
450 | #include <gpiod.hpp> | ||
451 | |||
452 | #include "helpers.hpp" | ||
453 | diff --git a/bindings/cxx/tests/tests-misc.cpp b/bindings/cxx/tests/tests-misc.cpp | ||
454 | index f06dc39..33fc3fa 100644 | ||
455 | --- a/bindings/cxx/tests/tests-misc.cpp | ||
456 | +++ b/bindings/cxx/tests/tests-misc.cpp | ||
457 | @@ -1,7 +1,7 @@ | ||
458 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
459 | // SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
460 | |||
461 | -#include <catch2/catch.hpp> | ||
462 | +#include <catch2/catch_all.hpp> | ||
463 | #include <filesystem> | ||
464 | #include <gpiod.hpp> | ||
465 | #include <string> | ||
466 | diff --git a/bindings/cxx/tests/tests-request-config.cpp b/bindings/cxx/tests/tests-request-config.cpp | ||
467 | index 66eb748..d71e91b 100644 | ||
468 | --- a/bindings/cxx/tests/tests-request-config.cpp | ||
469 | +++ b/bindings/cxx/tests/tests-request-config.cpp | ||
470 | @@ -1,7 +1,7 @@ | ||
471 | // SPDX-License-Identifier: GPL-2.0-or-later | ||
472 | // SPDX-FileCopyrightText: 2021-2022 Bartosz Golaszewski <brgl@bgdev.pl> | ||
473 | |||
474 | -#include <catch2/catch.hpp> | ||
475 | +#include <catch2/catch_all.hpp> | ||
476 | #include <cstddef> | ||
477 | #include <gpiod.hpp> | ||
478 | #include <string> | ||
479 | @@ -33,7 +33,7 @@ TEST_CASE("request_config can be moved", "[request-config]") | ||
480 | SECTION("move constructor works") | ||
481 | { | ||
482 | auto moved(::std::move(cfg)); | ||
483 | - REQUIRE_THAT(moved.consumer(), Catch::Equals("foobar")); | ||
484 | + REQUIRE_THAT(moved.consumer(), Catch::Matchers::Equals("foobar")); | ||
485 | REQUIRE(moved.event_buffer_size() == 64); | ||
486 | } | ||
487 | |||
488 | @@ -43,7 +43,7 @@ TEST_CASE("request_config can be moved", "[request-config]") | ||
489 | |||
490 | moved = ::std::move(cfg); | ||
491 | |||
492 | - REQUIRE_THAT(moved.consumer(), Catch::Equals("foobar")); | ||
493 | + REQUIRE_THAT(moved.consumer(), Catch::Matchers::Equals("foobar")); | ||
494 | REQUIRE(moved.event_buffer_size() == 64); | ||
495 | } | ||
496 | } | ||
497 | @@ -55,7 +55,7 @@ TEST_CASE("request_config mutators work", "[request-config]") | ||
498 | SECTION("set consumer") | ||
499 | { | ||
500 | cfg.set_consumer("foobar"); | ||
501 | - REQUIRE_THAT(cfg.consumer(), Catch::Equals("foobar")); | ||
502 | + REQUIRE_THAT(cfg.consumer(), Catch::Matchers::Equals("foobar")); | ||
503 | } | ||
504 | |||
505 | SECTION("set event_buffer_size") | ||
506 | @@ -77,7 +77,7 @@ TEST_CASE("request_config stream insertion operator works", "[request-config]") | ||
507 | |||
508 | ::std::string expected("gpiod::request_config(consumer='foobar', event_buffer_size=32)"); | ||
509 | |||
510 | - REQUIRE_THAT(buf.str(), Catch::Equals(expected)); | ||
511 | + REQUIRE_THAT(buf.str(), Catch::Matchers::Equals(expected)); | ||
512 | } | ||
513 | |||
514 | } /* namespace */ | ||
515 | diff --git a/configure.ac b/configure.ac | ||
516 | index a2370c5..216007e 100644 | ||
517 | --- a/configure.ac | ||
518 | +++ b/configure.ac | ||
519 | @@ -206,9 +206,9 @@ then | ||
520 | |||
521 | if test "x$with_tests" = xtrue | ||
522 | then | ||
523 | - PKG_CHECK_MODULES([CATCH2], [catch2],, [ | ||
524 | + PKG_CHECK_MODULES([CATCH2], [catch2-with-main],, [ | ||
525 | AC_LANG_PUSH([C++]) | ||
526 | - AC_CHECK_HEADERS([catch2/catch.hpp], [], [HEADER_NOT_FOUND_CXX([catch2/catch.hpp])]) | ||
527 | + AC_CHECK_HEADERS([catch2/catch_all.hpp], [], [HEADER_NOT_FOUND_CXX([catch2/catch_all.hpp])]) | ||
528 | AC_LANG_POP([C++]) | ||
529 | ]) | ||
530 | fi | ||
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-manager.init b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-manager.init new file mode 100644 index 000000000..e36755eea --- /dev/null +++ b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/gpio-manager.init | |||
@@ -0,0 +1,76 @@ | |||
1 | #! /bin/sh | ||
2 | ### BEGIN INIT INFO | ||
3 | # Provides: gpio-manager | ||
4 | # Required-Start: $remote_fs $syslog | ||
5 | # Required-Stop: $remote_fs $syslog | ||
6 | # Default-Start: 2 3 4 5 | ||
7 | # Default-Stop: 1 | ||
8 | # Short-Description: Centralized GPIO manager daemon | ||
9 | ### END INIT INFO | ||
10 | # | ||
11 | # -*- coding: utf-8 -*- | ||
12 | # Debian init.d script for gpio-manager | ||
13 | # Copyright (c) 2024 Bartosz Golaszewski <bartosz.golaszewski@linaro.org> | ||
14 | |||
15 | # set -e | ||
16 | |||
17 | # Source function library. | ||
18 | . /etc/init.d/functions | ||
19 | |||
20 | DAEMON=/usr/bin/gpio-manager | ||
21 | NAME=gpio-manager | ||
22 | PIDFILE=/var/run/gpio-manager/pid | ||
23 | DESC="GPIO manager daemon" | ||
24 | |||
25 | test -x $DAEMON || exit 0 | ||
26 | test "$ENABLED" != "0" || exit 0 | ||
27 | |||
28 | do_start() | ||
29 | { | ||
30 | mkdir -p "`dirname $PIDFILE`" | ||
31 | if [ -e $PIDFILE ]; then | ||
32 | PIDDIR=/proc/$(cat $PIDFILE) | ||
33 | if [ -d ${PIDDIR} -a "$(readlink -f ${PIDDIR}/exe)" = "${DAEMON}" ]; then | ||
34 | echo "$DESC already started; not starting." | ||
35 | else | ||
36 | echo "Removing stale PID file $PIDFILE." | ||
37 | rm -f $PIDFILE | ||
38 | fi | ||
39 | fi | ||
40 | |||
41 | echo -n "Starting $DESC: " | ||
42 | start-stop-daemon --user gpio-manager --background --start --quiet --make-pidfile --pidfile $PIDFILE --exec $DAEMON | ||
43 | echo "$NAME." | ||
44 | } | ||
45 | |||
46 | do_stop() | ||
47 | { | ||
48 | echo -n "Stopping $DESC: " | ||
49 | start-stop-daemon --stop --quiet --pidfile $PIDFILE | ||
50 | echo "$NAME." | ||
51 | rm -f $PIDFILE | ||
52 | } | ||
53 | |||
54 | case "$1" in | ||
55 | start) | ||
56 | do_start | ||
57 | ;; | ||
58 | stop) | ||
59 | do_stop | ||
60 | ;; | ||
61 | status) | ||
62 | status $DAEMON | ||
63 | exit $? | ||
64 | ;; | ||
65 | restart) | ||
66 | do_stop | ||
67 | sleep 1 | ||
68 | do_start | ||
69 | ;; | ||
70 | *) | ||
71 | echo "Usage: /etc/init.d/$NAME {start|stop|status|restart}" >&2 | ||
72 | exit 1 | ||
73 | ;; | ||
74 | esac | ||
75 | |||
76 | exit 0 | ||
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/run-ptest b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/run-ptest index 29ec0d102..eae172116 100644 --- a/meta-oe/recipes-support/libgpiod/libgpiod-2.x/run-ptest +++ b/meta-oe/recipes-support/libgpiod/libgpiod-2.x/run-ptest | |||
@@ -1,24 +1,43 @@ | |||
1 | #!/bin/sh | 1 | #!/bin/sh |
2 | 2 | ||
3 | testbins="gpiod-test gpio-tools-test.bash gpiod-cxx-test" | ||
4 | |||
5 | ptestdir=$(dirname "$(readlink -f "$0")") | 3 | ptestdir=$(dirname "$(readlink -f "$0")") |
6 | cd $ptestdir/tests | 4 | cd $ptestdir/tests |
7 | 5 | ||
6 | export GPIODBUS_TEST_DAEMON_PATH="$ptestdir/tests/gpio-manager" | ||
7 | export PATH="$ptestdir/tests/:$PATH" | ||
8 | |||
8 | # libgpiod v2 uses gpio-sim - a configfs-based testing module. We need to | 9 | # libgpiod v2 uses gpio-sim - a configfs-based testing module. We need to |
9 | # make sure configfs is mounted before running any tests. | 10 | # make sure configfs is mounted before running any tests. |
10 | modprobe configfs | 11 | modprobe configfs |
11 | mountpoint /sys/kernel/config > /dev/null || mount -t configfs configfs /sys/kernel/config | 12 | mountpoint /sys/kernel/config > /dev/null || mount -t configfs configfs /sys/kernel/config |
12 | 13 | ||
13 | for testbin in $testbins; do | 14 | # Make sure the daemon is not running during tests. |
14 | if test -e ./$testbin; then | 15 | systemctl stop gpio-manager 2> /dev/null > /dev/null |
15 | ./$testbin > ./$testbin.out 2>&1 | 16 | service gpio-manager stop 2> /dev/null > /dev/null |
16 | if [ $? -ne 0 ]; then | 17 | |
17 | echo "FAIL: $testbin" | 18 | run_one_test() { |
18 | else | 19 | testbin="$1" |
19 | echo "PASS: $testbin" | 20 | |
20 | fi | 21 | ./$testbin > ./$testbin.out 2>&1 |
22 | if [ $? -ne 0 ]; then | ||
23 | echo "FAIL: $testbin" | ||
21 | else | 24 | else |
22 | echo "SKIP: $testbin" | 25 | echo "PASS: $testbin" |
23 | fi | 26 | fi |
24 | done | 27 | } |
28 | |||
29 | run_one_test gpiod-test | ||
30 | run_one_test gpio-tools-test.bash | ||
31 | run_one_test gpiod-cxx-test | ||
32 | run_one_test gpiod-glib-test | ||
33 | |||
34 | # Wait for the leftover uevents to be emitted before running DBus tests. | ||
35 | udevadm settle | ||
36 | run_one_test gpiodbus-test | ||
37 | |||
38 | udevadm settle | ||
39 | gpio-manager 2> /dev/null > /dev/null & | ||
40 | GPIO_MANAGER_PID=$! | ||
41 | run_one_test gpiocli-test.bash | ||
42 | kill $GPIO_MANAGER_PID | ||
43 | wait $GPIO_MANAGER_PID | ||
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_2.1.3.bb b/meta-oe/recipes-support/libgpiod/libgpiod_2.1.3.bb deleted file mode 100644 index 6130371e4..000000000 --- a/meta-oe/recipes-support/libgpiod/libgpiod_2.1.3.bb +++ /dev/null | |||
@@ -1,33 +0,0 @@ | |||
1 | require libgpiod.inc | ||
2 | |||
3 | LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & CC-BY-SA-4.0" | ||
4 | LIC_FILES_CHKSUM = " \ | ||
5 | file://LICENSES/GPL-2.0-or-later.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ | ||
6 | file://LICENSES/LGPL-2.1-or-later.txt;md5=4b54a1fd55a448865a0b32d41598759d \ | ||
7 | file://LICENSES/CC-BY-SA-4.0.txt;md5=fba3b94d88bfb9b81369b869a1e9a20f \ | ||
8 | " | ||
9 | |||
10 | FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-2.x:" | ||
11 | |||
12 | SRC_URI += "file://0001-bindings-cxx-Migrate-C-tests-to-use-Catch2-v3.patch" | ||
13 | SRC_URI[sha256sum] = "2be4c0b03e995d236c0e476e14aeb475d7b431dd1439609b6d65c540f91eaf58" | ||
14 | |||
15 | # Enable all project features for ptest | ||
16 | PACKAGECONFIG[tests] = "--enable-tests --enable-tools --enable-bindings-cxx --enable-gpioset-interactive,--disable-tests,kmod util-linux glib-2.0 catch2 libedit" | ||
17 | PACKAGECONFIG[gpioset-interactive] = "--enable-gpioset-interactive,--disable-gpioset-interactive,libedit" | ||
18 | |||
19 | PACKAGES =+ "${PN}-ptest-dev" | ||
20 | FILES:${PN}-tools += "${bindir}/gpionotify" | ||
21 | FILES:${PN}-ptest += "${libdir}/libgpiosim.so.*" | ||
22 | FILES:${PN}-ptest-dev += "${includedir}/gpiosim.h" | ||
23 | |||
24 | RDEPENDS:${PN}-ptest += " \ | ||
25 | ${@bb.utils.contains('PTEST_ENABLED', '1', 'shunit2 bash', '', d)} \ | ||
26 | " | ||
27 | RRECOMMENDS:${PN}-ptest += "kernel-module-gpio-sim kernel-module-configfs" | ||
28 | |||
29 | do_install_ptest:append() { | ||
30 | install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/ | ||
31 | install -m 0755 ${S}/tools/gpio-tools-test.bash ${D}${PTEST_PATH}/tests/ | ||
32 | install -m 0644 ${S}/tests/gpiosim/gpiosim.h ${D}${includedir}/gpiosim.h | ||
33 | } | ||
diff --git a/meta-oe/recipes-support/libgpiod/libgpiod_2.2.bb b/meta-oe/recipes-support/libgpiod/libgpiod_2.2.bb new file mode 100644 index 000000000..b55da72f7 --- /dev/null +++ b/meta-oe/recipes-support/libgpiod/libgpiod_2.2.bb | |||
@@ -0,0 +1,99 @@ | |||
1 | require libgpiod.inc | ||
2 | |||
3 | inherit systemd update-rc.d useradd gobject-introspection | ||
4 | |||
5 | LICENSE = "GPL-2.0-or-later & LGPL-2.1-or-later & CC-BY-SA-4.0" | ||
6 | LIC_FILES_CHKSUM = " \ | ||
7 | file://LICENSES/GPL-2.0-or-later.txt;md5=b234ee4d69f5fce4486a80fdaf4a4263 \ | ||
8 | file://LICENSES/LGPL-2.1-or-later.txt;md5=4b54a1fd55a448865a0b32d41598759d \ | ||
9 | file://LICENSES/CC-BY-SA-4.0.txt;md5=fba3b94d88bfb9b81369b869a1e9a20f \ | ||
10 | " | ||
11 | |||
12 | FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}-2.x:" | ||
13 | |||
14 | SRC_URI += "file://gpio-manager.init" | ||
15 | |||
16 | SRC_URI[sha256sum] = "ee29735890eb1cc0e4b494001da5163d1a9c4735343201d22485db313601ca07" | ||
17 | |||
18 | S = "${UNPACKDIR}/${PN}-2.2" | ||
19 | |||
20 | # Enable all project features for ptest | ||
21 | PACKAGECONFIG[tests] = " \ | ||
22 | --enable-tests --enable-tools --enable-bindings-cxx --enable-bindings-glib --enable-gpioset-interactive --enable-dbus, \ | ||
23 | --disable-tests, \ | ||
24 | kmod util-linux glib-2.0 catch2 libedit glib-2.0-native libgudev, \ | ||
25 | bash dbus glib-2.0-utils libgpiod-manager shunit2 \ | ||
26 | " | ||
27 | PACKAGECONFIG[gpioset-interactive] = "--enable-gpioset-interactive,--disable-gpioset-interactive,libedit" | ||
28 | PACKAGECONFIG[glib] = "--enable-bindings-glib,--disable-bindings-glib,glib-2.0 glib-2.0-native" | ||
29 | PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,glib-2.0 glib-2.0-native libgudev,dbus" | ||
30 | |||
31 | PACKAGES =+ "${PN}-ptest-dev ${PN}-glib ${PN}-manager ${PN}-cli" | ||
32 | FILES:${PN}-tools += "${bindir}/gpionotify" | ||
33 | FILES:${PN}-ptest += "${libdir}/libgpiosim.so.*" | ||
34 | FILES:${PN}-ptest-dev += "${includedir}/gpiosim.h" | ||
35 | FILES:${PN}-glib += "${libdir}/libgpiod-glib.so.*" | ||
36 | FILES:${PN}-manager += " \ | ||
37 | ${bindir}/gpio-manager \ | ||
38 | ${sysconfdir}/dbus-1/system.d/io.gpiod1.conf \ | ||
39 | ${datadir}/dbus-1/interfaces/io.gpiod1.xml \ | ||
40 | ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${systemd_system_unitdir}/gpio-manager.service', '', d)} \ | ||
41 | ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', '${sysconfdir}/init.d/gpio-manager', '', d)} \ | ||
42 | " | ||
43 | FILES:${PN}-cli += "${bindir}/gpiocli" | ||
44 | |||
45 | RDEPENDS:${PN}-manager += "dbus" | ||
46 | RDEPENDS:${PN}-cli += "${PN}-manager" | ||
47 | |||
48 | SYSTEMD_PACKAGES = "${PN}-manager" | ||
49 | |||
50 | python __anonymous() { | ||
51 | distro_features = d.getVar("DISTRO_FEATURES").split() | ||
52 | packageconfig = d.getVar("PACKAGECONFIG").split() | ||
53 | pn = d.getVar("PN") | ||
54 | |||
55 | if "systemd" in distro_features and "dbus" in packageconfig: | ||
56 | d.appendVar("EXTRA_OECONF", " --enable-systemd") | ||
57 | # We need to set it conditionally or else the systemd class will look | ||
58 | # for the file that we don't install with systemd support disabled. | ||
59 | d.setVar("SYSTEMD_SERVICE:{}-manager".format(pn), "gpio-manager.service") | ||
60 | else: | ||
61 | d.appendVar("EXTRA_OECONF", " --disable-systemd") | ||
62 | } | ||
63 | |||
64 | UPDATERCPN = "${PN}-manager" | ||
65 | INITSCRIPT_NAME = "gpio-manager" | ||
66 | INITSCRIPT_PARAMS = "start 20 2 3 4 5 . stop 20 0 1 6 ." | ||
67 | |||
68 | USERADD_PACKAGES = "${PN}-manager" | ||
69 | GROUPADD_PARAM:${PN}-manager = "--system gpio" | ||
70 | USERADD_PARAM:${PN}-manager = "--system -M -s /bin/nologin -g gpio gpio-manager" | ||
71 | |||
72 | RDEPENDS:${PN}-ptest += " \ | ||
73 | ${@bb.utils.contains('PTEST_ENABLED', '1', 'shunit2 bash', '', d)} \ | ||
74 | " | ||
75 | RRECOMMENDS:${PN}-ptest += "kernel-module-gpio-sim kernel-module-configfs" | ||
76 | INSANE_SKIP:${PN}-ptest += "buildpaths" | ||
77 | |||
78 | do_compile:prepend() { | ||
79 | export GIR_EXTRA_LIBS_PATH="${B}/lib/.libs" | ||
80 | } | ||
81 | |||
82 | do_install:append() { | ||
83 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | ||
84 | install -d ${D}${sysconfdir}/init.d | ||
85 | install -m 0755 ${UNPACKDIR}/gpio-manager.init ${D}${sysconfdir}/init.d/gpio-manager | ||
86 | fi | ||
87 | } | ||
88 | |||
89 | do_install_ptest:append() { | ||
90 | install -m 0755 ${B}/bindings/cxx/tests/.libs/gpiod-cxx-test ${D}${PTEST_PATH}/tests/ | ||
91 | install -m 0755 ${S}/tools/gpio-tools-test.bash ${D}${PTEST_PATH}/tests/ | ||
92 | install -m 0644 ${S}/tests/scripts/gpiod-bash-test-helper.inc ${D}${PTEST_PATH}/tests/ | ||
93 | install -m 0644 ${S}/tests/gpiosim/gpiosim.h ${D}${includedir}/gpiosim.h | ||
94 | install -m 0755 ${B}/bindings/glib/tests/.libs/gpiod-glib-test ${D}${PTEST_PATH}/tests/ | ||
95 | install -m 0755 ${B}/dbus/tests/.libs/gpiodbus-test ${D}${PTEST_PATH}/tests/ | ||
96 | install -m 0755 ${S}/dbus/client/gpiocli-test.bash ${D}${PTEST_PATH}/tests/ | ||
97 | install -m 0755 ${B}/dbus/manager/.libs/gpio-manager ${D}${PTEST_PATH}/tests/ | ||
98 | install -m 0755 ${B}/dbus/client/.libs/gpiocli ${D}${PTEST_PATH}/tests/ | ||
99 | } | ||