Repository: canonical/snapcraft

Issue:
Regression: snapcraft started failing with craft_archives.repo.errors.AptGPGKeyInstallError
### Bug Description

On Friday git-ubuntu CI regressed. It uses the stable snapcraft snap.

It seems that something was switched that caused it to start failing with an error from inside craft-archives. See https://github.com/canonical/craft-archives/issues/83 for details.

### To Reproduce

In a Focal lxd container, running as the ubuntu user (eg. `lxc launch ubuntu:focal test-container && lxc shell test-container` and then `login -f ubuntu`):

```
git clone https://git.launchpad.net/git-ubuntu
git checkout 8f0d8e5
sh snap.sh
```

### Environment

Snapcraft is in destructive mode inside a lxd container.

### snapcraft.yaml

```shell
See https://git.launchpad.net/git-ubuntu/tree/snap/snapcraft.yaml although note that snap.sh modifies it slightly to work around LP: #1918968. See that script for details.
```


### Relevant log output

```shell
File "/snap/snapcraft/9362/lib/python3.8/site-packages/snapcraft_legacy/internal/project_loader/_config.py", line 304, in get_build_packages
    self.install_package_repositories()
  File "/snap/snapcraft/9362/lib/python3.8/site-packages/snapcraft_legacy/internal/project_loader/_config.py", line 288, in install_package_repositories
    refresh_required |= key_manager.install_package_repository_key(
  File "/snap/snapcraft/9362/lib/python3.8/site-packages/craft_archives/repo/apt_key_manager.py", line 257, in install_package_repository_key
    self.install_key(key=key_path.read_text())
  File "/snap/snapcraft/9362/lib/python3.8/site-packages/craft_archives/repo/apt_key_manager.py", line 170, in install_key
    raise errors.AptGPGKeyInstallError(
craft_archives.repo.errors.AptGPGKeyInstallError: Failed to install GPG key: Key must be a single key, not multiple.
```


### Additional context

_No response_


Discussion:

