Snippets and such for dh_elpa-fied emacs addon Debian package.

Quickstart:

  • apt-get install dh-make-elpa

  • man dh-make-elpa

This contains information that may prove useful in packaging an emacs addon for Debian when using the dh_elpa system and conforming to Debian elpa emacs addon policy. An attempt is made to organize the information in a fashion that facilitates copy-and-paste.

For concreteness, we imagine packaging a "hello" emacs addon package, which was previously packaged as hello-el.

This is not exhaustive. It does not include files or stanzas which are not specific to dh_elpa-ified emacs addon packages, e.g., debian/source/format or debian/changelog. Nor does it show how to generate or install an info file.

debian/* script snippets

debian/control

  • Appropriate section and priority:

    Section: editors
    Priority: extra
    
  • Indicate team maintenance:

    Maintainer: Debian Emacs addons team <pkg-emacsen-addons@lists.alioth.debian.org>
    Uploaders: Hello Packager <hellpackage@debian.org>
    
  • Declare appropriate build dependencies. Note that dh-elpa pulls in emacs. Need dh-elpa 0.0.17+ for "dh --with elpa" in debian/rules.

    Build-Depends: debhelper (>= 10), dh-elpa (>= 0.0.17)
    
  • Use an emacs addon packaging team git repo:

    Vcs-Git: https://anonscm.debian.org/git/pkg-emacsen/pkg/hello.git
    Vcs-Browser: https://anonscm.debian.org/git/pkg-emacsen/pkg/hello.git/
    

    (Unless there are good reasons to use something else, like a pre-existing collab-maint repository.)

  • Declare the actual binary package:

    Package: elpa-hello
    Architecture: all
    Depends: ${misc:Depends}, ${elpa:Depends}
    Recommends: emacs (>= 46.0)
    Enhances: emacs, emacs24, emacs25
    Breaks: hello-el (<< 1.0)
    Provides: hello-el
    Description: Emacs addon to say hello
     The Emacs editor addon likes to wave and say hello.
    
    Package: hello-el
    Architecture: all
    Depends: ${misc:Depends}, elpa-hello
    Description: Transition Package, hello-el to elpa-hello
     The hello emacs addon has been elpafied.  This dummy package
     helps ease transition from hello-el to elpa-hello.
    

    The transition package only included if there the addon was previously packaged under a different name, in this case hello-el.

    You should build a binary package for each ELPA package included in the upstream source repo. See below.

debian/hello-el.maintscript

  rm_conffile /etc/emacs/site-start.d/50hello-el.el

Only included if you have a hello-el transitional binary package.

debian/compat

  • Version of debhelper to use:

    10
    

    (Yes, this and the build dependency together violate various basic principles of software engineering.)

debian/rules

  • Standard boilerplate:

    \#!/usr/bin/make -f
    
    %:
            dh $@ --with elpa
    

debian/*.elpa

  • You should include a .elpa file for each elpa-* binary package your source package builds.

  • For our hello.el example, you just need elpa-hello.elpa:

    *.el
    
  • For upstream source repos that contain more than one ELPA package, first identify the root ELPA packages---generally the .el files that contains a Package-Requires line. Then list the *.el files associated with each one. For example, for magit, we would have

    git-commit.elpa:

    lisp/git-commit.el
    

    with-editor.elpa:

    lisp/with-editor.el
    

    git-rebase.elpa:

    lisp/git-rebase.el
    

    magit.elpa:

    lisp/magit.el
    lisp/magit-*.el
    

    To help in figuring this out you can look at the MELPA recipes for the packages where upstream should have broken down the files like this for you.

Common mistakes to avoid

dh_elpa and dh_make_elpa are designed to obviate the need for tools like Cask. Do not be misled by upstream's repository into thinking that you need to build-depend on Cask! Generally, you will want to disable Cask with rules targets like this:

override_dh_auto_build:
    /bin/true

and then configure dh_elpa_test to run the test suite anyway (which in most cases will not require any additional configuration).