diff options
author | Yi Zhao <yi.zhao@windriver.com> | 2024-03-06 20:54:06 +0800 |
---|---|---|
committer | Khem Raj <raj.khem@gmail.com> | 2024-03-08 10:07:24 -0800 |
commit | 29a287046e8200a8f9e5cb9c91f47feb7ceeebd1 (patch) | |
tree | a20b735587caf99c7a35ab6332a1b302165c15ec | |
parent | d49f1069c57d4e150e646e606dbf1bd272684d1d (diff) | |
download | meta-openembedded-29a287046e8200a8f9e5cb9c91f47feb7ceeebd1.tar.gz |
netplan: upgrade 0.106 -> 1.0
Release Notes:
https://github.com/canonical/netplan/releases/tag/1.0
* Switch to meson build
* Add systemd to REQUIRED_DISTRO_FEATURES as systemd dependency can not
be removed.
* Add a patch to fix build with clang.
Signed-off-by: Yi Zhao <yi.zhao@windriver.com>
Signed-off-by: Khem Raj <raj.khem@gmail.com>
7 files changed, 187 insertions, 99 deletions
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0001-Makefile-do-not-use-Werror.patch b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0001-Makefile-do-not-use-Werror.patch deleted file mode 100644 index b8c48d540..000000000 --- a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0001-Makefile-do-not-use-Werror.patch +++ /dev/null | |||
@@ -1,26 +0,0 @@ | |||
1 | From a06c77557ed951249d5b344441ad6ec57410e63f Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex@linutronix.de> | ||
3 | Date: Sun, 3 Oct 2021 21:52:16 +0200 | ||
4 | Subject: [PATCH] Makefile: do not use -Werror | ||
5 | |||
6 | Upstream-Status: Inappropriate [oe-core specific] | ||
7 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> | ||
8 | --- | ||
9 | Makefile | 1 - | ||
10 | 1 file changed, 1 deletion(-) | ||
11 | |||
12 | diff --git a/Makefile b/Makefile | ||
13 | index 97973ce..78273ff 100644 | ||
14 | --- a/Makefile | ||
15 | +++ b/Makefile | ||
16 | @@ -8,7 +8,6 @@ BUILDFLAGS = \ | ||
17 | -DSBINDIR=\"$(SBINDIR)\" \ | ||
18 | -I${CURDIR}/include \ | ||
19 | -Wall \ | ||
20 | - -Werror \ | ||
21 | $(NULL) | ||
22 | |||
23 | TESTFLAGS = \ | ||
24 | -- | ||
25 | 2.34.1 | ||
26 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0001-don-t-fail-if-GLOB_BRACE-is-not-defined.patch b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0001-don-t-fail-if-GLOB_BRACE-is-not-defined.patch index 0bd7f80c2..cabceae84 100644 --- a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0001-don-t-fail-if-GLOB_BRACE-is-not-defined.patch +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0001-don-t-fail-if-GLOB_BRACE-is-not-defined.patch | |||
@@ -1,20 +1,20 @@ | |||
1 | From e0df1f07d1707d5daf0358cc60b30f06121f7e60 Mon Sep 17 00:00:00 2001 | 1 | From 0ea11f520a8b4453e60eaf0679b9feb757024422 Mon Sep 17 00:00:00 2001 |
2 | From: Zang Ruochen <zangrc.fnst@cn.fujitsu.com> | 2 | From: Zang Ruochen <zangrc.fnst@cn.fujitsu.com> |
3 | Date: Fri, 25 Dec 2020 11:41:43 +0900 | 3 | Date: Fri, 25 Dec 2020 11:41:43 +0900 |
4 | Subject: [PATCH] don't fail if GLOB_BRACE is not defined | 4 | Subject: [PATCH] don't fail if GLOB_BRACE is not defined |
5 | 5 | ||
6 | Signed-off-by: Zang Ruochen <zangrc.fnst@cn.fujitsu.com> | ||
7 | --- | ||
8 | Upstream-Status: Pending | 6 | Upstream-Status: Pending |
9 | 7 | ||
8 | Signed-off-by: Zang Ruochen <zangrc.fnst@cn.fujitsu.com> | ||
9 | --- | ||
10 | src/util.c | 6 ++++++ | 10 | src/util.c | 6 ++++++ |
11 | 1 file changed, 6 insertions(+) | 11 | 1 file changed, 6 insertions(+) |
12 | 12 | ||
13 | diff --git a/src/util.c b/src/util.c | 13 | diff --git a/src/util.c b/src/util.c |
14 | index 841ec12..59595da 100644 | 14 | index 36eb896a..ee13ec44 100644 |
15 | --- a/src/util.c | 15 | --- a/src/util.c |
16 | +++ b/src/util.c | 16 | +++ b/src/util.c |
17 | @@ -32,6 +32,12 @@ | 17 | @@ -35,6 +35,12 @@ |
18 | #include "names.h" | 18 | #include "names.h" |
19 | #include "yaml-helpers.h" | 19 | #include "yaml-helpers.h" |
20 | 20 | ||
@@ -24,7 +24,7 @@ index 841ec12..59595da 100644 | |||
24 | +#define GLOB_BRACE 0 | 24 | +#define GLOB_BRACE 0 |
25 | +#endif | 25 | +#endif |
26 | + | 26 | + |
27 | NETPLAN_ABI GHashTable* | 27 | GHashTable* |
28 | wifi_frequency_24; | 28 | wifi_frequency_24; |
29 | 29 | ||
30 | -- | 30 | -- |
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0001-meson.build-drop-unnecessary-build-dependencies.patch b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0001-meson.build-drop-unnecessary-build-dependencies.patch new file mode 100644 index 000000000..4f385e917 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0001-meson.build-drop-unnecessary-build-dependencies.patch | |||
@@ -0,0 +1,58 @@ | |||
1 | From d3aa30f5cd7ba375e006a755752acbcfcd619452 Mon Sep 17 00:00:00 2001 | ||
2 | From: Yi Zhao <yi.zhao@windriver.com> | ||
3 | Date: Wed, 6 Mar 2024 19:27:15 +0800 | ||
4 | Subject: [PATCH] meson.build: drop unnecessary build dependencies | ||
5 | |||
6 | The pytest and pycoverage are required by meson test but not for | ||
7 | building. Mark them as 'required: false' to get rid of unnecessary | ||
8 | build dependencies. | ||
9 | |||
10 | Upstream-Status: Inappropriate [oe specific] | ||
11 | |||
12 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
13 | --- | ||
14 | meson.build | 8 ++++++-- | ||
15 | 1 file changed, 6 insertions(+), 2 deletions(-) | ||
16 | |||
17 | diff --git a/meson.build b/meson.build | ||
18 | index 9556836a..30f33fe2 100644 | ||
19 | --- a/meson.build | ||
20 | +++ b/meson.build | ||
21 | @@ -25,8 +25,8 @@ bash_completions_dir = completions.get_variable(pkgconfig: 'completionsdir', def | ||
22 | # Order: Fedora/Mageia/openSUSE || Debian/Ubuntu | ||
23 | pyflakes = find_program('pyflakes-3', 'pyflakes3', required: false) | ||
24 | pycodestyle = find_program('pycodestyle-3', 'pycodestyle', 'pep8', required: false) | ||
25 | -pytest = find_program('pytest-3', 'pytest3') # also requires the pytest-cov plugin | ||
26 | -pycoverage = find_program('coverage-3', 'python3-coverage') | ||
27 | +pytest = find_program('pytest-3', 'pytest3', required: false) # also requires the pytest-cov plugin | ||
28 | +pycoverage = find_program('coverage-3', 'python3-coverage', required: false) | ||
29 | pandoc = find_program('pandoc', required: false) | ||
30 | find = find_program('find') | ||
31 | |||
32 | @@ -75,6 +75,7 @@ if get_option('unit_testing') | ||
33 | endif | ||
34 | |||
35 | #FIXME: exclude doc/env/ | ||
36 | +if pyflakes.found() and pycodestyle.found() | ||
37 | test('linting', | ||
38 | pyflakes, | ||
39 | timeout: 100, | ||
40 | @@ -91,7 +92,9 @@ test('legacy-tests', | ||
41 | find_program('tests/cli_legacy.py'), | ||
42 | timeout: 600, | ||
43 | env: test_env) | ||
44 | +endif | ||
45 | #TODO: split out dbus tests into own test() instance, to run in parallel | ||
46 | +if pycoverage.found() | ||
47 | test('unit-tests', | ||
48 | pycoverage, | ||
49 | args: ['run', '-a', '-m', 'pytest', '-s', '-v', '--cov-append', meson.current_source_dir()], | ||
50 | @@ -143,4 +146,5 @@ if get_option('b_coverage') | ||
51 | priority: -99, # run last | ||
52 | is_parallel: false) | ||
53 | endif | ||
54 | +endif | ||
55 | |||
56 | -- | ||
57 | 2.25.1 | ||
58 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0001-networkd.c-define-scope-specific-to-case-statement.patch b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0001-networkd.c-define-scope-specific-to-case-statement.patch new file mode 100644 index 000000000..9f01108a2 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0001-networkd.c-define-scope-specific-to-case-statement.patch | |||
@@ -0,0 +1,47 @@ | |||
1 | From 6e3dd61bf90a7ca8c36c5b95943cbff7c1ad3c2d Mon Sep 17 00:00:00 2001 | ||
2 | From: Yi Zhao <yi.zhao@windriver.com> | ||
3 | Date: Wed, 6 Mar 2024 16:12:31 +0800 | ||
4 | Subject: [PATCH] networkd.c: define scope specific to case statement | ||
5 | |||
6 | Per [1], define a scope specific to case statement to fix build with | ||
7 | clang. | ||
8 | |||
9 | Fixes: | ||
10 | ../git/src/networkd.c:544:13: error: expected expression | ||
11 | 544 | gchar* first = g_strcmp0(def->id, def->veth_peer_link->id) < 0 ? def->id : def->veth_peer_link->id; | ||
12 | | ^ | ||
13 | ../git/src/networkd.c:545:17: error: use of undeclared identifier 'first' | ||
14 | 545 | if (first != def->id) { | ||
15 | | ^ | ||
16 | |||
17 | [1] https://stackoverflow.com/questions/92396/why-cant-variables-be-declared-in-a-switch-statement | ||
18 | |||
19 | Upstream-Status: Pending | ||
20 | |||
21 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
22 | --- | ||
23 | src/networkd.c | 2 ++ | ||
24 | 1 file changed, 2 insertions(+) | ||
25 | |||
26 | diff --git a/src/networkd.c b/src/networkd.c | ||
27 | index 25121c48..5eb9c0fe 100644 | ||
28 | --- a/src/networkd.c | ||
29 | +++ b/src/networkd.c | ||
30 | @@ -541,12 +541,14 @@ write_netdev_file(const NetplanNetDefinition* def, const char* rootdir, const ch | ||
31 | * and, if the selected name is the name of the netdef being written, we generate | ||
32 | * the .netdev file. Otherwise we skip the netdef. | ||
33 | */ | ||
34 | + { | ||
35 | gchar* first = g_strcmp0(def->id, def->veth_peer_link->id) < 0 ? def->id : def->veth_peer_link->id; | ||
36 | if (first != def->id) { | ||
37 | g_string_free(s, TRUE); | ||
38 | return; | ||
39 | } | ||
40 | g_string_append_printf(s, "Kind=veth\n\n[Peer]\nName=%s\n", def->veth_peer_link->id); | ||
41 | + } | ||
42 | break; | ||
43 | |||
44 | case NETPLAN_DEF_TYPE_TUNNEL: | ||
45 | -- | ||
46 | 2.25.1 | ||
47 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0002-meson.build-do-not-use-Werror.patch b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0002-meson.build-do-not-use-Werror.patch new file mode 100644 index 000000000..663a80ecd --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan/0002-meson.build-do-not-use-Werror.patch | |||
@@ -0,0 +1,29 @@ | |||
1 | From 668ee79f39614ad758edd44c42b8b0eff57877cf Mon Sep 17 00:00:00 2001 | ||
2 | From: Alexander Kanavin <alex@linutronix.de> | ||
3 | Date: Sun, 3 Oct 2021 21:52:16 +0200 | ||
4 | Subject: [PATCH] meson.build: do not use -Werror | ||
5 | |||
6 | Upstream-Status: Inappropriate [oe specific] | ||
7 | |||
8 | Signed-off-by: Alexander Kanavin <alex@linutronix.de> | ||
9 | Signed-off-by: Yi Zhao <yi.zhao@windriver.com> | ||
10 | --- | ||
11 | meson.build | 2 +- | ||
12 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
13 | |||
14 | diff --git a/meson.build b/meson.build | ||
15 | index 30f33fe2..0b214795 100644 | ||
16 | --- a/meson.build | ||
17 | +++ b/meson.build | ||
18 | @@ -4,7 +4,7 @@ project('netplan', 'c', | ||
19 | default_options: [ | ||
20 | 'c_std=c99', | ||
21 | 'warning_level=2', | ||
22 | - 'werror=true', | ||
23 | + 'werror=false', | ||
24 | ], | ||
25 | meson_version: '>= 0.61.0', | ||
26 | ) | ||
27 | -- | ||
28 | 2.25.1 | ||
29 | |||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan_0.106.bb b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan_0.106.bb deleted file mode 100644 index 8c1eaa550..000000000 --- a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan_0.106.bb +++ /dev/null | |||
@@ -1,67 +0,0 @@ | |||
1 | SUMMARY = "The network configuration abstraction renderer" | ||
2 | DESCRIPTION = "Netplan is a utility for easily configuring networking on a \ | ||
3 | linux system. You simply create a YAML description of the required network \ | ||
4 | interfaces and what each should be configured to do. From this description \ | ||
5 | Netplan will generate all the necessary configuration for your chosen renderer \ | ||
6 | tool." | ||
7 | HOMEPAGE = "https://netplan.io" | ||
8 | SECTION = "net/misc" | ||
9 | |||
10 | LICENSE = "GPL-3.0-only" | ||
11 | LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" | ||
12 | |||
13 | S = "${WORKDIR}/git" | ||
14 | SRCREV = "15ce044d1df27b5057556d84d0d14beef8dd4e4d" | ||
15 | PV = "0.106" | ||
16 | |||
17 | SRC_URI = "git://github.com/CanonicalLtd/netplan.git;branch=main;protocol=https \ | ||
18 | file://0001-Makefile-do-not-use-Werror.patch \ | ||
19 | " | ||
20 | |||
21 | SRC_URI:append:libc-musl = " file://0001-don-t-fail-if-GLOB_BRACE-is-not-defined.patch" | ||
22 | |||
23 | DEPENDS = "glib-2.0 libyaml ${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)}" | ||
24 | |||
25 | PACKAGECONFIG ?= "" | ||
26 | |||
27 | PACKAGECONFIG[tests] = ",,,python3-nose python3-coverage python3-netifaces python3-pycodestyle python3-pyflakes python3-pyyaml" | ||
28 | |||
29 | RDEPENDS:${PN} = "python3 python3-core python3-netifaces python3-pyyaml util-linux-libuuid libnetplan python3-dbus python3-rich" | ||
30 | |||
31 | inherit pkgconfig systemd | ||
32 | |||
33 | TARGET_CC_ARCH += "${LDFLAGS}" | ||
34 | |||
35 | EXTRA_OEMAKE = "generate netplan/_features.py" | ||
36 | EXTRA_OEMAKE =+ "${@bb.utils.contains('DISTRO_FEATURES','systemd','netplan-dbus dbus/io.netplan.Netplan.service','',d)}" | ||
37 | |||
38 | do_install() { | ||
39 | install -d ${D}${sbindir} ${D}${libdir} ${D}${base_libdir}/netplan ${D}${datadir}/netplan/netplan/cli/commands ${D}${sysconfdir}/netplan | ||
40 | install -m 755 ${S}/generate ${D}${base_libdir}/netplan/ | ||
41 | install -m 644 ${S}/netplan/*.py ${D}${datadir}/netplan/netplan | ||
42 | install -m 644 ${S}/netplan/cli/*.py ${D}${datadir}/netplan/netplan/cli | ||
43 | install -m 644 ${S}/netplan/cli/commands/*.py ${D}${datadir}/netplan/netplan/cli/commands | ||
44 | install -m 755 ${S}/src/netplan.script ${D}${datadir}/netplan/ | ||
45 | ln -srf ${D}${datadir}/netplan/netplan.script ${D}${sbindir}/netplan | ||
46 | sed -i -e "s#/lib/netplan/generate#${base_libdir}/netplan/generate#" ${D}${datadir}/netplan/netplan/cli/utils.py | ||
47 | |||
48 | install -d ${D}/${systemd_unitdir}/system ${D}${systemd_unitdir}/system-generators | ||
49 | ln -srf ${D}/${base_libdir}/netplan/generate ${D}${systemd_unitdir}/system-generators | ||
50 | |||
51 | if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then | ||
52 | install -d ${D}${datadir}/dbus-1/system.d ${D}${datadir}/dbus-1/system-services | ||
53 | install -m 755 ${S}/netplan-dbus ${D}${base_libdir}/netplan | ||
54 | install -m 644 ${S}/dbus/io.netplan.Netplan.conf ${D}${datadir}/dbus-1/system.d | ||
55 | install -m 644 ${S}/dbus/io.netplan.Netplan.service ${D}${datadir}/dbus-1/system-services | ||
56 | sed -i -e "s#^Exec=/lib/#Exec=${base_libdir}/#" ${D}${datadir}/dbus-1/system-services/io.netplan.Netplan.service | ||
57 | fi | ||
58 | |||
59 | install -m 755 ${S}/libnetplan.so.0.0 ${D}${libdir} | ||
60 | ln -rfs ${D}${libdir}/libnetplan.so.0.0 ${D}${libdir}/libnetplan.so | ||
61 | } | ||
62 | |||
63 | PACKAGES += "${PN}-dbus libnetplan" | ||
64 | |||
65 | FILES:libnetplan = "${libdir}/libnetplan.so.0.0" | ||
66 | FILES:${PN} = "${sbindir} ${base_libdir}/netplan/generate ${datadir}/netplan ${sysconfdir}/netplan ${systemd_unitdir}" | ||
67 | FILES:${PN}-dbus = "${base_libdir}/netplan/netplan-dbus ${datadir}/dbus-1" | ||
diff --git a/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan_1.0.bb b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan_1.0.bb new file mode 100644 index 000000000..71efd2cc3 --- /dev/null +++ b/meta-oe/dynamic-layers/meta-python/recipes-connectivity/netplan/netplan_1.0.bb | |||
@@ -0,0 +1,47 @@ | |||
1 | SUMMARY = "The network configuration abstraction renderer" | ||
2 | DESCRIPTION = "Netplan is a utility for easily configuring networking on a \ | ||
3 | linux system. You simply create a YAML description of the required network \ | ||
4 | interfaces and what each should be configured to do. From this description \ | ||
5 | Netplan will generate all the necessary configuration for your chosen renderer \ | ||
6 | tool." | ||
7 | HOMEPAGE = "https://netplan.io" | ||
8 | SECTION = "net/misc" | ||
9 | |||
10 | LICENSE = "GPL-3.0-only" | ||
11 | LIC_FILES_CHKSUM = "file://COPYING;md5=d32239bcb673463ab874e80d47fae504" | ||
12 | |||
13 | inherit meson pkgconfig systemd python3targetconfig features_check | ||
14 | |||
15 | REQUIRED_DISTRO_FEATURES = "systemd" | ||
16 | |||
17 | SRC_URI = "git://github.com/CanonicalLtd/netplan.git;branch=main;protocol=https \ | ||
18 | file://0001-meson.build-drop-unnecessary-build-dependencies.patch \ | ||
19 | file://0002-meson.build-do-not-use-Werror.patch \ | ||
20 | " | ||
21 | |||
22 | SRC_URI:append:libc-musl = " file://0001-don-t-fail-if-GLOB_BRACE-is-not-defined.patch" | ||
23 | SRC_URI:append:toolchain-clang = " file://0001-networkd.c-define-scope-specific-to-case-statement.patch" | ||
24 | |||
25 | SRCREV = "45f7cd1569896d9e316c130bf5c60b7ccfc8211d" | ||
26 | |||
27 | S = "${WORKDIR}/git" | ||
28 | |||
29 | DEPENDS = "glib-2.0 libyaml util-linux-libuuid \ | ||
30 | systemd python3-cffi-native \ | ||
31 | " | ||
32 | |||
33 | EXTRA_OEMESON = "-Dunit_testing=false" | ||
34 | |||
35 | RDEPENDS:${PN} = "python3-core python3-netifaces python3-pyyaml \ | ||
36 | python3-dbus python3-rich python3-cffi \ | ||
37 | util-linux-libuuid libnetplan \ | ||
38 | " | ||
39 | |||
40 | PACKAGES += "${PN}-dbus libnetplan" | ||
41 | |||
42 | FILES:libnetplan = "${libdir}/libnetplan.so.*" | ||
43 | FILES:${PN} = "${sbindir} ${libexecdir}/netplan/generate \ | ||
44 | ${datadir}/netplan ${datadir}/bash-completion \ | ||
45 | ${systemd_unitdir} ${PYTHON_SITEPACKAGES_DIR} \ | ||
46 | " | ||
47 | FILES:${PN}-dbus = "${libexecdir}/netplan/netplan-dbus ${datadir}/dbus-1" | ||