Refactor #3640
closedRakefy this package
Description
We are doing too much in SPEC file definitions, we should start to follow traditional approach of distributing our upstream code. That means we need a tool, that is responsible to build and install the codebase to given PREFIX. More than that, we can provide target that can create pre-built tarball so building phase can be skipped by users.
In UNIX world, this tool is called GNU Make (and Autotools), but since we are Ruby project, we can leverage Rake for this task. The main goals would be:
rake build
Builds the package in-place. This can be usually generating assets, gettext packages, man pages, making all steps we usually currently do in build section in SPEC (or DEB scripts). Of course, it's up to the user to install all dependencies, but we can provide some helper targets to install ruby deps via bundler if needed.
rake install PREFIX=/usr/local
Builds and installs whole sofware to given location, including all changes that are necessary and configuration files, manual pages and everything that is needed. Software package should work from this location normally, this could quickly become supported way of installing Foreman on systems we do not package for (Arch Linux, Gentoo, Microsoft Windows etc).
rake dist
Builds the package first and creates a distribution tarball with already pre-build files so users can directly install them without being forced to install build tools. We can distribute tarball in either plain form ("before autoconf-like") or in the pre-built form ("gnu configure ready"). This is a bonus, this step would need us to setup a build infrastructure for tarballs somewhere. We do not need to distribute these pre-built tarballs at all, this refactor issue is all about moving more things into Rakefiles rather than doing them in SPEC/DEB scripts. But this is one advantage we can have later on.
Package definitions (RPM, DEB) would be then used in a traditional way of just calling rake install with PREFIX pointing to a buildroot and making only changes which are platform-dependant (e.g. changing configuration paths, SCLing stuff).
Advantages:
- no duplication between SPEC and DEB scripts
- cleaner SPEC files (SCL can make SPEC a mess)
- much better intallations from source for people on Windows and other platforms
- possibility to provide uninstallation rake task for those people
This issue is open for discussion of course, I am filing this for our foreman-installer which could be good starting point if it works.