Comment 2 for bug 1575628

Revision history for this message
Kyle Fazzari (kyrofa) wrote : Re: "copy" plugin symlinks whole snap folder when no source is given

> I fail to see a real use case for copying the whole project folder to the build folder, apart for some very minimalistic projects which don't use a src folder, so even if snaps end up being blacklisted, the whole recursively copying the top folder bugs me as an approach.

It's not recursive since the copying doesn't include the parts/ dir. The reason the copy occurs (this is for all plugins with the `source` keyword) is to avoid dirtying the provided source. For example, take autotools, where ./configure and make/make install are run in the source. Snapcraft shouldn't dirty up the actual source, so it creates a copy of it. You'll notice the cmake plugin works differently since an out-of-source build is normal there.

> Since "source" is used in more than just the copy plugin, there may be problems with changing the approach, so maybe it's simply a documentation (or user :P) issue.

Indeed, as I mentioned, most plugins work this way. The workaround is to give the plugin a better `source` key, e.g.:

    delay-on-failure:
        plugin: copy
        source: src/delay-on-failure
        files:
            delay-on-failure: bin/

This will cause only src/delay-on-failure to be copied into the build directory.

It sounds like the real issue here is that built snaps get copied if plugins have `source: '.'` (which is the default for the copy plugin). Perhaps this bug should be updated to reflect, and make a case for excluding those in some way?