/usr/bin/mcpani is in libcpan-mini-inject-perl 0.35-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
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 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 | #!/usr/bin/perl -w
use strict;
use Pod::Usage 1.12;
use Getopt::Long;
use YAML qw( Load );
use CPAN::Mini::Inject;
use Env;
use File::Slurp 'write_file';
use File::Temp;
our $VERSION = '0.35';
our %options = ();
sub print_version {
printf( "mcpani v%s, using CPAN::Mini::Inject v%s and Perl v%vd\n",
$VERSION, $CPAN::Mini::Inject::VERSION, $^V );
}
sub chkactions {
for my $action ( qw(add update mirror inject) ) {
return 1 if ( $options{actionname} eq $action );
}
return 0;
}
sub setsub {
$options{actionname} = shift;
$options{action} = shift;
}
sub add {
my $mcpi = shift;
$mcpi->readlist;
$mcpi->add(
module => $options{module},
authorid => $options{authorid},
version => $options{version},
file => $options{file}
);
if ( $options{verbose} ) {
my @added = $mcpi->added_modules;
foreach my $added ( @added ){
print "\nAdding File: $added->{file}\n";
print "Author ID: $added->{authorid}\n";
my $modules = $added->{modules};
foreach my $mod ( sort keys %$modules ){
print "Module: $mod\n";
print "Version: $modules->{$mod}\n";
}
print "To repository: $mcpi->{config}{repository}\n\n";
}
}
$mcpi->writelist;
}
sub update {
my $mcpi = shift;
mirror( $mcpi );
inject( $mcpi );
}
sub mirror {
my $mcpi = shift;
my %mirroropts;
$mirroropts{remote} = $options{remote}
if ( defined( $options{remote} ) );
$mirroropts{local} = $options{local}
if ( defined( $options{local} ) );
$mirroropts{trace} = $options{verbose}
if ( defined( $options{verbose} ) );
$mcpi->update_mirror( %mirroropts );
}
sub inject {
my $mcpi = shift;
print "Injecting modules from $mcpi->{config}{repository}\n"
if ( $options{verbose} );
$mcpi->inject( $options{verbose} );
}
# MAIN
Getopt::Long::Configure( 'no_ignore_case' );
Getopt::Long::Configure( 'bundling' );
GetOptions(
'h|help|?' =>
sub { pod2usage( { -verbose => 1, -input => \*DATA } ); exit },
'H|man' =>
sub { pod2usage( { -verbose => 2, -input => \*DATA } ); exit },
'V|version' => sub { print_version(); exit; },
'v|verbose' => \$options{verbose},
'l|local=s' => \$options{local},
'r|remote=s' => \$options{remote},
'p|passive' => \$ENV{FTP_PASSIVE},
'add' => sub { setsub( 'add', \&add ) },
'update' => sub { setsub( 'update', \&update ) },
'mirror' => sub { setsub( 'mirror', \&mirror ) },
'inject' => sub { setsub( 'inject', \&inject ) },
'module=s' => \$options{module},
'authorid=s' => \$options{authorid},
'modversion=s' => \$options{version},
'file=s' => \$options{file},
'all-in-meta' => \$options{'all-in-meta'},
'signing-key=s' => \$options{'signing_key'},
'discover-packages' => \$options{'discover-packages'},
) or exit 1;
unless ( defined( $options{action} ) && chkactions() ) {
pod2usage( { -verbose => 1, -input => \*DATA } );
exit;
}
my $mcpi = CPAN::Mini::Inject->new->loadcfg( $options{cfg} )->parsecfg;
$CPAN::Checksums::SIGNING_KEY = $options{'signing_key'}
if ($options{'signing_key'});
&{ $options{action} }( $mcpi );
__END__
=head1 NAME
mcpani -- A command line tool to manage a CPAN Mini Mirror.
=head1 SYNOPSIS
mcpani [options] < --add | --update | --mirror | --inject >
Commands:
--add Add a new package to the repository
--module Name of the module to add
--authorid Author ID of the module
--modversion Version number of the module
--file tar.gz file of the module
--update Update local CPAN mirror and inject modules
--mirror Update local CPAN mirror from remote
--inject Add modules from repository to CPAN mirror
Options:
-h, --help This synopsis
-H, --man Detailed description
-l, --local local location for CPAN::Mini Mirror
-r, --remote CPAN mirror to mirror from
-p, --passive Enable passive ftp for mirroring.
-v, --verbose verbose output
-V, --version Version information.
--signing-key See CPAN::Checksums $SIGNING_KEY
=head1 COMMAND LINE OPTIONS
=head2 --add
Add a module to the repository for later inclusion in the CPAN Mini
mirror. The add command requires the following parameters:
=over 4
=item --module
This is the name of the module (ie CPAN::Mini::Inject).
=item --authorid
A CPAN 'like' author ID for the module. The author ID does not need to
exist on CPAN.
=item --modversion
Version number of the module. This must match the version number in the
file name.
=item --all-in-meta
=item --discover-packages
L<CPAN::Mini::Inject/add> adds all modules found in the file.
These options remain for backward compatibility and do nothing.
=item --file
File name and path of the module. The file name must follow the
standard CPAN naming convention (the resulting file from a
C<make tardist>).
=back
Example:
mcpani --add --module CPAN::Mini::Inject --authorid SSORICHE
--modversion 0.01 --file ./CPAN-Mini-Inject-0.01.tar.gz
=head2 --update
Update your local CPAN Mini mirror from a CPAN site. Once completed
add the modules contained in the repository to it. This is the same
as running C<mcpani --mirror> followed by C<mcpani --inject>
=head2 --mirror
Update the local CPAN Mini mirror from CPAN.
=head2 --inject
Add the repository modules into the CPAN Mini mirror.
=head2 -l, --local
A local directory to store the CPAN Mini mirror in. Specifying this
option overrides the value in the config file.
=head2 -r, --remote
A CPAN site to create the local CPAN Mini mirror from.
=head2 -v, --verbose
Display verbose processing information
=head2 -V, --version
Display version information.
=head1 CONFIGURATION FILE
F<mcpani> uses a simple configuration file in the following format:
local: /www/CPAN
remote: ftp://ftp.cpan.org/pub/CPAN ftp://ftp.kernel.org/pub/CPAN
repository: /work/mymodules
passive: yes
dirmode: 0755
Description of options:
=over 4
=item * local
location to store local CPAN::Mini mirror (*REQUIRED*)
=item * remote
CPAN site(s) to mirror from. Multiple sites can be listed, with spaces
between them. (*REQUIRED*)
=item * repository
Location to store modules to add to the local CPAN::Mini mirror.
=item * passive
Enable passive FTP.
=item * dirmode
Set the permissions of created directories to the specified mode
(octal value). The default value is based on the umask (if supported).
=back
F<mcpani> will search the following four places in order:
=over 4
=item * file pointed to by the environment variable MCPANI_CONFIG
=item * $HOME/.mcpani/config
=item * /usr/local/etc/mcpani
=item * /etc/mcpani
=back
=head1 CURRENT MAINTAINER
Christian Walde C<< <walde.christian@googlemail.com> >>
=head1 AUTHOR
Shawn Sorichetti C<< <ssoriche@coloredblocks.net> >>
=head1 BUGS
Please report any bugs or feature requests to
C<bug-cpan-mini-inject@rt.cpan.org>, or through the web interface at
L<http://rt.cpan.org>. I will be notified, and then you'll automatically
be notified of progress on your bug as I make changes.
=head1 Copyright & License
Copyright 2004 Shawn Sorichetti, All Rights Reserved.
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
=cut
|