English Chinese (Simplified)
How to Publish your Software on Copr, Fedora's User Repository
This is a short tutorial on how to create and maintain a Copr repository for your software in an automated fashion. It assumes some basic familiarity with Git & how to create a RPM package.
In this guide, we'll
create a RPM package for a program
create a Copr repository and publish the program to it
set up automatic management of program version, package release and package changelog
set up automatic building of new package versions
The aim is to let you keep your software up-to-date in Copr without ever having to interact with anything other than your software's git repository.
You can set up similar automation when packaging someone else's program, i.e. building from a downloaded source tarball. The needed modifications are described xref:#_packaging_from_source_tarballs[at the end of the tutorial].
Prerequisites
The following is needed:
Our program's source in a publicly available git repository somewhere. This tutorial uses a simple example program - hellocopr - to demonstrate the process. The program and all files referenced in this guide can be found in the link:https://pagure.io/copr-tito-quickdoc[project's git repository]. It's a very simple (& pointless) python program with a setuptools installer:
``` user@host ~/copr-tito-quickdoc % ls doc LICENSE README.md requirements.txt setup.py src
user@host ~/copr-tito-quickdoc % ls src/hellocopr colors.py hellocopr.py __init__.py ```
A Fedora (FAS) account in order to be able to create repositories on Copr. This tutorial's demo repository can be found link:https://copr.fedorainfracloud.org/coprs/lcts/hellocopr/[here].
`tito` installed on your system. link:https://github.com/rpm-software-management/tito[Tito] is capable of a lot of advanced automation for package creation, most of which we won't need here. Check out its documentation to learn more.
A specfile for our program. For more information on how to create one, refer to xref:creating-rpm-packages.adoc[Creating RPM packages] and xref:create-hello-world-rpm.adoc[How to Create a GNU Hello World RPM Package] or adapt this tutorial's link:https://pagure.io/copr-tito-quickdoc/blob/master/f/doc/hellocopr.spec.annotated[annotated example specfile].
You can follow along with this tutorial by cloning or forking the repository and checking out the `initial` tag. This will put the repository in the state just before the next step. The repo's commit history matches the steps followed in this tutorial.
Step 1: Creating the package using tito
Copy link:https://pagure.io/copr-tito-quickdoc/c/00963ac9339a13eefd2ab1ca42b1f72af12d3cac?branch=master[the spec file] into the project's base directory. A few changes should be made before proceeding: