Skip to content

CentOS Packaging Guide

Endi S. Dewata edited this page Feb 21, 2024 · 9 revisions

Prerequisites

$ dnf install centpkg

Packages

Authentication

To set up the authentication, login with Fedora FAS account to https://accounts.centos.org, then add SSH public key into https://gitlab.com.

To use centpkg, create a personal access token with scope api at https://gitlab.com/-/profile/personal_access_tokens. Store the token in ~/.config/rpkg/centpkg.conf as follows:

[centpkg.distgit]
token = <token>

To troubleshoot Kerberos issues:

$ KRB5_TRACE=/dev/stdout <command>

Cloning a Project

To clone a project into a local repository:

$ centpkg clone <project>

It will clone the project into a new repository folder and checkout the main branch (e.g. c9s). All subsequent centpkg and git commands need to be executed in the repository folder.

Forking a Project

To fork a project, visit the main project page and click the Fork button at the top of the page. The forked project should appear at https://gitlab.com/<username>/<project>/.

(Does not work) Alternatively, execute:

$ centpkg fork

Adding Forked Project

To add the forked package into the local repository, execute:

$ git remote add <username> [email protected]:<username>/<project>.git
$ git fetch <username>

Creating a Scratch Build

To create a scratch build with changes that have not been merged:

$ centpkg srpm
$ centpkg scratch-build --srpm <path>

If the branch has changed, it might be necessary to specify the main branch:

$ centpkg --release <main branch> srpm
$ centpkg --release <main branch> scratch-build --srpm <path>

The scratch build will be created in https://kojihub.stream.centos.org.

Creating a Merge Request

First, commit the changes into a temporary branch, and push the branch into the forked project:

$ git checkout -b <branch>
$ git commit -m "..."
$ git push <username> <branch>

Now we create the merge request by first going to the centos-stream project page:

The proper page to go to, to kick off this process is something like: https://gitlab.com/redhat/centos-stream/rpms/<package-name>/, where <package-name> is based on what project being worked on.

Then click on Merge Requests on the left hand side. From the merge request page, click New Merge Request. Within this UI we can choose the various source and destination branches.

To update multiple packages at the same time, request a side tag:

$ centpkg request-gated-side-tag

then specify the side tag in the merge request description:

side-tag: <side tag>

Merging a Merge Request

Open the merge request page, click Start merge train.

After the request is merged, checkout the main branch and pull the changes:

$ git checkout <main branch>
$ git pull

Creating an Official Build

To create an official build without a side tag:

$ centpkg build

To create an official build with a side tag:

$ centpkg build --target=<side tag>
$ stream wait-repo <side tag>

The official build will be created in https://kojihub.stream.centos.org. It will also trigger gating process and the result will be sent via email.

See Also

Clone this wiki locally