[Help] Changing the snap name causes a failure in execution

Hi everyone,

I have successfully created a snap package to the swift programming language (tested only locally), but whenever I change its name (because the name swift has been registered by someone else) it stops working.

Below is the yaml that is not working, the working version has swift instead of swift-language. What I need to change in order to the command swift be found within the snap?

name: swift-language
version: '4.0.3'
summary: The Swift Programming Language
description: |
  Swift is a high-performance system programming language. It has a clean and
  modern syntax, offers seamless access to existing C and Objective-C code and
  frameworks, and is memory safe by default.

# TODO:
#  - Build from source http://paste.ubuntu.com/25564789/

confinement: strict
grade: stable

parts:
  swift:
    plugin: dump
    source: https://swift.org/builds/swift-4.0.3-release/ubuntu1610/swift-4.0.3-RELEASE/swift-4.0.3-RELEASE-ubuntu16.10.tar.gz
    stage-packages:
      - clang
      - libblocksruntime0
      - libbsd0
      - libedit2
      - libicu-dev          # Yes, the -dev package is deliberately staged.
      - libncursesw5
      - libpython2.7
      - libsqlite3-0
      - libuutil1linux
      - libxml2
      - python2.7

apps:
  lldb:
    command: bin/lldb
    aliases: [ lldb ]
  lldb-4-0-0:
    command: bin/lldb-4.0.0
    aliases: [ lldb-4.0.0 ]
  lldb-argdumper:
    command: bin/lldb-argdumper
    aliases: [ lldb-argdumper ]
  lldb-mi:
    command: bin/lldb-mi
    aliases: [ lldb-mi ]
  lldb-mi-4-0-0:
    command: bin/lldb-mi-4.0.0
    aliases: [ lldb-mi-4.0.0 ]
  lldb-server:
    command: bin/lldb-server
    aliases: [ lldb-server ]
  lldb-server-4-0-0:
    command: bin/lldb-server-4.0.0
    aliases: [ lldb-server-4.0.0 ]
  repl-swift:
    command: bin/repl_swift
    aliases: [ repl_swift ]
  swift:
    command: bin/swift
  swift-autolink-extract:
    command: bin/swift-autolink-extract
    aliases: [ swift-autolink-extract ]
  swift-build:
    command: bin/swift-build
    aliases: [ swift-build ]
  swift-build-tool:
    command: bin/swift-build-tool
    aliases: [ swift-build-tool ]
  swift-demangle:
    command: bin/swift-demangle
    aliases: [ swift-demangle ]
  swift-package:
    command: bin/swift-package
    aliases: [ swift-package ]
  swift-test:
    command: bin/swift-test
    aliases: [ swift-test ]
  swiftc:
    command: bin/swiftc
    aliases: [ swiftc ]

You don’t need to change anything. Your app will be available at swift-language.swift, and you can request an alias for just swift from the store guys once you’ve uploaded it into the store.

Thank you for the answer,

I did ask for the swift name, in order to register the snap under it. I will wait for a response.

That is great, it is working under swift-language.swift as you pointed out. Is there a way of creating a local alias for it, so I can run swift directly?

Best,

lf

$ snap alias swift-language.swift swift

should do the trick (and tab completion should help for all but the last word).

Thank you,

When I publish, will the alias work for the users? Is there a way of building it into the snap?

Best,
lf

This manual alias is local to your machine. What you’ve been told to do is to request an automatic alias; once that is granted it’ll happen automatically for users (unless they have overridden it with a manual alias such as yours).

1 Like

@jdstrand explains how to request aliases here.