Log in

No account? Create an account

Previous Entry | Next Entry

Fedora::Rebuild tool is a project old few years. It evolved from first scripts to proper tool. It's developed by Petr Písař, who started with nifty script for rebuild of set of Perl packages. Usually packages or whole distribution are rebuild according to alphabetical order of packages. This approach doesn't work well when you have huge number of packages with dependency cycles and you need to boostrap it. The tool was developed for Perl, but it might be used for other defined sets of packages. If you've tried on a group of packages or even whole distribution, let us know how it worked.

How rebuild with bootstraping works
At least rebuild of Perl packages is done annually with new release of Perl, which might have some incompatibilities. Every Perl related package should contain a macro, which says which version was used for build of the package.

Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

All those packages are marked for rebuild (~2500 in Fedora). Firstly is Fedora::Rebuild tool counting dependencies (few minutes). Surprisingly, there doesn't exist any tool, which provide similar feature. After dependencies are solved, only packages with satisfied dependencies are built. Usually, only main perl package and perl-srpm-macros can be rebuild in first round, because they don't depend on anything else.
Even after few rounds, the rebuild can't continue because of unresolvable cyclic dependencies. Cycles can be broken by bootstraping macros in specfiles. The bootstrap macro is defined in perl-srpm-macros, which is always tagged into the buildroot. Breaking cycles is lot of manual work, the best way how to do it is look on visualisation and try to break them. When everything had passed, then is needed to undefine macro in perl-srpm-macros and run rebuild again. Everything should pass in one final round.

Example of breaking cycles for rebuild:

%if !%{defined perl_bootstrap}
BuildRequires: perl(File::Find::Rule) >= 0.32
BuildRequires: perl(Test::More) >= 0.47
BuildRequires: perl(Test::Script) >= 1.03

%if !%{defined perl_bootstrap}
make test

Set up Fedora::Rebuild

Rebuild has options, which can be set in /usr/bin/rebuildperl or you can create copy of this file or copy the configuration only as ./rebuildperlrc and modify. There are some known bugs like dist-git is taking only 10 connections, so it's not wise to set threads to more than 10. It's not very user friendly nor documented, but at least documentation is in todo.

my %config = (
# lists of packages for rebuild, list of failed ...
all => 'all',
    done => 'done',
    failed => 'failed',

# define work directory
workdir => 'workdir',
    repodir => 'testrepo',
    repourls => [
        'http://lab.com/pub/fedora/linux/development/rawhide/x86_64/os/' ],

# for mirrored repos, simple 'build' is for direct access to koji repos
mock_install_group => 'buildsys-build',
    architecture => 'x86_64',
    anonymous => 0,
    dist => 'rawhide',
    target => 'rawhide',
    message => 'Perl mass rebuild',

# restrict to list of dependencies
buildrequiresfilter => sub { $_[0] !~ /^\s*perl\(/ },
# rebuild can run in koji, mock or on local
mode => 'koji',
    threads => 16,
    loadthreads => 4,
    selectthreads => 1,

# how many failures must happened before rebuild stop
failurelimit => 8,
    ordered => 1,
    verbosesolver => 1


Rebuild of Perl packages in Fedora takes about 4 days of quad core cpu. Good luck with compiling!