Repository: canonical/snapcraft (language: python)

Issue:
Component types `kernel-modules` and `standard` are not supported
### What needs to get done

Component types `kernel-modules` and `standard` need to be supported by snapcraft.

### Why it needs to get done

It is a snapd feature that needs to be supported.


Discussion / hints:

Thank you for reporting us your feedback!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-3520.

> This message was autogenerated

Please also add `standard` as a valid type, we just got a +1 on this one.

Fix patch:
diff --git a/docs/reference/changelog.rst b/docs/reference/changelog.rst
index c4f94847ba..70a41f207b 100644
--- a/docs/reference/changelog.rst
+++ b/docs/reference/changelog.rst
@@ -70,6 +70,53 @@ Changelog
 
   For a complete list of commits, check out the `X.Y.Z`_ release on GitHub.
 
+8.4.4 (2024-Oct-24)
+-------------------
+
+Core
+====
+
+Bases
+#####
+
+core24
+""""""
+
+* Fix a bug where ``CRAFT_PARALLEL_BUILD_COUNT`` was not evaluated in
+  ``snapcraft.yaml`` files (`#4785`_).
+
+* Fix a bug where ``package-repositories`` declarations could conflict with
+  default sources present in Noble (`LP#2083013`_).
+
+For a complete list of commits, check out the `8.4.4`_ release on GitHub.
+
+
+7.5.8 (2024-Oct-24)
+-------------------
+
+Core
+====
+
+* Fix a regression where Snapcraft would fail to run on some architectures due
+  to a ``cryptography`` dependency that attempted to load legacy algorithms
+  (`#5077`_).
+
+For a complete list of commits, check out the `7.5.8`_ release on GitHub.
+
+
+8.4.3 (2024-Oct-10)
+-------------------
+
+Core
+====
+
+Components
+##########
+
+* Add support for component types ``kernel-modules`` and ``standard``
+  (`#5089`_).
+
+For a complete list of commits, check out the `8.4.3`_ release on GitHub.
 
 8.4.2 (2024-Oct-07)
 -------------------
@@ -1230,6 +1277,7 @@ For a complete list of commits, check out the `8.0.0`_ release on GitHub.
 .. _LP#2061603: https://bugs.launchpad.net/snapcraft/+bug/2061603
 .. _LP#2064639: https://bugs.launchpad.net/snapcraft/+bug/2064639
 .. _LP#2069783: https://bugs.launchpad.net/snapcraft/+bug/2069783
+.. _LP#2083013: https://bugs.launchpad.net/snapcraft/+bug/2083013
 
 .. _#4142: https://github.com/canonical/snapcraft/issues/4142
 .. _#4356: https://github.com/canonical/snapcraft/issues/4356
@@ -1255,6 +1303,7 @@ For a complete list of commits, check out the `8.0.0`_ release on GitHub.
 .. _#4780: https://github.com/canonical/snapcraft/issues/4780
 .. _#4781: https://github.com/canonical/snapcraft/issues/4781
 .. _#4783: https://github.com/canonical/snapcraft/issues/4783
+.. _#4785: https://github.com/canonical/snapcraft/issues/4785
 .. _#4791: https://github.com/canonical/snapcraft/issues/4791
 .. _#4798: https://github.com/canonical/snapcraft/issues/4798
 .. _#4804: https://github.com/canonical/snapcraft/issues/4804
@@ -1287,9 +1336,11 @@ For a complete list of commits, check out the `8.0.0`_ release on GitHub.
 .. _#5048: https://github.com/canonical/snapcraft/issues/5048
 .. _#5077: https://github.com/canonical/snapcraft/issues/5077
 .. _#5079: https://github.com/canonical/snapcraft/issues/5079
+.. _#5089: https://github.com/canonical/snapcraft/issues/5089
 
 .. _7.5.6: https://github.com/canonical/snapcraft/releases/tag/7.5.6
 .. _7.5.7: https://github.com/canonical/snapcraft/releases/tag/7.5.7
+.. _7.5.8: https://github.com/canonical/snapcraft/releases/tag/7.5.8
 .. _8.0.0: https://github.com/canonical/snapcraft/releases/tag/8.0.0
 .. _8.0.1: https://github.com/canonical/snapcraft/releases/tag/8.0.1
 .. _8.0.2: https://github.com/canonical/snapcraft/releases/tag/8.0.2
