cpanspec - Generate a spec file for a CPAN module


cpanspec [options] [file [...]]

   --help       -h      Help message
   --old        -o      Be more compatible with old RHL/FC releases
   --license    -l      Include generated license texts if absent in source
   --noprefix   -n      Don't add perl- prefix to package name
   --force      -f      Force overwriting existing spec
   --packager   -p      Name and email address of packager (for changelog)
   --release    -r      Release of package (defaults to 1)
   --epoch      -e      Epoch of package
   --disttag    -d      Disttag (defaults to %{?dist})
   --srpm       -s      Build a source rpm
   --build      -b      Build source and binary rpms
   --cpan       -c      CPAN mirror URL
   --verbose    -v      Be more verbose
   --prefer-macros  -m  Prefer macros over environment variables in the spec

 Long options:
   --follow             Process build dependencies
   --filter-requires    Specify Requires to remove
   --filter-provides    Specify Provides to remove
   --add-requires       Add Requires for this item
   --add-provides       Add Provides for this item
   --add-buildrequires  Add BuildRequires for this item
   --version            Print the version number and exit


cpanspec will generate a spec file to build a rpm from a CPAN-style Perl module distribution.


-h, --help

Print a brief help message and exit.

-o, --old

Be more compatible with old RHL/FC releases. With this option enabled, the generated spec file

-l, --license

Generate COPYING and Artistic license texts if the source doesn't seem to include them.

-n, --noprefix

Don't add perl- prefix to the name of the package. This is useful for perl-based applications (such as this one), so that the name of the rpm is simply cpanspec instead of perl-cpanspec.

-f, --force

Force overwriting an existing spec file. Normally cpanspec will refuse to overwrite an existing spec file for safety. This option removes that safety check. Please use with caution.

-p, --packager

The name and email address of the packager. Overrides the %packager macro in ~/.rpmmacros.

-r, --release

The release number of the package. Defaults to 1.

-e, --epoch

The epoch number of the package. By default, this is undefined, so no epoch will be used in the generated spec.

-d, --disttag

Disttag (a string to append to the release number), used to differentiate builds for various releases. Defaults to the semi-standard (for Fedora) string %{?dist}.

-s, --srpm

Build a source rpm from the generated spec file.

-b, --build

Build source and binary rpms from the generated spec file. Please be aware that this is likely to fail! Even if it succeeds, the generated rpm will almost certainly need some work to make rpmlint happy.

-c, --cpan

The URL to a CPAN mirror. If not specified with this option or the CPAN environment variable, defaults to

-v, --verbose

Be more verbose.

-m, --prefer-macros

Prefer the macro form of common spec constructs over the environment variable form (e.g. %{buildroot} vs $RPM_BUILD_ROOT).


Add build dependencies to the list of modules to process.


Specify Requires to remove.


Specify Provides to remove.


Add Requires for this item.


Add Provides for this item.


Add BuildRequires for this item.


Print the version number and exit.


Steven Pritchard <>


perl(1), cpan2rpm(1), cpanflute2(1)