2

So after floundering around from doc to doc I've latched onto and been following this tutorial: http://packaging.ubuntu.com/html/packaging-new-software.html

So I tried the steps in there and started running into troubles. Googling around has been largely unhelpful. I have a very standard autotools c++ project which builds a library and some executables. I wanted to make a libfoo-dev style package out of it and stick it up on a PPA.

To help show what I'm doing, I've stuck a script that does the steps proposed in the tutorial (so far as I am understanding them correctly..). Here's what I have: https://github.com/kevinkreiser/ppa-libprime-server

I have a bash script in there build.sh which has all the steps I've been doing. At first I was having trouble getting dh_* to build anything from my project until @sneetsher clued me into changing the rule file to do autoreconf. At this point my only issues are W: libprime-server0: empty-binary-package and W: prime-server-bin: empty-binary-package.

And like it says, the problem is now that a couple of my packages don't have much of anything in them:

user@pc$ lesspipe libprime-server0_0.3.2-0ubuntu1_amd64.deb 
libprime-server0_0.3.2-0ubuntu1_amd64.deb:
 neues Debian-Paket, Version 2.0.
 Größe 2004 Byte: control-Archiv= 528 Byte.
     425 Byte,    12 Zeilen      control              
     160 Byte,     2 Zeilen      md5sums              
 Package: libprime-server0
 Source: libprime-server
 Version: 0.3.2-0ubuntu1
 Architecture: amd64
 Maintainer: Kevin Kreiser <kevinkreiser@gmail.com>
 Installed-Size: 26
 Section: contrib/libs
 Priority: optional
 Homepage: https://github.com/kevinkreiser/prime_server
 Description: Service oriented distributed computing API
  A set of APIs designed around the zeromq butterfly pattern
  specifically focused on servicing http requests

*** Contents:
drwxr-xr-x root/root         0 2016-04-21 11:48 ./
drwxr-xr-x root/root         0 2016-04-21 11:48 ./usr/
drwxr-xr-x root/root         0 2016-04-21 11:48 ./usr/share/
drwxr-xr-x root/root         0 2016-04-21 11:48 ./usr/share/doc/
drwxr-xr-x root/root         0 2016-04-21 11:48 ./usr/share/doc/libprime-server0/
-rw-r--r-- root/root       167 2016-04-18 11:04 ./usr/share/doc/libprime-server0/changelog.Debian.gz
-rw-r--r-- root/root      1558 2016-04-15 09:46 ./usr/share/doc/libprime-server0/copyright

user@pc:~/sandbox/ppa-libprime-server/build$ lesspipe prime-server-bin_0.3.2-0ubuntu1_amd64.deb 
prime-server-bin_0.3.2-0ubuntu1_amd64.deb:
 neues Debian-Paket, Version 2.0.
 Größe 1994 Byte: control-Archiv= 517 Byte.
     437 Byte,    12 Zeilen      control              
     160 Byte,     2 Zeilen      md5sums              
 Package: prime-server-bin
 Source: libprime-server
 Version: 0.3.2-0ubuntu1
 Architecture: amd64
 Maintainer: Kevin Kreiser <kevinkreiser@gmail.com>
 Installed-Size: 26
 Depends: libprime-server0 (= 0.3.2-0ubuntu1)
 Section: contrib/misc
 Priority: optional
 Homepage: https://github.com/kevinkreiser/prime_server
 Description: Service oriented distributed computing executables
  A set of executables for use in running a distributed http service

*** Contents:
drwxr-xr-x root/root         0 2016-04-21 11:48 ./
drwxr-xr-x root/root         0 2016-04-21 11:48 ./usr/
drwxr-xr-x root/root         0 2016-04-21 11:48 ./usr/share/
drwxr-xr-x root/root         0 2016-04-21 11:48 ./usr/share/doc/
drwxr-xr-x root/root         0 2016-04-21 11:48 ./usr/share/doc/prime-server-bin/
-rw-r--r-- root/root       167 2016-04-18 11:04 ./usr/share/doc/prime-server-bin/changelog.Debian.gz
-rw-r--r-- root/root      1558 2016-04-15 09:46 ./usr/share/doc/prime-server-bin/copyright

