Contributing to CentOS Stream
1. Before you start writing code...
...we would like to thank you for your interest in contributing to CentOS Stream. Though we cannot accommodate all the code — Red Hat Enterprise Linux 8 guarantees compatibility within a major release of the distribution which needs to be preserved. You should always open a bugzilla first and discuss with the respective RHEL package maintainers if your change has a chance to be accepted. As with any open source projects, in the end it's up to maintainers to decide which changes they want to accept and maintain, so Red Hat maintainers can decline contributions for any reason.
The proposed change should already be merged in the upstream project before even being considered as an inclusion in CentOS Stream. It's also great to have it in Fedora Linux first as well.
And lastly, as a minor release of RHEL goes through various stages of development, changes may be postponed for a next iteration — once you get a review of your change, the respective maintainer should inform you about further steps.
If you want to contribute to CentOS Stream, you need to have an account in CentOS FAS.
3. Getting the repository
Once your account is set up, you can proceed to clone the respective package repository locally. The package repositories are right now located in two places:
Contributions via source-git are still being worked on so please be kind if things are not working as you expect - we'd be happy to get your feedback and improve. Please reach out if you have a question: either to the packit team or firstname.lastname@example.org.
3.1. Fork & clone
Once you located the repository in the web interface, fork it and clone it.
You'll be able to see 3 types of branches:
* c8 - this means there are no CentOS Stream changes and the package is tracking latest CentOS Linux 8 release. * c8s - CentOS Stream 8 * c9s - for the CentOS Stream 9 version.
4. Creating a change
This is the part where you can shine! There are two types of changes you can make:
1. Change the source code
2. Change packaging (spec file, additional sources such as downstream configuration files)
4.1. Submitting a merge request
We are using the standard git workflow you may know from upstream open source projects:
- Create a new local git branch
- Commit the change (if you are backporting a commit from upstream, please keep the upstream commit messages if possible)
- Push the branch to your fork
And finally open a merge request in GitLab
4.2. Dist-git vs. 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 source code - you need to execute %prep phase to see it.
With source-git, the sources are unpacked and downstream changes are layered on top as additional commits. The repositories don't contain upstream git history now, instead we are unpacking an archive for the corresponding upstream release and this is the first commit. For more details on how to work in a source-git repository, please head on to packit's documentation.
It's up to you to pick the preferred way of contributing: both dist-git and source-git are fine.
4.3. Submitting a change in a source-git repo
If you want to update packaging files (in SPECS directory), you can go ahead and change them - no special care is needed.
4.3.1. 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 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:
Now you need to annotate commit message with the respective change
We need this change in CentOS Stream patch_name: my-special-change.patch present_in_specfile: true Signed-off-by: Tomas Tomecek <email@example.com> --- 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 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 are in full control of the process.
4.3.2. Changing source code: packit takes care of patches
If packit does not find such metadata as defined above in a commit message:
- it adds a new patch entry in the spec file
- and generates a patch file from the respective commit
This is convenient but prone to errors. In case this method does not work, please set the metadata as described in the method above.
4.4. Submitting a change in a dist-git repo
The situation here is similar: packaging changes can be done directly, these files can be found in directories SOURCES and SPECS.
If you want to change source code, it's significantly different than doing this with source-git:
- the change has to be captured as a patch file
- the patch needs to be present in SOURCES directory
- and referenced in a spec file correctly (please make sure it applies cleanly)
4.5. After a pull request is created
When you submit a pull request for source-git, automation will pick up the change and build it - there will be RPMs with your change available so you can try them out or just make sure it builds fine.
Once your change is accepted, it will be marked with the label "accepted". Our automation will create a corresponding bugzilla with the patch attached and then it’s up to the RHEL maintainer to pick it up, commit and build internally so that it can land back into CentOS Stream - this process can take some time, so please be patient.
5. Get a review
In order for your change to land in RHEL and CentOS Stream, it needs to be reviewed and approved by the RHEL maintainer for the particular component. We are making sure behind the scenes they see your patch. If you are not getting any feedback feel free to reach out to #centos-devel on freenode.
As new changes are coming to CentOS Stream, there may be a need to rebase your pull request.