Source-git

If you’re familiar with how packaging is done in CentOS and Fedora, you may know dist-git repositories: each repository represents a source RPM package and contains all the RPM source files (RPM spec file, upstream tarball checksum and optionally patch files and other files). But the repository itself doesn’t contain any source code - you need to execute %prep phase to see the source tree before it’s being compiled.

CentOS Stream 8 and CentOS Stream 9 have orthogonal relationship with Red Hat Enterprise Linux and because of this fact, source-git repositories work differently for both c8s and c9s.

CentOS Stream 9

Red Hat maintainers that want to use a source-based workflow will be working here and MRs will be merged to the c9s branches and synchronized to dist-git. CentOS Stream 9 source-git repos contain git history of the upstream project so you’ll feel more like contributing to the project rather than a bunch of downstream packaging files. The CentOS Stream 9 changes and packaging content are layered on top of the upstream git history.

Submitting a change in a source-git repo

Changes to packaging files, such as the spec file, are done without any special care on your side: just edit the file, save it and commit it. All the packaging files live in a .distro subdirectory.

Changing source code by defining the patch in a spec file

Creating source code changes needs a bit more work. Packages are modified in CentOS Stream 9 traditional dist-git workflow by creating patch files and defining those patches in a spec file. The patches are then applied during a build process in a %prep section.

If you are changing source code and you know that a patch in the spec is needed, add the patch to the spec file with a name of your choice:

Patch123: my-special-change.patch

Now you need to annotate the git commit which matches the patch with the respective change

We need this change in CentOS Stream

Signed-off-by: Tomas Tomecek <ttomecek@redhat.com>
patch_name: my-special-change.patch

---
 src/code.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

The automation, packit, then reads the commit message, knows that the patch is already defined in the spec file and creates a patch file with the name set in patch_name from the respective commit when creating a SRPM.

This is the preferred way of changing source code since you define the name of the patch files.

For more details on how to work in a source-git repository, please head on to packit’s documentation.

After a merge request is created

You should receive a review from a Red Hat maintainer. And that’s the time as with any other open source project to work with the maintainer to get the contribution in a state that it can be merged.

Once your MR is approved, it’s gonna be merged first in a respective dist-git repo to make sure it can built and passes all the checks. Once all is good, it can be merged in the source-git repo as well.

When you open a source-git MR, you’ll be able to see CI checks which are coming from a mirrored MR which was automatically created in dist-git.