blob: eaadec1208a9bc350269c0c15f98f374652e6849 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# $Id: /local/youri/soft/trunk/lib/Youri/Upload/Action/Sign.pm 1543 2006-03-21T20:22:54.334939Z guillaume $
package Youri::Upload::Action::Link;
=head1 NAME
Youri::Upload::Action::Link - Noarch packages linking
=head1 DESCRIPTION
This action plugin ensures linking of noarch packages between arch-specific
directories.
=cut
use warnings;
use strict;
use Carp;
use File::Spec;
use base qw/Youri::Upload::Action/;
sub _init {
my $self = shift;
my %options = (
symbolic => 0, # use symbolic linking
@_
);
$self->{_symbolic} = $options{symbolic};
}
sub run {
my ($self, $package, $repository, $target, $define) = @_;
croak "Not a class method" unless ref $self;
# only needed for noarch packages
return unless $package->get_arch() eq 'noarch';
my $dest_dir = $repository->get_install_dir($package, $target, $define);
my (undef, $parent_dir, $relative_dir) = File::Spec->splitpath($dest_dir);
my $file = $package->get_file_name();
foreach my $other_dir (grep { -d } <$parent_dir/*>) {
next if $other_dir eq $dest_dir;
chdir $other_dir;
my $source_file = "../$relative_dir/$file";
if ($self->{_symbolic}) {
symlink $source_file, $file unless $self->{_test};
} else {
link $source_file, $file unless $self->{_test};
}
chdir '..';
}
}
=head1 COPYRIGHT AND LICENSE
Copyright (C) 2002-2006, YOURI project
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
=cut
1;
|