8 Package Formats

OBS differentiates between the format of the build recipes and the format of the installed packages. For example, the 'spec' recipe format is used to build 'rpm' packages by calling rpmbuild. In most cases the build result format is the same as the package format used for setting up the build environment, but sometimes the format is different. An example is the 'kiwi' recipe format, which builds products and isos, but uses rpm packages to setup the build process.

OBS currently supports 'rpm', 'deb' (debian), 'arch' as package formats and 'spec', 'dsc', 'kiwi' (both product and appliances), 'arch', 'preinstallimage' and 'simpleimage' as recipe formats.

8.1 Setting up a format

If no recipe format and binary format is specified in the prjconf, OBS tries to deduce them from the preinstall list, which includes the name of the used package manager. This means that you need to manually configure the 'kiwi' recipe config, as a 'rpm' package format will select 'spec' builds as default. This configuration is done by adding a 'Type' line to the project configuration.

8.2 Recipe Specials

Each format has some specials

8.2.1 spec

For building rpms you need a .spec file for each package, containing its build description. OBS parses the spec file's BuildRequires lines to get a list of package dependencies. OBS uses this information to both build the packages in the correct order and also for setting up the build environment. The parser understands most of rpm's macro handling, so it's possible to use architecture specific BuildRequires, conditional builds and other advanced rpm features.

8.2.2 deb

To build *.deb files, which are used on debian-based distributions, you need the following files:

  • debian.control

Here are the meta informations for the package like the build dependencies or some description.

  • debian.rules

This file describes the build section of the deb building process. There are the configure and make compile commands including other deb building sections.

  • $PACKAGE.dsc

In this file you describe the package names of each subpackage and their dependency level. Unlike rpm, the release numbers do not get increased automatically during build unless the keyword DEBTRANSFORM-RELEASE gets added to the file.

8.2.3 pkg

This package format is for Archlinux and his derivates. To build a Archlinux pkg you need a PKGBUILD file containing the build description and the source tarball. PKGBUILD's have no macros like %{buildroot}. They have variables for example makedepens=(package1, package2). This variables are parsed by the OBS and uses them as dependencies. On Archlinux you typically build packages without subpackage. They are no *-dev oder *-devel packages.

8.2.4 kiwi appliance

KIWI (http://opensuse.github.io/kiwi/) is an image producing platform that builds images for various formats, starting from hardware images, virtualization systems like QEMU, XEN and VMWare and many more. It supports a wide range of architecure, which are x86, x86_64, s390 and ppc.

Build instructions for KIWI usually consists of:

  • my_image.kiwi contains the image configuration in xml format. Full XML schema documentation can be found here (https://doc.opensuse.org/projects/kiwi/schema-doc/).
  • config.sh (optional) configuration script that runs at the end of the installation, but before package scripts have run.
  • root/ directory that contains files that will be applied to the built image after package installation. This can also be an archived and compressed directory.

Note
Note

OBS only accepts files with a .kiwi suffix as a KIWI configuration file. Other naming schemes KIWI supports, like the 'config.xml', are getting ignored in OBS.

Please refer to the KIWI cookbook (https://doc.opensuse.org/projects/kiwi/doc/) for indepth guidance for building images with KIWI.

8.2.5 kiwi product

...

8.2.6 simpleimage

This format can be used to get simple rootfs tarball or squashfs image. It doesn't contain bootloader nor kernel. For advanced features, use kiwi. Use simpleimage for simple rootfs tarball/squashfs image of any distribution that is supported by OBS but doesn't have anything fancier than that.

Simple image uses similar syntax as spec file. Supported tags include Name, Version and BuildRequires which is the way how to specify list of packages to include. #!BuildIgnore can be also used. For additional customization %build phase is supported - run via bash. RPM macros are not supported, but $SRCDIR shell variable is available.

8.2.6.1 Example

           
Name:           example-image
Version:        1.0
BuildRequire:   emacs
#!BuildIgnore:  gcc-c++

%build
# Set root password
passwd << EOF
opensuse
opensuse
EOF

# Enable ssh
systemctl enable sshd

          
Print this page