NAME

Youri::Package::RPM::Updater - Update RPM packages automatically

SYNOPSIS

my $updater = Youri::Package::RPM::Updater->new();
$updater->build_from_source('foo-1.0-1.src.rpm', '2.0');
$updater->build_from_spec('foo.spec', '2.0');
$updater->build_from_repository('foo', '2.0');

DESCRIPTION

This module automatises rpm package building. When given an explicit new version, it downloads new sources automatically, updates the spec file and builds a new version. When not given a new version, it just updates the spec file a builds a new release.

Warning, not every spec file syntax is supported. If you use specific syntax, you'll have to ressort to additional processing with explicit perl expression to evaluate for each line of the spec file.

Here is version update algorithm (only used when building a new version):

  • find the first definition of version

  • replace it with new value

Here is release update algorithm:

  • find the first definition of release

  • if explicit newrelease parameter given:

    • replace value

  • otherwise:

    • extract any macro occuring in the leftmost part (such as %mkrel)

    • extract any occurence of release_suffix option in the rightmost part

    • if a new version is given:

      • replace with 1

    • otherwise:

      • increment by 1

In both cases, both direct definition:

Version:    X

or indirect definition:

%define version X
Version:    %{version}

are supported. Any more complex one is not.

CLASS METHODS

new(%options)

Creates and returns a new MDV::RPM::Updater object.

Avaiable options:

topdir $topdir

rpm top-level directory (default: rpm %_topdir macro).

sourcedir $sourcedir

rpm source directory (default: rpm %_sourcedir macro).

options $options

rpm build options.

download true/false

download new sources (default: true).

update_revision true/false

update spec file revision (release/history) (default: true).

update_changelog true/false

update spec file changelog (default: true).

build_source true/false

build source package (default: true).

build_binaries true/false

build binary packages (default: true).

build_requires_callback $callback

callback to execute before build, with build dependencies as argument (default: none).

build_results_callback $callback

callback to execute after build, with build packages as argument (default: none).

spec_line_callback $callback

callback to execute as filter for each spec file line (default: none).

new_source_callback $callback

callback to execute before build for each new source (default: none).

old_source_callback $callback

callback to execute before build for each old source (default: none).

release_suffix $suffix

suffix appended to numerical value in release tag. (default: none).

changelog_entries $entries

list of changelog entries (default: empty).

srpm_dirs $dirs

list of directories containing source packages (default: empty).

INSTANCE METHODS

build_from_repository($name, $version, $release)

Update package with name $name to version $version and release $release.

build_from_source($source, $version, $release)

Update package with source file $source to version $version and release $release.

build_from_spec($spec, $version, $release)

Update package with spec file $spec to version $version and release $release.

AUTHORS

Julien Danjou <danjou@mandriva.com>

Michael Scherer <misc@mandriva.org>

Guillaume Rousse <guillomovitch@mandriva.org>

COPYRIGHT AND LICENSE

Copyright (c) 2003-2007 Mandriva.

Permission to use, copy, modify, and distribute this software and its documentation under the terms of the GNU General Public License is hereby granted. No representations are made about the suitability of this software for any purpose. It is provided "as is" without express or implied warranty. See the GNU General Public License for more details.