From c4c949a428c5c396800fddfb49fd36e37cfa7d4f Mon Sep 17 00:00:00 2001 From: Philip Meulengracht Date: Fri, 5 Jul 2024 13:55:37 +0200 Subject: [PATCH 1/4] slices: add netplan and dependencies --- slices/iproute2.yaml | 66 ++++++++++++++++++++++++++++++++ slices/libbpf1.yaml | 17 ++++++++ slices/libglib2.0-0t64.yaml | 27 +++++++++++++ slices/libmnl0.yaml | 15 ++++++++ slices/libnetplan1.yaml | 18 +++++++++ slices/libxtables12.yaml | 15 ++++++++ slices/netplan-generator.yaml | 20 ++++++++++ slices/netplan.io.yaml | 38 ++++++++++++++++++ slices/python3-cffi-backend.yaml | 17 ++++++++ slices/python3-dbus.yaml | 24 ++++++++++++ slices/python3-netifaces.yaml | 20 ++++++++++ slices/python3-netplan.yaml | 18 +++++++++ slices/python3-yaml.yaml | 22 +++++++++++ slices/python3.12-minimal.yaml | 1 + 14 files changed, 318 insertions(+) create mode 100644 slices/iproute2.yaml create mode 100644 slices/libbpf1.yaml create mode 100644 slices/libglib2.0-0t64.yaml create mode 100644 slices/libmnl0.yaml create mode 100644 slices/libnetplan1.yaml create mode 100644 slices/libxtables12.yaml create mode 100644 slices/netplan-generator.yaml create mode 100644 slices/netplan.io.yaml create mode 100644 slices/python3-cffi-backend.yaml create mode 100644 slices/python3-dbus.yaml create mode 100644 slices/python3-netifaces.yaml create mode 100644 slices/python3-netplan.yaml create mode 100644 slices/python3-yaml.yaml diff --git a/slices/iproute2.yaml b/slices/iproute2.yaml new file mode 100644 index 000000000..97a3b9519 --- /dev/null +++ b/slices/iproute2.yaml @@ -0,0 +1,66 @@ +package: iproute2 + +essential: + - iproute2_copyright + +slices: + bins: + essential: + - iproute2_config + - iproute2_libs + - libbpf1_libs + - libc6_libs + - libcap2-bin_bins + - libcap2_libs + - libdb5.3t64_libs + - libelf1t64_libs + - libmnl0_libs + - libselinux1_libs + - libtirpc3t64_libs + - libxtables12_libs + contents: + /bin/ip: + /bin/ss: + /sbin/bridge: + /sbin/dcb: + /sbin/devlink: + /sbin/ip: + /sbin/rtacct: + /sbin/rtmon: + /sbin/tc: + /sbin/tipc: + /sbin/vdpa: + /usr/bin/ctstat: + /usr/bin/lnstat: + /usr/bin/nstat: + /usr/bin/rdma: + /usr/bin/routel: + /usr/bin/rtstat: + /usr/sbin/arpd: + /usr/sbin/genl: + + config: + contents: + /etc/iproute2/bpf_pinning: + /etc/iproute2/ematch_map: + /etc/iproute2/group: + /etc/iproute2/nl_protos: + /etc/iproute2/rt_dsfield: + /etc/iproute2/rt_protos: + /etc/iproute2/rt_realms: + /etc/iproute2/rt_scopes: + /etc/iproute2/rt_tables: + + libs: + contents: + /usr/lib/*-linux-*/tc/experimental.dist: + /usr/lib/*-linux-*/tc/m_ipt.so: + /usr/lib/*-linux-*/tc/m_xt.so: + /usr/lib/*-linux-*/tc/normal.dist: + /usr/lib/*-linux-*/tc/pareto.dist: + /usr/lib/*-linux-*/tc/paretonormal.dist: + /usr/lib/*-linux-*/tc/q_atm.so: + + copyright: + contents: + /usr/share/doc/iproute2/copyright: diff --git a/slices/libbpf1.yaml b/slices/libbpf1.yaml new file mode 100644 index 000000000..4278e446d --- /dev/null +++ b/slices/libbpf1.yaml @@ -0,0 +1,17 @@ +package: libbpf1 + +essential: + - libbpf1_copyright + +slices: + libs: + essential: + - libc6_libs + - libelf1t64_libs + - zlib1g_libs + contents: + /usr/lib/*-linux-*/libbpf.so.1*: + + copyright: + contents: + /usr/share/doc/libbpf1/copyright: diff --git a/slices/libglib2.0-0t64.yaml b/slices/libglib2.0-0t64.yaml new file mode 100644 index 000000000..d357c79bd --- /dev/null +++ b/slices/libglib2.0-0t64.yaml @@ -0,0 +1,27 @@ +package: libglib2.0-0t64 + +essential: + - libglib2.0-0t64_copyright + +slices: + libs: + essential: + - libc6_libs + - libffi8_libs + - libmount1_libs + - libpcre2-8-0_libs + - libselinux1_libs + - zlib1g_libs + contents: + /usr/lib/*-linux-*/glib-2.0/gio-launch-desktop: + /usr/lib/*-linux-*/glib-2.0/gio-querymodules: + /usr/lib/*-linux-*/glib-2.0/glib-compile-schemas: + /usr/lib/*-linux-*/libgio-2.0.so.0*: + /usr/lib/*-linux-*/libglib-2.0.so.0*: + /usr/lib/*-linux-*/libgmodule-2.0.so.0*: + /usr/lib/*-linux-*/libgobject-2.0.so.0*: + /usr/lib/*-linux-*/libgthread-2.0.so.0*: + + copyright: + contents: + /usr/share/doc/libglib2.0-0t64/copyright: diff --git a/slices/libmnl0.yaml b/slices/libmnl0.yaml new file mode 100644 index 000000000..6a4a337fd --- /dev/null +++ b/slices/libmnl0.yaml @@ -0,0 +1,15 @@ +package: libmnl0 + +essential: + - libmnl0_copyright + +slices: + libs: + essential: + - libc6_libs + contents: + /usr/lib/*-linux-*/libmnl.so.0*: + + copyright: + contents: + /usr/share/doc/libmnl0/copyright: diff --git a/slices/libnetplan1.yaml b/slices/libnetplan1.yaml new file mode 100644 index 000000000..c40ae64e9 --- /dev/null +++ b/slices/libnetplan1.yaml @@ -0,0 +1,18 @@ +package: libnetplan1 + +essential: + - libnetplan1_copyright + +slices: + libs: + essential: + - libc6_libs + - libglib2.0-0t64_libs + - libuuid1_libs + - libyaml-0-2_libs + contents: + /usr/lib/*-linux-*/libnetplan.so.1*: + + copyright: + contents: + /usr/share/doc/libnetplan1/copyright: diff --git a/slices/libxtables12.yaml b/slices/libxtables12.yaml new file mode 100644 index 000000000..bd8d1d699 --- /dev/null +++ b/slices/libxtables12.yaml @@ -0,0 +1,15 @@ +package: libxtables12 + +essential: + - libxtables12_copyright + +slices: + libs: + essential: + - libc6_libs + contents: + /usr/lib/*-linux-*/libxtables.so.12*: + + copyright: + contents: + /usr/share/doc/libxtables12/copyright: diff --git a/slices/netplan-generator.yaml b/slices/netplan-generator.yaml new file mode 100644 index 000000000..ab15b1eb2 --- /dev/null +++ b/slices/netplan-generator.yaml @@ -0,0 +1,20 @@ +package: netplan-generator + +essential: + - netplan-generator_copyright + +slices: + data: + essential: + - libc6_libs + - libglib2.0-0t64_libs + - libnetplan1_libs + - systemd_bins + contents: + /usr/lib/netplan/PLACEHOLDER: + /usr/lib/systemd/system-generators/netplan: + /usr/libexec/netplan/generate: + + copyright: + contents: + /usr/share/doc/netplan-generator/copyright: diff --git a/slices/netplan.io.yaml b/slices/netplan.io.yaml new file mode 100644 index 000000000..f54f1f962 --- /dev/null +++ b/slices/netplan.io.yaml @@ -0,0 +1,38 @@ +package: netplan.io + +essential: + - netplan.io_copyright + +slices: + bins: + essential: + - iproute2_bins + - libc6_libs + - libglib2.0-0t64_libs + - libnetplan1_libs + - libsystemd0_libs + - netplan-generator_data + - netplan.io_cli + - python3-dbus_data + - python3-netifaces_data + - python3-netplan_data + - python3-yaml_data + - python3.12_standard + - systemd_bins + contents: + /usr/sbin/netplan: + + cli: + contents: + /usr/share/netplan/netplan.script: + /usr/share/netplan/netplan_cli/**: + + extras: + contents: + /usr/libexec/netplan/netplan-dbus: + /usr/share/dbus-1/system-services/io.netplan.Netplan.service: + /usr/share/dbus-1/system.d/io.netplan.Netplan.conf: + + copyright: + contents: + /usr/share/doc/netplan.io/copyright: diff --git a/slices/python3-cffi-backend.yaml b/slices/python3-cffi-backend.yaml new file mode 100644 index 000000000..4017145b1 --- /dev/null +++ b/slices/python3-cffi-backend.yaml @@ -0,0 +1,17 @@ +package: python3-cffi-backend + +essential: + - python3-cffi-backend_copyright + +slices: + data: + essential: + - libc6_libs + - libffi8_libs + - python3.12_standard + contents: + /usr/lib/python3/dist-packages/_cffi_backend.cpython-*-linux-*.so: + + copyright: + contents: + /usr/share/doc/python3-cffi-backend/copyright: diff --git a/slices/python3-dbus.yaml b/slices/python3-dbus.yaml new file mode 100644 index 000000000..308260c58 --- /dev/null +++ b/slices/python3-dbus.yaml @@ -0,0 +1,24 @@ +package: python3-dbus + +essential: + - python3-dbus_copyright + +slices: + data: + essential: + - libc6_libs + - libdbus-1-3_libs + - libglib2.0-0t64_libs + - python3.12_standard + contents: + /usr/lib/python3/dist-packages/_dbus_bindings.cpython-*-linux-*.so: + /usr/lib/python3/dist-packages/_dbus_glib_bindings.cpython-*-linux-*.so: + /usr/lib/python3/dist-packages/dbus/**: + /usr/lib/python3/dist-packages/dbus_python-1.3.2.egg-info/PKG-INFO: + /usr/lib/python3/dist-packages/dbus_python-1.3.2.egg-info/dependency_links.txt: + /usr/lib/python3/dist-packages/dbus_python-1.3.2.egg-info/not-zip-safe: + /usr/lib/python3/dist-packages/dbus_python-1.3.2.egg-info/top_level.txt: + + copyright: + contents: + /usr/share/doc/python3-dbus/copyright: diff --git a/slices/python3-netifaces.yaml b/slices/python3-netifaces.yaml new file mode 100644 index 000000000..5af094e35 --- /dev/null +++ b/slices/python3-netifaces.yaml @@ -0,0 +1,20 @@ +package: python3-netifaces + +essential: + - python3-netifaces_copyright + +slices: + data: + essential: + - libc6_libs + - python3.12_standard + contents: + /usr/lib/python3/dist-packages/netifaces-0.11.0.egg-info/PKG-INFO: + /usr/lib/python3/dist-packages/netifaces-0.11.0.egg-info/dependency_links.txt: + /usr/lib/python3/dist-packages/netifaces-0.11.0.egg-info/top_level.txt: + /usr/lib/python3/dist-packages/netifaces-0.11.0.egg-info/zip-safe: + /usr/lib/python3/dist-packages/netifaces.cpython-*.so: + + copyright: + contents: + /usr/share/doc/python3-netifaces/copyright: diff --git a/slices/python3-netplan.yaml b/slices/python3-netplan.yaml new file mode 100644 index 000000000..c4d050788 --- /dev/null +++ b/slices/python3-netplan.yaml @@ -0,0 +1,18 @@ +package: python3-netplan + +essential: + - python3-netplan_copyright + +slices: + data: + essential: + - libc6_libs + - libnetplan1_libs + - python3-cffi-backend_data + - python3.12_standard + contents: + /usr/lib/python3/dist-packages/netplan/**: + + copyright: + contents: + /usr/share/doc/python3-netplan/copyright: diff --git a/slices/python3-yaml.yaml b/slices/python3-yaml.yaml new file mode 100644 index 000000000..4010e2c15 --- /dev/null +++ b/slices/python3-yaml.yaml @@ -0,0 +1,22 @@ +package: python3-yaml + +essential: + - python3-yaml_copyright + +slices: + data: + essential: + - libc6_libs + - libyaml-0-2_libs + - python3.12_standard + contents: + /usr/lib/python3/dist-packages/PyYAML-6.0.1.dist-info/INSTALLER: + /usr/lib/python3/dist-packages/PyYAML-6.0.1.dist-info/METADATA: + /usr/lib/python3/dist-packages/PyYAML-6.0.1.dist-info/WHEEL: + /usr/lib/python3/dist-packages/PyYAML-6.0.1.dist-info/top_level.txt: + /usr/lib/python3/dist-packages/_yaml/__init__.py: + /usr/lib/python3/dist-packages/yaml/**: + + copyright: + contents: + /usr/share/doc/python3-yaml/copyright: diff --git a/slices/python3.12-minimal.yaml b/slices/python3.12-minimal.yaml index dae71c828..c7d4d4a5b 100644 --- a/slices/python3.12-minimal.yaml +++ b/slices/python3.12-minimal.yaml @@ -11,6 +11,7 @@ slices: - libpython3.12-minimal_libs - zlib1g_libs contents: + /usr/bin/python3: {symlink: /usr/bin/python3.12} /usr/bin/python3.12: # The next two directories are created to mimic the behaviour in # the "postinst" script. From 83c89fee73eda58fee1c54706a4f9de3ff3f3876 Mon Sep 17 00:00:00 2001 From: Philip Meulengracht Date: Fri, 30 Aug 2024 11:42:24 +0200 Subject: [PATCH 2/4] tests,slices: correct a couple of slices, add tests --- slices/netplan-generator.yaml | 13 ++++++++++--- slices/netplan.io.yaml | 8 ++++---- tests/spread/integration/iproute2/task.yaml | 15 +++++++++++++++ tests/spread/integration/iproute2/test.sh | 13 +++++++++++++ tests/spread/integration/netplan.io/task.yaml | 19 +++++++++++++++++++ tests/spread/integration/netplan.io/test.sh | 9 +++++++++ 6 files changed, 70 insertions(+), 7 deletions(-) create mode 100644 tests/spread/integration/iproute2/task.yaml create mode 100755 tests/spread/integration/iproute2/test.sh create mode 100644 tests/spread/integration/netplan.io/task.yaml create mode 100755 tests/spread/integration/netplan.io/test.sh diff --git a/slices/netplan-generator.yaml b/slices/netplan-generator.yaml index ab15b1eb2..b7a55a5d6 100644 --- a/slices/netplan-generator.yaml +++ b/slices/netplan-generator.yaml @@ -4,16 +4,23 @@ essential: - netplan-generator_copyright slices: - data: + bins: essential: - libc6_libs - libglib2.0-0t64_libs - libnetplan1_libs - systemd_bins contents: - /usr/lib/netplan/PLACEHOLDER: - /usr/lib/systemd/system-generators/netplan: /usr/libexec/netplan/generate: + /usr/lib/systemd/system-generators/netplan: + + # the generator needs the folder and thus carry + # a placeholder file, it will be removed and a + # symlink to /usr/libexec/netplan/generate will + # be created in this folder + placeholder: + contents: + /usr/lib/netplan/PLACEHOLDER: copyright: contents: diff --git a/slices/netplan.io.yaml b/slices/netplan.io.yaml index f54f1f962..60f476c72 100644 --- a/slices/netplan.io.yaml +++ b/slices/netplan.io.yaml @@ -11,8 +11,8 @@ slices: - libglib2.0-0t64_libs - libnetplan1_libs - libsystemd0_libs - - netplan-generator_data - - netplan.io_cli + - netplan-generator_bins + - netplan.io_scripts - python3-dbus_data - python3-netifaces_data - python3-netplan_data @@ -22,12 +22,12 @@ slices: contents: /usr/sbin/netplan: - cli: + scripts: contents: /usr/share/netplan/netplan.script: /usr/share/netplan/netplan_cli/**: - extras: + dbus-service: contents: /usr/libexec/netplan/netplan-dbus: /usr/share/dbus-1/system-services/io.netplan.Netplan.service: diff --git a/tests/spread/integration/iproute2/task.yaml b/tests/spread/integration/iproute2/task.yaml new file mode 100644 index 000000000..700173a5f --- /dev/null +++ b/tests/spread/integration/iproute2/task.yaml @@ -0,0 +1,15 @@ +summary: Integration tests for iproute2 + +execute: | + # Chisel a minimum number of slices to give us a runnable system that we can + # test in. + rootfs="$(install-slices bash_bins passwd_config base-files_base grep_bins iproute2_bins)" + + # iproute2 needs dev mounted + mkdir "${rootfs}"/dev + mount --rbind /dev "${rootfs}"/dev + + cp test.sh "${rootfs}/" + chroot "${rootfs}/" /test.sh + + umount -l "${rootfs}"/dev diff --git a/tests/spread/integration/iproute2/test.sh b/tests/spread/integration/iproute2/test.sh new file mode 100755 index 000000000..ffc1d6789 --- /dev/null +++ b/tests/spread/integration/iproute2/test.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +# smoketest ip commands +ip --help | grep "Usage:" + +# test some basic commands and against loopback that +# we can kinda expect is there +ip link | grep "LOOPBACK,UP" +ip addr | grep "inet 127.0.0.1" +ip route | grep -E "default via [0-9\.]+" + +# iproute carries many binaries +# so maybe extend as needed diff --git a/tests/spread/integration/netplan.io/task.yaml b/tests/spread/integration/netplan.io/task.yaml new file mode 100644 index 000000000..8c7bb4e6b --- /dev/null +++ b/tests/spread/integration/netplan.io/task.yaml @@ -0,0 +1,19 @@ +summary: Integration tests for netplan.io + +execute: | + # Chisel a minimum number of slices to give us a runnable system that we can + # test in. + rootfs="$(install-slices bash_bins coreutils_bins passwd_config base-files_base grep_bins netplan.io_bins)" + + # netplan needs proc and dev mounted + mkdir "${rootfs}"/proc + mount -t proc /proc "${rootfs}"/proc + + mkdir "${rootfs}"/dev + mount --rbind /dev "${rootfs}"/dev + + cp test.sh "${rootfs}/" + chroot "${rootfs}/" /test.sh + + umount -l "${rootfs}"/dev + umount "${rootfs}"/proc diff --git a/tests/spread/integration/netplan.io/test.sh b/tests/spread/integration/netplan.io/test.sh new file mode 100755 index 000000000..90fbe054b --- /dev/null +++ b/tests/spread/integration/netplan.io/test.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +# smoketest a couple of netplan commands +netplan --help | grep "Network configuration in YAML" +netplan info | grep "features" + +# 'netplan generate' needs udevadm to work +# 'netplan apply' needs udevadm to work +# 'netplan status' does not properly work inside chroot From df4c2410910637d78e83bbb372d38d1cfd6c4566 Mon Sep 17 00:00:00 2001 From: Philip Meulengracht Date: Fri, 30 Aug 2024 15:03:26 +0200 Subject: [PATCH 3/4] slices/netplan-generator: sort bins contents --- slices/netplan-generator.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/slices/netplan-generator.yaml b/slices/netplan-generator.yaml index b7a55a5d6..c2e345503 100644 --- a/slices/netplan-generator.yaml +++ b/slices/netplan-generator.yaml @@ -11,8 +11,8 @@ slices: - libnetplan1_libs - systemd_bins contents: - /usr/libexec/netplan/generate: /usr/lib/systemd/system-generators/netplan: + /usr/libexec/netplan/generate: # the generator needs the folder and thus carry # a placeholder file, it will be removed and a From 75a57e34a2cba97d3ba421ed202c2b65f809df11 Mon Sep 17 00:00:00 2001 From: Philip Meulengracht Date: Fri, 30 Aug 2024 15:07:07 +0200 Subject: [PATCH 4/4] slices: do not add the python3 symlink, do it in test instead --- slices/python3.12-minimal.yaml | 1 - tests/spread/integration/netplan.io/test.sh | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/slices/python3.12-minimal.yaml b/slices/python3.12-minimal.yaml index c7d4d4a5b..dae71c828 100644 --- a/slices/python3.12-minimal.yaml +++ b/slices/python3.12-minimal.yaml @@ -11,7 +11,6 @@ slices: - libpython3.12-minimal_libs - zlib1g_libs contents: - /usr/bin/python3: {symlink: /usr/bin/python3.12} /usr/bin/python3.12: # The next two directories are created to mimic the behaviour in # the "postinst" script. diff --git a/tests/spread/integration/netplan.io/test.sh b/tests/spread/integration/netplan.io/test.sh index 90fbe054b..5338ca484 100755 --- a/tests/spread/integration/netplan.io/test.sh +++ b/tests/spread/integration/netplan.io/test.sh @@ -1,5 +1,8 @@ #!/bin/bash +# create python3 symlink +ln -s /usr/bin/python3.12 /usr/bin/python3 + # smoketest a couple of netplan commands netplan --help | grep "Network configuration in YAML" netplan info | grep "features"