missing " git://" in the source crashes the snapcraft

Bug #1516228 reported by XiaoGuo, Liu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Medium
Sergio Schvezov

Bug Description

I have a something like in the following:

parts:
  cam:
    plugin: go
    source: github.com/liu-xiao-guo/webcamserv

It will crashes the snapcraft. The correct one should be:

    source: git://github.com/liu-xiao-guo/webcamserv

Revision history for this message
Sergio Schvezov (sergiusens) wrote :

this is already fixed?

Changed in snapcraft:
status: New → Invalid
status: Invalid → Fix Committed
Revision history for this message
XiaoGuo, Liu (liu-xiao-guo) wrote :

Hi Sergio,

I just checked it, and the problem still existed. My test project is like:

name: go-webserver
vendor: XiaoGuo, Liu <email address hidden>
icon: go.png
version: 1.0.7
summary: Go webserver
description: This is a simple go webserver. It is a service

services:
  webserver:
    description: "Go websever"
    start: bin/golang-http
    caps:
     - network-client
     - network-service

parts:
  webserver:
    plugin: go
    source: github.com/liu-xiao-guo/golang-http

liuxg@liuxg:~/snappy/examples/go-webserver$ snapcraft
Traceback (most recent call last):
  File "/usr/bin/snapcraft", line 33, in <module>
    snapcraft.main.main()
  File "/usr/lib/python3/dist-packages/snapcraft/main.py", line 147, in main
    args.func(args)
  File "/usr/lib/python3/dist-packages/snapcraft/cmds.py", line 103, in assemble
    snap(args)
  File "/usr/lib/python3/dist-packages/snapcraft/cmds.py", line 85, in snap
    cmd(args)
  File "/usr/lib/python3/dist-packages/snapcraft/cmds.py", line 322, in cmd
    config = _load_config()
  File "/usr/lib/python3/dist-packages/snapcraft/cmds.py", line 387, in _load_config
    _config = snapcraft.yaml.Config()
  File "/usr/lib/python3/dist-packages/snapcraft/yaml.py", line 139, in __init__
    self.load_plugin(part_name, plugin_name, properties)
  File "/usr/lib/python3/dist-packages/snapcraft/yaml.py", line 192, in load_plugin
    part_name, plugin_name, properties)
  File "/usr/lib/python3/dist-packages/snapcraft/lifecycle.py", line 274, in load_plugin
    return PluginHandler(plugin_name, part_name, properties)
  File "/usr/lib/python3/dist-packages/snapcraft/lifecycle.py", line 65, in __init__
    self._load_code(plugin_name, properties)
  File "/usr/lib/python3/dist-packages/snapcraft/lifecycle.py", line 92, in _load_code
    self.code = plugin(self.name, options)
  File "/usr/lib/python3/dist-packages/snapcraft/plugins/go.py", line 56, in __init__
    self.fullname = self.options.source.split("://")[1]
IndexError: list index out of range
liuxg@liuxg:~/snappy/examples/go-webserver$ sudo apt-get install snapcraft
Reading package lists... Done
Building dependency tree
Reading state information... Done
snapcraft is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
liuxg@liuxg:~/snappy/examples/go-webserver$ dpkg-query -W snapcraft
snapcraft 0.4

Revision history for this message
XiaoGuo, Liu (liu-xiao-guo) wrote :

Yes, it is resolved after I have used the 0.5 version from your master repository at:

https://github.com/ubuntu-core/snapcraft

No, the error becomes:

liuxg@liuxg:~/snappy/examples/go-webserver$ snapcraft
Pulling webserver
Failed doing pull for webserver: local source is not a directory

It does not crash any more.

Thanks!

Changed in snapcraft:
importance: Undecided → Medium
assignee: nobody → Sergio Schvezov (sergiusens)
milestone: none → 0.5
Revision history for this message
Leo Arias (elopio) wrote :

I confirm that it no longer crashes, and the error message is good.
I think this will continue to cause issues, because it's easy to miss that you have to add git:// to the source. But there's no easy way to tell if github.com/liu-xiao-guo/webcamserv is supposed to be a local directory, or pulled from github. Maybe we can try to find it locally, and if it fails, try to download it, but this might also cause unexpected results if it was done by mistake. I'm happy leaving it for now, and we can see if we get more people complaining about go sources.

Changed in snapcraft:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.