loris-imageserver / loris

Loris IIIF Image Server
Other
208 stars 87 forks source link

Packaging Loris for Debian/Ubuntu #424

Open minusdavid opened 6 years ago

minusdavid commented 6 years ago

I'm currently looking at packaging Loris for Debian/Ubuntu, and I'm having some ups and downs. I've managed to build a Debian package that contains the same files as /usr/local/lib/python2.7/dist-packages/Loris-2.2.0-py2.7.egg/loris, but that's after hacking on the setup.py file a bit.

I'm not a Pythonista by nature, but I was looking at https://docs.python.org/2/distutils/setupscript.html#installing-additional-files and thinking that might solve a lot of the issues I'm having in regards to the following steps in run():

self.make_directories() self.__write_wsgi() self.copy_index_and_favicon() self.__update_and_deploy_config()

My main beef with these is that setuptools/distutils has no idea what's happening during these steps, so if you run setup.py with "--root", it doesn't help at all.

Anyway, I've already stayed 2.5 hours late at work, but I was thinking of looking at this more tomorrow. These functions aren't super complicated. The trickiest part is the configurability Loris provides, but I'll look at how to handle that. Another issue is the owner/group and mode for some of these files, although I'll look at that more too.

I actually have a lot more experience building RPMs, although I think those functions would cause the same problems there too. They need to be installing files relative to some install root so that packagers can then make decisions from within an packaging root.

minusdavid commented 6 years ago

I did some reading last night which said that "data_files" wouldn't work for putting files into places like /etc and /var, but I just added data_files to setup.py and it worked for the sake of Debian package building...

minusdavid commented 6 years ago

It's actually really interesting going through the setup.py file. I'm on an old version now (2.2.0) as that's the version that I've been working with... but there's lots of stuff that could be improved.

bcail commented 6 years ago

@minusdavid PRs welcome. :)

minusdavid commented 6 years ago

I'm thinking about it, although I can't imagine most people would like the result as it would mean a two-step installation process? It seems to me setup.py is suited for modules/libraries rather than applications, but I see the utility in just running "./setup.py install" :/.

minusdavid commented 6 years ago

Although if I did make those functions install things relative to the installation root... maybe that's the key in terms of packaging vs setup.py/pip installs...

minusdavid commented 6 years ago

Actually I wonder if that would be better for pip installs too with the --user flag...

minusdavid commented 6 years ago

I don't have time to work on this at the moment, but my work-in-progress is available at https://github.com/minusdavid/loris/tree/debian_packaging.

Basically, it adds a debian/ directory, a build.sh for building packages, and a modified setup.py which prevents the majority of the installation really beyond installation the Loris Python source code in a package build root.

I've got this building on a custom Ubuntu 16.04.03 and installing on a bare Ubuntu 16.04.03.

When installed, it seems to work, but I think there may be issues with the versions specified in debian/control.

I think the biggest issues are the setup.py and dependencies. I'd happily make a RPM spec file as well, but similar issues (and I only need Loris to run on Ubuntu for now).

minusdavid commented 6 years ago

For now, I think I'm just going to script the install of Loris using Ansible, but I really like the package idea.