Ask Your Question

Build Debian Package Locally?

asked 2013-07-15 03:57:12 -0600

allenh1 gravatar image

updated 2013-07-22 07:29:26 -0600

Hello all,

I was wondering if there was a way to build a ROS debian package locally (for testing purposes). While using Bloom, I have had some trouble in my release. So, before I submit my package again, I'd like to verify that it will build.


-Hunter A.

I ran the commands you suggested, but encountered an error:

allenh1@allenh1-Vostro-430:~/p2os-release$ git checkout debian/ros-hydro-p2os-urdf_1.0.1-0_precise
Note: checking out 'debian/ros-hydro-p2os-urdf_1.0.1-0_precise'.

You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.

If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:

  git checkout -b new_branch_name

HEAD is now at cd7c4f8... Generated debian files for precise
allenh1@allenh1-Vostro-430:~/p2os-release$ git-buildpackage -uc -us --git-ignore-branch --git-ignore-new
dh  clean
Unknown option: buildsystem
dh_testdir: warning: ignored unknown options in DH_OPTIONS
Unknown option: buildsystem
dh_clean: warning: ignored unknown options in DH_OPTIONS
    rm -f debian/ros-hydro-p2os-urdf.substvars
    rm -f debian/ros-hydro-p2os-urdf.*.debhelper
    rm -rf debian/ros-hydro-p2os-urdf/
    rm -f debian/*.debhelper.log
    rm -f debian/files
    find .  \( \( -type f -a \
            \( -name '#*#' -o -name '.*~' -o -name '*~' -o -name DEADJOE \
         -o -name '*.orig' -o -name '*.rej' -o -name '*.bak' \
         -o -name '.*.orig' -o -name .*.rej -o -name '.SUMS' \
         -o -name TAGS -o \( -path '*/.deps/*' -a -name '*.P' \) \
        \) -exec rm -f {} \; \) -o \
        \( -type d -a -name autom4te.cache -prune -exec rm -rf {} \; \) \)
    rm -f *-stamp
Warning generated by debuild:
Making debian/rules executable!

fatal: ref HEAD is not a symbolic ref
gbp:error: release/hydro/p2os_urdf/1.0.1-0 is not a valid branch

I'm sure it's something simple.

edit retag flag offensive close merge delete


I haven't run into this, I thought this would be covered by the `--git-ignore-branch`, but maybe not...

William gravatar image William  ( 2013-07-22 07:52:04 -0600 )edit

This seems to indicate that calling this from a tag is a problem, but that hasn't been my experience. I have no idea why this doesn't work, @tfoote any ideas?

William gravatar image William  ( 2013-07-22 07:54:31 -0600 )edit

Since bloom uses a tag, not a branch, you might need to use "--git-export=WC" to use the "working copy" that is checked out?

fergs gravatar image fergs  ( 2013-08-06 22:21:02 -0600 )edit

That seems to make sense. Do I need to change the rest of the command?

allenh1 gravatar image allenh1  ( 2013-08-08 05:17:18 -0600 )edit

I found that I needed to add the --git-upstream-tree=tag flags to get GBP to run properly on 13.10.

ahendrix gravatar image ahendrix  ( 2013-12-14 14:47:26 -0600 )edit

Austin—just ran into this trying to make builds on 14.04. Thanks for the heads-up.

mikepurvis gravatar image mikepurvis  ( 2013-12-16 08:57:32 -0600 )edit

Ditto...cheers Austin.

Daniel Stonier gravatar image Daniel Stonier  ( 2014-07-31 12:21:56 -0600 )edit

1 Answer

Sort by » oldest newest most voted

answered 2013-07-15 07:54:10 -0600

William gravatar image

updated 2013-08-03 08:19:02 -0600

You can test it locally, but there is no tutorial for doing it yet.

You can checkout the tag in your bloom repo which matches your system, for example:

$ git checkout debian/ros-hydro-PACKAGE-NAME_1.0.0-0_precise

Then you can build it locally with:

$ git-buildpackage -uc -us --git-ignore-branch --git-ignore-new

This test should be sufficient for everything but missing dependencies, because this will not build it exactly like the farm, this command will use the packages you have installed locally. So this will not catch errors which happen from missing dependencies, if you have those missing dependencies installed locally.

You can build it just like the farm using pbuilder, which builds your package in a vacuum, setting up an empty change root and installing only the packages you depend on. You can do this with this command:

$ git-buildpackage -uc -us --git-ignore-branch --git-ignore-new --git-pbuilder

This command will do the full, isolated build of your package. Your machine will likely need some setup, it's hard for me to tell what all the steps were as my machines are already setup, but I imagine these should get you close:

$ sudo apt-get install git-buildpackage pbuilder cowbuilder
$ sudo cowbuilder --create

To really mimic the build farm you will want to be using the ros-shadow-fixed repository, which is the package repository where packages go to be tested before being synched to the public debian repositories. Comment out any ROS debian entries in your /etc/apt/sources.list.d/* files and add these lines:

deb '' precise main
deb-src '' precise main
edit flag offensive delete link more



Now it seems that tutorial for local pre-release is started under bloom tutorial directory.

130s gravatar image 130s  ( 2013-07-23 17:49:04 -0600 )edit

For setting pbuilder on Ubuntu precise, what you listed worked for me. I only needed this tweak.

130s gravatar image 130s  ( 2014-09-11 18:27:23 -0600 )edit

I have created a bash script that helps a lot with this task: . It makes it easier to handle generating multiple packages when you need to play with rosdep keys so that the dependencies can be resolved.

VictorLamoine gravatar image VictorLamoine  ( 2018-11-13 07:13:58 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2013-07-15 03:57:12 -0600

Seen: 3,382 times

Last updated: Aug 03 '13