ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Compiling [or not] a package before pushing to repo

asked 2012-04-02 23:38:17 -0500

Haikal Pribadi gravatar image

updated 2014-01-28 17:11:51 -0500

ngrennan gravatar image

Hi everybody,
I realized that during compilation time there will be a CMakeCache created; which is specific to our machine. Hence if we push the package (after compiling it) to a repo and someone else tries to compile it, they will get an error that the CMakeCache doesn't match the CMake on their current machine. The fix is simple - simply do a make clean in the downloaded package directory and then try compiling it again. But, it would be nice if there's no cache included.
1. Is there a way to disable the CMakeCache during compilation?
2. Is it a good practice to compile a package and pushing it the repo? or should we just push an uncompiled and clean package (with only the source codes files) to the repo?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2012-04-03 04:39:20 -0500

Every version control system can be instructed to ignore certain files or directories, so that they are never committed to the repository. Usually, this is a special file that contains a list of ignored names, one per line.

For Git, write those file names to a file named .gitignore (don't forget the leading dot). For CVS and Mercurial, the file is called .cvsignore and .hgignore respectively. Subversion is a bit special, because it stores this information in a "property" called svn:ignore. You can edit this property with the command

EDITOR=gedit svn propedit svn:ignore /path/to/my/workingcopy

For ROS packages, I usually end up ignoring the following files:


Of course, this does not remove files from the repository which are already checked in; you will have to do this manually.

edit flag offensive delete link more


exactly! thank you for reminding me this - it's funny how I overlooked this. Hence I can always have compiled packages on my machine yet the released repo only have the source code. And now i'm confused which one to mark as answer. I guess i'll leave it to the votes till tomorrow.

Haikal Pribadi gravatar image Haikal Pribadi  ( 2012-04-03 05:55:19 -0500 )edit

what do you do about generated source files that end up in the src directory? Do you just let them be, or add something like src/my_package to svn ignore?

mlanting gravatar image mlanting  ( 2012-10-31 03:25:17 -0500 )edit

Ignore them; if necessary, name the files individually or by some wildcard like *.moc.cpp

roehling gravatar image roehling  ( 2012-11-05 02:56:37 -0500 )edit

answered 2012-04-03 02:46:55 -0500

John Hoare gravatar image

In general, you should only have the source code in the repository. The main reason is whomever is using your software may have a different system architecture/operating system/library version/etc than what you've used to compile your code, and it will not run on their systems. If you put only what is required to build your code, than your users can build it on whatever environment they are using.

Here's a discussion that may be helpful:

edit flag offensive delete link more


Completely understood now! thanks John. But I'm confused which answer to mark as correct. So I guess I'll leave it to the votes till tomorrow.

Haikal Pribadi gravatar image Haikal Pribadi  ( 2012-04-03 05:56:39 -0500 )edit

Question Tools


Asked: 2012-04-02 23:38:17 -0500

Seen: 304 times

Last updated: Apr 03 '12