SUMMARY: Packaging Perl Modules on Solaris...

Hello,
Thank you to the many individuals who responded. Too many to list. I got
lots of responses back so here are the most relevant (WARNING: this email
is long!):
Original Post:
> Is there any easy way to package perl modules on Solaris without having to
> tar up the source directory, move it to the destination host, untar it and
> run 'make install'?
Post #1:
Date: Wed, 28 May 2003 16:36:19 +0200
From: "Korte, Michael" <michael.korte@materna.de>
Yes, just be sure which directories belong to @INC
(just write a script with a line called :
use FOO; # does not exist !
and start it, the system will print out all directories where
it searched for *.pm files (perl modules)
)
then untar your tar file and copy all *.pm files in one of this directories.
But in this case there will be no man page for this Module.
You will need to create it manual -> perldoc
Post #2:
If they're reasonably simple, you could just tar them up and untar them
in their final resting place. On my system a lot of modules will end up
in /local/lib/perl5/site_perl/5.8.0 (I use a locally compiled copy of
perl). This works great for pure perl modules, especially the ones I've
written.
Another approach is just to do what the Makefile says. You can see that
with 'make -n install' in the source directory. For example:
my_box:/usr/local/src/Date-Calc-5.3$ make -n install | head
/usr/local/bin/perl "-MExtUtils::Command" -e mkpath blib/lib/Date
/usr/local/bin/perl "-MExtUtils::Command" -e eqtime
/local/lib/perl5/5.8.0/sun4-solaris-thread-multi/CORE/perl.h blib/lib/Date/.exists
chmod 755 blib/lib/Date
/bin/sh -c true
/usr/local/bin/perl "-MExtUtils::Command" -e mkpath blib/arch/auto/Date/Calc
Etc. (There may have been some line-wrapping above.)
I would recommend testing this, of course, as I rarely do this (except
in those rare cases when 'make install' doesn't work anyway).
Post #3 (The most relevant because I'm using this for installing
SpamAssassin):
I have just done this for Spamassassin 2.53 and all its dependant
components.
firstly, I downloaded Perl 5.8 from Sunfreeware.com this was
precompiled into a package.
then, on a development machine I downloaded all the perl modules I
needed and installed them on the Dev machine.
I then used the ".packlist" files for each module to create the package
for solaris in the following fashion:
In a directory I created called local_pkgs
create a subdirectory for the module to be packaged: i.e.
# mkdir PERLdatecalc
# cd PERLdatecalc
# vi Makefile
PKG=PERLdatcal
ARCH=sparc
PKGFILE=$(PKG)-$(ARCH).pkg
pkg:
pkgmk -o -r / -d /tmp -a $(ARCH)
touch $(PKGFILE)
pkgtrans -s /tmp $(PKGFILE) $(PKG)
@ echo check current directory for .pkg files
Create a pkginfo file next
# vi pkginfo
CLASSES=none
BASEDIR=/
TZ=GMT
PATH=/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin
PKG=PERLdatcal
NAME=Perl Date Calc Module
VERSION=5.3
CATEGORY=application
DESC=Date Calc Perl Module for SpamAssassin
VENDOR=(where you got the source code from)
PSTAMP=28thMay2003
PKGSAV=/var/sadm/pkg/PKG/save
now take your .packlist file and for each set of files in a unique
directory, add a line in for the directory, ie
the .packlist file contains:
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Carp/Clan.pm
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Carp/Clan.pod
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calc.pm
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calc.pod
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calc/Object.pm
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calc/Object.pod
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calendar.pm
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calendar.pod
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calendar/Profiles.pm
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calendar/Profiles.pod
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calendar/Year.pm
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calendar/Year.pod
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/auto/Date/Calc/Calc.bs
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/auto/Date/Calc/Calc.so
you will edit the file so it looks like this: (save the edited file in
the /local_pkgs/PERLdatecalc directory as PERLdatcal.list)
/usr
/usr/local
/usr/local/lib
/usr/local/lib/perl5
/usr/local/lib/perl5/site_perl/
/usr/local/lib/perl5/site_perl/5.8.0
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Carp
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Carp/Clan.pm
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Carp/Clan.pod
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calc.pm
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calc.pod
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calc
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calc/Object.pm
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calc/Object.pod
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calendar.pm
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calendar.pod
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calendar
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calendar/Profiles.pm
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calendar/Profiles.pod
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calendar/Year.pm
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/Date/Calendar/Year.pod
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/auto
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/auto/Date
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/auto/Date/Calc
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/auto/Date/Calc/Calc.bs
/usr/local/lib/perl5/site_perl/5.8.0/sun4-solaris/auto/Date/Calc/Calc.so
Then create the prototype file:
# cat PERLdatcal.list | pkgproto > prototype
then add the folowing to the top of the prototype file: (add the line I
have highlighted in bold)
# vi prototype
i pkginfo
d none /usr 0755 root sys
d none /usr/local 0755 root sys
d none /usr/local/lib 0755 bin bin
d none /usr/local/lib/perl5 0755 bin bin
d none /usr/local/lib/perl5/site_perl 0755 bin bin
d none /usr/local/lib/perl5/site_perl/5.8.0 0755 bin bin
.......
......
Now just make the package....
# make pkg
tar it up and write it to cd,
then you can use pkgadd to install it on any similar architecture.
you might want to check out this links
http://www.netsys.com/cgi-bin/display_article.cgi?909
or do a search on google for creating solaris packages
Post #4:
I have found another paper on creating packages in my favorites....
http://www.bolthole.com/solaris/makeapackage2.html
Post #5:
If you have the same perl version on say your desktop
you can build the perl modules, install them and then
tar up /usr/local/lib/perl5. Take that tar file and
move it to the systems you want to install the modules
on and untar. I would strongly recommend making a
backup on the system you are going to be doing this on
so you can debug any flakyness you may see.
Hope this helps, as ive done this on remote systems
I've had to replicate perl modules on and havent seen
a problem. Best way in the I would recommend is todo
sunpkgs so you have a good installation.
Post #6:
One trick I've used with good success is
'makepl_arg' => q[PREFIX=/var/tmp],
(in my ~/.cpan/CPAN/MyConfig.pm file)
followed by copying the relevant files from /var/tmp (mostly the
/var/tmp/lib and /var/tmp/man subtrees, sometimes /var/tmp/bin)
into my real perl installation directory.
The reason I'm doing this is that I tend to build modules as an
unprivileged user with read-only access to the perl installation.
You can of course make a tar, zip/jar or cpio archive of those files.
Or even a proper Solaris package. I think there is one file that the
normal module installation procedure would append to, to keep a
historical record; a purist may want to merge that carefully, but
I've found one can skip that step with impunity.
It is of course essential that you have the exact same version of
perl on your development and target machines, with the same installation
path names. But I don't think that should be a problem for you.
Thanks again to everyone who responded.
Ryan
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers