debpkg is a pure Go library to create Debian Linux packages. The package can be directly imported in your go project or run a debpkg
cli tool with a custom debpkg YAML specfile (just like a single RPM spec file). It has zero dependencies outside go modules, to
and doesn't use exec wrappers. Therefor it is able to generate packages from non Linux systems like Mac OS X, *BSD and Windows without the Perl dependency (as with official debbuild). The "problem" with the Debian package build system is it universal and flexable nature, which can be a pro or con. Packaging just a small bunch of files with simple configuration the Debian build system is a fairly complex beast to understand. And you must dig deep into the workings of the Debian package management documentation. Debpkg is not able to resolve all the advanced packaging requirements theirfor one must use the official debbuild
and debhelper
. It is created for the simple case to convert a directory structure to be installable and maintained via the standard debian way.
The feature list below describes the usability state of the project:
- Create debian packages from files and folders
- Create package from
debpkg.yml
specfile - Add custom control files (preinst, postinst, prerm, postrm etcetera)
It is currently not possible to use the debpkg
as a framework to manipulate and introspect individual Debian package objects (see issue #26). As it is only capable of creating packages.
This package was created due to the lack to debianize from other platforms (windows/mac/*bsd). Because the whole debian package management system is glued together with Perl scripts and uses a bunch of Perl modules. Which isn't easy to use in a CI/CD pipeline for Go projects.
Converting a simple directory structure with files into a debian package is a difficult without knowing the deb
-file internals.
This package is heavily inspired by godeb and CPackDeb. It is very royal licensed.
go get -u github.com/xor-gate/debpkg/cmd/debpkg
The package is currently in production state. The API is stable (v1).
The specfile is written in the YAML markup format. It controls the package information and data.
A simple example is listed below:
# debpkg.yml specfile
name: foobar
version: 7.6.5
architecture: all
maintainer: Foo Bar
maintainer_email: [email protected]
homepage: https://github.com/xor-gate/debpkg
description:
short: This package is just a test
long: >
This package tests the working of debpkg.
And can wrap multiple
lines.
And multiple paragraphs.
This project originate from an in-company implementation sponsored by @dualinventive in 2016-2017, with help from collegue @rikvdh.
I would like to mention some other noticable projects for debian package management:
- https://github.com/Debian/dh-make-golang
- https://github.com/niemeyer/godeb
- https://github.com/smira/aptly
- https://github.com/esell/deb-simple
- https://github.com/paultag/go-debian
- https://github.com/jordansissel/fpm
- https://github.com/laher/debgo-v0.2
- https://github.com/debber/debber-v0.3
- https://github.com/laher/goxc
- https://github.com/knqyf263/go-deb-version
Other packaging tools in golang:
When debugging on a Debian system the following commands are usefull:
- Print package info:
dpkg --info <debfile>
- Extract data.tar.gz:
dpkg --extract <debfile> data
- Verbose extract data.tar.gz:
dpkg --vextract <debfile> data
- Extract control.tar.gz:
dpkg --control <debfile> control
- Show .deb file contents:
dpkg-deb dpkg-deb --contents package.deb
- Install .deb file manually without repository:
dpkg -i package.deb
More information can be gathered from the Debian and Ubuntu documentation: