Snapcraft is pulling content snap before building a snap

snapcraft both in stable and edge channel is pulling content snap described in plugs of app’s snapcraft before building the snap package of app.

This is very annoying and i don’t know what is the use of such behavior. Content snaps are usually used to package runtime libs and other things required by app. I dont know why they are required by snapcraft before building the .snap file of app.

my app’s snapcraft.yaml

Command i used to build app snap. I used --destructive cause i don’t need build it inside a VM since i don’t want snapcraft to figure out library/dependency resolution, since libs and runtime is built in VM and have all required components.

snapcraft --destructive-mode
will install content snap described in plugs of app snapcraft.yaml (why?)

same happen with
snapcraft command, imagine you have to build your app snap manytime in VM on local machine, and snapcraft downloading installing content snap (which is huge in size) as many time you do a clean build of your snap.
The process which was supposed to take 1 minute is taking 30+minutes and depends on speed of users connection.

I tried remote-build and saw that there also snapcraft downloads content snaps described in plugs inside snapcraft.yaml file. Am attaching the log:

snapcraft 3.10.2 from Canonical* installed
/usr/lib/python2.7/dist-packages/pylxd/ UserWarning: Attempted to set unknown attribute "description" on instance of "Container"
  key, self.__class__.__name__
Running repo phase...
Cloning into 'snapcraft-red-app-fc0966'...
[28/Mar/2020:17:09:39 +0000] "CONNECT HTTP/1.1" 200 2288475 "-" "git/2.17.1"
Running pull phase...
snapd is not logged in, snap install commands will use sudo
qt513 5.13 from keshavbhatt (keshavnrj) installed
snapd is not logged in, snap install commands will use sudo
gtk-common-themes 0.1-29-g45e78c5 from Canonical* installed

Why snapcraft need to install qt513 (240Mb) and gtk-common-themes snap to build snap of an app which require these content snaps at runtime and not while building,

Can someone from snapcraft development team explain why we need install content snap to build a snap ? I would like to discus my usecase and share how it is irrelevant.

Developer who are making use of content snaps know that their content snap contain all libs required, hence they just make app snap (which just contains app executable, app icon and desktop file) and describe content snap in plug of their multiple apps.

Now they build multiple app snaps and snacraft right now downlaoding and installing content snaps in VM as many time developer want snap his app. This behaviour is time taking and consuming resources. snapcraft or any packaging tool should not be developed in a way where they are doing things by their own, they are intended to do stuffs which are instructed by packager.
If there is need to have this kind of behaviour where you forcibly doing things there must be an opt out.

If I’m not mistaken, snapcraft does this to analyze if there are duplicated libraries between the app snap and the content snap.

I understand and know that there are no stage package in my app snap yaml.

How about passing a flag to bypass this in the command.

That would be a question for snapcraft devs such as @cjp256 or @sergiusens

1 Like

I think it would quite reasonable to have a flag to allow you to opt out of that check. @sergiusens, what do you think?

1 Like

Upon discussion, @sergiusens and @popey seemed to agree an opt-out check will be fine.

I don’t know when I’ll get to it, but I added a ticket in launchpad:

1 Like

I have a bug opened regarding the same on lp.

This behaviour of snapcraft also responsible for another bug i repoted here : also look at it.

I thank for making a feature request fox adding an opt-out flag. This is much needed feature for cases like i described above.

1 Like