Thursday, February 15, 2018

Packaging for PPA .deb Creation Missing Files


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
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
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



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
    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


No comments:

Post a Comment

11.10 - Can't boot from USB after installing Ubuntu

I bought a Samsung series 5 notebook and a very strange thing happened: I installed Ubuntu 11.10 from a usb pen drive but when I restarted (...