The first package does work if I re-name the files back to libprime-server1.install and libprime-server1.dirs. I haven't be able to figure out what I'm doing wrong with the -bin package. bzr asks about the type of package I am making and I choose l for library should I be choosing something else?

EDIT:

The whole thing works: https://launchpad.net/~kevinkreiser/+archive/ubuntu/prime-server

With the help of @sneetsher I was able to get all of this up on a ppa and working properly in trusty! I just want to thank @sneetsher for all of the help and patience along the way. Hopefully this script can help others looking to do something similar: https://github.com/kevinkreiser/ppa-libprime-server/blob/master/build.sh

  • Is the subject project this one github.com/kevinkreiser/prime_server? – user.dz Apr 15 '16 at 20:59
  • 1
    @sneetsher yep thats the one. might there be something wrong with the way i've setup autotools that is breaking the packaging tools? – Kevin Kreiser Apr 16 '16 at 4:19
  • so i've gotten around the original issue and updated the question above to reflect that. i'm now at the point where the contents of the packages aren't quite right despite it configuring, building and testing fine – Kevin Kreiser Apr 18 '16 at 15:12
  • I tried to build it to see its installation structure, but I got a make error. submitted a report here. – user.dz Apr 19 '16 at 9:34
  • This should be fixed now, I would greatly appreciate it if you gave it another go! Thanks again for your help! – Kevin Kreiser Apr 19 '16 at 15:41
2

Well, I could test it on Ubuntu 14.04 and (with last commit) in Ubuntu 16.04.

  • As you are new to packaging, it better to enable the verbose debhelper output. Uncomment export DH_VERBOSE=1 in the rules file.

  • The package seems to depend on autoreconf not just automake/autotools. So change the rules main line to:

    %:
        #dh $@ --with autotolls-dev
        dh $@ --parallel --list-missing --with autoreconf
    

    and add dh-autoreconf to build dependencies in control file.

    So you are now longer need to pre-generate the auto build files by running ./autogen.sh manually. Keep in mind that every thing should be done through rules file, otherwise it will fail when it is built on PPA server with clean source tree.

  • One of the tests fails, I go around by skipping them. overriding the dh_auto_test. So I add this to the rules file:

    override_dh_auto_test:
        echo skip auto-test
    

    leave it later to be fixed.

  • For the empty libprime-server package, this is because it's has a wrong name.

    libprime-server in control file and libprime-server1 with 1 in others (like libprime-server1.install)

  • Yes, lintian (QA tool) raises that warning because it expect to be the major version of the package. Yes, it should be ok to rename it to libprime-server0. There is only one note, you have to clean up the build tree from the previous build. So delete debian/libprime-server1 folder & try rebuild again.

    You can add as many packages as you want, see updated files below.

  • Yes, dependencies should include the binary package, libprime-server0. The source package libprime-server it is not a dependency on any.

  • I wasn't using your script to build, I was using another manual work-flow (Download original zip archive, extract it, add debian folder, build using debuild). I couldn't reproduce same issue as that one of empty binary packages.

    I could reproduce it with build.sh. The problem, you have changed the full debian/:

    rm -rf libprime-server/debian
    cp -rp ../debian libprime-server
    

    but committed only one file

    bzr add debian/source/format
    

    to fix it, commit the whole folder:

    bzr add debian
    

    bzr builddeb seems to use only the commit/tag (with Debian label) files, not the current working tree.

