creating a deb with cpack (linux)

✏️ Edit this page on GitHub

#contents

Introduction

The procedure for creating a deb package is shown below.

Creation Procedure When Not Including doxygen Documentation

  • By default, the documentation build is OFF, so it is not generated.

  • For a C++ RTC

 $ cd プロジェクトディレクトリー
 $ mkdir build
 $ cd build
 $ cmake ..
 $ make
 $ cpack
  • For a Pyrhon RTC
 $ cd プロジェクトディレクトリー
 $ mkdir build
 $ cd build
 $ cmake ..
 $ cpack

Creation Procedure When Including doxygen Documentation

Change the following line in CMakeLists.txt directly under the project directory from OFF to ON.
For a C++ RTC, this is around line 86, and for a Python RTC, around line 77.

 option(BUILD_DOCUMENTATION "Build the documentation" ON) ※この行の OFF を ON に書き換えます。(デフォルトは OFF)
  • For a C++ RTC
 $ cd プロジェクトディレクトリー
 $ mkdir build
 $ cd build
 $ cmake ..
 $ make
 $ make doc
 $ cpack
  • For a Pyrhon RTC
 $ cd プロジェクトディレクトリー
 $ mkdir build
 $ cd build
 $ cmake ..
 $ make doc
 $ cpack

[Notes]
If you turn ON the documentation build and run “cpack” without running “make doc”, the following error will occur.

 CMake Error at /home/プロジェクトディレクトリー/build/doc/cmake_install.cmake:36 (file):
 file INSTALL cannot find
 "/home/プロジェクトディレクトリー/build/doc/html/doxygen/html".

deb Package Storage Location and File Name

If it is created successfully, it will be saved in [build] under the project directory.
The file name will be “RTC project name_RTC version number_architecture”.

(Example) Flip_1.2.0_amd64.deb

  • The architecture will be [i386] or [amd64].

How to Check a deb Package

  • When checking a deb package with the less command
 $ cd プロジェクトディレクトリー/build 
 $ less Flip_1.2.0_amd64.deb
 Flip_1.2.0_amd64.deb
 新形式 debian パッケージ、バージョン 2.0。
 サイズ 258304 バイト: コントロールアーカイブ = 2797 バイト。
     162 バイト、    9 行      control              
   10062 バイト、   92 行      md5sums              
 Package: affine
 Version: 1.2.0
 Section: devel
 Priority: optional
 Architecture: amd64
 Installed-Size: 884
 Maintainer: unknown ※パッケージメンテナー情報を定義していないと「unknown」になります
 Description: Flip image component

Press “q” to exit less.

  • When extracting and checking the contents of a deb package
    If the tree command is not installed, install it.
 $ sudo apt-get install tree
 $ cd プロジェクトディレクトリー/build 
 $ dpkg -x Flip_1.2.0_amd64.deb .
 $ tree usr
 usr
 └─ share
     └─ openrtm-1.2
          └─ components
               └─ python
                    └─ Category ※指定したインストール先ディレクトリー
                         └─ FlipGUI
                              ├─ RTC.xml
                              ├─ FlipGUIComp.py
                              ├─ idl
                              │    ├─ BasicDataType.idl
                              │    ├─ CMakeLists.txt
                              │    ├─ CalibrationService.idl
                              │    ├─ ExtendedDataTypes.idl
                              │    └─ InterfaceDataTypes.idl
                              ├─ idlcompile.sh
                              ├─ rtutil.py
                              ├─ setup.py
                              └─ flipgui.py

Installing and Uninstalling a deb Package

Installation

Run the following command to install.

 $ cd プロジェクトディレクトリー/build 
 $ sudo dpkg -i Flip_1.2.0_amd64.deb 

Uninstallation

Run the following command to uninstall.

 $ sudo dpkg -r Flip

IDL Compilation Processing for Python RTCs with Service Ports

Python RTCs with service ports execute IDL compilation when the package is installed. This behavior is implemented by postinst.in and prerm.in in the project directory during IDL compilation execution, so be careful not to delete these files, as the function will stop working.

The following is a list of files installed from the deb package. Files marked with ★ are generated by IDL compilation.

 $ tree /usr/share/openrtm-1.2/components/python/Category/FlipGUI/
 /usr/share/openrtm-1.2/components/python/Category/FlipGUI/
   ├─ BasicDataType_idl.py  ★
   ├─ CalibrationService_idl.py  ★
   ├─ ExtendedDataTypes_idl.py  ★
   ├─ ImageCalibService  ★
   │   └─ __init__.py  ★
   ├─ ImageCalibService__POA  ★
   │   └─ __init__.py  ★
   ├─ InterfaceDataTypes_idl.py  ★
   ├─ RTC  ★
   │   └─ __init__.py  ★
   ├─ RTC.xml
   ├─ RTC__POA  ★
   │   └─ __init__.py  ★
   ├─ FlipGUIComp.py
   ├─ idl
   │   ├─ BasicDataType.idl
   │   ├─ CMakeLists.txt
   │   ├─ CalibrationService.idl
   │   ├─ ExtendedDataTypes.idl
   │   └─ InterfaceDataTypes.idl
   ├─ idlcompile.sh
   ├─ rtutil.py
   ├─ setup.py
   └─ flipgui.py