From af87aa0e4db5f890c9b8fa1cf16248a24cdfdae5 Mon Sep 17 00:00:00 2001 From: gbeuzeboc Date: Wed, 24 May 2023 15:30:31 +0200 Subject: [PATCH 1/7] ros plugins: setup proxy for rosdep In remote-build a proxy is used and passed as env var. When calling rosdep init as root those env var were not forwarded. This was causing core20 and core22 ROS snap to be unbuildable on remote-build rosdep doesn't support proxy: https://github.com/ros-infrastructure/rosdep/issues/271 --- snapcraft/parts/plugins/_ros.py | 7 +++++-- snapcraft_legacy/plugins/v2/_ros.py | 6 +++++- tests/legacy/unit/plugins/v2/test_catkin.py | 8 ++++---- tests/legacy/unit/plugins/v2/test_catkin_tools.py | 8 ++++---- tests/legacy/unit/plugins/v2/test_colcon.py | 8 ++++---- tests/unit/parts/plugins/test_colcon.py | 8 ++++---- 6 files changed, 26 insertions(+), 19 deletions(-) diff --git a/snapcraft/parts/plugins/_ros.py b/snapcraft/parts/plugins/_ros.py index b993d1fd4b..c4891128ef 100644 --- a/snapcraft/parts/plugins/_ros.py +++ b/snapcraft/parts/plugins/_ros.py @@ -177,8 +177,11 @@ def get_build_commands(self) -> List[str]: return ( self._get_workspace_activation_commands() + [ - "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; " - "then sudo rosdep init; fi", + "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then", + # Preserve http(s)_proxy env var in root for remote-build proxy since rosdep + # doesn't support proxy + # https://github.com/ros-infrastructure/rosdep/issues/271 + "sudo --preserve-env=http_proxy,https_proxy rosdep init; fi", 'rosdep update --include-eol-distros --rosdistro "${ROS_DISTRO}"', "rosdep install --default-yes --ignore-packages-from-source " '--from-paths "${CRAFT_PART_SRC_WORK}"', diff --git a/snapcraft_legacy/plugins/v2/_ros.py b/snapcraft_legacy/plugins/v2/_ros.py index 9d732bb36a..3fd7465363 100644 --- a/snapcraft_legacy/plugins/v2/_ros.py +++ b/snapcraft_legacy/plugins/v2/_ros.py @@ -120,7 +120,11 @@ def get_build_commands(self) -> List[str]: return ( self._get_workspace_activation_commands() + [ - "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then sudo rosdep init; fi", + "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then", + # Preserve http(s)_proxy env var in root for remote-build proxy since rosdep + # doesn't support proxy + # https://github.com/ros-infrastructure/rosdep/issues/271 + "sudo --preserve-env=http_proxy,https_proxy rosdep init; fi", 'rosdep update --include-eol-distros --rosdistro "${ROS_DISTRO}"', 'rosdep install --default-yes --ignore-packages-from-source --from-paths "${SNAPCRAFT_PART_SRC_WORK}"', ] diff --git a/tests/legacy/unit/plugins/v2/test_catkin.py b/tests/legacy/unit/plugins/v2/test_catkin.py index 95d3a8a8ba..df99d97d77 100644 --- a/tests/legacy/unit/plugins/v2/test_catkin.py +++ b/tests/legacy/unit/plugins/v2/test_catkin.py @@ -95,8 +95,8 @@ class Options: "fi", '. /opt/ros/"${ROS_DISTRO}"/setup.sh', 'eval "${state}"', - "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then sudo rosdep " - "init; fi", + "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then", + "sudo --preserve-env=http_proxy,https_proxy rosdep init; fi", 'rosdep update --include-eol-distros --rosdistro "${ROS_DISTRO}"', 'rosdep install --default-yes --ignore-packages-from-source --from-paths "${SNAPCRAFT_PART_SRC_WORK}"', 'state="$(set +o); set -$-"', @@ -159,8 +159,8 @@ class Options: "fi", '. /opt/ros/"${ROS_DISTRO}"/setup.sh', 'eval "${state}"', - "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then sudo rosdep " - "init; fi", + "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then", + "sudo --preserve-env=http_proxy,https_proxy rosdep init; fi", 'rosdep update --include-eol-distros --rosdistro "${ROS_DISTRO}"', 'rosdep install --default-yes --ignore-packages-from-source --from-paths "${SNAPCRAFT_PART_SRC_WORK}"', 'state="$(set +o); set -$-"', diff --git a/tests/legacy/unit/plugins/v2/test_catkin_tools.py b/tests/legacy/unit/plugins/v2/test_catkin_tools.py index a9e9a018ec..fc1c7905af 100644 --- a/tests/legacy/unit/plugins/v2/test_catkin_tools.py +++ b/tests/legacy/unit/plugins/v2/test_catkin_tools.py @@ -90,8 +90,8 @@ class Options: "fi", '. /opt/ros/"${ROS_DISTRO}"/setup.sh', 'eval "${state}"', - "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then sudo rosdep " - "init; fi", + "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then", + "sudo --preserve-env=http_proxy,https_proxy rosdep init; fi", 'rosdep update --include-eol-distros --rosdistro "${ROS_DISTRO}"', 'rosdep install --default-yes --ignore-packages-from-source --from-paths "${SNAPCRAFT_PART_SRC_WORK}"', 'state="$(set +o); set -$-"', @@ -155,8 +155,8 @@ class Options: "fi", '. /opt/ros/"${ROS_DISTRO}"/setup.sh', 'eval "${state}"', - "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then sudo rosdep " - "init; fi", + "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then", + "sudo --preserve-env=http_proxy,https_proxy rosdep init; fi", 'rosdep update --include-eol-distros --rosdistro "${ROS_DISTRO}"', 'rosdep install --default-yes --ignore-packages-from-source --from-paths "${SNAPCRAFT_PART_SRC_WORK}"', 'state="$(set +o); set -$-"', diff --git a/tests/legacy/unit/plugins/v2/test_colcon.py b/tests/legacy/unit/plugins/v2/test_colcon.py index b7f807d382..9821d9817e 100644 --- a/tests/legacy/unit/plugins/v2/test_colcon.py +++ b/tests/legacy/unit/plugins/v2/test_colcon.py @@ -115,8 +115,8 @@ class Options: "fi", '. /opt/ros/"${ROS_DISTRO}"/local_setup.sh', 'eval "${state}"', - "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then sudo rosdep " - "init; fi", + "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then", + "sudo --preserve-env=http_proxy,https_proxy rosdep init; fi", 'rosdep update --include-eol-distros --rosdistro "${ROS_DISTRO}"', 'rosdep install --default-yes --ignore-packages-from-source --from-paths "${SNAPCRAFT_PART_SRC_WORK}"', 'state="$(set +o); set -$-"', @@ -182,8 +182,8 @@ class Options: "fi", '. /opt/ros/"${ROS_DISTRO}"/local_setup.sh', 'eval "${state}"', - "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then sudo rosdep " - "init; fi", + "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then", + "sudo --preserve-env=http_proxy,https_proxy rosdep init; fi", 'rosdep update --include-eol-distros --rosdistro "${ROS_DISTRO}"', 'rosdep install --default-yes --ignore-packages-from-source --from-paths "${SNAPCRAFT_PART_SRC_WORK}"', 'state="$(set +o); set -$-"', diff --git a/tests/unit/parts/plugins/test_colcon.py b/tests/unit/parts/plugins/test_colcon.py index b143ca3668..a37c025dc4 100644 --- a/tests/unit/parts/plugins/test_colcon.py +++ b/tests/unit/parts/plugins/test_colcon.py @@ -139,8 +139,8 @@ def test_get_build_commands(self, setup_method_fixture, new_dir, monkeypatch): "fi", '. "/opt/ros/${ROS_DISTRO}/local_setup.sh"', 'eval "${state}"', - "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then sudo rosdep " - "init; fi", + "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then", + "sudo --preserve-env=http_proxy,https_proxy rosdep init; fi", 'rosdep update --include-eol-distros --rosdistro "${ROS_DISTRO}"', "rosdep install --default-yes --ignore-packages-from-source " '--from-paths "${CRAFT_PART_SRC_WORK}"', @@ -218,8 +218,8 @@ def test_get_build_commands_with_all_properties( "fi", '. "/opt/ros/${ROS_DISTRO}/local_setup.sh"', 'eval "${state}"', - "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then sudo rosdep " - "init; fi", + "if [ ! -f /etc/ros/rosdep/sources.list.d/20-default.list ]; then", + "sudo --preserve-env=http_proxy,https_proxy rosdep init; fi", 'rosdep update --include-eol-distros --rosdistro "${ROS_DISTRO}"', "rosdep install --default-yes --ignore-packages-from-source " '--from-paths "${CRAFT_PART_SRC_WORK}"', From df792927924c2d5d6144b42c794b8426f7ea7e59 Mon Sep 17 00:00:00 2001 From: Callahan Date: Tue, 6 Jun 2023 11:16:51 -0500 Subject: [PATCH 2/7] ros: remove linter warnings from spread tests (#4203) Signed-off-by: Claudio Matsuoka --- .../linter-ros2-humble-mixed/expected_linter_output.txt | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/spread/core22/linters/linter-ros2-humble-mixed/expected_linter_output.txt b/tests/spread/core22/linters/linter-ros2-humble-mixed/expected_linter_output.txt index 2442be15bb..e5aff790af 100644 --- a/tests/spread/core22/linters/linter-ros2-humble-mixed/expected_linter_output.txt +++ b/tests/spread/core22/linters/linter-ros2-humble-mixed/expected_linter_output.txt @@ -6,39 +6,32 @@ Lint warnings: - library: libexpat.so.1: unused library 'lib/x86_64-linux-gnu/libexpat.so.1.8.7'. (https://snapcraft.io/docs/linters-library) - library: libtirpc.so.3: unused library 'lib/x86_64-linux-gnu/libtirpc.so.3.0.0'. (https://snapcraft.io/docs/linters-library) - library: libz.so.1: unused library 'lib/x86_64-linux-gnu/libz.so.1.2.11'. (https://snapcraft.io/docs/linters-library) -- library: libaction_msgs__rosidl_generator_py.so: unused library 'opt/ros/humble/lib/libaction_msgs__rosidl_generator_py.so'. (https://snapcraft.io/docs/linters-library) - library: libaction_msgs__rosidl_typesupport_cpp.so: unused library 'opt/ros/humble/lib/libaction_msgs__rosidl_typesupport_cpp.so'. (https://snapcraft.io/docs/linters-library) - library: libaction_msgs__rosidl_typesupport_fastrtps_c.so: unused library 'opt/ros/humble/lib/libaction_msgs__rosidl_typesupport_fastrtps_c.so'. (https://snapcraft.io/docs/linters-library) - library: libaction_msgs__rosidl_typesupport_fastrtps_cpp.so: unused library 'opt/ros/humble/lib/libaction_msgs__rosidl_typesupport_fastrtps_cpp.so'. (https://snapcraft.io/docs/linters-library) - library: libaction_msgs__rosidl_typesupport_introspection_c.so: unused library 'opt/ros/humble/lib/libaction_msgs__rosidl_typesupport_introspection_c.so'. (https://snapcraft.io/docs/linters-library) - library: libaction_msgs__rosidl_typesupport_introspection_cpp.so: unused library 'opt/ros/humble/lib/libaction_msgs__rosidl_typesupport_introspection_cpp.so'. (https://snapcraft.io/docs/linters-library) -- library: libbuiltin_interfaces__rosidl_generator_py.so: unused library 'opt/ros/humble/lib/libbuiltin_interfaces__rosidl_generator_py.so'. (https://snapcraft.io/docs/linters-library) - library: libbuiltin_interfaces__rosidl_typesupport_cpp.so: unused library 'opt/ros/humble/lib/libbuiltin_interfaces__rosidl_typesupport_cpp.so'. (https://snapcraft.io/docs/linters-library) -- library: liblifecycle_msgs__rosidl_generator_py.so: unused library 'opt/ros/humble/lib/liblifecycle_msgs__rosidl_generator_py.so'. (https://snapcraft.io/docs/linters-library) - library: liblifecycle_msgs__rosidl_typesupport_cpp.so: unused library 'opt/ros/humble/lib/liblifecycle_msgs__rosidl_typesupport_cpp.so'. (https://snapcraft.io/docs/linters-library) - library: liblifecycle_msgs__rosidl_typesupport_fastrtps_c.so: unused library 'opt/ros/humble/lib/liblifecycle_msgs__rosidl_typesupport_fastrtps_c.so'. (https://snapcraft.io/docs/linters-library) - library: liblifecycle_msgs__rosidl_typesupport_fastrtps_cpp.so: unused library 'opt/ros/humble/lib/liblifecycle_msgs__rosidl_typesupport_fastrtps_cpp.so'. (https://snapcraft.io/docs/linters-library) - library: liblifecycle_msgs__rosidl_typesupport_introspection_c.so: unused library 'opt/ros/humble/lib/liblifecycle_msgs__rosidl_typesupport_introspection_c.so'. (https://snapcraft.io/docs/linters-library) - library: liblifecycle_msgs__rosidl_typesupport_introspection_cpp.so: unused library 'opt/ros/humble/lib/liblifecycle_msgs__rosidl_typesupport_introspection_cpp.so'. (https://snapcraft.io/docs/linters-library) -- library: librcl_interfaces__rosidl_generator_py.so: unused library 'opt/ros/humble/lib/librcl_interfaces__rosidl_generator_py.so'. (https://snapcraft.io/docs/linters-library) - library: librcl_interfaces__rosidl_typesupport_cpp.so: unused library 'opt/ros/humble/lib/librcl_interfaces__rosidl_typesupport_cpp.so'. (https://snapcraft.io/docs/linters-library) - library: librcl_interfaces__rosidl_typesupport_fastrtps_c.so: unused library 'opt/ros/humble/lib/librcl_interfaces__rosidl_typesupport_fastrtps_c.so'. (https://snapcraft.io/docs/linters-library) - library: librcl_interfaces__rosidl_typesupport_fastrtps_cpp.so: unused library 'opt/ros/humble/lib/librcl_interfaces__rosidl_typesupport_fastrtps_cpp.so'. (https://snapcraft.io/docs/linters-library) - library: librcl_interfaces__rosidl_typesupport_introspection_c.so: unused library 'opt/ros/humble/lib/librcl_interfaces__rosidl_typesupport_introspection_c.so'. (https://snapcraft.io/docs/linters-library) - library: librcl_interfaces__rosidl_typesupport_introspection_cpp.so: unused library 'opt/ros/humble/lib/librcl_interfaces__rosidl_typesupport_introspection_cpp.so'. (https://snapcraft.io/docs/linters-library) -- library: librmw_dds_common__rosidl_generator_py.so: unused library 'opt/ros/humble/lib/librmw_dds_common__rosidl_generator_py.so'. (https://snapcraft.io/docs/linters-library) - library: librmw_dds_common__rosidl_typesupport_fastrtps_c.so: unused library 'opt/ros/humble/lib/librmw_dds_common__rosidl_typesupport_fastrtps_c.so'. (https://snapcraft.io/docs/linters-library) - library: librmw_dds_common__rosidl_typesupport_fastrtps_cpp.so: unused library 'opt/ros/humble/lib/librmw_dds_common__rosidl_typesupport_fastrtps_cpp.so'. (https://snapcraft.io/docs/linters-library) - library: librmw_dds_common__rosidl_typesupport_introspection_c.so: unused library 'opt/ros/humble/lib/librmw_dds_common__rosidl_typesupport_introspection_c.so'. (https://snapcraft.io/docs/linters-library) - library: librmw_dds_common__rosidl_typesupport_introspection_cpp.so: unused library 'opt/ros/humble/lib/librmw_dds_common__rosidl_typesupport_introspection_cpp.so'. (https://snapcraft.io/docs/linters-library) - library: librmw_fastrtps_cpp.so: unused library 'opt/ros/humble/lib/librmw_fastrtps_cpp.so'. (https://snapcraft.io/docs/linters-library) -- library: librosgraph_msgs__rosidl_generator_py.so: unused library 'opt/ros/humble/lib/librosgraph_msgs__rosidl_generator_py.so'. (https://snapcraft.io/docs/linters-library) - library: librosgraph_msgs__rosidl_typesupport_cpp.so: unused library 'opt/ros/humble/lib/librosgraph_msgs__rosidl_typesupport_cpp.so'. (https://snapcraft.io/docs/linters-library) - library: librosgraph_msgs__rosidl_typesupport_fastrtps_c.so: unused library 'opt/ros/humble/lib/librosgraph_msgs__rosidl_typesupport_fastrtps_c.so'. (https://snapcraft.io/docs/linters-library) - library: librosgraph_msgs__rosidl_typesupport_fastrtps_cpp.so: unused library 'opt/ros/humble/lib/librosgraph_msgs__rosidl_typesupport_fastrtps_cpp.so'. (https://snapcraft.io/docs/linters-library) - library: librosgraph_msgs__rosidl_typesupport_introspection_c.so: unused library 'opt/ros/humble/lib/librosgraph_msgs__rosidl_typesupport_introspection_c.so'. (https://snapcraft.io/docs/linters-library) - library: librosgraph_msgs__rosidl_typesupport_introspection_cpp.so: unused library 'opt/ros/humble/lib/librosgraph_msgs__rosidl_typesupport_introspection_cpp.so'. (https://snapcraft.io/docs/linters-library) -- library: libunique_identifier_msgs__rosidl_generator_py.so: unused library 'opt/ros/humble/lib/libunique_identifier_msgs__rosidl_generator_py.so'. (https://snapcraft.io/docs/linters-library) - library: libunique_identifier_msgs__rosidl_typesupport_cpp.so: unused library 'opt/ros/humble/lib/libunique_identifier_msgs__rosidl_typesupport_cpp.so'. (https://snapcraft.io/docs/linters-library) - library: libatomic.so.1: unused library 'usr/lib/x86_64-linux-gnu/libatomic.so.1.2.0'. (https://snapcraft.io/docs/linters-library) - library: libicuio.so.70: unused library 'usr/lib/x86_64-linux-gnu/libicuio.so.70.1'. (https://snapcraft.io/docs/linters-library) From 9e86eb101bb4d6ddcbdfb1d71bf248c351346cd7 Mon Sep 17 00:00:00 2001 From: lissyx <1645737+lissyx@users.noreply.github.com> Date: Tue, 6 Jun 2023 18:59:00 +0200 Subject: [PATCH 3/7] desktop extensions: set libthai dictionary path (#4199) --- extensions/desktop/common/desktop-exports | 3 +++ 1 file changed, 3 insertions(+) diff --git a/extensions/desktop/common/desktop-exports b/extensions/desktop/common/desktop-exports index f950085681..d76cf68ec9 100644 --- a/extensions/desktop/common/desktop-exports +++ b/extensions/desktop/common/desktop-exports @@ -467,3 +467,6 @@ ln -sfn "$REALHOME/.config/ibus/bus" "$IBUS_CONFIG_PATH" # Set libgweather path export LIBGWEATHER_LOCATIONS_PATH="$SNAP_DESKTOP_RUNTIME/usr/lib/$ARCH/libgweather-4/Locations.bin" + +# Set libthai dict path +export LIBTHAI_DICTDIR="$SNAP_DESKTOP_RUNTIME/usr/share/libthai/" From c0e7fd9e62ba22d658740f20ed8ff993017eacae Mon Sep 17 00:00:00 2001 From: Ondra Kubik Date: Tue, 6 Jun 2023 12:29:51 -0700 Subject: [PATCH 4/7] plugins: update unpack location of snapd deb for kernel plugin (#4200) `ubnutu-core-initramfs` tool changed where `snap-boostrap` is fetched from. It assumes `snap-bootstrap` from passed `--root` to be used. Unpack the downloaded snapd debian package to the same directory where "ubnutu-core-initramfs" debian package is unpacked. This directory is already passed to the `ubnutu-core-initramfs` tool as `--root` Signed-off-by: Ondrej Kubik --- snapcraft/parts/plugins/kernel.py | 1 - snapcraft_legacy/plugins/v2/_kernel_build.py | 10 +++++----- snapcraft_legacy/plugins/v2/kernel.py | 1 - tests/legacy/unit/plugins/v2/test_kernel.py | 17 +++++++---------- tests/unit/parts/plugins/test_kernel.py | 17 +++++++---------- 5 files changed, 19 insertions(+), 27 deletions(-) diff --git a/snapcraft/parts/plugins/kernel.py b/snapcraft/parts/plugins/kernel.py index 514657ec52..8dbc63a787 100644 --- a/snapcraft/parts/plugins/kernel.py +++ b/snapcraft/parts/plugins/kernel.py @@ -447,7 +447,6 @@ def get_build_environment(self) -> Dict[str, str]: "ARCH": self._kernel_arch, "DEB_ARCH": "${CRAFT_TARGET_ARCH}", "UC_INITRD_DEB": "${CRAFT_PART_BUILD}/ubuntu-core-initramfs", - "SNAPD_UNPACKED_SNAP": "${CRAFT_PART_BUILD}/unpacked_snapd", "KERNEL_BUILD_ARCH_DIR": f"${{CRAFT_PART_BUILD}}/arch/{self._kernel_arch}/boot", "KERNEL_IMAGE_TARGET": self.kernel_image_target, } diff --git a/snapcraft_legacy/plugins/v2/_kernel_build.py b/snapcraft_legacy/plugins/v2/_kernel_build.py index 5179090646..38cb062f1e 100644 --- a/snapcraft_legacy/plugins/v2/_kernel_build.py +++ b/snapcraft_legacy/plugins/v2/_kernel_build.py @@ -211,8 +211,8 @@ def _download_snap_bootstrap_cmd(target_arch: str) -> List[str]: echo "Getting snapd deb for snap bootstrap..." # only download again if files does not exist, otherwise # assume we are re-running build - if [ ! -e ${{SNAPD_UNPACKED_SNAP}} ]; then - download_snap_bootstrap {arch} ${{SNAPD_UNPACKED_SNAP}} + if [ ! -e ${{UC_INITRD_DEB}}/usr/lib/snapd ]; then + download_snap_bootstrap {arch} ${{UC_INITRD_DEB}} fi """.format( arch=target_arch @@ -709,7 +709,7 @@ def _make_initrd_cmd( " ".join( [ "link_files", - '"${SNAPD_UNPACKED_SNAP}"', + '"${UC_INITRD_DEB}"', '"usr/lib/snapd/snap-bootstrap"', '"${uc_initrd_feature_snap_bootstratp}"', ] @@ -717,7 +717,7 @@ def _make_initrd_cmd( " ".join( [ "link_files", - '"${SNAPD_UNPACKED_SNAP}"', + '"${UC_INITRD_DEB}"', '"usr/lib/snapd/info"', '"${uc_initrd_feature_snap_bootstratp}"', ] @@ -725,7 +725,7 @@ def _make_initrd_cmd( " ".join( [ "cp", - "${SNAPD_UNPACKED_SNAP}/usr/lib/snapd/info", + "${UC_INITRD_DEB}/usr/lib/snapd/info", f"{install_dir}/snapd-info", ] ), diff --git a/snapcraft_legacy/plugins/v2/kernel.py b/snapcraft_legacy/plugins/v2/kernel.py index 1ece2957d1..aaee65c33c 100644 --- a/snapcraft_legacy/plugins/v2/kernel.py +++ b/snapcraft_legacy/plugins/v2/kernel.py @@ -490,7 +490,6 @@ def get_build_environment(self) -> Dict[str, str]: "ARCH": self._kernel_arch, "DEB_ARCH": "${SNAPCRAFT_TARGET_ARCH}", "UC_INITRD_DEB": "${SNAPCRAFT_PART_BUILD}/ubuntu-core-initramfs", - "SNAPD_UNPACKED_SNAP": "${SNAPCRAFT_PART_BUILD}/unpacked_snapd", "KERNEL_BUILD_ARCH_DIR": f"${{SNAPCRAFT_PART_BUILD}}/arch/{self._kernel_arch}/boot", "KERNEL_IMAGE_TARGET": self.kernel_image_target, } diff --git a/tests/legacy/unit/plugins/v2/test_kernel.py b/tests/legacy/unit/plugins/v2/test_kernel.py index 1bc95d9eeb..3344862804 100644 --- a/tests/legacy/unit/plugins/v2/test_kernel.py +++ b/tests/legacy/unit/plugins/v2/test_kernel.py @@ -503,7 +503,6 @@ def test_check_get_build_environment(self): "ARCH": plugin._kernel_arch, "DEB_ARCH": "${SNAPCRAFT_TARGET_ARCH}", "UC_INITRD_DEB": "${SNAPCRAFT_PART_BUILD}/ubuntu-core-initramfs", - "SNAPD_UNPACKED_SNAP": "${SNAPCRAFT_PART_BUILD}/unpacked_snapd", "KERNEL_BUILD_ARCH_DIR": f"${{SNAPCRAFT_PART_BUILD}}/arch/{plugin._kernel_arch}/boot", "KERNEL_IMAGE_TARGET": plugin.kernel_image_target, }, @@ -524,7 +523,6 @@ def test_check_get_build_environment_compiler_paths_cross(self): "ARCH": "arm", "DEB_ARCH": "${SNAPCRAFT_TARGET_ARCH}", "UC_INITRD_DEB": "${SNAPCRAFT_PART_BUILD}/ubuntu-core-initramfs", - "SNAPD_UNPACKED_SNAP": "${SNAPCRAFT_PART_BUILD}/unpacked_snapd", "KERNEL_BUILD_ARCH_DIR": "${SNAPCRAFT_PART_BUILD}/arch/arm/boot", "KERNEL_IMAGE_TARGET": "Image.gz", "PATH": "${SNAPCRAFT_STAGE}/gcc-11/bin:${PATH}", @@ -544,7 +542,6 @@ def test_check_get_build_environment_compiler_paths(self): "ARCH": plugin._kernel_arch, "DEB_ARCH": "${SNAPCRAFT_TARGET_ARCH}", "UC_INITRD_DEB": "${SNAPCRAFT_PART_BUILD}/ubuntu-core-initramfs", - "SNAPD_UNPACKED_SNAP": "${SNAPCRAFT_PART_BUILD}/unpacked_snapd", "KERNEL_BUILD_ARCH_DIR": f"${{SNAPCRAFT_PART_BUILD}}/arch/{plugin._kernel_arch}/boot", "KERNEL_IMAGE_TARGET": plugin.kernel_image_target, "PATH": "${SNAPCRAFT_STAGE}/gcc-11/bin:${SNAPCRAFT_STAGE}/gcc-11/sbin:${PATH}", @@ -1237,8 +1234,8 @@ def _is_sub_array(array, sub_array): echo "Getting snapd deb for snap bootstrap..." # only download again if files does not exist, otherwise # assume we are re-running build - if [ ! -e ${{SNAPD_UNPACKED_SNAP}} ]; then - download_snap_bootstrap {arch} ${{SNAPD_UNPACKED_SNAP}} + if [ ! -e ${{UC_INITRD_DEB}}/usr/lib/snapd ]; then + download_snap_bootstrap {arch} ${{UC_INITRD_DEB}} fi """.format( arch=_DEB_ARCH_TRANSLATIONS[platform.machine()] @@ -1252,8 +1249,8 @@ def _is_sub_array(array, sub_array): echo "Getting snapd deb for snap bootstrap..." # only download again if files does not exist, otherwise # assume we are re-running build - if [ ! -e ${{SNAPD_UNPACKED_SNAP}} ]; then - download_snap_bootstrap {arch} ${{SNAPD_UNPACKED_SNAP}} + if [ ! -e ${{UC_INITRD_DEB}}/usr/lib/snapd ]; then + download_snap_bootstrap {arch} ${{UC_INITRD_DEB}} fi """.format( arch="armhf" @@ -1662,12 +1659,12 @@ def _is_sub_array(array, sub_array): " ".join( [ "link_files", - '"${SNAPD_UNPACKED_SNAP}" "usr/lib/snapd/snap-bootstrap"', + '"${UC_INITRD_DEB}" "usr/lib/snapd/snap-bootstrap"', '"${uc_initrd_feature_snap_bootstratp}"', ], ), - 'link_files "${SNAPD_UNPACKED_SNAP}" "usr/lib/snapd/info" "${uc_initrd_feature_snap_bootstratp}"', - "cp ${SNAPD_UNPACKED_SNAP}/usr/lib/snapd/info ${SNAPCRAFT_PART_INSTALL}/snapd-info", + 'link_files "${UC_INITRD_DEB}" "usr/lib/snapd/info" "${uc_initrd_feature_snap_bootstratp}"', + "cp ${UC_INITRD_DEB}/usr/lib/snapd/info ${SNAPCRAFT_PART_INSTALL}/snapd-info", ] _clean_old_initrd_cmd = [ diff --git a/tests/unit/parts/plugins/test_kernel.py b/tests/unit/parts/plugins/test_kernel.py index c49b01fc8f..ec04c31daa 100644 --- a/tests/unit/parts/plugins/test_kernel.py +++ b/tests/unit/parts/plugins/test_kernel.py @@ -382,7 +382,6 @@ def test_check_get_build_environment(self, setup_method_fixture, new_dir): "ARCH": plugin._kernel_arch, "DEB_ARCH": "${CRAFT_TARGET_ARCH}", "UC_INITRD_DEB": "${CRAFT_PART_BUILD}/ubuntu-core-initramfs", - "SNAPD_UNPACKED_SNAP": "${CRAFT_PART_BUILD}/unpacked_snapd", "KERNEL_BUILD_ARCH_DIR": f"${{CRAFT_PART_BUILD}}/arch/{plugin._kernel_arch}/boot", "KERNEL_IMAGE_TARGET": plugin.kernel_image_target, } @@ -404,7 +403,6 @@ def test_check_get_build_environment_compiler_paths_cross( "ARCH": "arm", "DEB_ARCH": "${CRAFT_TARGET_ARCH}", "UC_INITRD_DEB": "${CRAFT_PART_BUILD}/ubuntu-core-initramfs", - "SNAPD_UNPACKED_SNAP": "${CRAFT_PART_BUILD}/unpacked_snapd", "KERNEL_BUILD_ARCH_DIR": "${CRAFT_PART_BUILD}/arch/arm/boot", "KERNEL_IMAGE_TARGET": "Image.gz", "PATH": "${CRAFT_STAGE}/gcc-11/bin:${PATH}", @@ -426,7 +424,6 @@ def test_check_get_build_environment_compiler_paths( "ARCH": plugin._kernel_arch, "DEB_ARCH": "${CRAFT_TARGET_ARCH}", "UC_INITRD_DEB": "${CRAFT_PART_BUILD}/ubuntu-core-initramfs", - "SNAPD_UNPACKED_SNAP": "${CRAFT_PART_BUILD}/unpacked_snapd", "KERNEL_BUILD_ARCH_DIR": f"${{CRAFT_PART_BUILD}}/arch/{plugin._kernel_arch}/boot", "KERNEL_IMAGE_TARGET": plugin.kernel_image_target, "PATH": "${CRAFT_STAGE}/gcc-11/bin:${CRAFT_STAGE}/gcc-11/sbin:${PATH}", @@ -1340,8 +1337,8 @@ def _is_sub_array(array, sub_array): echo "Getting snapd deb for snap bootstrap..." # only download again if files does not exist, otherwise # assume we are re-running build - if [ ! -e ${{SNAPD_UNPACKED_SNAP}} ]; then - download_snap_bootstrap {_machine_arch} ${{SNAPD_UNPACKED_SNAP}} + if [ ! -e ${{UC_INITRD_DEB}}/usr/lib/snapd ]; then + download_snap_bootstrap {_machine_arch} ${{UC_INITRD_DEB}} fi """ ) @@ -1353,8 +1350,8 @@ def _is_sub_array(array, sub_array): echo "Getting snapd deb for snap bootstrap..." # only download again if files does not exist, otherwise # assume we are re-running build - if [ ! -e ${SNAPD_UNPACKED_SNAP} ]; then - download_snap_bootstrap armhf ${SNAPD_UNPACKED_SNAP} + if [ ! -e ${UC_INITRD_DEB}/usr/lib/snapd ]; then + download_snap_bootstrap armhf ${UC_INITRD_DEB} fi """ ) @@ -1772,13 +1769,13 @@ def _is_sub_array(array, sub_array): " ".join( [ "link_files", - '"${SNAPD_UNPACKED_SNAP}" "usr/lib/snapd/snap-bootstrap"', + '"${UC_INITRD_DEB}" "usr/lib/snapd/snap-bootstrap"', '"${uc_initrd_feature_snap_bootstratp}"', ], ), - 'link_files "${SNAPD_UNPACKED_SNAP}" "usr/lib/snapd/info"' + 'link_files "${UC_INITRD_DEB}" "usr/lib/snapd/info"' ' "${uc_initrd_feature_snap_bootstratp}"', - "cp ${SNAPD_UNPACKED_SNAP}/usr/lib/snapd/info ${CRAFT_PART_INSTALL}/snapd-info", + "cp ${UC_INITRD_DEB}/usr/lib/snapd/info ${CRAFT_PART_INSTALL}/snapd-info", ] _clean_old_initrd_cmd = [ From 389462c518f83330d5d4a81032c3bc89e59476b8 Mon Sep 17 00:00:00 2001 From: Ondra Kubik Date: Tue, 6 Jun 2023 14:20:50 -0700 Subject: [PATCH 5/7] kernel plugin: add debhelper build dependency (#4185) Required by "debian/rules clean" call Signed-off-by: Ondrej Kubik --- snapcraft/parts/plugins/kernel.py | 1 + snapcraft_legacy/plugins/v2/kernel.py | 1 + tests/legacy/unit/plugins/v2/test_kernel.py | 7 +++++++ tests/unit/parts/plugins/test_kernel.py | 8 ++++++++ 4 files changed, 17 insertions(+) diff --git a/snapcraft/parts/plugins/kernel.py b/snapcraft/parts/plugins/kernel.py index 8dbc63a787..82d7cc5f6a 100644 --- a/snapcraft/parts/plugins/kernel.py +++ b/snapcraft/parts/plugins/kernel.py @@ -385,6 +385,7 @@ def get_build_packages(self) -> Set[str]: build_packages = { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", diff --git a/snapcraft_legacy/plugins/v2/kernel.py b/snapcraft_legacy/plugins/v2/kernel.py index aaee65c33c..af29bd0fd2 100644 --- a/snapcraft_legacy/plugins/v2/kernel.py +++ b/snapcraft_legacy/plugins/v2/kernel.py @@ -430,6 +430,7 @@ def get_build_packages(self) -> Set[str]: build_packages = { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", diff --git a/tests/legacy/unit/plugins/v2/test_kernel.py b/tests/legacy/unit/plugins/v2/test_kernel.py index 3344862804..81dd38910f 100644 --- a/tests/legacy/unit/plugins/v2/test_kernel.py +++ b/tests/legacy/unit/plugins/v2/test_kernel.py @@ -266,6 +266,7 @@ def test_get_base_build_packages(self): { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", @@ -285,6 +286,7 @@ def test_get_base_build_packages_lz4(self): { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", @@ -304,6 +306,7 @@ def test_get_base_build_packages_xz(self): { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", @@ -323,6 +326,7 @@ def test_get_base_build_packages_zfs(self): { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", @@ -347,6 +351,7 @@ def test_get_base_build_packages_zfs_cross(self): { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", @@ -1002,6 +1007,7 @@ def test_use_llvm(self): { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", @@ -1034,6 +1040,7 @@ def test_use_llvm_specific_version(self): { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", diff --git a/tests/unit/parts/plugins/test_kernel.py b/tests/unit/parts/plugins/test_kernel.py index ec04c31daa..d9d5ecaf52 100644 --- a/tests/unit/parts/plugins/test_kernel.py +++ b/tests/unit/parts/plugins/test_kernel.py @@ -71,6 +71,7 @@ def test_get_base_build_packages(self, setup_method_fixture, new_dir): assert plugin.get_build_packages() == { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", @@ -92,6 +93,7 @@ def test_get_base_build_packages_lz4(self, setup_method_fixture, new_dir): assert plugin.get_build_packages() == { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", @@ -113,6 +115,7 @@ def test_get_base_build_packages_xz(self, setup_method_fixture, new_dir): assert plugin.get_build_packages() == { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", @@ -134,6 +137,7 @@ def test_get_base_build_packages_zfs(self, setup_method_fixture, new_dir): assert plugin.get_build_packages() == { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", @@ -161,6 +165,7 @@ def test_get_base_build_packages_zfs_cross(self, setup_method_fixture, new_dir): assert plugin.get_build_packages() == { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", @@ -188,6 +193,7 @@ def test_get_base_build_packages_efi(self, setup_method_fixture, new_dir): assert plugin.get_build_packages() == { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", @@ -1094,6 +1100,7 @@ def test_use_llvm(self, setup_method_fixture, new_dir): assert plugin.get_build_packages() == { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", @@ -1128,6 +1135,7 @@ def test_use_llvm_specific_version(self, setup_method_fixture, new_dir): assert plugin.get_build_packages() == { "bc", "binutils", + "debhelper", "fakeroot", "gcc", "cmake", From d7a5048999758bb514a46b595f544a3e55d7b44b Mon Sep 17 00:00:00 2001 From: Claudio Matsuoka Date: Fri, 9 Jun 2023 21:43:14 -0300 Subject: [PATCH 6/7] requirements: update craft-parts to 1.19.6 Craft Parts 1.19.6 reverts subdir changes in pull and build steps. Signed-off-by: Claudio Matsuoka --- requirements-devel.txt | 2 +- requirements.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements-devel.txt b/requirements-devel.txt index 3afae65bfe..1ac83f9a80 100644 --- a/requirements-devel.txt +++ b/requirements-devel.txt @@ -14,7 +14,7 @@ coverage==7.2.5 craft-archives==0.0.3 craft-cli==1.2.0 craft-grammar==1.1.1 -craft-parts==1.19.5 +craft-parts==1.19.6 craft-providers==1.10.0 craft-store==2.4.0 cryptography==40.0.2 diff --git a/requirements.txt b/requirements.txt index dece2a3db8..5486ce4b69 100644 --- a/requirements.txt +++ b/requirements.txt @@ -8,7 +8,7 @@ click==8.1.3 craft-archives==0.0.3 craft-cli==1.2.0 craft-grammar==1.1.1 -craft-parts==1.19.5 +craft-parts==1.19.6 craft-providers==1.10.0 craft-store==2.4.0 cryptography==40.0.2 From 4ce377ce8201ddd406bdbeb4fac4064c83447107 Mon Sep 17 00:00:00 2001 From: Callahan Date: Wed, 7 Jun 2023 12:25:04 -0500 Subject: [PATCH 7/7] lint: fix typing for pyright 1.1.312 (#4205) Signed-off-by: Callahan Kovacs --- snapcraft/commands/account.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/snapcraft/commands/account.py b/snapcraft/commands/account.py index ccc4aad0bb..9887a72154 100644 --- a/snapcraft/commands/account.py +++ b/snapcraft/commands/account.py @@ -23,7 +23,7 @@ import stat import textwrap from datetime import datetime -from typing import TYPE_CHECKING, Dict, Union +from typing import TYPE_CHECKING, Any, Dict from craft_cli import BaseCommand, emit from craft_cli.errors import ArgumentParsingError @@ -192,7 +192,7 @@ def run(self, parsed_args): f"Set {store.constants.ENVIRONMENT_STORE_AUTH}=candid instead", ) - kwargs: Dict[str, Union[str, int]] = {} + kwargs: Dict[str, Any] = {} if parsed_args.snaps: kwargs["packages"] = parsed_args.snaps.split(",") if parsed_args.channels: