Debuild to fpm

jordansissel edited this page Apr 18, 2011 · 3 revisions

I used to build debian packages with a one-two punch combination of "dh_make" and "debuild".

I didn't bother creating debian/ directories by hand, with control files and other madness. The 'dh_make' tool does this for me.

So I would go about my day, doing dh_make, using sed to inject dependency info, and then running debuild.

Using dh_make straight up kind of sucks. It generates a debian/control file that will result in all of the following things I do not necessarily want of all of my packages:

  • python mangling
  • stripping binaries and libraries of debug symbols (autostrip is very annoying)
  • random file movement
  • warnings about things not being in the right place

Here is the actual diff of one project at Loggly being converted from this dh_make+debuild process to using fpm:

Index: Makefile
--- Makefile    (revision 38)
+++ Makefile    (revision 42)
@@ -19,14 +19,5 @@

 .PHONY: deb
-       rm -r debian || true
-       dh_make -s -n -c blank -e "build <>" -p "$(NAME)_$(VERSION)" < /dev/null
-       $(MAKE) patch
-       debuild -uc -us -b
-       #debsigs --sign=origin $$(ls -t ../*.deb| head -1)
-.PHONY: patch
-       sed -i -e "s/^Build-Depends:.*/&, $(BUILDDEPS)/" $(SOURCEDIR)/debian/control
-       sed -i -e "s/^Depends:.*/&, $(RUNDEPS)/" $(SOURCEDIR)/debian/control
+       fpm -s dir -t deb -n $(NAME) -v $(VERSION) -d "nodejs (>= 0)" -a all \
+         --prefix $(INSTALLDIR) --exclude .svn -C src $(SOURCEDIR)

Lots of benefits here. The above fpm invocation is great for java apps, rails apps, etc - anything where you might normally deploy a plain directory (anything capistrano deploys, etc).