Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Packaging Go 1.5 applications for Debian-like systems

The original question, Packaging Go application for Debian, was asked over three years ago, when Go was statically linking executables.

Now, with the new Go 1.5 Release, whose release note says,

Changes to the linker enable distributing Go packages as shared libraries to link into Go programs, and building Go packages into archives or shared libraries that may be linked into or loaded by C programs

I headed to Debian GoPackaging wiki, but only to find out that it has not been updated to Go 1.5 yet, maybe the wiki is not maintained, or maybe not, but,

I just want to know, if I want to package a tool that depends on nothing but the official Go packages, how should I take advantage of the shared libraries, instead of building my app into a humongous statically linked executable?

I know the official answer may take some time, but I can wait.

Thanks to Braiam's answer, I moved a bit further.

  • I followed the blog to the step head -100 debian/**/*, but my output is completely different from the blog's. Mine is just the following. Anyone knows why and how to fix?

    $ head -100 debian/**/*
    3.0 (quilt)
    
  • I tried to run gbp buildpackage --git-pbuilder but bumped into error:

    gbp:info: Building with (cowbuilder) for sid
    Base directory /var/cache/pbuilder/base.cow does not exist
    gbp:error: 'git-pbuilder' failed: it exited with 1
    
  • I checked and verified that I already have cowbuilder & pbuilder installed:

    ii cowbuilder  amd64 pbuilder running on cowdancer
    ii pbuilder  all personal package builder for Debian packages
    

What's wrong? This pbuilder thing is new to me as I build Debian/Ubuntu Package with Docker.

like image 826
xpt Avatar asked Aug 23 '15 21:08

xpt


People also ask

What packages does Debian use?

There were different package managers used in Debian 11 to install packages like apt, snap, gdebi, aptitude, and dpkg, some of them are by default in Debian and others have to be installed.

How does deb package work?

A Debian package contains metadata and files. The metadata contains the package name, description, a list of dependencies, and more. The files are extracted into the filesystem root (/), so the file paths in a package are absolute paths.

What is Dh_make?

dh_make is a tool to convert a regular source code package into one formatted according to the requirements of the Debian Policy. dh_make must be invoked within a directory containing the source code, which must be named <packagename>-<version>. The <packagename> must be all lowercase, digits and dashes.


1 Answers

The easiest method is to use dh-make-golang and verify/correct the autogenerated files. Otherwise you must follow Debian Packaging Guide and create debian/* directory and editing the control and rules file to match the examples.

like image 105
Braiam Avatar answered Sep 28 '22 18:09

Braiam