home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / make_ppm < prev    next >
Encoding:
Text File  |  2004-01-10  |  9.3 KB  |  295 lines

  1. #!/usr/bin/perl
  2.  
  3. use strict;
  4. # use warnings;
  5. use Getopt::Long qw(:config no_ignore_case auto_version auto_help);
  6. use PPM::Make;
  7. use Pod::Usage;
  8. $main::VERSION = $PPM::Make::VERSION;
  9. my %opts = ();
  10. my @files = ();
  11. my %progs = ();
  12. GetOptions(\%opts,
  13.            'zip|z',
  14.            'force|f',
  15.            'ignore|i',
  16.            'cpan',
  17.            'no_cfg',
  18.            'no_case',
  19.            'binary|b:s',
  20.            'arch_sub|n',
  21.            'script|s:s',
  22.            'exec|e:s',
  23.            'os|o:s',
  24.            'arch|a:s',
  25.            'remove|r',
  26.            'as|A!',
  27.            'vs|V',
  28.            'vsr',
  29.            'vsp',
  30.            'add|x:s' => \@files,
  31.            'program|p:s' => \%progs,
  32.            'ppd:s',
  33.            'ar:s',
  34.            'host:s',
  35.            'user:s',
  36.            'passwd:s',
  37.           ) or pod2usage(2);
  38.  
  39. my $dist = shift;
  40. my %upload = ();
  41.  
  42. for (qw(binary script exec add program ppd ar host user passwd)) {
  43.   die "Please supply an argument to '$_'"
  44.      if ( defined $opts{$_} and $opts{$_} eq "");
  45. }
  46.  
  47. for (qw(ppd ar host user passwd)) {
  48.   $upload{$_} = delete $opts{$_};
  49. }
  50. $opts{upload} = \%upload if defined $upload{ppd};
  51. $opts{dist} = $dist if $dist;
  52.  
  53. my $ppm = PPM::Make->new(%opts);
  54. $ppm->make_ppm();
  55.  
  56. __END__
  57.  
  58. =head1 NAME
  59.  
  60. make_ppm - make a PPM distribution
  61.  
  62. =head1 SYNOPSIS
  63.  
  64.    make_ppm [options] [Module | Distribution]
  65.  
  66. Options:
  67.  
  68.  [-z | --zip]              : make a zip distribution
  69.  [-f | --force]            : force remaking a distribution
  70.  [-i | --ignore]           : ignore any failing test results
  71.  [-b | --binary] location  : specify the binary location
  72.  [-n | --arch_sub]         : use \$Config{archname} as a subdirectory
  73.  [-s | --script] script    : specify a script in the <INSTALL> field
  74.  [-x | --add] file         : add specified extra files to the archive
  75.  [-e | --exec] exec        : specify the executable to run the <INSTALL> script
  76.  [-x | --add] file         : add file to the archive
  77.  [-o | --os] os            : use os for the <OS> field
  78.  [-a | --arch] arch        : use arch for the <ARCHITECTURE> field
  79.  [-v | --version]          : print version information and exit
  80.  [-h | --help]             : print this help screen
  81.  [-r | --remove]           : remove the build directory after installation
  82.  [-p | --program]  b=a     : specify "a" to be used for the "b" program
  83.  [-A | --as]               : add Perl version number to ARCHITECTURE (>= 5.8)
  84.  [-V | --ppmv]             : add version string to ppd and archive filenames
  85.  [ --ppd ]  location       : copy the ppd to the specified location
  86.  [ --ar ]   location       : copy the archive file to the specified location
  87.  [ --host]  host           : use the specified host for copying the ppm files
  88.  [ --user]  user           : username to use when transferring ppm files
  89.  [ --passwd] password      : password associated with user
  90.  [ --cpan ]                : make a CPAN distribution
  91.  [ --no_case ]             : for module searches, ignore case
  92.  [ --no_cfg ]              : do not read a .ppmcfg configuration file
  93.  [ --vsr]                  : add version string to the archive filename
  94.  [ --vsp]                  : add version string to the ppd filename
  95.  
  96. Additional Arguments:
  97.  
  98.    Module       : specify a module to fetch (requires CPAN.pm)
  99.    Distribution : specify a distribution to fetch
  100.  
  101. With no arguments, make_ppm will build a distribution
  102. inside the current directory. 
  103.  
  104. =head1 DESCRIPTION
  105.  
  106. C<make_ppm> is an interface to the C<PPM::Make> module,
  107. and is used to build a PPM (Perl Package Manager) distribution
  108. from a CPAN source distribution. See L<PPM::Make> for a
  109. discussion.
  110.  
  111. Apart from the options described below, without any arguments 
  112. C<make_ppm> will assume it is inside an unpacked source
  113. distribution and make the corresponding PPM distribution.
  114. If it is given an argument of what looks like a module
  115. name (eg, I<Net::FTP>), it will use C<CPAN.pm> to look up the 
  116. corresponding distribution and fetch and build it. Otherwise, 
  117. additional arguments (eg, F<package.tar.gz>, or
  118. I<http://someplace.org/package.tar.gz>) will be interpreted
  119. as distributions to fetch and build.
  120.  
  121. Options can be read from a configuration file
  122. (see L<PPM::Make>) and/or given as options to I<make_ppm>,
  123. unless the I<no_cfg> option is given.
  124. In case of duplicates, the options to I<make_ppm> take
  125. precedence. Available options include:
  126.  
  127. =over
  128.  
  129. =item [-z | --zip]
  130.  
  131. By default, C<make_ppm> will build a C<.tar.gz> distribution
  132. if possible. This option forces a C<.zip> distribution to be made.
  133.  
  134. =item [-f | --force]
  135.  
  136. By default, if C<make_ppm> detects a F<blib/> directory,
  137. it will assume the distribution has already been made, and
  138. will not remake it. This option forces remaking the distribution.
  139.  
  140. =item [-i | --ignore]
  141.  
  142. By default, C<make_ppm>, if it is building the distribution,
  143. will die if all tests do not pass. Turning on this option
  144. instructs C<make_ppm> to ignore any test failures.
  145.  
  146. =item [-b | --binary] location
  147.  
  148. I<location> is used as the value for the C<BINARY_LOCATION>
  149. attribute passed to C<perl Makefile.PL>, and is used in
  150. setting the I<HREF> attribute of the I<CODEBASE> field
  151. in the ppd file.
  152.  
  153. =item [-n | --arch_sub]
  154.  
  155. This option will insert the value of C<$Config{archname}>
  156. (or the value of the I<-a> option, if given)
  157. as a relative subdirectory in the I<HREF> attribute of the 
  158. I<CODEBASE> field in the ppd file.
  159.  
  160. =item  [-o | --os] os
  161.  
  162. If this option is specified, the value, if present, will be used 
  163. instead of the default for the I<NAME> attribute of the I<OS> field 
  164. of the ppd file. If no value is supplied, the I<OS> field will not 
  165. be included in the ppd file.
  166.  
  167. =item [-a | --arch] arch
  168.  
  169. If this option is specified, the value, if present, will be used instead 
  170. of the default for the I<NAME> attribute of the I<ARCHITECTURE> field of 
  171. the ppd file. If no value is specified, the  I<ARCHITECTURE> field 
  172. will not be included in the ppd file.
  173.  
  174. =item  [-s | --script] script
  175.  
  176. This will be used in the I<PPM_INSTALL_SCRIPT>
  177. attribute passed to C<perl Makefile.PL>, and arises in
  178. setting the value of the I<INSTALL> field in the ppd file.
  179. If this begins with I<http://> or I<ftp://>, so that the
  180. script is assumed external, this will be
  181. used as the I<HREF> attribute for I<INSTALL>.
  182.  
  183. =item [-e | -- exec] exec
  184.  
  185. This will be used in the I<PPM_INSTALL_EXEC>
  186. attribute passed to C<perl Makefile.PL>, and arises in
  187. setting the I<EXEC> attribute of the I<INSTALL> field
  188. in the ppd file.
  189.  
  190. =item  [-x | --add] file
  191.  
  192. This option, which can be specified multiple times, can
  193. be used to add additional files outside of the the F<blib>
  194. directory to the archive.
  195.  
  196. =item [-r | --remove]
  197.  
  198. If specified, the directory used to build the ppm distribution
  199. given on the command line will be removed after a successful install.
  200.  
  201. =item [-p | --prog] program=/path/to/program
  202.  
  203. This option specifies that C</path/to/program> should be used
  204. for C<program>, rather than the one PPM::Make finds. This option
  205. can be specified multiple times, with
  206. C<program> being one of C<tar>, C<gzip>, C<zip>, C<unzip>, or C<make>.
  207.  
  208. =item ppd $path_to_ppd_files
  209.  
  210. If given, this will copy the ppd file to the location specified,
  211. and must be given as an absolute pathname. If I<host> is specified,
  212. this copy will be done via ftp, otherwise a local copy is made.
  213.  
  214. =item ar $path_to_archive_files
  215.  
  216. This is the location where the archive file should be placed.
  217. This may either be an absolute pathname or a relative one,
  218. in which case it is interpreted to be relative to that
  219. specified by I<ppd>. If this is not given, but I<ppd>
  220. is specified, this will default to the value of I<ppd>.
  221.  
  222. =item host $hostname
  223.  
  224. If specified, an ftp transfer to the specified host is
  225. done, with I<ppd> and I<ar> as described above.
  226.  
  227. =item user $username
  228.  
  229. This specifies the user name to login as when transferring
  230. via ftp.
  231.  
  232. =item passwd $passwd
  233.  
  234. This is the associated password to use for I<user>
  235.  
  236. =item [-A | --as]
  237.  
  238. Beginning with Perl-5.8, Activestate adds the Perl version number to
  239. the NAME of the ARCHITECTURE tag in the ppd file. This option,
  240. which is enabled by default, will make a ppd file compatible with this
  241. practice. Specify C<--noas> to disable this option.
  242.  
  243. =item [-V | --vs]
  244.  
  245. This option will add a version string (based on the VERSION reported
  246. in the ppd file) to the ppd and archive filenames.
  247.  
  248. =item [--vsr]
  249.  
  250. This option, if enabled, will add a version string 
  251. (based on the VERSION reported in the ppd file) to the 
  252. archive filename.
  253.  
  254. =item [--vsp]
  255.  
  256. This option, if enabled, will add a version string 
  257. (based on the VERSION reported in the ppd file) to the 
  258. ppd filename.
  259.  
  260. =item [--cpan]
  261.  
  262. If specified, a distribution will be made using C<make dist>
  263. which will include the I<ppd> and I<archive> file.
  264.  
  265. =item [--no_case]
  266.  
  267. If specified, module searches will be performed in a case-insensitive
  268. manner.
  269.  
  270. =item [--no_cfg]
  271.  
  272. If specified, do not attempt to read a F<.ppmcfg> configuration
  273. file.
  274.  
  275. =item [--help]
  276.  
  277. This prints out a short help screen and exits.
  278.  
  279. =item [--version]
  280.  
  281. This prints out some version information and exits.
  282.  
  283. =back
  284.  
  285. =head1 COPYRIGHT
  286.  
  287. This program is copyright, 2002, by Randy Kobes <randy@theoryx5.uwinnipeg.ca>.
  288. It is distributed under the same terms as Perl itself.
  289.  
  290. =head1 SEE ALSO
  291.  
  292. L<PPM::Make>, and L<PPM>.
  293.  
  294. =cut
  295.