WebARENAのVPSサーバー設定メモ(4) cpan2rpmの導入


cpan2rpmを導入し、PerlモジュールをRPMパッケージでインストールできるようにします。

IT/WEB業界への転職なら求人サイトGreen

cpan2rpmインストール

[root@localhost ~]# wget http://nchc.dl.sourceforge.net/sourceforge/cpan2rpm/cpan2rpm-2.027-1.noarch.rpm
最新版の確認
[root@localhost ~]# rpm -Uvh cpan2rpm-2.027-1.noarch.rpm  ← cpan2rpmインストール
Preparing...                ########################################### [100%]
1:cpan2rpm               ########################################### [100%]
[root@localhost ~]# rm -f cpan2rpm-2.027-1.noarch.rpm  ← ダウンロードしたファイルを削除 
[root@localhost ~]# 

cpan2rpm確認

cpan2rpmが正しく動作するか、試しにURI::Findをインストールしてみます。

[root@localhost ~]# cpan2rpm –install URI::Find
-- cpan2rpm - Ver: 2.027 --
Upgrade check
* A newer version of this program is now available. To upgrade
* enter the following command: /usr/bin/cpan2rpm --upgrade
Fetch: HTTP
-- module: –install --
Module not found on CPAN web site! at /usr/bin/cpan2rpm line 1201.
-- Done --
[root@localhost ~]# 

あれ?新しいバージョンを入れてくださいとエラーが出ました。
最新版のはずなのに、、、と思いつつupdate実行

[root@localhost ~]#  /usr/bin/cpan2rpm --upgrade  ← cpan2rpmのアップグレード
-- cpan2rpm - Ver: 2.027 --
Upgrading...
Latest ver: 2.028
Retrieving URL
Generating spec file
SPEC: ./cpan2rpm.spec
-- Done --
Installing package
Preparing...                ########################################### [100%]
1:cpan2rpm               ########################################### [100%]
-- Done --
[root@localhost ~]# 

これで最新のcpan2rpmがインストールされました。
気を取り直して、再度URI::Findをインストールしてみます。

[root@localhost ~]# cpan2rpm --install URI::Find
-- cpan2rpm - Ver: 2.028 --
Upgrade check
Fetch: HTTP
-- module: URI::Find --
Found: URI-Find-20100505.tar.gz
At: http://search.cpan.org//CPAN/authors/id/M/MS/MSCHWERN
Retrieving URL
Metadata retrieval
Tarball extraction: [/usr/src/redhat/SOURCES/URI-Find-20100505.tar.gz]
Module::Build unloadable
Can't locate Module/Build.pm in @INC (@INC contains: /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/site_perl/5.8.8 /usr/lib/perl5/site_perl /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/vendor_perl/5.8.8 /usr/lib/perl5/vendor_perl /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi /usr/lib/perl5/5.8.8 .) at (eval 24) line 2.
BEGIN failed--compilation aborted at (eval 24) line 2.
-- Done --
[root@localhost ~]# 

Module/Build.pmが無いと怒られましたので、インストールします。

