Parts injected by multiple apps with same extensions

The fact that the extensions attribute is on individual apps results in extension overlap.

Consider the following example (example names all around obviously)

apps:
    allo:
        command: launch allo
        extensions: [launcher]
    pronto:
        command: launch pronto
        extensions: [launcher]

This should be perfectly reasonable to write. I have two apps, both rely on the launcher extension to work.

LauncherExtension may create a part which organizes launch into place. Which is why the apps need the extension.

What will happen when you snapcraft that is:

Failed to apply extension 'launcher': this extension adds a part named 'launchpart', but a part by that name already exists.
Rename the 'launchpart' part to something else and try again.   

This seems to be caused by the fact that foreach app the extension is applied. However, parts is not a per-app affair, so applying the extension twice will attempt to inject the same parts twice and thus result in the conflict.

What I think should happen is that the extension.parts must only be applied once even when the same extension is used more than once?

Same with extension.part_snippet I suppose.

1 Like

Sorry for the delay @sitter. I agree that such a use-case is perfectly reasonable, and we actually have a test case covering exactly that. We actually used to have that problem though, any chance your master is significantly out of date?

Ah! Nevermind me then, I am currently poking around on whatever version is in 18.04, which apparently doesn’t have the fix.

1 Like

Ah, yeah that sounds about right. If you’re actually hacking on snapcraft, I suggest installing it in a virtualenv, it’ll be much easier (and you’ll have all the fixes… and breakages :wink:).