Reputation: 11
How can I generate deb installable file from the python files in my package(in the script folder), so I can deliver the deb file to the client who can run the python executables in the package?
For example, I just completed the ROS tutorial and created the beginner_tutorials package in my catkin workspace. I also completed the Simple Publisher and Subscriber tutorials which mean the python talker.py and listener.py in the script folder in the beginner_tutorials package.Then I run the following command in the package folder,~/ROS/catkin_workspace/src/beginner_tutorials:
$ bloom-generate rosdebian --os-name ubuntu --ros-distro kinetic
$ fakeroot debian/rules binary
So it generated the deb file. After I installed the deb to a new machine and I try to run the command:
$ rosrun beginner_tutorials talker
$ rosrun beginner_tutorials talker.py
$ rosrun beginner_tutorials listener
$ rosrun beginner_tutorials listener.py
After the installation on the new machine. I can't run the talker and listener. There is no python file in the /opt/ros/kinetic/lib. but look inside of the deb file, there are python files in the /opt/ros/kinetic/lib folder. I don't know where the python file went after install the deb file. I was wondering how can I export the package with python script to a installable deb file and after I install the deb file on a new machine, I can run the python executable file on the new machine?
If someone can give me some hints or guidance, I would really appreciate it. Thank you in advance!
Jue Wang(Patrick)
Upvotes: 0
Views: 1005
Reputation: 586
You may just use CPack with following options:
(Package-wide CMakeLists.txt
file)
#############
## Install ##
#############
set(CPACK_GENERATOR "DEB")
#Creating UNIX structured package
set(CPACK_CMAKE_GENERATOR "Unix Makefiles")
set(CPACK_PACKAGE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/../..")
set(CPACK_PACKAGE_VERSION 0.2.9)
#Set directory to /../ to avoid /share part of ROS_PACKAGE_PATH
set(CPACK_PACKAGING_INSTALL_PREFIX "$ENV{ROS_PACKAGE_PATH}/../")
set(CPACK_INSTALL_CMAKE_PROJECTS "${CMAKE_CURRENT_BINARY_DIR};${PROJECT_NAME};ALL;/./")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY
"${PROJECT_NAME} - ${PROJECT_DESCRIPTION}")
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_PACKAGE_VENDOR "RCS")
#Now we can simply create the dependencies using almost the same package names as they declared in ROS repository
set(CPACK_DEBIAN_PACKAGE_DEPENDS "ros-kinetic-roscpp, ros-kinetic-std-msgs, ros-kinetic-message-runtime, ros-kinetic-sensor-msgs")
#IMPORTANT: set this to keep on auto-introspection for system dependencies like libc++6
set (CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
#Keep Debian package structure untouched
set(CPACK_DEBIAN_PACKAGE_CONTROL_STRICT_PERMISSION TRUE)
#Standard naming schema for Debian-based distros
set(CPACK_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}~${CMAKE_SYSTEM_NAME}_${CMAKE_SYSTEM_PROCESSOR}")
set(CPACK_PACKAGE_VENDOR "Technical University")
set(CPACK_PACKAGE_CONTACT "<[email protected]>")
#Turn the process on
include(CPack)
In case of simple catkin package structure you can simply uncomment and edit install
sections of your CMakeLists.txt
according to files your package required to install. Then run
catkin_make package
After that you will have the .deb
package archive in the root directory of your ROS package. Now you can use dpkg-deb -c
command to ensure the paths defined within the package are correct. To obtain the example download and examine any ROS package from the official binaries repository.
Upvotes: 1