From 7eb10844459d5a738f9162e921238b4163af4359 Mon Sep 17 00:00:00 2001 From: Dennis Kaarsemaker Date: Thu, 1 Sep 2011 22:25:11 +0200 Subject: [PATCH] Resurrect cpanget as a symlink to cpanspec - Update the POD in cpanspec to document its use as cpanget - Subclass Module::Build to create the symlinks to cpanspec and cpanspec.1p at build time. --- Build.PL | 17 ++++++++++++++++- TODO | 3 --- cpanspec | 25 +++++++++++++++++++++++-- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/Build.PL b/Build.PL index a13258e..936b9a5 100644 --- a/Build.PL +++ b/Build.PL @@ -2,7 +2,22 @@ use strict; use warnings; use Module::Build; -my $builder = Module::Build->new( +my $class = Module::Build->subclass( + class => 'CpanSpec::Build', + code => q{ + use File::Basename qw(dirname); + use FindBin; + + sub ACTION_build { + my $self = shift; + $self->SUPER::ACTION_build(@_); + symlink("cpanspec", "$FindBin::Bin/blib/script/cpanget"); + symlink("cpanspec.1p", "$FindBin::Bin/blib/bindoc/cpanget.1p"); + } + } +); + +my $builder = $class->new( dist_name => 'cpanspec', license => 'perl', dist_author => 'Steven Pritchard ', diff --git a/TODO b/TODO index 46f2000..ecfdcc9 100644 --- a/TODO +++ b/TODO @@ -4,6 +4,3 @@ hard-coding $pkgdetails. * Add an option to honor %_sourcedir and such. - -* Install cpanspec as cpanget (with a symlink?) also. - - Also need to add a man page for cpanget. diff --git a/cpanspec b/cpanspec index a443663..e909803 100755 --- a/cpanspec +++ b/cpanspec @@ -19,9 +19,13 @@ our $VERSION='1.79'; cpanspec - Generate a spec file for a CPAN module +cpanget - Download a CPAN module + =head1 SYNOPSIS -cpanspec [options] [file [...]] +cpanspec [options] [module [...]] + +cpanget [options] [module [...]] Options: --help -h Help message @@ -39,6 +43,7 @@ cpanspec [options] [file [...]] --cpan -c CPAN mirror URL --verbose -v Be more verbose --prefer-macros -m Prefer macros over environment variables in the spec + --download-only -D Only download the tarball from CPAN Long options: --follow Process build dependencies @@ -49,11 +54,25 @@ cpanspec [options] [file [...]] --add-buildrequires Add BuildRequires for this item --version Print the version number and exit +The modules specified on the command line can be either filenames of tarballs, +or module names as downloadable from CPAN. + +=head1 EXAMPLES + +cpanspec Linux::Prctl + +cpanspec ~/downloads/Acme-MetaSyntactic-0.99.tar.gz + +cpanget Module::Build + =head1 DESCRIPTION B will generate a spec file to build a rpm from a CPAN-style Perl module distribution. +B will download the tarball for a module from CPAN. This +implies --download-only and ignores most other options. + =head1 OPTIONS =over 4 @@ -135,7 +154,9 @@ semi-standard (for Fedora) string C<%{?dist}>. =item B<-D>, B<--download-only> -Only download the upstream tarball, do not generate a specfile +Only download the upstream tarball, do not generate a specfile. Most +other options are ignored as they are only relevant when creating a +specfile or building a package. =item B<-s>, B<--srpm>