From dist.ini to .deb in one go =============================== :author: Axel Beckert :backend: slidy :data-uri: https://noone.org/talks/pkg-perl/ :max-width: 94% :icons: Maintaining Debian Packages of Your Own Dist::Zilla based Perl Modules ---------------------------------------------------------------------- Typical VCS-Workflow for Building .deb Packages from Your Own Perl Module ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 1. Build CPAN tar-ball from `master` branch with `dzil build` 2. Switch to the `upstream` branch 3. Import the contents of the tar-ball destined for CPAN into VCS 4. Merge the `upstream` branch into the `debian` branch 5. Update packaging (`debian/changelog`, etc.) 6. Build `.deb` package What we want ~~~~~~~~~~~~ * Building the `.deb` directly from a VCS checkout * Skip manual tar-ball generation and reimport * Don't commit generated files to VCS dh-dist-zilla ------------- Obstacles ~~~~~~~~~ * `dh-make-perl` (for bootstrapping the Debian packaging) needs CPAN meta data. ** Solution: Run `dh-make-perl` once manually inside the `dzil`-generated build directory, copy `debian/` subdirectory back into the project root directory. * debhelper (`dh`) only knows about `Build.PL` and `Makefile.PL`, not about `dist.ini` Debhelper Sequence Modification ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ * Generate build directory before debhelper looks for the existing of `Build.PL` or `Makefile.PL`. ** Call `dzil build` before `dh_auto_configure` ** Ignore generated tar ball * Build package inside the generated build directory ** Pass build directory option `-D` to `dh_auto_configure`, `dh_auto_build`, `dh_auto_test` and `dh_auto_install`. * Easy cleanup: Just delete the build directory. ** Call `dzil clean` before `dh_auto_clean`. How do I use dh-dist-zilla in my Debian package? ------------------------------------------------ It's as simple as this `debian/rules` file: #!/usr/bin/make -f %: dh $@ --with dist-zilla Additionally, a build-dependency on `dh-dist-zilla` is needed. Untypical Workflow ~~~~~~~~~~~~~~~~~~ Expected / Traditional: * VCS → `dzil build` → CPAN tar-ball ∈ Debian Source Package → Debian Binary Package dh-dist-zilla: * VCS → `dzil build` → CPAN tar-ball * VCS = Debian Source Package → Debian Binary Package Links ----- Slides ~~~~~~ - https://noone.org/talks/pkg-perl/ - Contact: ** Axel Beckert ** Elmar Heeb Tools ~~~~~ - dh-dist-zilla: https://github.com/elmar/dh-dist-zilla ** Available in Debian Testing - debhelper: http://joeyh.name/code/debhelper/ - Dist::Zilla: http://dzil.org/ - dh-make-perl: https://metacpan.org/release/DhMakePerl Examples ~~~~~~~~ - Run::Parts: https://github.com/xtaran/run-parts - Bio-Roary: https://anonscm.debian.org/cgit/debian-med/roary.git/tree/debian/rules