Zygmunt Krynicki <[email protected]> wrote: > On Wed, Jun 15, 2016 at 9:49 PM, Bill Janssen <[email protected]> wrote: > > > I've got a big package, multiple programs, that I assemble in one > > directory under /opt/goodstuff, using conda as the packaging system -- > > the goodstuff directory tree is a conda 'env'. It seems that this > > should be easy to re-package as a snap. However, conda does a few > > things that have to be changed, or undone, for snap: > > > > 1) It mungs shebangs; that is, a header like "#!/usr/bin/env python" > > gets changed to "#!/opt/goodstuff/bin/python". I think that would > > have to be undone; what snapcraft stage should that occur in? > > > > Hey > > Remember that your snap will most likely ship python by itself.
Right. It's already present under /opt/goodstuff/bin/, so it will get copied into the snap. > The shebang line doesn't matter because the root filesystem at the > time your snap will execute is not going to show much of the host > distribution file system. So how is a shebang in a snap script resolved? Or are shebangs not resolved? That means I'd have to gen up a whole new line of launchers for my executables. > > 2) It symlinks in some of the binaries; for example, > > /opt/goodstuff/bin/conda is a symlink to /opt/conda/bin/conda. Those > > would have to be reified (copied), perhaps in the "pull" stage? > > > > In general, you should install your snap to "anything you want" and that I'm confused; I'm talking about building the snap squashfs, not installing it. I originally thought I could just use the "copy" plug-in, but that doesn't seem to work. When I figure up my Python script (now a command under /snap/bin), I get this error: $ /snap/bin/goodstuff ImportError: No module named site $ The shebang line (in /snap/goodstuff/x1/bin/goodstuff) is not modified; it still says, "#!/opt/goodstuff/bin/python". So I think this has to be changed. > will show up under /snap/conda/current/. In this case you would have > /snap/conda/current/opt/conda/bin/conda. You should try to simplify the > structure though it matters little in practice. Do you mean that I should just copy the entire conda install? Yes, that would work, I think. However, it would probably also copy lots of other stuff that I don't want. The thing is, conda already provides a way to assemble lots of parts into an integrated environment. I'd like to re-use that capability; I've already written the conda yaml for goodstuff. > > 3) It rewrites RPATH on some platforms (OS X), but perhaps not on > > Linux, I'll have to check. That should be redone to accord with snap. > > > > This should be harmless but note that currently snapcraft has a bug when > executables use rpath. What bug is that? > It is better to strip rpath and rely on LD_LIBRARY_PATH that snapcraft > and snapd automatically arrange for you. Yes, but... I tend to use systems like JModelica which has its own ideas about who should set LD_LIBRARY_PATH and what it should be set to. > > 4) It's not a completely clean package. There are some dependencies, > > like "python-dbus", that are hard to build, and therefore installed > > via apt-get. > > > > That's okay. Right. > > > > > > > Seems to me that the way to this is with a conda plug-in for snapcraft > > that would take a conda env and package it; "copy" with fixes for conda. > > > > Any suggestions about this? What would be a good plug-in to use as a > > template? > > > You can put a custom plugin alongside your snapcraft.yaml file. You can > experiment with the make plugin since makefiles are familiar to many people > and you can use that as a way to just put files in various places and see > what happens. > > Oh and while you experiment, do use "snap try", it will be much faster than > rebuilding the snap all the time. Thanks for the tip! Bill > > Best regards > ZK > > > > > > > Bill > > > > -- > > Snapcraft mailing list > > [email protected] > > Modify settings or unsubscribe at: > > https://lists.ubuntu.com/mailman/listinfo/snapcraft > > -- Snapcraft mailing list [email protected] Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/snapcraft
