# Simultaneously Work on Packages of the Same Name

I'm simultaneously working on two projects with the same starting-point code: I've forked public repo A twice locally. I want to publish my modifications to A (let's call this A') to open-source my code. However, I want to make different changes to the same original package and just use those locally (let's call this A").

Obviously, when I call "catkin_make", I get an error for having multiple packages of the same name. Is there a way around this? Should I setup multiple catkin workspaces or is this bad practice? Do I have to systematically go through one of the packages and change every duplicate name to something else?

edit retag close merge delete

Sort by » oldest newest most voted

Having two different workspaces or renaming one of the variants of your package are the two most obvious solution to your problem. Both are reasonable; which one you choose really depends on why you have two copies of this package, and how you want to use them.

If your private version is making massive changes to the package or changing its functionality, it probably makes sense to rename it.

If you want to run nodes from both versions of the package at the same time, you should rename your private version.

If your private version will never be used at the same time as the open-source version, you can use it in a different catkin workspace without renaming it.

more

To rename a ROS package:

1.Simply rename its folder name.

2.Update the name in Package.xml file of the package.

3.Update the name in CMakeLists.txt file of the package.

Its Done, No need to build that package again after renaming.

more

The package tends to use its files itself in launch/urdf/etcetera files, and other packages depending on the package may as well. For editing these dependencies:

find PKG-FOLDER $$-type d -name .git -prune$$ -o -type f \
-exec sed -i 's/old-pkg-name/new-pkg-name/g' {} +


This should replace all occurences of old-pkg-name in all files of PKG-FOLDER with new-pkg-name. Plus, if your files have names containing old-pkg-name, you may need to update these names too to maintain integrity.

find PKG-FOLDER $$\( -type d -name .git -prune$$ -o -type f \) \
-iwholename "*old-pkg-name*" \
-exec rename s/old-pkg-name/new-pkg-name/ '{}' \;

more