Introducing dgroc
By Pierre-Yves on Thursday, March 20 2014, 14:24 - Général - Permalink
dgroc for ''Daily Git Rebuild On Copr''.
copr is a build system made publicly available to Fedora contributors and allowing to provide package repository for packages that are not or cannot be part of the standard Fedora repositories. There are multiple reasons a package is allowed in copr but not in the standard repositories, for examples:
- bundled libraries in the sources that have not been cleaned
- unstable version
- version introducing too many changes to be introduced to a stable Fedora release
- packages that are in the process of being integrated into Fedora but have not yet been approved
The use-case for dgroc is the second point on this list: unstable version
.
I know some of us out here are crazy testers and for two projects I was interested in having daily builds, this allows easy install/update (just run yum/dnf) and easy testing.
What dgroc does is providing an easy way to automatically build packages on copr from a git repository.
It works fairly simply:
- Create a
~/.config/dgroc
file and include in it some basic, generic information that will be needed either to update the spec file, make the source rpm available or build on copr:
[main] username = me email = my_email@example.com copr_url = https://copr.fedoraproject.org/ upload_command = cp %s /var/www/html/subsurface/ upload_url = http://my_server/subsurface/%s #no_ssl_check = True # no longer need now that copr has a valid ssl cert
- Then for each project you have to define at least three information, for example for subsurface:
[subsurface] git_url = git://subsurface.hohndel.org/subsurface.git git_folder = /tmp/subsurface/ spec_file = ~/dgroc/subsurface.spec
Eventually, you can specify a patch_files
argument that will be a comma-separated list of patches that are need to build the project.
All what dgroc does from there is:
- clone the git repo if it is not already in the filesystem
- run a git pull to get the latest changes
- generate a new tarball (in the rpm %_sourcedir)
- update the spec file (release, source0 and changelog)
- generate the source rpm
- move that source rpm somewhere to make it available to copr (see the
upload_command
in the config file - start the build on copr
I have been running dgroc for both subsurface and guake and it seems to work fine :)
The project isn't packaged yet but I thought I would announce it in case there are people interested in testing it and reporting bugs and RFE.
Hope you like it! :)
Comments
Thanks, that's exactly what I want to script for myself for a long time. How the spec file looks, can I use some macros that would evaluate to git commit hash?
Hi Miro,
The spec looks just like what you would use in Fedora.
It will not use any macro as it will override the current Release and Source0
For example
Release: 2%{?dist}
and
Source0: http://subsurface.hohndel.org/downl...
become:
Release: 2.20140325gitdd0c995f%{?dist}
and
Source0: subsurface-dd0c995f.tar
The tricky part is really (imho) to change:
%setup -q -n Subsurface-%{version}
into
%setup -q -n subsurface
otherwise it won't build correctly.
Also note that for testing dgroc as a `--srpm-only` that just update the spec and build the source-rpm
(you may want to change the git hash in the release after that to get it to build on copr)