Pagure Dist Git Interactions With Packit

Packit is a CLI tool that helps developers auto-package upstream projects into Fedora operating system. You can use packit to continuously build your upstream project in Fedora. With packit you can create SRPMs, open pull requests in dist-git, submit koji builds and even create bodhi updates, effectively replacing the whole Fedora packaging workflow.

Packit interacts with Dist Git mainly by making pull requests (eg. with version bumps)

Packit Source Code

Possible Interactions

The following are a set of documented possible interactions between Pagure Dist Git and Packit

The DistGit class

  • Packit has a class named DistGit that interacts with dist-git and pagure-over-dist-git API. The logic covers git and pagure interaction, manipulation with content, spec files, patches and archives. One optional argument, “clone_path” is the path where the dist-git repo is cloned, this will be affected by a Dist Git deployment change. There are a number of methods in the class that interact with dist-git listed below.

  • Cloning the repo This method clones the dist-git repo for the selected package and returns the instance of the Dist Git class. Packit uses a wrapper, pkgtool that utilizes fedpkg clone method which builds the clone command from getting the fas username, directory, branch, and target path.

    • API Endpoint: /api/0/<namespace>/<repo>

  • Cloning the package This method clones the package from Dist Git, utilizing the same clone method in the pkgtool wrapper. Optional argument for the branch to checkout, if so, an additional API call is made to the endpoint below.

    • API Endpoint: /api/0/<namespace>/<package_name>

    • API Endpoint: /api/0/<namespace>/<package_name>/git/branches

  • Obtaining absolute path for the specfile Determines the absolute path for the specfile in Dist Git. Specfile path is built using the configured spec_dir_name, then f"{self.package_config.downstream_package_name}.spec"

    • API Endpoint: /api/0/<namespace>/<repo>

  • Updating branch Fetches the latest commits to the selected branch. Needs to hit the same API Endpoint as the package cloning method. Packit has a LocalProject class That represents the cloned repo, the fetch method is defined there Fetch method

    • API Endpoint: /api/0/<namespace>/<package_name>/git/branches

  • Synchronizing Access Control Lists Synchronizes ACLs between the Dist Git project and its fork. Users and groups with commit or higher access to the original project will gain commit access to the fork. Users and groups without commit or higher access to the original project will be removed from the fork. Utilizes ogr.abstract methods in the GitProject class

    • API Endpoint: /api/0/<namespace>/<package_name>/hascommit

    • API Endpoint: /api/0/<namespace>/<package_name>/git/modifyacls

  • Pushing to a fork repository Push changes to a fork of the Dist Git repo after checking if user has access. Hits the same API Endpoint as Cloning the repo above.

    • API Endpoint: /api/0/<namespace>/<package_name>

  • Creating pull request Creates a Dist Git PR using the requested branches

    • API Endpoint: /api/0/<namespace>/<package_name>/pull-request/new

  • Downloading upstream tarballs Fetch archives for the current upstream release defined in Dist Git’s spec. Again, uses the fedpkg wrapper packit/pkgtool.py, specifically the sources method in pkgtool.py

  • Downloading source files Downloads source files from the lookaside cache. Using the the sources method in packit/pkgtool.py

  • Uploading the source files to the lookaside cache Uploads files (archives) to the lookaside cache. Uses the new_sources method in pkgtool.py method in packit/pkgtool.py

  • Checking if lookaside cache is already populated Checks whether the archive is already uploaded to the lookaside cache, using a wrapper around lookaside cache lookaside.py This returns True if the archive is present in the lookaside cache, False if not.

Changes proposed

In order to switch out Pagure Dist Git for an alternative that provides a relatively compatible API pattern, the following changes must be made in the places mentioned below.

Necessary

  • Packit uses a number of URLs that point to dist-git mentioned above. If the URL should change, they would need to be updated.

  • Packit team has created a library that provides the same API for various git forges, so the proposed changes above would be necessary for OGR if another git forge is used. Packit/ogr

Unnecessary

  • none