2013-12-29 19:35:03

How to build in Copr

Is your project is released under Good License? Are you upstream of some project? Do you want to build packages for continuous integration or simply to provide yum repos for user for your project? Then you want to build your project in Copr. I will show you how to do it.

I would say that building using WebUI is intuitive and documented on Copr wiki. So I will focus on command line interface (CLI).

yum install copr-cli

Then go to Copr WebUI. Log in. And go to API page. Copy information from this page and create file ~/.config/copr with content:

[copr-cli]
username = your_fas_login
login = Y57wcg==##fkfaxbkjhuoiebfafadl
token = vbfseelqdebzedukgombekmuvbkqwo

You then may want to restrict access to this credentials:

chmod go-rw ~/.config/copr

And now you can create new project:

copr-cli create --chroot epel-6-i386 --chroot epel-6-x86_64 \\
--chroot fedora-20-i386 --chroot fedora-20-x86_64 \\
--description 'demo repository' \\
--instructions 'do not try this, I am just doing demo for blogpost' \\
demo

This will create new project msuchy/demo (msuchy is my FAS name). Your project will carry your FAS name, therefore there can be plenty of projects with the same name.

Now you need to create SRPM package. And put it somewhere on internet. In my case I do:

scp copr-1.19-1.fc20.src.rpm miroslav.suchy.cz:www/copr/

and this package is then available on URL http://miroslav.suchy.cz/copr/ Now I can run:

copr-cli build demo http://miroslav.suchy.cz/copr/copr-1.19-1.fc20.src.rpm

And it will build this src.rpm package in project msuchy/demo for all configured chroots and will provide yum repos for all those chroots. So we are done.

Few notes:

  • You can submit more src.rpm files at once but I do not recommend it. You will lost the nice overview of Monitor tab in WebUI, because if you submit more src.rpm at once and one of them fail. Copr will think that all of them failed.
  • Once build succeed, it is available in buildroot and you can BuildRequire it in next builds.

If you use Tito (I wrote about Tito in previous entry) you can automate your set up little bit more (For Fedora 20 please install tito from updates-testing).

In your project git repo create file rel-eng/releasers.conf with content like:

[copr-msuchy]
releaser = tito.release.CoprReleaser
project_name = demo
upload_command = scp %(srpm)s miroslav.suchy.cz:www/copr/
remote_location = http://miroslav.suchy.cz/copr/

upload_command can be nearly anything. It will be executed as-is right after substituion of src.rpm file name. And (now I'm assuming that you have rel-eng/tito.props configured to your needs) then you can just run:

tito release copr-msuchy

and tito will:

  1. create src.rpm from last tag
  2. execute upload_command. I.e. upload src.rpm to my personal web.
  3. submit this src.rpm to Copr.

If you need to build from last commit (e.g. because of testing) add to rel-eng/releasers.conf something like this:

[copr-msuchy-test]
releaser = tito.release.CoprReleaser
project_name = demo
upload_command = scp %(srpm)s miroslav.suchy.cz:www/copr/
remote_location = http://miroslav.suchy.cz/copr/
builder.test = 1

And command:

tito release copr-msuchy-test

will create testing src.rpm from last git commit, upload it to your web and submit to Copr.


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