[root@localhost ~]# yum install --enablerepo=rpmforge perl-Module-Build
Loaded plugins: downloadonly, fastestmirror, priorities
Loading mirror speeds from cached hostfile
* addons: rsync.atworks.co.jp
* base: rsync.atworks.co.jp
* extras: rsync.atworks.co.jp
* rpmforge: fr2.rpmfind.net
* updates: rsync.atworks.co.jp
addons                                                             |  951 B     00:00     
base                                                               | 2.1 kB     00:00     
extras                                                             | 2.1 kB     00:00     
updates                                                            | 1.9 kB     00:00     
Excluding Packages in global exclude list
Finished
402 packages excluded due to repository priority protections
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package perl-Module-Build.noarch 1:0.3607-1.el5.rf set to be updated
--> Processing Dependency: perl(ExtUtils::CBuilder) >= 0.27 for package: perl-Module-Build
--> Processing Dependency: perl(ExtUtils::ParseXS) >= 2.21 for package: perl-Module-Build
--> Running transaction check
---> Package perl-ExtUtils-CBuilder.noarch 0:0.2603.01-1.el5.rf set to be updated
---> Package perl-ExtUtils-ParseXS.noarch 0:2.20.02-1.el5.rf set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
==========================================================================================
Package                      Arch         Version                   Repository      Size
==========================================================================================
Installing:
perl-Module-Build            noarch       1:0.3607-1.el5.rf         rpmforge       298 k
Installing for dependencies:
perl-ExtUtils-CBuilder       noarch       0.2603.01-1.el5.rf        rpmforge        36 k
perl-ExtUtils-ParseXS        noarch       2.20.02-1.el5.rf          rpmforge        32 k
Transaction Summary
==========================================================================================
Install       3 Package(s)
Upgrade       0 Package(s)
Total download size: 366 k
Is this ok [y/N]: y
Downloading Packages:
(1/3): perl-ExtUtils-ParseXS-2.20.02-1.el5.rf.noarch.rpm           |  32 kB     00:00     
(2/3): perl-ExtUtils-CBuilder-0.2603.01-1.el5.rf.noarch.rpm        |  36 kB     00:00     
(3/3): perl-Module-Build-0.3607-1.el5.rf.noarch.rpm                | 298 kB     00:01     
------------------------------------------------------------------------------------------
Total                                                      93 kB/s | 366 kB     00:03     
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing     : perl-ExtUtils-CBuilder                                             1/3 
Installing     : perl-ExtUtils-ParseXS                                              2/3 
Installing     : perl-Module-Build                                                  3/3 
Installed:
perl-Module-Build.noarch 1:0.3607-1.el5.rf                                              
Dependency Installed:
perl-ExtUtils-CBuilder.noarch 0:0.2603.01-1.el5.rf                                      
perl-ExtUtils-ParseXS.noarch 0:2.20.02-1.el5.rf                                         
Complete!
[root@localhost ~]#

今度こそURI::Findは入るでしょうか。再チャレンジです。

[root@localhost ~]# cpan2rpm --install URI::Find
-- cpan2rpm - Ver: 2.028 --
Upgrade check
Fetch: HTTP
-- module: URI::Find --
Using cached URL: http://search.cpan.org//CPAN/authors/id/M/MS/MSCHWERN/URI-Find-20100505.tar.gz
Tarball found - not fetching
Metadata retrieval
Tarball extraction: [/usr/src/redhat/SOURCES/URI-Find-20100505.tar.gz]
No version found, please use --version option.  Stopped at /usr/bin/cpan2rpm line 580.
-- Done --
[root@localhost ~]#

今度は見つからないとエラーが、、、

URLを指定するか、バージョンを指定すればダウンロードできました。