Resolving patch:
diff --git a/setup.py b/setup.py
--- a/setup.py
+++ b/setup.py
@@ -99,7 +99,7 @@ def recursive_data_files(directory, install_directory):
 install_requires = [
     "attrs",
     "click",
-    "craft-archives==0.0.3",
+    "craft-archives",
     "craft-cli",
     "craft-grammar",
     "craft-parts",
diff --git a/snapcraft_legacy/plugins/v1/catkin.py b/snapcraft_legacy/plugins/v1/catkin.py
--- a/snapcraft_legacy/plugins/v1/catkin.py
+++ b/snapcraft_legacy/plugins/v1/catkin.py
@@ -282,6 +282,7 @@ def get_required_package_repositories(self) -> List[PackageRepository]:
 
         return [
             PackageRepositoryApt(
+                type="apt",
                 formats=["deb"],
                 components=["main"],
                 key_id="C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654",
diff --git a/snapcraft_legacy/plugins/v1/colcon.py b/snapcraft_legacy/plugins/v1/colcon.py
--- a/snapcraft_legacy/plugins/v1/colcon.py
+++ b/snapcraft_legacy/plugins/v1/colcon.py
@@ -231,6 +231,7 @@ def get_required_package_repositories(cls) -> List[PackageRepository]:
         codename = os_release.OsRelease().version_codename()
         return [
             PackageRepositoryApt(
+                type="apt",
                 formats=["deb"],
                 components=["main"],
                 key_id="C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654",


Test patch:
diff --git a/tests/spread/core22/package-repositories/task.yaml b/tests/spread/core22/package-repositories/task.yaml
--- a/tests/spread/core22/package-repositories/task.yaml
+++ b/tests/spread/core22/package-repositories/task.yaml
@@ -6,6 +6,7 @@ environment:
   SNAP/test_apt_keyserver: test-apt-keyserver
   SNAP/test_apt_ppa: test-apt-ppa
   SNAP/test_pin: test-pin
+  SNAP/test_multi_keys: test-multi-keys
   SNAPCRAFT_BUILD_ENVIRONMENT: ""
 
 restore: |
diff --git a/tests/spread/core22/package-repositories/test-multi-keys/snap/keys/9E61EF26.asc b/tests/spread/core22/package-repositories/test-multi-keys/snap/keys/9E61EF26.asc
new file mode 100644
--- /dev/null
+++ b/tests/spread/core22/package-repositories/test-multi-keys/snap/keys/9E61EF26.asc
@@ -0,0 +1,239 @@
+# NOTE: this keyring has expired keys and subkeys. Lines with "pub:e:" are expired
+# keys, and lines with "sub:e:" are expired subkeys. python-gnupg returns the
+# fingerprints for all primary keys, expired or not:
+# pub:e:4096:1:B8F999C007BB6C57:1360109177:1549910347::-:::sc::::::23::0:
+# fpr:::::::::8735F5AF62A99A628EC13377B8F999C007BB6C57:
+# uid:e::::1455302347::A8FC88656336852AD4301DF059CEE6134FD37C21::Puppet Labs Nightly Build Key (Puppet Labs Nightly Build Key) <delivery@puppetlabs.com>::::::::::0:
+# uid:e::::1455302347::4EF2A82F1FF355343885012A832C628E1A4F73A8::Puppet Labs Nightly Build Key (Puppet Labs Nightly Build Key) <info@puppetlabs.com>::::::::::0:
+# sub:e:4096:1:AE8282E5A5FC3E74:1360109177:1549910293:::::e::::::23:
+# fpr:::::::::F838D657CCAF0E4A6375B0E9AE8282E5A5FC3E74:
+# gpg: key 7F438280EF8D349F: 8 signatures not checked due to missing keys
+# pub:e:4096:1:7F438280EF8D349F:1471554366:1629234366::-:::sc::::::23::0:
+# fpr:::::::::6F6B15509CF8E59E6E469F327F438280EF8D349F:
+# uid:e::::1471554366::B648B946D1E13EEA5F4081D8FE5CF4D001200BC7::Puppet, Inc. Release Key (Puppet, Inc. Release Key) <release@puppet.com>::::::::::0:
+# sub:e:4096:1:A2D80E04656674AE:1471554366:1629234366:::::e::::::23:
+# fpr:::::::::07F5ABF8FE84BC3736D2AAD3A2D80E04656674AE:
+# pub:-:4096:1:4528B6CD9E61EF26:1554759562:1743975562::-:::scESC::::::23::0:
+# fpr:::::::::D6811ED3ADEEB8441AF5AA8F4528B6CD9E61EF26:
+# uid:-::::1554759562::B648B946D1E13EEA5F4081D8FE5CF4D001200BC7::Puppet, Inc. Release Key (Puppet, Inc. Release Key) <release@puppet.com>::::::::::0:
+# sub:-:4096:1:F230A24E9F057A83:1554759562:1743975562:::::e::::::23:
+# fpr:::::::::90A29D0A6576E2CA185AED3EF230A24E9F057A83:
+-----BEGIN PGP PUBLIC KEY BLOCK-----
+
+mQINBFERnnkBEAC6FNq5aPrrLxiqpgSmhJfAm8dFGWOLUGtTkEgwo+kHggXN+q6t
+jQgBaY2INJ68TDfOntGh2FVXrU++a0l+9NY0SQ/00Qj869N0FcBLZBqRiKQV7Xcd
+PetiNFnua0mS9k1irj7RkSq27OgklZTcpy6ayBJzftrCWHf9chLK0fcAbVH1TpKu
+qOIQVjo+KBKoakL9TD79U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----END PGP PUBLIC KEY BLOCK-----
diff --git a/tests/spread/core22/package-repositories/test-multi-keys/snap/snapcraft.yaml b/tests/spread/core22/package-repositories/test-multi-keys/snap/snapcraft.yaml
new file mode 100644
--- /dev/null
+++ b/tests/spread/core22/package-repositories/test-multi-keys/snap/snapcraft.yaml
@@ -0,0 +1,38 @@
+name: test-multi-keys
+version: '1.0'
+summary: test
+description: test installing a package repository with an asset file with multiple keys
+grade: stable
+confinement: strict
+base: core22
+
+parts:
+  test-ppa:
+    plugin: nil
+    build-packages:
+      - test-ppa
+    stage-packages:
+      - test-ppa
+      - puppet-tools-release # Comes from the Puppet repo
+    override-build: |
+      craftctl default
+      # This file comes from the puppet-tools-release package.
+      test -f ${CRAFT_PART_INSTALL}/usr/share/doc/puppet-tools-release/bill-of-materials
+
+apps:
+    test-ppa:
+      command: usr/bin/test-ppa
+
+package-repositories:
+  - type: apt
+    formats: [deb, deb-src]
+    components: [main]
+    suites: [focal]
+    key-id: 78E1918602959B9C59103100F1831DDAFC42E99D
+    url: http://ppa.launchpad.net/snappy-dev/snapcraft-daily/ubuntu
+  - type: apt # puppet bolt
+    components: [puppet-tools]
+    suites: [focal]
+    url: http://apt.puppet.com
+    # Asset 9E61EF26.asc has multiple keys inside
+    key-id: D6811ED3ADEEB8441AF5AA8F4528B6CD9E61EF26