Skip to content

Instantly share code, notes, and snippets.

@awesomebytes
Last active November 13, 2024 12:06
Show Gist options
  • Save awesomebytes/196eab972a94dd8fcdd69adfe3bd1152 to your computer and use it in GitHub Desktop.
Save awesomebytes/196eab972a94dd8fcdd69adfe3bd1152 to your computer and use it in GitHub Desktop.
How to create a debian from a ROS package

How to make a debian from a ROS package

The instructions are based on this answers.ros.org thread.

Get dependencies

You may need the latest pip, follow the official instructions.

Install bloom:

sudo apt-get install python-bloom

or (recommended)

sudo pip install -U bloom

Install fakeroot:

sudo apt-get install fakeroot

Get ready

To make a debian folder structure from the ROS package you must cd into the package to be in the same folder where package.xml file is.

Create debian structure

bloom-generate rosdebian --os-name ubuntu --os-version trusty --ros-distro indigo

You can also let the tool guess some stuff:

bloom-generate rosdebian --ros-distro indigo

You'll get something like this:

~/audio_ws/src/audio_file_player$ bloom-generate rosdebian --os-name ubuntu --os-version trusty --ros-distro indigo
==> Generating debs for ubuntu:trusty for package(s) ['audio_file_player']
No homepage set, defaulting to ''
No historical releaser history, using current maintainer name and email for each versioned changelog entry.
No CHANGELOG.rst found for package 'audio_file_player'
Package 'audio-file-player' has dependencies:
Run Dependencies:
  rosdep key           => trusty key
  rospy                => ['ros-indigo-rospy']
  actionlib_msgs       => ['ros-indigo-actionlib-msgs']
Build and Build Tool Dependencies:
  rosdep key           => trusty key
  rospy                => ['ros-indigo-rospy']
  actionlib_msgs       => ['ros-indigo-actionlib-msgs']
  catkin               => ['ros-indigo-catkin']
==> Placing templates files in the 'debian' folder.
==> In place processing templates in 'debian' folder.
Expanding 'debian/control.em' -> 'debian/control'
Expanding 'debian/changelog.em' -> 'debian/changelog'
Expanding 'debian/compat.em' -> 'debian/compat'
Expanding 'debian/rules.em' -> 'debian/rules'
~/audio_ws/src/audio_file_player$ ls
action  assets  CMakeLists.txt  debian  launch  package.xml  README.md  scripts 
~/audio_ws/src/audio_file_player$ ls debian
changelog  compat  control  rules  source

Create binary debian

Having sourced the necessary dependencies (most probably source /opt/ros/indigo/setup.bash) execute:

fakeroot debian/rules binary

If you get the error:

dh: Command not found

You need to install:

sudo apt-get install dpkg-dev debhelper

In the end you'll get a line like:

dpkg-deb: building package `ros-indigo-audio-file-player' in `../ros-indigo-audio-file-player_0.0.1-0trusty_amd64.deb'.
@mjm522
Copy link

mjm522 commented Jul 14, 2023

This is an old post, yet I am trying my luck to get a reply. I made my debians and facing exact problem @ipa-hsd faced here. But in my case the dependency libraries are not debians. They exist in the install folder of the workspace. This workspace is part of a docker image (meaning it is always present there). I want my package to be a debian that can be installed on to this docker image. While instaling it, I want it to pick up libraries from the install folder (it is sourced and all, can see it in the LD_LIBRARY_PATH), but my dpkg -i my_package.deb fails to pick them up. Can anything be done for this?

@pulak-gautam
Copy link

@DarkCowMoo Were you able to find a workaround to your problem? I am currently stuck in the same boat.

@Hawxxer
Copy link

Hawxxer commented Sep 18, 2024

Even if this thread is old, it's the pretty much the only full explanation how this works, when you try to google this issue. As so I want to add some information about issues I stumbled. To compile python ros2 packages you need to install the dh-python package.
apt install dh-python
Also I had dependency issues with my own rosdep.yaml file. The issue was, that my package name has a "_", which need to be written with "-" in the yaml to probably work, even if the package name keep the underscore. For example package name is ros_testpackage, the the rosdep.yaml need to contain

ros_testpackage:
  ubuntu: [ros-humble-ros-testpackage]

Thanks to vunguyen for pointing this out here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment