Jump to: navigation, search

Difference between revisions of "StarlingX/DebianBuildStructure"

Line 1: Line 1:
 +
= Overview =
  
=== StarlingX Debian Folder Layout ===
+
This document describes the layout of a Debian build folder for a StarlingX upstream package.
  
This document is used to describe how to manage the Debian folder for a package in StarlingX upstream
+
== Debian Folder Location ==
  
== Debian folder location ==
+
The top level Debian build folder is named "debian". It is found in each package folder as a peer of the CentOS build folder "centos".
  
The debian folder is in the same directory of the cantos folder. Fox example, the “dhcp” packages is at inter/base/dhcp. Its centos folder is integ/base/centos, the debian folder is  
+
For example, consider the DHCP package found in the integ repo in the directory "integ/base/dhcp". The CentOS build folder for this package is "integ/base/dhcp/centos", while the Debian build folder for the package is "integ/base/dhcp/debian".
Integ/base/dhcp/debian
 
  
== Debian folder structure ==
+
== Debian Folder Structure ==
  
This is a full Debian folder structure, which lists all of the files and directories needed by re-package a Debian source package. Some of them are necessary for all kinds of Debian package, and some of them are optional different types of packages.
+
The following example shows a full Debian build folder structure. It lists all of the files and directories needed to create a Debian package. Some of the folders and files are required for all kinds of Debian packages, while others are optional depending on the package type.
 +
 
 +
  path/to/package-name
 +
  .
 +
  └── debian
 +
      ├── dl_hook
 +
      ├── meta_data.yaml
 +
      ├── deb_folder
 +
      │  ├── changelog
 +
      │  ├── compat
 +
      │  ├── control
 +
      │  ├── copyright
 +
      │  ├── patches
 +
      │  │  ├── 0001-xxx-yyy-zzz.patch
 +
      │  │  ├── 0002-xxx-yyy-zzz.patch
 +
      │  │  └── series
 +
      │  ├── rules
 +
      │  ├── source
 +
      │  │  └── format
 +
      │  ├── watch
 +
      │  ├── ...
 +
      │  └── ...
 +
      ├── deb_patches
 +
      │  ├── 0001-xxx-yyy-zzz-deb.patch
 +
      │  ├── 0002-xxx-yyy-zzz-deb.patch
 +
      │  └── series
 +
      ├── patches
 +
      │  ├── 0001-xxx-yyy-zzz.patch
 +
      │  ├── 0002-xxx-yyy-zzz.patch
 +
      │  └── series
 +
 
 +
 
 +
==dl_hook==
 +
 
 +
The dl_hook file is a bash script file which is used when the package requires both source files from a local repo and third-party source files or files from another StarlingX repository. This file is used to create a different build root directory and copy both the external sources and local repo source files to that location prior to the build.
  
  integ/base/xxx
 
  .
 
  └── debian
 
        |── meta_data.yaml
 
      ├── deb_folder
 
      │   ├── changelog
 
      │   ├── compat
 
      │   ├── control
 
      │   ├── copyright
 
      │   ├── patches
 
      │   │   ├── 0001-xxx-yyy-zzz.patch
 
      │   │   ├── 0002-xxx-yyy-zzz.patch
 
      │   │   └── series
 
      │   ├── rules
 
      │   ├── source
 
      │   │   └── format
 
      │   ├── watch
 
      │  ├── ...
 
      │  └── ...
 
        |── deb_patches
 
      │   ├── 0001-xxx-yyy-zzz-deb.patch
 
      │   ├── 0002-xxx-yyy-zzz-deb.patch
 
      │   └── series
 
      ├── patches
 
      │   ├── 0001-xxx-yyy-zzz.patch
 
      │   ├── 0002-xxx-yyy-zzz.patch
 
      │   └── series
 
     
 
 
== meta_data.yaml ==
 
== meta_data.yaml ==
  
The meta_data.yml consists of information that describes the package to the build system: It consists of several fields:
+
The meta_data.yaml file contains information that describes the package to the build system. It consists of several fields:
  * ‘’’debver’’ (mandatory) - contains the package version. For Debian packages, you can run “apt-cache madison package-name”  to get the package version.
 
      For example the systemd the package in Debian Bullseye is 247.3-3. For 3rd party and StaringX packages, you need to fill it manually.
 
  * “”””debname””” (optional) - contains the package name in Debian. Most packages have a uniform name for both Centos and Debian. Hence usually the file
 
    isnt required. The build system uses the last folder name if the deb name is absent. For example, “integ/base/dhcp”, in Debian “isc-dhcp”
 
  
 +
    debver (mandatory) - Contains the package version. For Debian packages, you can run “apt-cache madison package-name” to get the package version. For example, the systemd the package in Debian Bullseye is 247.3-3. For third party and StarlingX packages, the debver must be specified manually.
 +
 +
    debname (optional) - Contains the name of the Debian package. Most packages have a uniform name for both Centos and Debian, in which case the field isn't required. If it is not specified, the build system will use the last folder name.
  
 
== deb_folder ==
 
== deb_folder ==
  
The deb_folder consists of the Debian folder. For Debian packages, the build system inherits the Debian folder from the Debian upstream package. If you put full Debian folder here, the build system uses it to override the upstream Debian folder. For 3rd part and StarlingX packages, you need to pul a full Debian folder. The build system copies it to the  
+
The deb_folder contains all of the Debian package build files. It corresponds to the debian folder of a native Debian package. For native Debian packages, the build system inherits the debian folder from the Debian upstream package. If a complete debian folder is included in this directory, the build system will use it to override the upstream debian folder. For 3rd party and StarlingX packages, a complete debian folder must be provided. The build system will copy this folder to the build directory.
build directory.
+
 
 +
The following table lists the most common files in a debian folder, along with a brief description and a link to the Debian documentation for each file.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! File !! Mandatory !! Description
 +
|-
 +
| changelog || Yes || Contains the version information, distribution and urgency of the package.
 +
|-
 +
| compat || Yes || Defines the debhelper compatibility level.
 +
|-
 +
| control || Yes || Contains the definitions of the .deb files which comprise the Debian package.
 +
|-
 +
| copyright || No || Contains copyright and license information for the upstream sources included in the package.
 +
|-
 +
