Simple Package Transformations with tsrpm

A number of different binary package transformations are supported by tsrpm. These include repackaging target RPMs, repackaging as a host RPM, and repackaging as an IPKG. These transformations support typical user needs without requiring you to rebuild a package from scratch. For example, in most embedded applications, the deployment RFS is optimized for a smaller footprint; therefore, it is common to remove unneeded package contents before constructing the target RFS. As shown in the following example, tsrpm facilitates file removal by providing the ability to perform file exclusions based on a pattern match.

[juser@host RPMS]$ tsrpm --repackage=targetrpm --target=mipsel \
 --excludedocs --exclude='/usr/share/oprofile/arm/.*' \
 oprofile-0.9.1-2.mipsel.rpm

The command line shown in the previous example removes all package documentation, and removes the oprofile event description files for the arm architecture, which are unnecessary when installing on a mips target. This file removal leads to a space savings of 50 KB.

The IPKG format is a popular runtime package management format for embedded devices. The repackage feature of tsrpm makes the conversion of binary RPMs into ipackages fairly straightforward. For example, the exclusion transformation described in the previous example can be combined with an ipackage conversion step as follows:

[juser@host RPMS]$ tsrpm --scripts --repackage=targetrpm --target=mipsel --excludedocs \
   --exclude='/usr/share/oprofile/arm/.*' oprofile-0.9.1-2.mipsel.rpm

  . . .

Created: /home/juser/RPMS/mipsel/IPKG/oprofile_0.9.1-2_mipsel.ipk

This example includes the --scripts option. This option ensures that any installation scripts that were present in the RPM package get translated to the resulting IPKG file. There are instances in which this is not desirable because the scripts are not correct for the IPKG environment. In such a situation, omitting the --scripts option excludes the scripts from the repackaging step.