[root@localhost ~]# cpan2rpm http://search.cpan.org//CPAN/authors/id/R/RO/ROSCH/URI-Find-0.16.tar.gz --no-sign --install --author URI::Find
-- cpan2rpm - Ver: 2.028 --
Upgrade check
Fetch: HTTP
-- module: http://search.cpan.org//CPAN/authors/id/R/RO/ROSCH/URI-Find-0.16.tar.gz --
Retrieving URL
Metadata retrieval
Tarball extraction: [/usr/src/redhat/SOURCES/URI-Find-0.16.tar.gz]
Generating spec file
SPEC: /usr/src/redhat/SPECS/URI-Find.spec
Generating package
Executing(%prep): /bin/sh -e /var/tmp/rpm-tmp.94103
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd /usr/src/redhat/BUILD
+ rm -rf URI-Find-0.16
+ /bin/gzip -dc /usr/src/redhat/SOURCES/URI-Find-0.16.tar.gz
+ tar -xf -
+ STATUS=0
+ '[' 0 -ne 0 ']'
+ cd URI-Find-0.16
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chown -Rhf root .
++ /usr/bin/id -u
+ '[' 0 = 0 ']'
+ /bin/chgrp -Rhf root .
+ /bin/chmod -Rf a+rX,u+w,g-w,o-w .
+ chmod -R u+w /usr/src/redhat/BUILD/URI-Find-0.16
+ exit 0
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.94103
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd URI-Find-0.16
+ grep -rsl '^#!.*perl' .
+ grep -v '.bak$'
+ xargs --no-run-if-empty /usr/bin/perl -MExtUtils::MakeMaker -e 'MY->fixin(@ARGV)'
+ CFLAGS='-O2 -g -m64 -mtune=generic'
++ /usr/bin/perl -MExtUtils::MakeMaker -e ' print qq|PREFIX=/var/tmp/perl-URI-Find-0.16-root/usr| if $ExtUtils::MakeMaker::VERSION =~ /5\.9[1-6]|6\.0[0-5]/ '
+ /usr/bin/perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for URI::Find
+ /usr/bin/make
cp lib/URI/Find.pm blib/lib/URI/Find.pm
cp lib/URI/Find/Schemeless.pm blib/lib/URI/Find/Schemeless.pm
Manifying blib/man3/URI::Find.3pm
Manifying blib/man3/URI::Find::Schemeless.3pm
+ /usr/bin/make test
PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
t/Find...............ok                                                      
t/load-schemeless....ok                                                      
All tests successful.
Files=2, Tests=382,  0 wallclock secs ( 0.09 cusr +  0.03 csys =  0.12 CPU)
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.35008
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd URI-Find-0.16
+ '[' /var/tmp/perl-URI-Find-0.16-root '!=' / ']'
+ rm -rf /var/tmp/perl-URI-Find-0.16-root
++ /usr/bin/perl -MExtUtils::MakeMaker -e ' print $ExtUtils::MakeMaker::VERSION <= 6.05 ? qq|PREFIX=/var/tmp/perl-URI-Find-0.16-root/usr| : qq|DESTDIR=/var/tmp/perl-URI-Find-0.16-root| '
+ make prefix=/var/tmp/perl-URI-Find-0.16-root/usr exec_prefix=/var/tmp/perl-URI-Find-0.16-root/usr bindir=/var/tmp/perl-URI-Find-0.16-root/usr/bin sbindir=/var/tmp/perl-URI-Find-0.16-root/usr/sbin sysconfdir=/var/tmp/perl-URI-Find-0.16-root/etc datadir=/var/tmp/perl-URI-Find-0.16-root/usr/share includedir=/var/tmp/perl-URI-Find-0.16-root/usr/include libdir=/var/tmp/perl-URI-Find-0.16-root/usr/lib64 libexecdir=/var/tmp/perl-URI-Find-0.16-root/usr/libexec localstatedir=/var/tmp/perl-URI-Find-0.16-root/var sharedstatedir=/var/tmp/perl-URI-Find-0.16-root/usr/com mandir=/var/tmp/perl-URI-Find-0.16-root/usr/share/man infodir=/var/tmp/perl-URI-Find-0.16-root/usr/share/info install DESTDIR=/var/tmp/perl-URI-Find-0.16-root
Installing /var/tmp/perl-URI-Find-0.16-root/usr/lib/perl5/site_perl/5.8.8/URI/Find.pm
Installing /var/tmp/perl-URI-Find-0.16-root/usr/lib/perl5/site_perl/5.8.8/URI/Find/Schemeless.pm
Installing /var/tmp/perl-URI-Find-0.16-root/usr/share/man/man3/URI::Find.3pm
Installing /var/tmp/perl-URI-Find-0.16-root/usr/share/man/man3/URI::Find::Schemeless.3pm
Writing /var/tmp/perl-URI-Find-0.16-root/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/auto/URI/Find/.packlist
Appending installation info to /var/tmp/perl-URI-Find-0.16-root/usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/perllocal.pod
+ cmd=/usr/share/spec-helper/compress_files
+ '[' -x /usr/share/spec-helper/compress_files ']'
+ cmd=/usr/lib/rpm/brp-compress
+ '[' -x /usr/lib/rpm/brp-compress ']'
+ /usr/lib/rpm/brp-compress
+ '[' -e /etc/SuSE-release -o -e /etc/UnitedLinux-release ']'
+ find /var/tmp/perl-URI-Find-0.16-root -name perllocal.pod -o -name .packlist -o -name '*.bs'
+ xargs -i rm -f '{}'
+ find /var/tmp/perl-URI-Find-0.16-root/usr -type d -depth -exec rmdir '{}' ';'
+ /usr/bin/perl -MFile::Find -le '
find({ wanted => \&wanted, no_chdir => 1}, "/var/tmp/perl-URI-Find-0.16-root");
print "%doc  TODO Changes INSTALL README";
for my $x (sort @dirs, @files) {
push @ret, $x unless indirs($x);
}
print join "\n", sort @ret;
sub wanted {
return if /auto$/;
local $_ = $File::Find::name;
my $f = $_; s|^\Q/var/tmp/perl-URI-Find-0.16-root\E||;
return unless length;
return $files[@files] = $_ if -f $f;
$d = $_;
/\Q$d\E/ && return for reverse sort @INC;
$d =~ /\Q$_\E/ && return
for qw|/etc /usr/man /usr/bin /usr/share|;
$dirs[@dirs] = $_;
}
sub indirs {
my $x = shift;
$x =~ /^\Q$_\E\// && $x ne $_ && return 1 for @dirs;
}
'
+ '[' -z URI-Find-0.16-filelist ']'
+ /usr/lib/rpm/brp-compress
+ /usr/lib/rpm/brp-strip
+ /usr/lib/rpm/brp-strip-static-archive
+ /usr/lib/rpm/brp-strip-comment-note
Processing files: perl-URI-Find-0.16-1
Executing(%doc): /bin/sh -e /var/tmp/rpm-tmp.99301
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd URI-Find-0.16
+ DOCDIR=/var/tmp/perl-URI-Find-0.16-root/usr/share/doc/perl-URI-Find-0.16
+ export DOCDIR
+ rm -rf /var/tmp/perl-URI-Find-0.16-root/usr/share/doc/perl-URI-Find-0.16
+ /bin/mkdir -p /var/tmp/perl-URI-Find-0.16-root/usr/share/doc/perl-URI-Find-0.16
+ cp -pr TODO Changes INSTALL README /var/tmp/perl-URI-Find-0.16-root/usr/share/doc/perl-URI-Find-0.16
+ exit 0
Provides: perl(URI::Find) = 0.16 perl(URI::Find::Schemeless) = 1.8
Requires(rpmlib): rpmlib(CompressedFileNames) <= 3.0.4-1 rpmlib(PayloadFilesHavePrefix) <= 4.0-1 rpmlib(VersionedDependencies) <= 3.0.3-1
Requires: perl >= 0:5.005 perl(Carp) perl(URI) perl(URI::Find) perl(URI::URL) perl(base) perl(constant) perl(strict) perl(vars)
Checking for unpackaged file(s): /usr/lib/rpm/check-files /var/tmp/perl-URI-Find-0.16-root
Wrote: /usr/src/redhat/SRPMS/perl-URI-Find-0.16-1.src.rpm
Wrote: /usr/src/redhat/RPMS/noarch/perl-URI-Find-0.16-1.noarch.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.99301
+ umask 022
+ cd /usr/src/redhat/BUILD
+ cd URI-Find-0.16
+ '[' /var/tmp/perl-URI-Find-0.16-root '!=' / ']'
+ rm -rf /var/tmp/perl-URI-Find-0.16-root
+ exit 0
Executing(--clean): /bin/sh -e /var/tmp/rpm-tmp.99301
+ umask 022
+ cd /usr/src/redhat/BUILD
+ rm -rf URI-Find-0.16
+ exit 0
RPM: /usr/src/redhat/RPMS/noarch/perl-URI-Find-0.16-1.noarch.rpm
SRPM: /usr/src/redhat/SRPMS/perl-URI-Find-0.16-1.src.rpm
Installing package
Preparing...                ########################################### [100%]
1:perl-URI-Find          ########################################### [100%]
-- Done --
[root@localhost ~]#

正しくインストールされたか確認します。

[root@localhost ~]#  rpm -q perl-URI-Find
perl-URI-Find-0.16-1  ← インストールされていれば表示される

 

この記事が気に入ったら
いいね!しよう

最新情報をお届けします

follow us in feedly