I’ve a problem with wanting to exclude content from packages that are pulled in transitively (because I need to get them from a content snap instead). I’m wondering if snapcraft has any tooling to assist in this?
Ideally, something like an option to “don’t stage any files from this package or dependencies”. But there’s no such thing as (by analogy with stage:):
I can list the files I don’t want explicitly in every part, but that is repetitive, high maintenance and error prone. There’s an example of this approach here:
i’d inlude graphics-core-20 as a build-snap … and then create a cleanup part using find to remove all duplicated libs by comparing with /snap/graphics-core-20/current/usr/lib/${SNAPCRAFT_ARCH_TRIPLET}
In theory, that too can break. If a new file is added to the .deb and the consumer snap rebuilds before the supplier update is published to stable then that file won’t be cleaned. OTOH that is going to be rare and,even if it happens, the spurious file unlikely to a problem.
Do you have an example of a “cleanup part”? How does it run at the right time relative to other parts and how does it detect their content?
You could also use named YAML anchors or aliases, define the set of files you want removed in one part and then have all the stage: stanzas dereference that named anchor/alias and it will expand with the contents of the named one originally.