Jump to: navigation, search

StarlingX/CentosToDebian

< StarlingX
Revision as of 15:39, 9 November 2021 by Zulcss (talk | contribs)

Overview

The purpose of this wiki is to provide some guidance for converting a CentOS package to a Debian package.

CentOS Package Files

There are two main files which specify the CentOS build of a package:

  • build_srpm.data - Specifies the input sources for the build (both within and external to the package repository).
  • <packageName>.spec - Specification file which defines the package(s), dependencies, build rules and install rules.

These files are found in the "centos" directory which is generally a top-level directory in the root package directory. For example:

  • Repository: nfv
  • Package directory: nfv/nova-api-proxy
  • CentOS build directory: nfv/nova-api-proxy/centos

The "debian" build directory is a peer of the "centos" directory (i.e. nfv/nova-api-proxy/debian).

build_srpm.data

The build_srpm.data file defines the source inputs for the package build. The inputs may be files from the package repo itself, files from another repo or files from a download mirror.

The following variables are commonly used for these inputs:

  • CGCS_BASE - An import mirror (/import/mirrors/starlingx).
  • PKG_BASE - The root package directory.
  • STX_BASE - The root directory for all StarlingX repositories.

Specification File

The specification file drives the CentOS package build. It contains two main sections:

  • Preamble - Defines metadata for the build.
  • Body - Contains the build instructions.

The following table describes the commonly used fields (SPEC directives) in the specification file.

Directive Type Description
Summary Preamble A brief description of the package.
Name Preamble The name of the package.
Version Preamble The current version of the package.
Source* Preamble Specifies a source file for the build.
BuildRequires Preamble Specifies a dependency for the package.
Requires Preamble Specifies a dependency for the package.
 %package Body Defines an RPM file to be built. This is used if multiple RPMs are built from the SPEC file.
 %description Body A detailed description of the package
 %prep Body Steps for preparing the software to be built. This might include extracting a tar file of upstream source code, for example.
 %build Body Specifies the rules to build the software of the package.
 %install Body Specifies the install rules for the package. Files are copied from the build directory to the directory structure containing the files to be installed.
 %files Body Defines the files to be installed on a a system when the package is installed

Mapping a CentOS Specification file to Debian Build Files

The following table shows at a high level how to map sections of Centos .spec