Loading...
Loading...
tarball | cpan2rpm-2.028.tar.gz | |
binary RPM | cpan2rpm-2.028-1.noarch.rpm | |
source RPM
cpan2rpm-2.028-1.src.rpm
| |
binary RPM | perl-HTTP-Lite-2.1.6-1.noarch.rpm | |
source RPM | perl-HTTP-Lite-2.1.6-1.src.rpm |
# yum -y install cpan2rpmFinally, I've put the full source on github at https://github.com/ekkis/cpan2rpm so anyone can patch it. Grab what's there and overwrite your current version to make sure you've got the latest bug fixes.
# cd /tmp # wget ftp.arix.com/RPM-GPG-KEY # gpg --import RPM-GPG-KEY # rpm --import RPM-GPG-KEY # gpg --fingerprint cpan2rpm@arix.comNext you can verify the embedded signatures on our packages like this:
# rpm --checksig cpan2rpm-X.XX-X.noarch.rpm cpan2rpm-X.XX-X.noarch.rpm: (sha1) dsa sha1 md5 gpg OKNote that the text gpg OK should be present in the command's output. Additionally,
# rpm -qip cpan2rpm-x.xx-xx.noarch.rpm |grep -i signatureshould display something similar to the line below, where the key id matches the imported key in your GPG keyring.
Signature: DSA/SHA1, Mon 20 Jun 2005 10:41:39 PM PDT, Key ID d2fd5ae4ea0a41be
# rpm -Uvh cpan2rpm-x.xx-x.noarch.rpmAlternatively you can simply supply rpm with a url, like this:
# rpm -Uvh ftp://arix.com/cpan2rpm-x.xx-x.noarch.rpmOur binaries are architecture independent but generated on an i386 platform running perl 5.10.0 - if you run a different version of Perl, you'll need to recompile on your platform; fortunately that is easy, either get the source RPM and:
# rpm --rebuild cpan2rpm-x.xx-x.src.rpm...or get the tarball and:
# rpmbuild -ta cpan2rpm-x.xx.tar.gzafter which the resulting package will be located at /usr/src/redhat/RPMS/<your-platform-here> (or wherever your ~/.rpmmacros indicate).
# wget -P /etc/yum.repos.d http://perl.arix.com/cpan2rpm/arix-perl.repoand install whatever you need in the normal way:
# yum -y install perl-*whatever*By default, packages will be verified before they are installed. To avoid this, edit the definition file and set gpgcheck=0, otherwise, please install our public key as indicated below.
# wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-arix-perl ftp://arix.com/RPM-GPG-KEYAdditionally, you may want to disable our repo from default use by setting the flag as shown: enabled=0. You can still use the repo when you like by calling yum like this:
# yum --enablerepo=arix-perl install perl-*whatever*
export SVN_SSH="ssh -l svn -i /path/to/your/private-key"
# svn checkout svn+ssh://arix.com/cpan2rpm
Appending installation info to /var/tmp/perl-XML-SAX-Expat-0.37-rbos/usr/lib/perl5/5.8.0/i586-linux-thread-multi/perllocal.pod Can't locate XML/SAX/Expat.pm in @INC (@INC contains: /usr/lib/perl5/5.8.0/i586-linux-thread-multi /usr/lib/perl5/5.8.0 /usr/lib/perl5/site_perl/5.8.0/i586-linux-thread-multi /usr/lib/perl5/site_perl/5.8.0 /usr/lib/perl5/site_perl .) at /usr/lib/perl5/site_perl/5.8.0/XML/SAX.pm line 147. make: *** [install_sax_expat] Error 2 Bad exit status from /var/tmp/rpm-tmp.91049 (%install)Courtesy of Richard Bos, the problem owes to the fact that the module needs to perform some steps in what would be the %post section of a spec-file. Since tarballs do not support this concept, the steps are currently performed under the %install section. The solution is two-fold:
## add ourselves to the list of installed parsers sub MY::install { package MY; my $script = shift->SUPER::install(@_); $script =~ s/install :: (.*)$/install :: $1 install_sax_expat/m; $script .= <<"INSTALL"; install_sax_expat : \t\@\$(PERL) -MXML::SAX -e "XML::SAX->add_parser(q(XML::SAX::Expat))->save_parsers()" INSTALL return $script; }
%{__perl} -MXML::SAX -e " XML::SAX->add_parser(q(XML::SAX::Expat))->save_parsers() "
cpan2rpm - A Perl module packager
To download the tarball from CPAN and create an RPM package, its source package and the specfile:
cpan2rpm Proc::Daemon /tmp/String-Canonical-1.2.tar.gz
To install from a URL:
cpan2rpm -i http://.../Proc-Daemon-0.03.tar.gz
To make a package out of the current directory (that contains a module):
cpan2rpm .
To create a list of packages stored in a file:
cpan2rpm -f module-list
This script generates an RPM package from a Perl module. It uses the standard RPM file structure and creates a spec file, a source RPM, and a binary, leaving these in their respective directories.
The script can operate on local files, directories, urls and CPAN module names. Install this package if you want to create RPMs out of Perl modules.
The syntax for cpan2rpm supports multiple distribution names, which can take one of four different forms:
perl Makefile.PL make make dist
will be performed in that directory in order to create the tarball necessary for package creation.
At present the script will handle .tar.gz, .tgz, .bz2 and .zip tarballs but each of these types requires the appropriate decompression programs installed on the system.
Spec files generated will generally assume header values as configured in the RPM macro files which are evaluated in the following order: /usr/lib/rpm/macros, /etc/rpm/macros and ~/.rpmmacros. Most of these headers can, however, be overridden through options. Whenever a header is neither configured in the RPM macro files nor is passed at the command line, the script will seek to calculate a proper value and supplies a default as stated for each option below. It is thus typically sufficient to provide only the distribution name.
The distribution name may be preceded by a number of optional arguments which modify the behaviour of the script. These options are grouped into three main categories as described below. Additionally, options may be stored in a configuration file - see the CONFIGURATION FILE section below.
The following options control the contents of the specification file generated. They come in four flavours as follows:
Simple Tags
These represent all tags which get inserted in the package with single values. The option may be used on the command line only once.
string-value
This option corresponds to the Name tag in the spec file. As is customary with Perl RPMs, the string perl-
will be prepended to any value passed here. If no value is supplied, the script will use the NAME field found in the module's Makefile.PL
Even though this script is meant to build RPM packages from CPAN modules, it may be used on a more generic basis, thus the perl-
prefix in a package may be undesirable. As an example, cpan2rpm generates itself but is not called perl-cpan2rpm
. This option suppresses the aforementioned prefix in the package name.
At times the user may want to package a module that depends on other CPAN modules not presently installed. This is generally not possible since cpan2rpm does an up-front check for modules listed in the PREREQ_PM field of the Makefile.PL. This switch turns this checking off so that the process may continue and implies the --make-no-test since testing with missing module dependencies will certainly fail.
string-value
A one-line description of the package. If left unspecified the script will use the module name, appending an abstract whenever available.
float-value
The script determines the version number of the module by consulting the Makefile.PL's VERSION or VERSION_FROM fields. If neither is specified, it parses the tarball name. Note: If you're looking to get the version of cpan2rpm itself, see the -V option.
integer-value
The package release number. Defaults to 1. Allows alphanumerics.
integer-value
By default, this tag is not written to the spec file. Enter a value here when needed.
string-value
This is the name and address of the person who authored the module. Typically it should be in the format: Name <e-mail-address>. If left unspecified, the script will attempt to extract it from the tarball's MakeMaker file, failing to build the package otherwise. There is no default for this option.
string-value
This is you (if you're packaging someone else's module). The string should be in the same format as for --author and defaults to: Arix International <cpan2rpm@arix.com>
unless the RPM macro files provide a value.
string-value
This key overrides the %{distribution} tag as defined in the macros files. There is no default for this tag and will be left out unless specified.
string-value
The license header specified in the spec file. This field is also sometimes referred to as Copyright, but License is a more suitable name and has become more common. Defaults to Artistic
, Perl's own license.
string-value
This is the RPM group. For further information on available groups please see your RPM documentation. Defaults to Applications/CPAN
.
string-value
The home url for the package. Defaults to http://www.cpan.org.
string-value
The architecture for a package is determined by whether the tarball includes files matching *.xs or *.c. If it does, %_arch macro from rpm is used as the target architecture, otherwise noarch is used. This value may be overridden with this parameter. Typically the package build will be found in the RPMS directory, under the indicated architecture.
string-value
Allows specifying a directory to use as a BuildRoot. Don't mess with this is you don't know what it is. Defaults to: %{_tmppath}/%{name}-%{version}
.
-,root,root
Upon installation of a package created with cpan2rpm, the files installed are owned according to the contents of the %defattr tag inserted into the %files section of the spec file. The value of this tag may be passed using this switch and defaults to the value shown above.
string-value
This text describes the package/module. This value is picked up from the POD's Synopsis section in the module. Defaults to None.
.
Aggregate Tags
These represent tags which may be repeated in the spec file. With all of the following, users may either specify a single option with a comma-delimited string of values, or multiple options, each with a single value.
exempli gratia
--requires="rpm, rpm-build" --requires="rpm" --requires="rpm-build"
string-value
Indicates that a package is provided by the module being built. RPM will generate an appropriate list of provide dependencies and any passed here will be in addition to those calculated.
string-value
Indicates packages that should be required for installation. This option works precisely as --provides above.
string-value
Suppresses generation of a given required dependency. Sometimes authors create dependencies on modules the packager can't find, sometimes RPM generates spurious dependencies. This option allows the packager to arbitrarily supress a given requirement.
string-value
This option indicates dependencies at build time.
string-value
Allows for specifying patch files to be inserted into the spec file and applied when building the source.
name body
Works much like the rpm --define syntax to define rpm macro initializations. A comma-delimited list of macro definitions is not supported, but ut may be used multiple times to define more than one macro.
exempli gratia
--define="suidperl 1" --define "usethreads 1" --define admindir=/var/www/html/admin
string-value
This option may be used to add values to the %doc line in the spec's %files section. By default, cpan2rpm examines the contents of a tarball, using a regular expression to pick up files it recognises as belonging to the /usr/share/doc directory. If your module contains files cpan2rpm does not recognise, they may be added with this option.
Additionally, the user may replace the calculated list by providing values prepended with an equal sign. In the following example, ONLY the Changes
file is added to the list, dismissing any files found by the script:
--doc "=Changes"
Section options
These represent tags which may be repeated in the spec file. Users may specify these either with a single option and a comma-delimited string of values, or by repeating the option, each with a single value.
<section>:<code>
This option allows the user to insert arbitrary code at the top of a given section of the spec file. The section is named in the value passed to the option as the first word followed by a colon. At present, the following sections are supported: prep, build, install, clean, changelog.
<section>:<code>
As with the previous option, this may be used to insert code at the end of a given section. This option also supports the tag and files sections which allow for the user to insert extra tags or files to the spec file.
exempli gratia
--epilogue="tag:epoch: 1"
The following options control the package making process.
This option instructs the script to only generate a spec file and not build the RPM package.
This option allows the user to specify the full-path of the spec file to produce. By default, the specfile is placed in the SPECS directory and is named after the module with a .spec extension. Please note that cpan2rpm will overwrite existing files, so if you care about your current spec file, save it!
string-value
This option allows passing a string to the MakeMaker process (i.e. perl Makefile.PL <your-arguments-here>). At present there is no support for passing parameters to Module::Build->new()
- if this is either possible or desired, please mail the author.
string-value
Arguments supplied here get passed directly to the make process. (As with the above, no support is offered for Module::Build).
Use this option to suppress running a module's test suite during build.
string-value
Allows user to supply arguments to the make install process. (As with the above, no support is offered for Module::Build).
string-value
string-value
These two options allow for redefining the RPM macros of the same name in the spec file.
string-value
Specify a temporary working directory instead of utilizing File::Temp.
By default, the rpm-build requirements script scans all files in a tarball for requirements information. As this may on occasion generate requirements on the produced rpm that belong only to sample programs or other files not critical to the module being installed, we provide a patch the user may apply (included in this distribution as perl.req.patch) which causes dependencies to be harvested from only .pm files. When this patch is installed, this switch reverses the behaviour, causing cpan2rpm to scan all files as originally intended.
By default, the system passes --clean to rpmbuild, thus removing the unpacked sources from the BUILD directory. This option suppresses that functionality.
Forces installation under installarchlib even if the module is pure perl. This is significant because it is first in the @INC search for module determination. This will not do any good for modules with XS code or those that are already installed into an architecture dependent path. This is most useful for those pure perl modules that come stock with the perl rpm itself (i.e. Test::Harness) but you wish to try another version without having to be forced to use "rpm --replacefiles" and destroying the old files. Using this option will allow both versions of the module to be installed, but the new version will just mask the old version later in the @INC. Additionally, the new man pages will mask the old man pages even though the man pages for both version will be installed. This option should only be used as a last resort to install a module when "conflicts" errors occur on rpm installation such as the following: file from install of perl-Module-1.11-1 conflicts with file from package perl-5.x.x
User may be required to use --force (see below) in conjuction with this option to build a fresh rpm before attempting to --install again.
By default the script will do as little work as possible i.e. if it has already previously retrieved a module from CPAN, it will not retrieve it again. If it has already generated a spec file it will not generate it again. This option allows the packager to force all actions, starting from scratch.
This option allows suppression of the fixin step when generating a package and avoids breaking certain test script e.g. MIME::Base64
Suppresses package signatures. By default, cpan2rpm will sign the packages it generates IF the the RPM macros file has been configured to use signatures - this option prevents this behaviour. See also the --sign-setup option below.
Install the RPM after building it. If non-root user, you must have "sudo rpm" privileges to use this option.
The options below perform functions not closely related to the quotidien process of building a package.
string-value
One of cpanplus, cpan or web, this parameter specifies which method to use when retrieving a module from CPAN. Web retrievals are by parsing the CPAN website and may be faster though more error prone. To use either the CPAN or CPAN+ modules, these must be installed. Default: web.
If your environment requires the use of a proxy, simply set the environment variable as indicated below in (bash format):
string-value
Lists of modules to be processed can be stored in a file. Pass this parameter the name of your file. The file should contain the name of each module in a single line and the modules can be specified in any of their many forms (e.g. url, path to tarball, CPAN module name, etc.). Comments (begining with #) will be ignore and so will empty lines.
string-value
This option allows the non-root user to easily set up his account for building packages. The option requires a directory path where the RPMS, SPECS, etc. subdirectories will be created. These directories will contain the spec files, binaries and the source packages generated. Additionally the %_topdir macro will be defined in the ~/.rpmmacros file. If this file doesn't exist it will be created, if it does but does not contain a definition for this macro, it will be appended to it. Suggested value is ~/rpm but it's up to user.
Additionally, the script will create architecture directories i386, i686 and noarch and allows the user to pass --buildarch to also create a directory for that architecture.
type:user
]This option sets up your RPM macros file to support the signing of packages. The option may be passed a value consisting of the signature type to use (currently only gpg and pgp are valid but consult the RPM man pages), a colon, and the user name to sign with. If no value is passed gpg
is used for the signature type and the first key listed in the secure keyring is taken for signing.
Note: unless you know what you're doing, do not pass any arguments to this option! Also, make sure not to pass a module name as an argument.
To further tailor your macros file please refer to the GPG SIGNATURES section of the RPM man page.
Whenever a new version of this program becomes available, an automatic notification will be issued to the user of this fact. The user may then choose to upgrade via this option. The option takes no parameters.
During version checks, the script will time out within 5 seconds if the arix.com server is unavailable (when working offline or if the server is down). Should the 5 seconds become annoying, users may pass this option to skip the version check.
This option produces debugging output. An optional integer increases the level of verbosity for this output. If no integer is given, 1 is assumed.
Displays a terse syntax message.
This option displays the version number of cpan2rpm itself.
This option runs cpan2rpm in the Perl debugger. Useful for anyone willing to dig on my behalf.
In addition to reading options from the command line, cpan2rpm will slurp the configuration file ~/.cpan2rpm, if it exists. Please note that for this functionality to work, the module Getopt::ArgvFile must be installed. If the config file exists but the module is not available, cpan2rpm will puke.
Additionally, please note that if no config file exists in the $HOME directory, one may be passed explicitly on the command line as shown in the example below:
# cpan2rpm @options-file -V
Note that options from command line will override options from config file.
The configuration file should contain options in same format as they would be used in command line. Place one option per line.
Example:
--packager="John Doe <john.doe@example.com>" --url="http://example.com/johndoe/perlmodules/"
This script requires that RPM be installed. Both the rpm and rpm-build packages must be installed on the local machine. Please see the RPM documentation (man rpm) for further information.
Additionally, the Perl package will be needed :) and the CPAN module (which is bundled with the Perl distribution) will need to be configured. To configure CPAN (CPAN.pm or CPAN/MyConfig.pm) use the following:
perl -MCPAN -e shell
For further information please refer to the CPAN manpage.
At present, cpan2rpm has been tested and is known to work under the following environments:
The script has been tested under the OS list below:
- Linux RedHat: 6.1, 6.2, 7.0, 7.2, 7.3, 8.0, 9.0 - Redhat Enterprise v3 (RHELv3), AS4 (Nahant) - SuSE 8.1, 9.0
Rumour has it it's been tested on Solaris and FreeBSD as well but I don't know for sure. See README.redhat6 for 6.x issues to be aware of.
The script is known to work with Perl versions 5.005_03, 5.6.0, 5.6.1 and 5.8.0.
This module is used for making and installing the CPAN modules. However many of MakeMaker's versions are broken and incompatible with other versions. For that reason, cpan2rpm works well with versions < 5.91 and > 6.05 but in between it requires an upgrade.
This module replaces the old and crusty MakeMaker. At present not all modules yet use this new install method so cpan2rpm autodetects the install method and supports both. Please note that some of the meta-data retrieval functions may not work as well with this module as it requires less information to be present in the initial script than does MakeMaker.
The RPM system has undergone a lot of change. At present, cpan2rpm runs on version 4.0.4-7x but requires certain special attention (see README for more information). Earlier versions of RPM are borked in various ways and are not currently supported, though on SuSE version 3.0.6 appears to work.
If you are running on a platform not listed above, do drop us a note and let us know!
Erick Calder <ecalder@cpan.org>
The script was inspired by cpanflute which is distributed with the rpm-build package from RedHat. Many thanks to Robert Brown <bbb@cpan.org> for all his cool tricks, advice and patient support.
Thank you notes can be mailed directly to the author :)
For help, you can subscribe to our mailing list at:
http://lists.sourceforge.net/lists/listinfo/cpan2rpm-general
or send a message to cpan2rpm-general-request@lists.sourceforge.net with help
as the subject header. Please note, when submitting patches, please first retrieve the latest (unreleased version of the script from the home page).
Feature requests, bug reports and patch submissions should also be handled through SourceForge.
Some things we're working on/thinking about:
1. extract all functionality into a perl module and make cpan2rpm a thin script
2. allow macro definitions like %_sourcedir %_topdir/%name
in .rpmmacros file (%name isn't defined till later)
3. a --recursive option to install perl rpm dependencies
4. Provides: requirements are generated in the form "perl(POE::Filter) = 1.12" but not "perl-POE-Filter = 1.12" which is for SuSE.
5. PREREQ_PM should be added to the unique list of requirements for the RPM
6. look into --make-test-continue to move past failed testing
7. rethink --force
The latest version of the tarball, RPM and SRPM may always be found at:
Additionally, the module is available on CPAN at:
http://search.cpan.org/author/ECALDER/cpan2rpm/
and the project is also hosted on SourceForge at:
http://sourceforge.net/projects/cpan2rpm/
The distribution includes a Changes file which details the evolution of this utility. For your convenience, this file may also be found online at:
http://perl.arix.com/cpan2rpm/Changes
Copyright (c) 2002-2003 Erick Calder <ecalder@cpan.org>
This product is free and distributed under the Gnu Public License (GPL). A copy of this license was included in this distribution in a file called LICENSE. If for some reason, this file was not included, please see http://www.gnu.org/licenses/ to obtain a copy of this license.
$Id: cpan2rpm,v 2.310 2009-08-12 18:06:16 ekkis Exp $