Contributing to CentOS Stream
If you want to contribute to CentOS Stream, you need to have an account in CentOS FAS.
2. 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 in beta 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 directly to the product owner or email@example.com.
2.1. Fork & clone
Once you located the repository in the web interface, fork it and clone it.
$ git clone ssh://firstname.lastname@example.org/forks/$user/rpms/rpm.git
$ git clone ssh://email@example.com/forks/$user/source-git/rpm.git
Don’t forget to set up the upstream remote for the main repository (NOT upstream project):
$ git remote add upstream ssh://firstname.lastname@example.org/rpms/rpm.git
$ git remote add upstream ssh://email@example.com/source-git/rpm.git
Once cloned locally, you should check out the c8s branch. If there is no such branch, locate c8 - this means there are no CentOS Stream changes and the package is tracking latest CentOS Linux 8 release.
3. 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)
3.1. Submitting a pull 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 pull request via Pagure web interface
3.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.
3.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.
3.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 <firstname.lastname@example.org> --- 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.
3.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.
3.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)
3.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.
4. 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.
6. Will it get accepted or rejected?
Just to be clear, your PR is never going to be merged, even when accepted. It needs to land in the development version of RHEL first so that it can be pulled back to CentOS Stream. Once that happens, you'll be able to see it while being set as the contributor of the particular change.