creating an rpm with cpack (linux)
#contents
Introduction
The procedure for creating an rpm 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".
rpm Package Storage Location and File Name
If it is created successfully, it will be saved in [build] inside the project directory.
The file name will be “RTC project name-RTC version number-architecture”.
(Example) Flip-1.2.0-x86_64.rpm
- The architecture will be [i686] or [x86_64].
How to Check an rpm Package
- When checking an rpm package with the less command
$ cd プロジェクトディレクトリー/build
$ less Flip-1.2.0-x86_64.rpm
Name : Flip
Version : 1.2.0
Release : 1
Architecture: x86_64
Install Date: (not installed)
Group : unknown
Size : 506080
License : unknown
Signature : (none)
Source RPM : Flip-1.2.0-1.src.rpm
Build Date : 2017年xx月xx日 xx時xx分x秒
Build Host : localhost
Relocations : /usr
Vendor : AIST
Summary : Flip image component
Description :
DESCRIPTION
Press “q” to exit less.
- When extracting and checking the contents of an rpm package
If the tree command is not installed, install it.
$ sudo apt-get install tree
$ cd プロジェクトディレクトリー/build
$ dpkg -x Flip-1.2.0-x86_64.rpm .
$ 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 an rpm Package
Installation
Run the following command to install.
$ cd プロジェクトディレクトリー/build
$ sudo rpm -i Flip-1.2.0-x86_64.rpm
Uninstallation
Run the following command to uninstall.
$ sudo rpm -e 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 rpm 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