Package Repositories Issue

I am trying this experimental feature for the first time as I need a .deb from the Ookla Speedtest CLI repo.

I’m following these instructions: https://snapcraft.io/docs/release-notes-snapcraft-4-0#Package

Here’s my current yaml:

name: spdtest
version: 'latest'
summary: Internet speed test
description: |
    Internet speeds are tested against random servers from speedtest.net at an timed interval (defined by user). 
    If slow speed (defined by user) is detected, then runs a number of download and upload test with optional route tests to servers and writes to a logfile.
    
base: core18
grade: stable
confinement: strict

license: Apache-2.0

apps:
  spdtest:
    command: sh /usr/bin/spdtest.sh
    environment:
      LC_ALL: C.UTF-8
    plugs:
      - network
      - network-bind
      - home
      
package-repositories:
  - type: apt
    deb-types: 
      - deb
    name: generic
    components:
      - main
    key-id: 379CE192D401AB61
    url: https://ookla.bintray.com/debian  
  
parts:
  spdtest:
    source: https://github.com/aristocratos/spdtest.sh
    source-type: git
    plugin: nil

    build-packages:
      - speedtest-cli
      - python3
      - jq
      - grc
      - mtr
      - less
      - gnupg1 
      - apt-transport-https 
      - dirmngr
      
    stage-packages:
      - speedtest-cli
      - python3
      - jq
      - grc
      - mtr
      - less
      - gnupg1 
      - apt-transport-https 
      - dirmngr
      
      
  publish:
    plugin: dump
    source: .
    organize:
      ./spdtest.sh: /usr/bin/spdtest.sh

Here’s the error I am getting when attempting to build with snapcraft.io:

RuntimeError: invalid deb repository object: OrderedDict([('type', 'apt'), ('deb-types', ['deb']), ('name', 'generic'), ('components', ['main']), ('key-id', '379CE192D401AB61'), ('url', 'https://ookla.bintray.com/debian')]) (invalid suites)

I’ve updated the yaml based on other posts but now I get the following error:

RuntimeError: invalid deb repository object: OrderedDict([('type', 'apt'), ('deb-types', ['deb']), ('components', []), ('suites', ['/']), ('key-id', '379CE192D401AB61'), ('url', 'https://ookla.bintray.com/debian')]) (extra keys)

The “extra keys” error goes away if I remove the key-id but then I get (invalid key-id). What am I missing…

Here’s the current snippet:

package-repositories:
  - type: apt
    deb-types: [deb]
    components: [main]
    name: [generic]
    suites: [$SNAPCRAFT_APT_RELEASE]
    key-id: 379CE192D401AB61
    url: https://ookla.bintray.com/debian 

TIA.

I gave up and went back to the way I had it:

    override-pull: |
      export INSTALL_KEY=379CE192D401AB61
      sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys $INSTALL_KEY
      echo "deb https://ookla.bintray.com/debian generic main" | sudo tee  /etc/apt/sources.list.d/speedtest.list
1 Like

It should look like:

package-repositories:
  - type: apt
    components: [main]
    suites: [focal]  <- focal if core20, bionic if core18
    key-id: 8756C4F765C9AC3CB6B85D62379CE192D401AB61
    url: https://ookla.bintray.com/debian 

I’m finishing up the last of the work required on this today and will update the documentation. Since the GPG key is not on the ubuntu keyserver, it will need to be placed in snap/keys/30D79C7C.asc, though there is a pending change for that to take effect.

It should be stable in Snapcraft 4.5.

1 Like

That attempt was made somewhere in the middle of all my other attempts as I was thinking the same thing but got invalid suite.

Are you able to successfully add that repo in your testing? If so, I’ll mimic your settings again.

Looks like they don’t have suite for ‘focal’, but they suggest using ‘generic’.

This worked for me:

package-repositories:
  - type: apt
    components: [main]
    suites: [generic]
    key-id: 8756C4F765C9AC3CB6B85D62379CE192D401AB61
    url: https://ookla.bintray.com/debian
1 Like