Things that help:
http://fedoraproject.org/wiki/How_to_create_an_RPM_package
https://wiki.debian.org/IntroDebianPackaging
http://guide.macports.org/chunked/development.creating-portf...
Things that help:
http://fedoraproject.org/wiki/How_to_create_an_RPM_package
https://wiki.debian.org/IntroDebianPackaging
http://guide.macports.org/chunked/development.creating-portf...
With debhelper v9, and it's lovely sequencer things are a lot easier. The once-so-arcane debian/rules is now only a few lines, and as long as you set DH_VERBOSE=1, you can see exactly which internal helper gets called at any point of the packaging run. If you need to override a step, simply define "override_dh_auto_FOO" target and that's it.
There's less boilerplate, and thus the packaging will be quite a bit easier to adapt to official Debian standards. So it will be (hopefully) less work for an official NM/DD to adapt your simple rules and get the package into a shape where it could be uploaded to experimental or unstable.
Back in my previous life I actually wrote two or three instruction sets for random developers on how to get their software into a working debian package. And then, when the customer project manager wanted to try his hand at coding too, I came up with a bunch of reductionist scripts and templates that allowed to automatically generate a sensible debian/* hierarchy. (That effort was later taken over by developers more capable than me - and made into a proper QtCreator plugin. That thing has supported "easy debian package" system for a couple of years now...)
I still can't produce packages that would pass the extremely high bar Debian sets for their packaging standards, but I sure can put together a packaging that works and is relatively easy to polish.
Debian is much harder to get right, though I do have more experience maintaining Fedora systems. The Debian packaging process seems an order of magnitude more difficult to get right, mainly because of the magic documented in various scattered documents and the many different build systems. I've yet to find a good document explaining how all this stuff interacts with each other. rpmbuild is much more conceptually easy to understand for me.
You also have more boilerplate documents (e.g. copyright), that Fedora doesn't care about. Fedora also has a nice system where you can get builds done on a server with various architectures and for different releases.
You have a number of PatchXX definitions, and then in %prep stage you do %patchXX -p N.
Compare with debian: you have debian/source/format which tells which patch format is expected. The old (and ugly) dpatch? Quilt? Native? Change the source format from one version to another and you need to respin the patch set too.
Whereas for rpm you simply do a "git format-patch -o $patchdir ..." and then copy-paste the patch sequence into the specfile. I've done both. I can also see the different benefits between the two systems. Debian's requirement to have debian/changelog name to match the upstream source name is a recurring hurdle. I still occasionally forget to get it right on the first go.
Then there's the split between build rules and package descriptions (debian/control vs. debian/rules). For rpm all of these are in the same file.
But then you get into packaging maintainability... After all the overengineering that you feel in debian packaging, updating it evevn across bigger upstream jumps is actually easier. When upstream changes things in a big way, catching up in the specfile takes quite a bit more work.
I learned this the hard way with Qt5.
The system saves on boilerplate, but it doesn't provide new abstractions for the packaging process. So you still have to know what is actually going on, and that's harder to discover when it's being done magically behind the scenes than when it's done by boilerplate in the rules file. So it's easier for experts now, but hard for novices to get beyond the most trivial cases.
Of course, the impression that it's difficult is reinforced by Debian's extremely strict standards for accepting packages.
That's what DH_VERBOSE=1 is for. Export that at the beginning on debian/rules and then do the usual "dpkg-buildpackage -rfakeroot -us -uc" dance.
You will see every dh_* command being executed. If it produced any output, you'll see that too. Most of them are no-ops for small project anyway.
For example: the build output will have "dh_configure", which under the hood calls ./configure with the stock debian flags. Your project doesn't use autoconf? Put this in the rules file:
override_dh_auto_configure: echo "Skipping configure"
Same for dh_test, or any other bit. The funky bit is that if your package needs some special treatment, you can cheat fairly easily. Just hijack a logically suitable no-op step and put the manual tweaks into the override. The verbose output shows you exactly which steps do nothing in your project. :)
I saw a comment on a feature request in FPM by Jordan Sissel: "I'd think about implementing it, but there's so much silly ceremony around .deb packaging" (paraphrased). 'Silly ceremony' stuck with me. I'm sure it makes sense once you know, but there's a steep learning curve.
To create a package you write a single PKGBUILD file with a few required fields (like pkgname, pkgver, etc) and a bash build script - that's it. Then you run "makepkg" and it's done.
Take a look for yourself. This is a build script for tmux:
https://projects.archlinux.org/svntogit/community.git/tree/t...
If you know of an app which isn't available for Arch yet, I welcome you to give it a try and build a package. It's really easy.
And for completeness - the package guidelines for Archlinux:
https://wiki.archlinux.org/index.php/Arch_Packaging_Standard...
To help convince folks on the value of packages, you could try pointing them toward Michael Stahnke's presentation "The Balance of Packaging vs. Puppet Manifests":
I don't know about clouds, but packages are fully DevOps.
You can tell them i said that.
I'm always wary of installing packages not provided by my distribution, just because I have more faith that my distribution's packagers know how to package and they are more likely to use QA processes that will catch packaging bugs. I'd rather compile from source than install third-party packages; I can make my own rudimentary package that would be woefully inadequate for general use but that is perfectly sufficient for my needs.
I get where you're coming from - there's some apps that want to redefine how packaging or your OS works - but I think it's easier for software devs to learn things like the FHS and packaging than it is for distro maintainers to judge whether an arbitrary piece of software works on not.
+1 making your own packages though. More people should do that - if you're smart enough to compile from source, you can easily make an RPM or Dpkg.
The goal of packaging your own software shouldn't be to spin up a public repository of your own, but to get it into distribution repositories. You don't need to be an expert to make decent packages, nor do you have to toil on your own for perfection. Just have something to show for yourself when you get the package reviewed by the distribution maintainers.
My take is that any package is better than no package. At least then there's something for a sysadmin, distributor, or other ops person to work with, and it shows that you actively want your software to be packaged.
You're the expert on your program and what it needs to work, knowing what the dependencies are, etc - inject that knowledge into the spec/port file and then whatever upstream packager will have even more to work from.
> I can make my own rudimentary package that would be woefully inadequate for general use but that is perfectly sufficient for my needs.
Why not make that and share it? Having the rudiments around as a starting point to fix and improve is almost always better than having nothing.
Think of making packages as a collaboration, rather than something that someone else has to do for you.
I suppose it is fair enough that you would want to install third party packages from source but with most package managers I would guess you could download the package and look at how it is built or at least what files it contains. Using packages can make cleaning up a bad package easier.
Some of the problems you'll face when packaging random code:
* non-standard version numbers
* non-standard file paths
* non-standard configure/make/install routines (or none at all)
* custom or non-standard build/install tools
* lack of build/configure/install documentation
* lack of dependency documentation (including what versions of what dependencies might conflict)
* code that isn't portable past the desktop the developer wrote it on
* lack of best practices in setting up multi-user permissions
* lack of pre/post install scripts
* lack of simple init scripts
* lack of minimal configuration files
* lack of pidfile, log rotation, crontab, environment, and other necessary ops functions
* patching code just to get them to build and install on your distro
* bundled, highly patched, third-party software (!!!)
Learning to make packages is easy, but what's even easier is leaving your source in a state that's convenient for packagers of all distros to put it together with little or no effort. Here's some suggestions on how to do this:1. Make sure your code is portable. Please, try not to hardcode things; use a 'configure'-type process to allow someone to override things like file paths, usernames, and other variable data. Test it on multiple architectures or distributions to see what kind of dependencies you might need to document.
2. PLEASE use a standard configure/make/make install method for your language, and don't write one yourself or depend on some backwards antiquated build tool that nobody uses. Interpreted languages often have their own standard, and compiled languages often use autoconf/automake. Learn them and use them, or at the very least, make an incredibly basic Makefile. And please document the expected permissions and users (chowns/chgrps/chmods).
3. Make sure that you can run one command for each of the configure/make/make install steps. Make sure it can be passed options or environment variables to change the root directory to install into. Make sure your install procedure puts them all in Filesystem Hierarchy Standard paths. Make sure it works as a non-root user; the packager will add the permissions and ownership as metadata to the package.
4. Provide working samples of all the things your app will need. Crontabs, log rotation, pid file tracking for daemons, configuration files, documentation, init scripts, preinstall/postinstall/uninstall scripts.
5. For the love of god, use standard version numbers. Either X.XXXX, X.XX.XX, or X.X.X.X. Pick one and stick with it. Otherwise different distros might actually use different version schemes for their packages which confuses everyone. Please don't include any non-numeric characters (fuck you, openssl! hex doesn't belong in versions!!!)
6. Fully document your ChangeLogs. A packager needs to know that your new release now requires a newer dependency or breaks ABI compatibility, because now they have to modify the metadata of the package to specify what deps will or won't work. Remember that users often install and uninstall different versions of different software.
This, a thousand times this.
A basic Makefile is always preferable to me finding a problem with your magical unicorn make system of choice (read: CMake).
Not to mention auto-generated code being extremely difficult to work with.
All companies I worked at had replaced "make" with something in-house, because make is simply horrible.
I got sick and tired of this situation and wrote a small CMake module [1] that accepts standard configure options to determine the installation path.
[1] http://bloerg.net/2013/10/29/turning-cmake-into-a-good-unix-...
set(LIBDIR lib CACHE STRING "lib dir")
install(${lib_targets} DESTINATION ${LIBDIR})
That's what I do and I am able to build packages with it just fine, that send the libs to wherever the hell they want them.On my anecdotal desktop install there are two packages that use cmake; awesome and taskwarrior.
Grep'ing the ebuilds on this Gentoo box, shows me ~400 packages out of ~16000 that use cmake(excluding KDE where it clearly is standard). A lot of the remaining ones seem to be very project specific too(70 leechcraft, 11 fcitx, 10 opensync).
Official: 547 out of 5115 use cmake.
Unofficial: 5167 out of 47069 use cmake.
A lot of these offer plain Makefiles too, but cmake is decently popular and hard to dismiss.
Autoconf/Automake are more popular so it's going to be a lot easier on packagers if developers use them. But if they use them incorrectly, packagers will have to hack on the Makefiles when they could have run a bootstrapper like autoreconf.
If you don't know automake, this tutorial is fantastic: https://www.lrde.epita.fr/~adl/autotools.html