Skip to content
Pablo Estigarribia edited this page Apr 4, 2016 · 1 revision

Ubuntu PPA Packaging

Brief information

I have some plans to test burp2 as server with protocol one (clients running burp1 in this case). Burp compiling is ver easy, Graham and collaborators have made an excelent README.md on the sources available at github. But I prefer to have packages instead of installing dependencies for compiling the software on each server, with packages it's also easier to maintain (remove, upgrade). Because there is no ppa with burp2. In this case I have been looking for some way to create a deb package for Ubuntu trusty (the version actually I use for servers). I had to spent more time than expected, ofcourse with no previous experience packaging it maybe had to be expected (something around 5hs to have everything clear and working).I had to look over many documentation, so I'm creating a ppa and and also documenting what I got in this experience today. My goal with this document is to help others in creating their own packages, and also invite some others to write similar guide for other distributions (Redhat, opensuse, etc).

It could need some more tunning...

Authors here:

  • Pablo Estigarribia (pablodav at gmail)

Clone repository

 git clone git://github.com/grke/burp.git
 git checkout 2.0.36  # Example to move to some tag 

Install Dependencies for burp and packaging deb

 sudo apt-get install make pkg-config check g++ librsync-dev libz-dev libssl-dev uthash-dev libyajl-dev
 sudo apt-get install autoconf automake libtool
 sudo apt-get install build-essential fakeroot devscripts
 sudo apt-get install packaging-dev

Activating/prepare ppa (not required if you not use ppa)

Follow some steps: https://help.launchpad.net/Packaging/PPA?action=show&redirect=PPA

Resume:

Generate the gpg key and ssh-key to activate uploads to ppa

gpg --gen-key
ssh-keygen

Read the information required

cat ~/.ssh/id_rsa.pub

gpg --fingerprint [email protected]

Add the keys to required profile

Upload your key:

gpg --keyserver keyserver.ubuntu.com --send-keys NNNNNNNN

Add to your profile:

https://launchpad.net/~username/+editpgpkeys https://launchpad.net/~username/+editsshkeys

Configure bzr (bazaar) with your name and login:

bzr whoami "Name Lastname <[email protected]>"
bzr launchpad-login username

Prepare some environment variables to start packaging

Edit your ~/.bashrc

export DEBFULLNAME="Name Lastname"
export DEBEMAIL="[email protected]"

Preparing the sources for packaging

Add new debian/changelog information

dch -n

Ensure debian/rules has these lines:

override_dh_install:
        $(MAKE) DESTDIR=$$(pwd)/debian/burp install
        $(MAKE) DESTDIR=$$(pwd)/debian/burp install-configs

$(MAKE) DESTDIR=$$(pwd)/debian/burp install-configs is important for burp2 because it is the way to build the .conf files in /etc/burp, this was the thing that made me expent more time than anything else, as I got errors because the configuration files where missing on the firsts packages tried.

If you want to build without conf files, you should remove references to the files in debian/rules and debian/burp.lintian-overrides

I had to change debian/control sources to ensure it will work always

Build-Depends: debhelper (>= 9), autotools-dev, libncurses5-dev, libssl-dev, zlib1g-dev, librsync-dev, libacl1-dev, libattr1-dev, uthash-dev, openssl, libyajl-dev, pkg-config, check, g++, libz-dev, make, autoconf, automake, libtool, dh-autoreconf

For this line autoreconf -vif, I have added the following dh_auto_configure to debian/rules in my package

DH_VERBOSE=1
#Add build flags
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

export DH_VERBOSE=1

%:
dh $@ --with autoreconf,autotools-dev

override_dh_auto_configure:
dh_testdir
dh_auto_configure -- --prefix="/usr" --sysconfdir=/etc/burp  --sbindir=\$${prefix}/sbin --mandir=\$${prefix}/share/man --localstatedir=/var CFLAGS="$(CFLAGS)" LDFLAGS="$(LDFLAGS)"  CPPFLAGS="$(CPPFLAGS)" 

I will try to upload all these changes to main repository of burp, so burp will be ready to compile on ubuntu later.

Same configuration should work for debian

Prepare the source to build-deb for ppa

Compress the source:

tar czf burp-2.0.36.tar.gz burp

Build new this with bzr ready to upload later to ppa:

bzr dh-make burp 2.0.36 burp-2.0.36.tar.gz

Build a .deb locally to test

You can use just builddeb for debian

bzr builddeb -- -us -uc

Installing to test:

sudo dpkg -i ../burp_2.0.36-0ubuntu1_amd64.deb 

Here you are ready to use this package in your servers, but you can continue reading to try to upload it to your ppa.

Build source signed and upload:

http://packaging.ubuntu.com/html/packaging-new-software.html#next-steps

bzr builddeb -- -S -sa
cd ../build-area

Pbuilder to test if it will work on ppa builder

pbuilder-dist trusty create
pbuilder-dist trusty build burp_2.0.36-0ubuntu1.dsc

Upload:

dput ppa:user/burp2-backup burp_2.0.36-0ubuntu1_source.changes

Optional:

Upload your sources to launchpad, not really necesary or recomended:

bzr push lp:~<lp-username>/+junk/hello-package

External resources

http://packaging.ubuntu.com/html/packaging-new-software.html https://help.launchpad.net/Packaging/PPA/BuildingASourcePackage https://help.launchpad.net/Packaging/PPA/Uploading https://help.launchpad.net/Packaging/UploadErrors https://wiki.debian.org/BuildingTutorial#Building_the_source_package https://wiki.debian.org/Autoreconf https://www.debian.org/doc/manuals/maint-guide/dother.en.html