copr is a build system for everybody to create rpm packages; you give copr a source rpm package (.src.rpm) or a spec file (.spec), and copr builds it into rpm packages (.rpm) and make a yum repo for you to install them;

copr is useful for continuous integration, and to provide a custom yum repo; it is also very useful when you are writing a spec file and need to repeatedly test whether it works or not;

quickstart

to use copr, you need to have a FAS account; after that, you can create build project on its webpage; copr also provides a nice command line tool copr-cli;

the steps:

  1. setup a FAS account here;

  2. log in into copr;

  3. go to https://copr.fedorainfracloud.org/api/;

  4. copy the generated auth token into ~/.config/copr;

  5. install copr-cli tool:

    sudo dnf install copr-cli
    
  6. to create your first project, run:

    copr-cli create first-project --chroot fedora-rawhide-x86_64
    

    where first-project is the project name, rawhide is release, x86_64 is arch; you can use other release and arch provided by copr, such as:

    copr-cli create first-project --chroot fedora-29-x86_64
    
  7. to build your first project, run:

    copr-cli build first-project {.src.rpm}
    

also, you can build multiple source rpms in a single copr project:

copr-cli create {project} --chroot fedora-{release}-{arch}
copr-cli build {project} {0.src.rpm}
copr-cli build {project} {1.src.rpm}
copr-cli build {project} {2.src.rpm}

tips for writing spec

suppose you are writing a spec file and you need to continuously test it; you can cd into ~/rpmbuild and loop this cycle until everything works:

  • fix spec;

  • build source rpm on local:

    rpmbuild -bs SPECS/{.spec}
    

    this outputs a source rpm in ~/rpmbuild/SRPMS/;

  • build rpm on copr:

    copr-cli build {project} SRPMS/{.src.rpm}
    

check build status

you can watch your build status online; to see all your builds, go to this page:

it lists your builds and their status; click a build to check details; to see logs, click the Directory link and jump to a result page like this:

click into the build id, there is a file builder-live.log; therein you can see how everything is going; if the build fails, there will be more files to let you know what happened; if the build succeeds, there will be rpm packages for you to install; if you go back to the build page, you can also download packages there; furthermore, it gives you a yum repo at an address like this:

so you can add this repo and install packages using dnf;