1 About Building Source Packages
This chapter provides overview information about building and packaging source packages as binary RPM packages. A distinction is made between building standard non-modular source packages and building source that is distributed within DNF modules and streams. Some information on how to obtain source packages is also provided.
Attention:
This documentation illustrates how source packages for Oracle Linux 8 can be built and packaged as binary RPM packages to effectively bootstrap Oracle Linux 8 from source. The information that is provided here is intended to assist developers in understanding how to build and package source code for Oracle Linux 8. Oracle does not support packages that are built externally. These instructions do not imply support for the infrastructure that is described or for any package build processes.
About Source RPMS
All of the sources for Oracle Linux packages are available on the Oracle Linux yum server and ULN. For any package, you can download the relevant source RPM and rebuild the binary equivalent by using the rpmbuild utility. Source RPM packages contain the source code, which is provided as a tarball. Also included are any other patches that Oracle may apply during the build, as well as a SPEC file that provides important build information, which includes a list of the build dependencies that are required to build the package and build instructions for any actions that should be taken at different stages of the package build process.
Obtaining source packages is straightforward. You can manually download each source package that you wish to build by using the dnf download command. For example, to download the latest source package for the UEK package that is shipped for Oracle Linux 8, run:
sudo dnf download --source kernel-uek
Note that you can encounter some issues when downloading the source RPM packages by using the dnf download command if the package is released as a module. If necessary, you can manually download source packages directly from https://yum.oracle.com/oracle-linux-8.html.
Modular packages contain metadata with information about the packages that are part of the module and are made available in a modular RPM repository that includes a YAML file that provides more information about the modules and streams available. You cannot download sources for modular packages directly by using the dnf download command. For more information about downloading modular packages, see Download Module Sources.
More information about DNF modularity is provided in Oracle® Linux: Managing Software on Oracle Linux.
If you intend to build the majority of packages directly from source, you should consider creating a mirror of the yum repositories or ULN channels where the packages are located. On an Oracle Linux 8 system, you can easily create a mirror of all of the repositories or channels that your system is subscribed to by running the following command:
mkdir source_rpms
sudo dnf reposync --source -p source_rpms
The previous command downloads all of the sources for every package in every repository for which the system is subscribed. You must ensure that the file system on which you host these source RPM packages has sufficient space to store these packages. You can find out how much space is used by each repository by running dnf repolist -v.
For modular packages, the dnf reposync command downloads the source RPM packages for each defined module stream, which means that multiple versions of the same source package may exist in the repository mirror.
More information about the RPM packaging format can be found at https://rpm.org/documentation and a detailed guide to RPM packaging is available at https://rpm-packaging-guide.github.io/.
About the Module Build Service
The Module Build Service (MBS) is a build management utility that coordinates build jobs specifically for DNF modules. This utility provides an interface to:
-
manage client-side tooling,
-
validate build configuration for each module,
-
set up the appropriate build environment,
-
and handle build scheduling, tracking, and reporting.
The upstream project is hosted at https://pagure.io/fm-orchestrator.
The Mock build tool is used within MBS to facilitate builds of the source packages. Mock builds source RPM packages within a chroot environment. This tool simply sets up the environment and populates it based on the contents of a configuration file. The source RPM packages are then built within the chroot environment and packaged as RPM binaries. The Mock build tool can be threaded within MBS to improve performance and speed up builds for many modules in parallel.
Oracle provides packages for MBS and its dependencies in a developer repository. These packages include some initial configuration that can help you get started with building modules directly from the sources that are provided by Oracle.