@@ -1318,3 +1369,5 @@ For a complete list of commits, check out the `8.0.0`_ release on GitHub.
 .. _8.4.0: https://github.com/canonical/snapcraft/releases/tag/8.4.0
 .. _8.4.1: https://github.com/canonical/snapcraft/releases/tag/8.4.1
 .. _8.4.2: https://github.com/canonical/snapcraft/releases/tag/8.4.2
+.. _8.4.3: https://github.com/canonical/snapcraft/releases/tag/8.4.3
+.. _8.4.4: https://github.com/canonical/snapcraft/releases/tag/8.4.4
diff --git a/requirements-devel.txt b/requirements-devel.txt
index b34cf5f2ea..a11632f78f 100644
--- a/requirements-devel.txt
+++ b/requirements-devel.txt
@@ -24,8 +24,8 @@ click==8.1.7
 codespell==2.3.0
 colorama==0.4.6
 coverage==7.6.1
-craft-application==4.2.6
-craft-archives==2.0.0
+craft-application==4.2.7
+craft-archives==2.0.1
 craft-cli==2.7.0
 craft-grammar==2.0.1
 craft-parts==2.1.2
diff --git a/requirements-docs.txt b/requirements-docs.txt
index 3c0d37570a..024510c35c 100644
--- a/requirements-docs.txt
+++ b/requirements-docs.txt
@@ -19,8 +19,8 @@ chardet==5.2.0
 charset-normalizer==3.3.2
 click==8.1.7
 colorama==0.4.6
-craft-application==4.2.6
-craft-archives==2.0.0
+craft-application==4.2.7
+craft-archives==2.0.1
 craft-cli==2.7.0
 craft-grammar==2.0.1
 craft-parts==2.1.2
diff --git a/requirements.txt b/requirements.txt
index f8f5854405..db561aecc0 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -7,8 +7,8 @@ cffi==1.17.1
 chardet==5.2.0
 charset-normalizer==3.3.2
 click==8.1.7
-craft-application==4.2.6
-craft-archives==2.0.0
+craft-application==4.2.7
+craft-archives==2.0.1
 craft-cli==2.7.0
 craft-grammar==2.0.1
 craft-parts==2.1.2
diff --git a/setup.py b/setup.py
index 275446acd9..3fc201f7fd 100755
--- a/setup.py
+++ b/setup.py
@@ -98,7 +98,7 @@ def recursive_data_files(directory, install_directory):
     "attrs",
     "catkin-pkg; sys_platform == 'linux'",
     "click",
-    "craft-application>=4.2.6,<5.0.0",
+    "craft-application>=4.2.7,<5.0.0",
     "craft-archives~=2.0",
     "craft-cli~=2.6",
     "craft-grammar>=2.0.1,<3.0.0",
diff --git a/snapcraft/models/project.py b/snapcraft/models/project.py
index d748ef347f..0b2b0bee59 100644
--- a/snapcraft/models/project.py
+++ b/snapcraft/models/project.py
@@ -581,7 +581,7 @@ class Component(models.CraftBaseModel):
 
     summary: SummaryStr
     description: str
-    type: Literal["test"]
+    type: Literal["test", "kernel-modules", "standard"]
     version: VersionStr | None = None
     hooks: dict[str, Hook] | None = None
 


Test patch:
diff --git a/tests/spread/core24-suites/environment/test-variables/task.yaml b/tests/spread/core24-suites/environment/test-variables/task.yaml
index f9fb09d0a2..22d50aeed0 100644
--- a/tests/spread/core24-suites/environment/test-variables/task.yaml
+++ b/tests/spread/core24-suites/environment/test-variables/task.yaml
@@ -8,6 +8,7 @@ systems:
 
 environment:
   SNAP/test_variables: test-variables
+  SNAPCRAFT_PARALLEL_BUILD_COUNT: 5
 
 prepare: |
   #shellcheck source=tests/spread/tools/snapcraft-yaml.sh
@@ -35,7 +36,7 @@ execute: |
       "^SNAPCRAFT_PROJECT_GRADE=devel$" \
       "^SNAPCRAFT_PROJECT_NAME=variables$" \
       "^SNAPCRAFT_PROJECT_VERSION=1$" \
-      "^SNAPCRAFT_PARALLEL_BUILD_COUNT=[0-9]\+$" \
+      "^SNAPCRAFT_PARALLEL_BUILD_COUNT=5$" \
       "^SNAPCRAFT_PROJECT_DIR=${root}$" \
       "^SNAPCRAFT_PART_SRC=${root}/parts/hello/src$" \
       "^SNAPCRAFT_PART_SRC_WORK=${root}/parts/hello/src$" \
