++ed by:
1 non-PAUSE user
Author image Pascal Terjan
and 1 contributors


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


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


This module updates rpm packages. When given an explicit new version, it updates the spec file, and downloads new sources automatically. When not given a new version, it just updates the spec file.

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.


The following YAML-format configuration files are used:

the system configuration file is /etc/youri/updater.conf
the user configuration file is $HOME/.youri/updater.conf

Allowed directives are the same as new method options.


Julien Danjou <danjou@mandriva.com>

Michael Scherer <misc@mandriva.org>

Guillaume Rousse <guillomovitch@mandriva.org>


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.



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

Available options:

verbose $level

verbosity level (default: 0).

check_new_version <true/false>

check new version is really new before updating spec file (default: true).

topdir $topdir

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

sourcedir $sourcedir

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

release_suffix $suffix

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

srpm_dirs $dirs

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

timeout $timeout

timeout for file downloads (default: 10)

agent $agent

user agent for file downloads (default: youri-package-updater/$VERSION)

alternate_extensions $extensions

alternate extensions to try when downloading source fails (default: tar.gz, tgz, zip)

sourceforge_mirrors $mirrors

mirrors to try when downloading files hosted on sourceforge (default: ovh, mesh, switch)

url_rewrite_rules $rules

list of rewrite rules to apply on source tag value for computing source URL when the source is a local file, as hashes of two regexeps

archive_content_types $types

hash of lists of accepted content types when downloading archive files, indexed by archive extension


changelog message for new version (default: New version %%VERSION)


changelog message for new release (default: Rebuild)


update_from_repository($name, $version, %options)

Update package with name $name to version $version.

Available options:

release => $release

Force package release, instead of computing it.

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).

spec_line_callback $callback

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

spec_line_expression $expression

perl expression (or list of expressions) to evaluate for each spec file line (default: none). Takes precedence over previous option.

changelog_entries $entries

list of changelog entries (default: empty).

update_from_source($source, $version, %options)

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

See update_from_repository() for available options.

update_from_spec($spec, $version, %options)

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

See update_from_repository() for available options.