Here are the files I have changed:

  1. debian/rules

    #!/usr/bin/make -f
    # -*- makefile -*-
    
    # Uncomment this to turn on verbose mode.
    export DH_VERBOSE=1
    
    %:
        #dh $@  --with autotools-dev
        dh $@ --parallel --list-missing --with autoreconf
    
    override_dh_auto_test:
        echo skip auto-test
    
  2. debian/control

    Source: libprime-server
    Priority: optional
    Maintainer: Kevin Kreiser <kevinkreiser@gmail.com>
    Build-Depends: debhelper (>= 9), autotools-dev, dh-autoreconf, libcurl4-openssl-dev, libzmq3-dev
    Standards-Version: 3.9.5
    Section: libs
    Homepage: https://github.com/kevinkreiser/prime_server
    Vcs-Git: git://github.com/kevinkreiser/prime_server.git
    
    Package: libprime-server-dev
    Section: contrib/libdevel
    Architecture: any
    Depends: libprime-server0 (= ${binary:Version}), ${misc:Depends}
    Description: Service oriented distributed computing API
     A set of APIs designed around the zeromq butterfly pattern
     specifically focused on servicing http requests
    
    Package: libprime-server0
    Section: contrib/libs
    Architecture: any
    Depends: ${shlibs:Depends}, ${misc:Depends}
    Description: Service oriented distributed computing API
     A set of APIs designed around the zeromq butterfly pattern
     specifically focused on servicing http requests
    
    Package: prime-server-bin
    Section: contrib/misc
    Architecture: any
    Depends: libprime-server0 (= ${binary:Version}), ${misc:Depends}
    Description: Service oriented distributed computing API
     A set of APIs designed around the zeromq butterfly pattern
     specifically focused on servicing http requests
    
  3. libprime-server1.install is renamed to libprime-server0.install

  4. libprime-server1.dir is renamed to libprime-server0.dir

  5. Create prime-server-bin.dirs

    usr/bin
    
  6. Create prime-server-bin.install

    usr/bin/*
    
  7. build.sh

    #!/bin/bash
    
    set -e
    
    rm -rf build
    mkdir build
    pushd build
    
    #get prime_server software
    #sudo apt-get install autoconf automake libtool make gcc-4.9 g++-4.9 lcov
    sudo apt-get install libcurl4-openssl-dev libzmq3-dev
    git clone --branch 0.3.2 --recursive  https://github.com/kevinkreiser/prime_server.git
    tar pczf prime_server.tar.gz prime_server
    rm -rf prime_server
    
    #start building the package
    sudo apt-get install dh-make dh-autoreconf bzr-builddeb
    bzr dh-make libprime-server 0.3.2 prime_server.tar.gz
    rm -rf libprime-server/debian
    cp -rp ../debian libprime-server
    pushd libprime-server
    bzr add debian
    bzr commit -m "Initial commit of Debian packaging."
    bzr builddeb -- -us -uc
    #TODO: sign the package
    popd
    
    #TODO: push the package to the ppa
    
    #TODO: make an ITP for inclusion in mainline
    
    popd
    
  • 1
    what determins the package name? lintian complains that it doesnt match the soname (because its libprime_server.so.0.0.0) and suggests that i name the package libprime-server0 but doing this in the control file and renaming the .dirs and .install files create empty packages again. also i am building some executables, can i add a package to the control file like prime-server-bin and get those to land in there? – Kevin Kreiser Apr 20 '16 at 11:56
  • 1
    ive pushed up the updates you suggested and they work great to build the library packages! i was wondering though, when we say in the dev package that it depends on the nondev package, should it refer to the nondev package via its package name. in other words should the depends line in the dev package be libprime-server1 instead of libprime-server: ? if its the package name that its referring to then it seems like it should right? – Kevin Kreiser Apr 20 '16 at 12:20
  • 1
    @KevinKreiser, updated the answer to cover that too. I have only one thing that may be an issue as I'm not sure if Launchpad supports Git submodules. Try it and let me know. – user.dz Apr 20 '16 at 12:53
  • 1
    @KevinKreiser, I copied your last debian folder as it is and works fine, libprime-server0 is not empty, it contains the .so lib. for section, I was wrong, updated answer and here full list of available sections: debian.org/doc/debian-policy/ch-archive.html#s-subsections – user.dz Apr 21 '16 at 14:32
  • 1
    @KevinKreiser, I've updated the answer, problem was with build.sh script. – user.dz Apr 22 '16 at 11:25

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.