@@ -48,7 +49,7 @@ execute: |
       "^CRAFT_ARCH_TRIPLET_BUILD_ON=x86_64-linux-gnu$" \
       "^CRAFT_ARCH_BUILD_FOR=s390x$" \
       "^CRAFT_ARCH_TRIPLET_BUILD_FOR=s390x-linux-gnu$" \
-      "^CRAFT_PARALLEL_BUILD_COUNT=[0-9]\+$" \
+      "^CRAFT_PARALLEL_BUILD_COUNT=5$" \
       "^CRAFT_PROJECT_DIR=${root}$" \
       "^CRAFT_PART_NAME=hello$" \
       "^CRAFT_PART_SRC=${root}/parts/hello/src$" \
diff --git a/tests/spread/core24/package-repositories/task.yaml b/tests/spread/core24/package-repositories/task.yaml
index 96db7835e5..46c8063548 100644
--- a/tests/spread/core24/package-repositories/task.yaml
+++ b/tests/spread/core24/package-repositories/task.yaml
@@ -9,6 +9,7 @@ environment:
   SNAP/test_multi_keys: test-multi-keys
   SNAP/test_foreign_armhf: test-foreign-armhf
   SNAP/test_foreign_i386: test-foreign-i386
+  SNAP/test_key_conflict: test-key-conflict
 
 prepare: |
   # Remove the currently installed "gpg" and "dirmngr" packages to ensure that
diff --git a/tests/spread/core24/package-repositories/test-key-conflict/snapcraft.yaml b/tests/spread/core24/package-repositories/test-key-conflict/snapcraft.yaml
new file mode 100644
index 0000000000..4252620f38
--- /dev/null
+++ b/tests/spread/core24/package-repositories/test-key-conflict/snapcraft.yaml
@@ -0,0 +1,40 @@
+name: test-key-conflict
+version: '1.0'
+summary: test package repos with keys already present on the system
+description: test package repos with keys already present on the system
+confinement: strict
+base: core24
+platforms:
+  amd64:
+
+package-repositories:
+  # In core24+ this pair of url + suite is already listed in
+  # /etc/apt/sources.list.d/ubuntu.sources. Add it here to make sure this setup
+  # is working.
+  - type: apt
+    url: http://archive.ubuntu.com/ubuntu
+    suites: [noble]
+    components: [main, universe]
+    architectures: [i386]
+    key-id: F6ECB3762474EDA9D21B7022871920D1991BC93C
+    key-server: keyserver.ubuntu.com
+  # This ports.ubuntu.com repo is not affected by the bug, but add it here to
+  # ensure that a different repo with the same key-id still works.
+  - type: apt
+    url: http://ports.ubuntu.com/ubuntu-ports
+    suites: [noble]
+    architectures: [armhf]
+    components: [main]
+    key-id: F6ECB3762474EDA9D21B7022871920D1991BC93C
+
+parts:
+  mypart:
+    plugin: nil
+    stage-packages:
+      - zlib1g:i386 # To ensure the package-repo is setup correctly
+      - zlib1g:armhf
+      - hello       # there is no hello:i386 in the archives
+
+apps:
+  test-key-conflict:
+    command: usr/bin/hello -g hello
diff --git a/tests/unit/models/test_projects.py b/tests/unit/models/test_projects.py
index 1cbbdabbec..793a546b6f 100644
--- a/tests/unit/models/test_projects.py
+++ b/tests/unit/models/test_projects.py
@@ -2566,16 +2566,17 @@ def test_components_valid(self, project, project_yaml_data, stub_component_data)
 
         assert test_project.components == components
 
+    @pytest.mark.parametrize("component_type", ["test", "kernel-modules", "standard"])
     def test_component_type_valid(
-        self, project, project_yaml_data, stub_component_data
+        self, component_type, project, project_yaml_data, stub_component_data
     ):
         component = {"foo": stub_component_data}
-        component["foo"]["type"] = "test"
+        component["foo"]["type"] = component_type
 
         test_project = project.unmarshal(project_yaml_data(components=component))
 
         assert test_project.components
-        assert test_project.components["foo"].type == "test"
+        assert test_project.components["foo"].type == component_type
 
     def test_component_type_invalid(
         self, project, project_yaml_data, stub_component_data