debpkg
debpkg is a pure Go library to create Debian packages. It has zero dependencies to Debian. It is able to generate packages from Mac OS X, *BSD and Windows.
Features
The feature list below describes the usability state of the project:
- Create debian packages from files and folders
- Create package from
debpkg.ymlspecfile - 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.
Why this package was created
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.
Installation
go get -u github.com/xor-gate/debpkg/cmd/debpkg
Status
The package is currently in production state. The API is still unstable (v0) most rough edges are already polished but a wider audience is necessary.
debpkg.yml specfile
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: foo@bar.com
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.
Mentions
This project is sponsored by @dualinventive
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
Debugging
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
Further documentation
More information can be gathered from the Debian and Ubuntu documentation:
- dpkg manpage
- dpkg-deb manpage
- dpkg-sig manpage
- Debian New Maintainers' Guide
- Debian Policy Manual
- Setting up signed APT repository with Reprepro
- Create authenticated repository