difference between stage and prime?

Didier Roche didrocks at ubuntu.com
Fri Jun 17 06:11:29 UTC 2016


Le 16/06/2016 20:32, Bill Janssen a écrit :
> I'm trying to figure out what happens in the transition from stage to
> prime.  My "stage" directory looks like a nice clean copy of my conda
> env.  Good.  But the "prime" directory has some cruft in it.  For
> instance, it has a "home/wjanssen" directory tree, which is clearly
> *not* something I want in the snap.  There's also an "opt/goodstuff/"
> tree, which contains only "opt/goodstuff/lib/libpython2.7.so.1.0".
> That's in addition to "lib/libpython2.7.so.1.0".

Hey Bill,

Kyle had a nice explanation for that on Wednesday.
Basically (from what I got), not everything is copied from stage to
prime, the copy is from parts/<part_name>/install to prime/

stage/ is used primarly when one of parts needs another one to build,
like some headers:
parts:
  foo:
    […]
  bar:
    plugins: autotools
    configflags: --use-foo-headers=$SNAPCRAFT_STAGE/usr/lib/header
    after: [foo]

That way, bar will be able to use foo.

There are some tricks with the organize
(https://developer.ubuntu.com/en/snappy/build-apps/snapcraft-syntax/)
keywords which organize stage/, but also needs to impact the install
copy to prime/, which even Kyle wasn't fully sure about. That's why I'm
CCing Sergio on that so that he can shed some lights (and we hope to be
able to improve the documentation there as well).
To filter what you ship in the finale snap, you can use the "snap"
keyword (see same url above) and use something like:
parts:
  foo:
    snap:
      - -home/wjanssen

Cheers,
Didier





More information about the Snapcraft mailing list