[Catalyst] Deploying with Perlbrew
Nick
oinksocket at letterboxes.org
Tue May 15 14:11:02 GMT 2012
On 15/05/12 14:05, Bill Moseley wrote:
> Is anyone creating an RPM out of their Perlbrew install? I'm looking for
> pointers and examples.
I found .spec files for Perl are surprisingly hard to come by. I ended up
writing my own.
I'm not using Perlbrew, but here's my .spec (appended) with a makefile and an
.rpmmacros file. The makefile downloads and builds the Perl version named in the
PERL_VERSION variable, then builds an RPM called "my-perl" which installs in
/opt/perl. Obviously you could modify this to be whatever you like.
I don't bundle any extra cpan stuff in there, but you could, and I don't think
you'd need to change the .spec much, if at all. Of course, you'd need to add a
target to the makefile to install the stuff you need.
We use this RPM as a base, and use local-lib installs to supplement it for
development, and (intend to) use git snapshots of applications complete with
local-lib for production deployment (it's still work in progress).
I started off using FPM [1], and then tweaked the spec our own ends. (FPM
didn't work so smoothly at the time, some now-fixed bug I don't remember the
details of, but this .spec doesn't need it anyway.)
Cheers,
Nick
1. http://www.semicomplete.com/blog/geekery/fpm.html
--- SPEC/my-perl.spec
# This .spec file started life autogenerated by the FPM tool.
# It was then tweaked, generalised and simplified
%define perl_version %{getenv:PERL_VERSION}
%define prefix /opt/perl
%define __rh_distro %(cat /etc/redhat-release)
Name: my-perl
Version: %{perl_version}
Release: %{getenv:RELEASE}
Summary: Practical Extraction and Report Language
BuildArch: %{_arch}
AutoReqProv: no
Group: Development/Languages
License: (GPL+ or Artistic) and (GPLv2+ or Artistic) and Copyright Only
and MIT and Public Domain and UCD
Url: http://www.perl.org/
Source0: %{getenv:SOURCE_URL}
BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
BuildRequires: tcsh, dos2unix, man, groff
BuildRequires: gdbm-devel, db4-devel, zlib-devel
# For tests
BuildRequires: procps, rsyslog
%description
This is perl (v%{perl_version}) built for %{_arch}-linux
(%{__rh_distro}) compiled to be used in %{prefix} for
internal projects. It includes all of Perl core in one
package.
%prep
# For info on flags, see
#
http://docs.fedoraproject.org/en-US/Fedora_Draft_Documentation/0.1/html/RPM_Guide/ch09s04.html#id515031
%setup -n perl-%{perl_version}
%build
# -Dpager is set because "the trailing -R option was throwing
# the [Configure] script off". The CentOS SRPM also sets it, as below.
/bin/sh Configure -des \
-Dprefix='%{prefix}' \
-Dpager='/usr/bin/less -isr'
make
%install
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,-)
%doc Artistic AUTHORS Copying README Changes
%doc %{prefix}/man
%{prefix}/bin
%{prefix}/lib
%changelog
* Thu Feb 9 2012 Joe <bloggs at somewhere> - 0.1
- Initial build, based on an FPM-generated .specfile,
and the CentOS SRPM perl-5.10.1-119.el6_1.1.src.rpm.
--- makefile
RPMBUILD_OPTS = --define "_topdir $$PWD" --define "_tmppath $$PWD/TMP"
# --clean
PKG = my-perl
PERL_VERSION = 5.12.4
RELEASE = 1
SOURCE := perl-${PERL_VERSION}.tar.bz2
SOURCE_URL := http://www.cpan.org/src/5.0/${SOURCE}
SPEC = SPECS/${PKG}.spec
# Export all variables into the environment so that the .spec can pick
# them up
export
.PSEUDO: rpmlint cleantmp srpm rpm
#.INTERMEDIATE: SOURCES/${SOURCE}
rpmlint:
rpm -q --specfile ${SPEC}
rpmlint -i ${SPEC}
SOURCES/${SOURCE}:
(cd SOURCES/; wget ${SOURCE_URL})
srpm: ${SPEC} SOURCES/${SOURCE}
mkdir -p SRPMS TMP
rpmbuild ${RPMBUILD_OPTS} -bs ${SPEC}
rpm: ${SPEC} SOURCES/${SOURCE}
mkdir -p RPMS BUILD TMP
rpmbuild ${RPMBUILD_OPTS} -bb ${SPEC}
cleantmp:
rm -rf BUILD TMP SOURCES/${SOURCE}
--- .rpmmacros
%packager Joe <bloggs at somewhere>
%distribution Internal Company RPM Repository
%vendor Company
%_signature gpg
%_gpg_name Company
%_topdir
%_tmppath %{_topdir}/TMP
# we don't use this, since the my-perl package is not a modified version
# of an upstream package
#%dist .my
%debug_package %{nil}
More information about the Catalyst
mailing list