PAR-Dist
view release on metacpan or search on metacpan
lib/PAR/Dist.pm view on Meta::CPAN
: $Config::Config{installsitelib}),
$sources{inst_archlib} => $Config::Config{installsitearch},
$sources{inst_bin} => $Config::Config{installbin} ,
$sources{inst_script} => $Config::Config{installscript},
$sources{inst_man1dir} => $Config::Config{installman1dir},
$sources{inst_man3dir} => $Config::Config{installman3dir},
};
# Included for future support for ${flavour}perl external lib installation
# if ($Config::Config{flavour_perl}) {
# my $ext = File::Spec->catdir($dir, 'blib', 'ext');
# # from => to
# $sources{inst_external_lib} = File::Spec->catdir($ext, 'lib');
# $sources{inst_external_bin} = File::Spec->catdir($ext, 'bin');
# $sources{inst_external_include} = File::Spec->catdir($ext, 'include');
# $sources{inst_external_src} = File::Spec->catdir($ext, 'src');
# $target->{ $sources{inst_external_lib} } = $Config::Config{flavour_install_lib};
# $target->{ $sources{inst_external_bin} } = $Config::Config{flavour_install_bin};
# $target->{ $sources{inst_external_include} } = $Config::Config{flavour_install_include};
# $target->{ $sources{inst_external_src} } = $Config::Config{flavour_install_src};
# }
# insert user overrides
foreach my $key (keys %$user) {
my $value = $user->{$key};
if (not defined $value and $key ne 'packlist_read' and $key ne 'packlist_write') {
# undef means "remove"
delete $target->{ $sources{$key} };
}
elsif (exists $sources{$key}) {
# overwrite stuff, don't let the user create new entries
$target->{ $sources{$key} } = $value;
}
}
# apply the automatic inst_lib => inst_archlib conversion again
# if the user asks for it and there is an archlib in the .par
if ($user->{auto_inst_lib_conversion} and $par_has_archlib) {
$target->{inst_lib} = $target->{inst_archlib};
}
return $target;
}
sub _directory_not_empty {
require File::Find;
my($dir) = @_;
my $files = 0;
File::Find::find(sub {
return if $_ eq ".exists";
if (-f) {
$File::Find::prune++;
$files = 1;
}
}, $dir);
return $files;
}
=head2 sign_par
Digitally sign a PAR distribution using C<gpg> or B<Crypt::OpenPGP>,
via B<Module::Signature>.
=cut
sub sign_par {
my %args = &_args;
_verify_or_sign(%args, action => 'sign');
}
=head2 verify_par
Verify the digital signature of a PAR distribution using C<gpg> or
B<Crypt::OpenPGP>, via B<Module::Signature>.
Returns a boolean value indicating whether verification passed; C<$!>
is set to the return code of C<Module::Signature::verify>.
=cut
sub verify_par {
my %args = &_args;
$! = _verify_or_sign(%args, action => 'verify');
return ( $! == Module::Signature::SIGNATURE_OK() );
}
=head2 merge_par
I<Note:> Since version 0.32 of PAR::Dist, this function requires a YAML
reader. The order of precedence is:
YAML:XS YAML YAML::Syck YAML::Tiny
Merges two or more PAR distributions into one. First argument must
be the name of the distribution you want to merge all others into.
Any following arguments will be interpreted as the file names of
further PAR distributions to merge into the first one.
merge_par('foo.par', 'bar.par', 'baz.par')
This will merge the distributions C<foo.par>, C<bar.par> and C<baz.par>
into the distribution C<foo.par>. C<foo.par> will be overwritten!
The original META.yml of C<foo.par> is retained, but augmented with any
C<provides>, C<requires>, C<recommends>, C<build_requires>, and
C<configure_requires> sections from the other C<.par> files.
=cut
sub merge_par {
my $base_par = shift;
my @additional_pars = @_;
require Cwd;
require File::Copy;
require File::Path;
require File::Find;
# parameter checking
if (not defined $base_par) {
croak "First argument to merge_par() must be the .par archive to modify.";
}
if (not -f $base_par or not -r _ or not -w _) {
croak "'$base_par' is not a file or you do not have enough permissions to read and modify it.";
}
foreach (@additional_pars) {
if (not -f $_ or not -r _) {
croak "'$_' is not a file or you do not have enough permissions to read it.";
}
}
# The unzipping will change directories. Remember old dir.
( run in 0.620 second using v1.01-cache-2.11-cpan-df04353d9ac )