2022-07-14 11:51:41

Packit - how to create pull-request for Fedora from upstream

I am a contributor to fedora-license-data upstream, and I investigated what will be the easiest way to build a new version of the Fedora package. I ended up using Packit for that. With just one command, it creates a pull request in src.fedoraproject.org.

At the start, we have to configure the upstream. I run:

$ packit init

in the upstream repository. This command created .packit.yaml with

# See the documentation for more information: 
# https://packit.dev/docs/configuration/ 

specfile_path: fedora-license-data.spec 

# add or remove files that should be synced 
   - fedora-license-data.spec 
   - .packit.yaml 
# name in upstream package repository or registry (e.g. in PyPI) 
upstream_package_name: fedora-license-data 
# downstream (Fedora) RPM package name 
downstream_package_name: fedora-license-data

The upstream uses tags to mark a release. The commits look like this:

*  e960257 (tag: v1.0) Merge branch 'noarch' into 'master'

I put in .packit.yaml one line to configure how we do a release:

upstream_tag_template: "v{version}"

The packit.yaml is highly configurable and you can see result of my .packit.yaml.

Now I can run command:

# packit propose-downstream

If you did not git-push it, you have to run:

# packit propose-downstream --local-content

For some unknown reason, Packit still cannot figure out the version automatically. So I had to run:

# packit propose-downstream --local-content . 1.0 --dist

This command creates PR for all branches. To limit for just some branch(es) you can use the command line option --dist-git-branch rawhide,f36.

You can see the resulting PR here

By the way, the Packit team is working on a feature where you can configure this workflow in dist-git, and you will not need to modify the upstream - if you are not a direct upstream contributor.

Posted by Miroslav Suchý | Permanent link
comments powered by Disqus