Additional package-repositories support

Has there been any discussion on supporting other deb source formats other than deb822 for the new package-repositories in snapcraft 4.0? I have a case where the *.list format is needed for a repo that doesn’t provide the directory structure needed for deb822.

Surely it is just a matter of translating one configuration format to the other? The sources.list(5) man page describes the relationship between the two formats:

The format for two one-line-style entries using the deb and deb-src
types is:

    deb [ option1=value1 option2=value2 ] uri suite [component1] [component2] [...]
    deb-src [ option1=value1 option2=value2 ] uri suite [component1] [component2] [...]

Alternatively the equivalent entry in deb822 style looks like this:

         Types: deb deb-src
         URIs: uri
         Suites: suite
         Components: [component1] [component2] [...]
         option1: value1
         option2: value2

Can you use this as a guide to figure out how to configure the repository?

1 Like

If you’re still having trouble, can you share your repository example?

Here is my package-repositories definition and the resulting error when trying to build the snap. If the “suites” list could be empty, it seems like a full path in the “url” could possibly work but this specific repo might be a case where a different “type” is needed to support a repo that doesn’t follow the expected directory structure.

package-repositories:
  - type: apt
    deb-types: [deb]
    components: [multiverse]
    suites: [ubuntu1804/x86_64]
    key-id: 7fa2af80
    url: https://developer.download.nvidia.com/compute/cuda/repos
  - type: apt
    deb-types: [deb]
    components: [multiverse]
    suites: [ubuntu1804/x86_64]
    key-id: 7fa2af80
    url: https://developer.download.nvidia.com/compute/machine-learning/repos


Hit:1 http://security.ubuntu.com/ubuntu bionic-security InRelease
Hit:2 http://archive.ubuntu.com/ubuntu bionic InRelease                               
Hit:3 http://archive.ubuntu.com/ubuntu bionic-updates InRelease          
Ign:4 https://developer.download.nvidia.com/compute/cuda/repos ubuntu1804/x86_64 InRelease
Ign:5 https://developer.download.nvidia.com/compute/machine-learning/repos ubuntu1804/x86_64 InRelease
Err:6 https://developer.download.nvidia.com/compute/cuda/repos ubuntu1804/x86_64 Release
  404  Not Found [IP: x.x.x.x 443]
Err:7 https://developer.download.nvidia.com/compute/machine-learning/repos ubuntu1804/x86_64 Release
  404  Not Found [IP: x.x.x.x 443]
Reading package lists... Done
E: The repository 'https://developer.download.nvidia.com/compute/cuda/repos ubuntu1804/x86_64 Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
E: The repository 'https://developer.download.nvidia.com/compute/machine-learning/repos ubuntu1804/x86_64 Release' does not have a Release file.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
Failed to update the package cache: Some files could not be downloaded:

failed to run apt update

Check that the sources on your host are configured correctly.

Ah, well you can indeed have an empty component list! Thank you for bringing that to our attention :slight_smile:

Here is a fix PR: https://github.com/snapcore/snapcraft/pull/3169

Here is the config for your repo:

package-repositories:
  - type: apt
    deb-types: [deb]
    components: []
    suites: [/]
    key-id: 7fa2af80
    url: https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64

You can test the pr in a while once the build is ready: sudo snap refresh snapcraft --channel=edge/pr-3169

I tested the PR build and it worked for me. Thanks!

1 Like