DEV Community

Priscila Gutierres
Priscila Gutierres

Posted on • Edited on

A recipe made to create your first PR for the Fedora Project

Step 0: Creating your Fedora account and installing Fedora

Step 1: Set up your Fedora environment

I strong recommend you to install the development tools group:

dnf install @development-tools
Enter fullscreen mode Exit fullscreen mode

Step 2: Find some package needing an update

  • First of all, you have to create your Bugzilla account When a package needs an update, an automatic bz is created, so you can use a query like this one below:

Image description

  • Then, clone it using fedpkg. For example, for python-pluggy we have:
fedpkg clone --anonymous python-pluggy
Enter fullscreen mode Exit fullscreen mode

Step 3: Making your own changes

It didn't work for me cloning the project directly from my own fork, I had problems when trying to upload my changes.

cd ./python-pluggy
git remote remove origin
Enter fullscreen mode Exit fullscreen mode

Then, add your remote origin

git remote add origin https://src.fedoraproject.org/forks/<your_fedora_user>/rpms/python-pluggy.git
Enter fullscreen mode Exit fullscreen mode
  • Check the project's github page. In this case,looking at the Changelog, the latest version is 1.3.0 .

  • Open the specfile with your favorite editor:

cd ./python-pluggy
code python-pluggy.spec
Enter fullscreen mode Exit fullscreen mode

Change the Version string:

Version:        1.3.0
Enter fullscreen mode Exit fullscreen mode

You also need to change the Release string to 1, because is the first build of this new version:

Release:        1%{?dist}
Enter fullscreen mode Exit fullscreen mode

Now we are going to download the sources to create our local build:

spectool -g <your_package>.spec
Enter fullscreen mode Exit fullscreen mode

Create your local mockbuild:

fedpkg mockbuild
Enter fullscreen mode Exit fullscreen mode

Step 4: Checking results & troubleshooting

If you get an output like that:

(...)
Finish: build phase for python-pluggy-1.3.0-1.fc40.src.rpm
INFO: Done(/home/priscila/Fedora/packages/fedpkg/python-pluggy/python-pluggy-1.3.0-1.fc40.src.rpm) Config(fedora-rawhide-x86_64) 0 minutes 30 seconds
INFO: Results and/or logs in: /home/priscila/Fedora/packages/fedpkg/python-pluggy/results_python-pluggy/1.3.0/1.fc40
INFO: Cleaning up build root ('cleanup_on_success=True')
Start: clean chroot
Finish: clean chroot
Finish: run
Enter fullscreen mode Exit fullscreen mode

Go to the next step :-)

Otherwise, is time to debug what is going on.
Common issues are:

  • A new BuildRequirement is needed: if apparently a package is missing during the build time, check for new dependencies in the Changelog.

  • A test is failing: in this case, you need to debug the source code. Is absolutely necessary have a strong knowledge about the programming languages in the package you are working on
    If nothing works and you are still in trouble.
    Note that some tests are not supported by koji during the build time.

  • A new patch is needed: this article covers this case.

Step 5: Finish editing the specfile

  • Now that everything is working as expected, you have to add the changelog to the specfile:
%changelog
* Tue Oct 17 2023 Priscila Gutierres <pgutier@redhat.com> - 1.3.0-1
- Update to 1.3.0.
Enter fullscreen mode Exit fullscreen mode
  • Add the sources:
fedpkg new-sources --offline pluggy-1.3.1.tar.gz
Enter fullscreen mode Exit fullscreen mode
  • Add and commit the changes using git

Step 6: Creating your Pull Request

As a non-maintainer, you can't upload the sources, so when creating your PR, the checking pipeline will fail.
To fix it, ask the maintainer to upload the sources.
And.. Congrats! You have your first Fedora contribution :-)

Top comments (0)