| patches/* || No || Contains copyright and license information for the upstream sources included in the package.
 +
|-
 +
| rules || Yes || Contains the build rules for the package.
 +
|-
 +
| source/format || Yes || Contains the desired format for the package.
 +
|-
 +
| watch || No || Contains the desired format for the package.  
 +
|}
  
 
== deb_patches ==
 
== deb_patches ==
  
This folder contains the patches to apply to the debian folder of a Debian upstream package. For example, if you want to modify the debian/rules file of a Debian upstream package, put the patch here and add it to the series file. It is not needed for 3rd party and StarlingX packages.
+
This folder contains the patches to apply to the debian folder of an upstream Debian package. For example, if you want to modify the debian/rules file of a Debian upstream package, put the patch here and add it to the series file. This folder is not needed for 3rd party and StarlingX packages.
  
 
== patches ==
 
== patches ==
  
This folder contains the patches that are applied to the source code of a debian upstream package. Similarly, a developer can drop a patch into this directory with a series file to apply a patch to the source code of a Debian package. The series file will be appended to an existing debian/patches/series. For 3rd party and StarlingX packages it is not
+
This folder contains the patches that are applied to the source code of a Debian upstream package. A developer can also drop a patch into this directory with a series file to apply a patch to the source code of a Debian package. The series file will be appended to an existing debian/patches/series. For 3rd party and StarlingX packages it is not needed.
needed.
 
  
 +
== Examples ==
  
Examples can be found [https://review.opendev.org/q/topic:%22debian-pkg%22+(status:open%20OR%20status:merged) here.]
+
Examples of reviews which add Debian packaging to various StarlingX repositories can be found [https://review.opendev.org/q/topic:%22debian-pkg%22+(status:open%20OR%20status:merged) via this query.]

Revision as of 18:26, 8 November 2021

Overview

This document describes the layout of a Debian build folder for a StarlingX upstream package.

Debian Folder Location

The top level Debian build folder is named "debian". It is found in each package folder as a peer of the CentOS build folder "centos".

For example, consider the DHCP package found in the integ repo in the directory "integ/base/dhcp". The CentOS build folder for this package is "integ/base/dhcp/centos", while the Debian build folder for the package is "integ/base/dhcp/debian".

Debian Folder Structure

The following example shows a full Debian build folder structure. It lists all of the files and directories needed to create a Debian package. Some of the folders and files are required for all kinds of Debian packages, while others are optional depending on the package type.

 path/to/package-name
 . 
 └── debian
     ├── dl_hook 
     ├── meta_data.yaml
     ├── deb_folder
     │   ├── changelog
     │   ├── compat
     │   ├── control
     │   ├── copyright
     │   ├── patches
     │   │   ├── 0001-xxx-yyy-zzz.patch
     │   │   ├── 0002-xxx-yyy-zzz.patch
     │   │   └── series
     │   ├── rules
     │   ├── source
     │   │   └── format
     │   ├── watch
     │   ├── ...
     │   └── ...
     ├── deb_patches
     │   ├── 0001-xxx-yyy-zzz-deb.patch
     │   ├── 0002-xxx-yyy-zzz-deb.patch
     │   └── series
     ├── patches
     │   ├── 0001-xxx-yyy-zzz.patch
     │   ├── 0002-xxx-yyy-zzz.patch
     │   └── series


dl_hook

The dl_hook file is a bash script file which is used when the package requires both source files from a local repo and third-party source files or files from another StarlingX repository. This file is used to create a different build root directory and copy both the external sources and local repo source files to that location prior to the build.

meta_data.yaml

The meta_data.yaml file contains information that describes the package to the build system. It consists of several fields:

   debver (mandatory) - Contains the package version. For Debian packages, you can run “apt-cache madison package-name” to get the package version. For example, the systemd the package in Debian Bullseye is 247.3-3. For third party and StarlingX packages, the debver must be specified manually.
   debname (optional) - Contains the name of the Debian package. Most packages have a uniform name for both Centos and Debian, in which case the field isn't required. If it is not specified, the build system will use the last folder name.

deb_folder

The deb_folder contains all of the Debian package build files. It corresponds to the debian folder of a native Debian package. For native Debian packages, the build system inherits the debian folder from the Debian upstream package. If a complete debian folder is included in this directory, the build system will use it to override the upstream debian folder. For 3rd party and StarlingX packages, a complete debian folder must be provided. The build system will copy this folder to the build directory.

The following table lists the most common files in a debian folder, along with a brief description and a link to the Debian documentation for each file.

File Mandatory Description
changelog Yes Contains the version information, distribution and urgency of the package.
compat Yes Defines the debhelper compatibility level.
control Yes Contains the definitions of the .deb files which comprise the Debian package.
copyright No Contains copyright and license information for the upstream sources included in the package.
patches/* No Contains copyright and license information for the upstream sources included in the package.
rules Yes Contains the build rules for the package.
source/format Yes Contains the desired format for the package.
watch No Contains the desired format for the package.

deb_patches

This folder contains the patches to apply to the debian folder of an upstream Debian package. For example, if you want to modify the debian/rules file of a Debian upstream package, put the patch here and add it to the series file. This folder is not needed for 3rd party and StarlingX packages.

patches

This folder contains the patches that are applied to the source code of a Debian upstream package. A developer can also drop a patch into this directory with a series file to apply a patch to the source code of a Debian package. The series file will be appended to an existing debian/patches/series. For 3rd party and StarlingX packages it is not needed.

Examples

Examples of reviews which add Debian packaging to various StarlingX repositories can be found via this query.