UbuntuPackaging


 * 1) Ubuntu packaging (for reference only)

'''This information is provided for reference only. You should not build .debs manually. Instead use the release script described above, which will cause Jenkins to build debs.'''


 * 1) Background


 * Gazebo itself is stored in https://bitbucket.org/osrf/gazebo. That's just the code, no packaging metadata.  We make source tarballs from that repo.


 * Debian/Ubuntu packaging metadata is stored in https://bitbucket.org/osrf/gazebo-release-ubuntu. The release process involves overlaying the debian/ subdirectory from that repo on an unpacked source tarball that was made from the Gazebo repo.


 * 1) Make an Ubuntu package manually


 * 1) One-time setup

1. Determine the architecture and distro you want to build for (you can repeat this sequence once for each arch/distro pair):

DISTRO=precise # ubuntu distro to build for ARCH=amd64 # machine architecture to build for 1. Install deb-building tools:

sudo apt-get install -y pbuilder debootstrap devscripts ubuntu-dev-tools mercurial debhelper

1. Create pbuilder chroot tarball. Note that we add ROS's package repo. You should have first added the ROS key to your local keyring (e.g., `wget http://packages.ros.org/ros.key -O - | sudo apt-key add -`).

pbuilder-dist $DISTRO $ARCH create --othermirror "deb http://packages.ros.org/ros/ubuntu precise main" --keyring /etc/apt/trusted.gpg --debootstrapopts --keyring=/etc/apt/trusted.gpg

1. Install Gazebo compile-time prereqs, needed for Gazebo's cmake step to succeed (https://bitbucket.org/osrf/gazebo/issue/27/)

sudo apt-get install cmake build-essential debhelper libfreeimage-dev libprotoc-dev libprotobuf-dev protobuf-compiler freeglut3-dev libcurl4-openssl-dev libtinyxml-dev libtar-dev libtbb-dev ros-fuerte-visualization-common libxml2-dev pkg-config libqt4-dev ros-fuerte-urdfdom libltdl-dev libboost-thread-dev libboost-signals-dev libboost-system-dev libboost-filesystem-dev libboost-program-options-dev libboost-regex-dev libboost-iostreams-dev


 * 1) Making a release

1. Set some variables that we'll use throughout, e.g.:

WORKSPACE=/tmp/work # the directory in which we're working PACKAGE=gazebo # the name of the package being released VERSION=1.2.0 # the underlying version being released UBUNTU_VERSION=0ubuntu1 # the ubuntu version being released BRANCH=dev # the branch to release from DISTRO=precise # ubuntu distro to build for ARCH=amd64 # machine architecture to build for

1. Update the changelog to contain an entry for the new version:

cd $WORKSPACE hg clone https://hg@bitbucket.org/osrf/$PACKAGE-release-ubuntu #  # 

1. Get the Gazebo source code and get to the right branch:

cd $WORKSPACE hg clone https://hg@bitbucket.org/osrf/gazebo cd gazebo hg up $BRANCH

1. Build a source tarball:

rm -rf $WORKSPACE/build mkdir $WORKSPACE/build cd $WORKSPACE/build cmake $WORKSPACE/$PACKAGE make package_source

1. Rename source tarball to fit Debian's convention:

cp $PACKAGE-$VERSION.tar.bz2 ${PACKAGE}_$VERSION.orig.tar.bz2

1. Unpack the tarball

rm -rf $PACKAGE-$VERSION tar xf ${PACKAGE}_$VERSION.orig.tar.bz2

1. Add debian/ subdirectory and any other added/modified files to unpacked source tarball:

cp -a $WORKSPACE/$PACKAGE-release-ubuntu/* $PACKAGE-$VERSION

1. Use debuild to create source package:

cd $PACKAGE-$VERSION debuild -S -uc -us

1. Use pbuilder-dist to create binary package:

pbuilder-dist $DISTRO $ARCH build ../*.dsc

1. There should now be a binary deb called `$HOME/pbuilder/${DISTRO}_result/${PACKAGE}_${VERSION}-${UBUNTU_VERSION}_$ARCH.deb`. Enjoy.


 * 1) Upload new package (TODO)

The .deb package needs to be uploaded to the machine hosting the apt repository (e.g., packages.osrfoundation.org). Then you need to invoke `reprepro` appropriately to include the new deb.