Test::AutoBuild::Stage::PackageCopier - Copy generated packages to a distribution site


Test-AutoBuild documentation Contained in the Test-AutoBuild distribution.

Index


Code Index:

NAME

Top

Test::AutoBuild::Stage::PackageCopier - Copy generated packages to a distribution site

SYNOPSIS

Top

  use Test::AutoBuild::Stage::PackageCopier




DESCRIPTION

Top

This module provides a means to copy generated packages to a distribution site (eg web site, or FTP server).

METHODS

Top

AUTHORS

Top

Dennis Gregorovic <dgregorovic@alum.mit.edu> Daniel P. Berrange <dan@berrange.com>

COPYRIGHT

Top

SEE ALSO

Top

perl(1), Test::AutoBuild::Stage, Test::AutoBuild::Stage::Copier


Test-AutoBuild documentation Contained in the Test-AutoBuild distribution.
# -*- perl -*-
#
# Test::AutoBuild::Stage::PackageCopier by Daniel P. Berrange <dan@berrange.com>
#
# Copyright (C) 2002-2005 Daniel P. Berrange <dan@berrange.com>
#
# 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: PackageCopier.pm,v 1.10 2007/12/08 17:35:16 danpb Exp $

package Test::AutoBuild::Stage::PackageCopier;

use base qw(Test::AutoBuild::Stage::Copier);
use warnings;
use strict;
use File::Path;
use Log::Log4perl;


sub handle_directory {
    my $self = shift;
    my $runtime = shift;
    my $directory_name = shift;
    my $directory_attrs = shift;

    my @modules = $runtime->modules();

    my $log = Log::Log4perl->get_logger();

    for my $name (@modules) {
	if (!exists $directory_attrs->{'module'} || $directory_attrs->{'module'} eq $name) {
	    my $packages = $runtime->module($name)->packages();
	    foreach my $filename (keys %{$packages}) {
		if (!exists $directory_attrs->{'package_type'} ||
		    $directory_attrs->{'package_type'} eq $packages->{$filename}->type()->name()) {
		    mkpath($directory_name);
		    $log->info("Copy $filename $directory_name");
		    Test::AutoBuild::Lib::copy_files($filename, $directory_name, { 'link' => 1 });
		}
	    }
	}
    }
}

1 # So that the require or use succeeds.

__END__