| Test-AutoBuild documentation | Contained in the Test-AutoBuild distribution. |
Test::AutoBuild::Stage::Yum - Create an index for Yum package management tool
use Test::AutoBuild::Stage::Yum
my $stage = Test::AutoBuild::Stage::Yum->new(name => "yum",
label => "Create yum index",
options => {
directory => "/var/lib/builder/public_html/dist",
parameters => "-d -s -n",
});
$stage->run($runtime);
This module invokes the yum-arch(8) command to generate an index of RPM
packages generated during the build. The index enables use of the yum(8)
command to install packages generated by the builder. The yum-arch(8)
command is expected to be found in the $PATH.
In addition to the standard parameters defined by the Test::AutoBuild::Stage
module, this module accepts two entries in the options parameter:
The full path to the directory containing RPMs to be indexed. If this option
is not specified, then the directories option must be set.
An array of paths to directories containing RPMs to be indexed. If this option
is not specified, then the directory option must be set.
A string of command line arguments to be passed to the yum-arch command,
see the yum-arch(8) manual page for details of possible values.
{
name = yum
label = Update Yum Repository
module = Test::AutoBuild::Stage::Yum
critical = 0
options = {
directory = /var/lib/builder/public_html/dist
parameters = -d
}
}
For each directory defined in the options parameter, this method will
run the yum-arch command to generate the index.
Daniel Berrange <dan@berrange.com> Dennis Gregorovic <dgregorovic@alum.mit.edu>
Copyright (C) 2004 Red Hat, Inc.
perl(1), Test::AutoBuild::Stage, yum(8), yum-arch(8)
| Test-AutoBuild documentation | Contained in the Test-AutoBuild distribution. |
# -*- perl -*- # # Test::AutoBuild::Stage::Yum # # Daniel Berrange <dan@berrange.com> # Dennis Gregorovic <dgregorovic@alum.mit.edu> # # Copyright (C) 2004 Red Hat, Inc. # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # # $Id: Yum.pm,v 1.9 2007/12/08 17:35:16 danpb Exp $
package Test::AutoBuild::Stage::Yum; use base qw(Test::AutoBuild::Stage); use warnings; use strict; use Log::Log4perl;
sub process { my $self = shift; my $runtime = shift; my $log = Log::Log4perl->get_logger(); my $directories = $self->option('directories'); if (!defined $directories) { my $dir = $self->option("directory"); $directories = [$dir]; } if (defined $directories) { foreach my $directory (@{$directories}) { my $dirs = Test::AutoBuild::Lib::_expand_standard_macros([[ "", $directory, {} ]], $runtime); foreach my $expanded_dir (@{$dirs}) { if (-d $expanded_dir->[1]) { my $parameters = $self->option('parameters') || ""; my $cmdopt = $self->option("command") || {}; my $mod = $cmdopt->{module} || "Test::AutoBuild::Command::Local"; my $opts = $cmdopt->{options} || {}; eval "use $mod;"; die "cannot load $mod: $!" if $@; my @cmd = ("yum-arch", ref($parameters)? @{$parameters} : ($parameters), $expanded_dir->[1]); my $c = $mod->new(cmd => \@cmd, dir => $expanded_dir->[1], options => $opts); my ($output, $errors); my $status = $c->run(\$output, \$errors); $output = "" unless defined $output; $errors = "" unless defined $errors; my $log = Log::Log4perl->get_logger(); $log->debug("Output: [$output]") if $output; $log->debug("Errors: [$errors]") if $errors; die "command '" . join("' '", @cmd) . "' exited with status $status\n$errors" if $status; } else { $log->warn("directory does not exists: " . $expanded_dir->[1]); } } } } } 1 # So that the require or use succeeds. __END__