Fetching a plain uncompressed binary with the dump plugin?

Hephy Workflow ships as an uncompressed single binary that you just download and run (cf. https://raw.githubusercontent.com/teamhephy/workflow-cli/master/install-v2.sh)

I intended to use the dump plugin to fetch this for my snap, much like the snapcrafters do for helm:

parts:
  hephy:
    plugin: dump
    source:
      - on amd64: https://storage.googleapis.com/hephy-workflow-cli-release/v$SNAPCRAFT_PROJECT_VERSION/deis-v$SNAPCRAFT_PROJECT_VERSION-linux-amd64
      - on i386: https://storage.googleapis.com/hephy-workflow-cli-release/v$SNAPCRAFT_PROJECT_VERSION/deis-v$SNAPCRAFT_PROJECT_VERSION-linux-i386

However, if I don’t specify a source-type, I get:

Sorry, an error occurred in Snapcraft:
Failed to pull source: unable to determine source type of 'https://storage.googleapis.com/hephy-workflow-cli-release/v2.20.2/deis-v2.20.2-linux-amd64'.
Check that the URL is correct or consider specifying `source-type` for this part. See `snapcraft help sources` for more information.

but none of the suggested source-types seem appropriate:

source-type
Can be one of the following: [bzr|deb|git|hg|local|mercurial|rpm|subversion|svn|tar|zip|7z]

They seem to be a mixture of:

  • Specifying some kind of packing (deb, rpm, tar, etc.) and assuming/inferring underlying transport
  • Specifying part of the transport protocol (bzr, git, etc.) but assuming/inferring underlying transport
  • local

but no e.g. http for “fetch but don’t unpack”

What am I missing? Should I be using a different plugin? Thanks

You can overcome this limitation with an override-pull scriptlet:

parts:
  hephy:
    plugin: dump
    source: .
    override-pull: |
      cd "$SNAPCRAFT_PART_SOURCE" # this line might be wrong. also maybe unneeded
      if [ "$SNAPCRAFT_ARCH_TRIPLET" = "x86_64-linux-gnu" ]; then
        curl -sSLO https://storage.googleapis.com/hephy-workflow-cli-release/v$SNAPCRAFT_PROJECT_VERSION/deis-v$SNAPCRAFT_PROJECT_VERSION-linux-amd64
      elif [ "$SNAPCRAFT_ARCH_TRIPLET" = "i386-linux-gnu" ]; then
        curl -sSLO https://storage.googleapis.com/hephy-workflow-cli-release/v$SNAPCRAFT_PROJECT_VERSION/deis-v$SNAPCRAFT_PROJECT_VERSION-linux-i386
      else
        exit 1
      fi
    build-packages:
    - curl

i wonder if source-type: local wouldnt work though …

Alas I tried snap-type: local in case, but (quite reasonably) it doesn’t solve this for me:

Pulling hephy 
Sorry, an error occurred in Snapcraft:
'/build/https:/storage.googleapis.com/hephy-workflow-cli-release/v2.20.2/deis-v2.20.2-linux-amd64' is not a directory

Cheers, yeah, figured I could invoke curl myself - thanks for putting it together for me!

well, was worth a shot at least … perhaps you should file a whishlist bug for source-type: binary or some such :slight_smile:

1 Like

The taxonomy is not well split out in terms of transport and all end up assume you will have files in a tree at the end of it. Internally we do support a “download this file” mechanism which can be exposed and would match your purposes.

That would be highly convenient, yes please!

What’s the preferred venue for wishlist-style “bugs” as mentioned by ogra above, and is it still useful for me to file one?

A wishlist bug on https://bugs.launchpad.net/snapcraft should do, thanks

2 Likes

Thanks! Filed at https://bugs.launchpad.net/snapcraft/+bug/1839842