• このエントリーをはてなブックマークに追加

2012-11-29 22:15 追記

@hide_o_55 さんにジャストな答えをいただきました.ありがとうございます!

@issm オレオレモジュールはorepan.plで登録できますよ。orepan.pl -d /path/to/repository Bar-0.01.tar.gz –pause FOO
Twitter / hide_o_55: @issm オレオレモジュールはorepan.plで …

@issm 依存モジュールは cpanm –save-dists=/path/to/repository –installdeps + orepan_index.pl でやっておく必要がありますけどね
Twitter / hide_o_55: @issm 依存モジュールは …

ということで解決編を追記しました.

はじめに

CPANのしくみをよくわかっていない私めにどなたか教えてくだちい><

環境

% cpanm --version; carton --version; perl -v | head -2
cpanm (App::cpanminus) version 1.5018
carton v0.9.4
 
This is perl 5, version 14, subversion 3 (v5.14.3) built for darwin-2level

ワーキングディレクトリを /Users/issm/path/to/app とし,その下 local/cache に orepan モジュール群を準備したいと考えています.

なお,本エントリで使用しているオレオレモジュールは,PDF::API2::Koromo という PDF::API2 のラッパ的なものです:

一応 make test は通っているので,そのあたりの問題ではないかと思います><

やってみた手順

ディストリビューションファイルを local/cache 下に置きたいので,次のようにして持ってきました.ディレクトリ _dummy はあとで消します:

% cd /Users/issm/path/to/app
% cpanm --save-dists=local/cache -L_dummy --installdeps /path/to/my/nora/modules/PDF-API2-Koromo-0.00_04-no-Image-Magick/PDF-API2-Koromo-0.00_04.tar.gz
...

こんな感じで置かれました:

% find local/cache -name PDF-API2-Koromo\*
local/cache/authors/id/PDF-API2-Koromo-0.00_04.tar.gz

orepan_index.pl を実行します:

% orepan_index.pl -r local/cache
...

インデックス(?)は次のように:

% gunzip -c local/cache/modules/02packages.details.txt.gz | grep PDF::API2::Koromo
PDF::API2::Koromo       0.00_04 PDF-API2-Koromo-0.00_04.tar.gz
PDF::API2::Koromo::Types        undef   PDF-API2-Koromo-0.00_04.tar.gz

ちなみに PDF::API2 の場合はこんな感じですね:

% gunzip -c local/cache/modules/02packages.details.txt.gz | grep PDF::API2 | head -1
PDF::API2       2.019   S/SS/SSIMMS/PDF-API2-2.019.tar.gz

以上の環境のもと,CPAN ミラーを file:///Users/issm/path/to/app/local/cache として PDF::API2::Koromo を(ダミーディレクトリに)インストールしようとしたところ,うまくいきませんでした:

% cpanm -v -l_dummmy --mirror file:///Users/issm/path/to/app/local/cache --mirror-only PDF::API2::Koromo
cpanm (App::cpanminus) 1.5018 on perl 5.014003 built for darwin-2level
Work directory is /Users/issm/.cpanm/work/1354185174.40090
You have make /usr/bin/make
You have LWP 6.04
You have /usr/bin/tar: bsdtar 2.8.3 - libarchive 2.8.3
You have /usr/bin/unzip
Searching PDF::API2::Koromo on mirror file:///Users/issm/path/to/app/local/cache ...
Downloading index file file:///Users/issm/path/to/app/local/cache/modules/02packages.details.txt.gz ...
Checking if you have ExtUtils::MakeMaker 6.31 ... Yes (6.62)
Checking if you have ExtUtils::Install 1.46 ... Yes (1.56)
--> Working on PDF::API2::Koromo
Fetching file:///Users/issm/path/to/app/local/cache/authors/id////P/PD/PDF-API2-Koromo-0.00_04.tar.gz ... FAIL
! Download file:///Users/issm/path/to/app/local/cache/authors/id////P/PD/PDF-API2-Koromo-0.00_04.tar.gz failed. Retrying ... 
! Download file:///Users/issm/path/to/app/local/cache/authors/id////P/PD/PDF-API2-Koromo-0.00_04.tar.gz failed. Retrying ... 
! Download file:///Users/issm/path/to/app/local/cache/authors/id////P/PD/PDF-API2-Koromo-0.00_04.tar.gz failed. Retrying ... 
! Failed to download file:///Users/issm/path/to/app/local/cache/authors/id////P/PD/PDF-API2-Koromo-0.00_04.tar.gz
! Failed to fetch distribution PDF-API2-Koromo-0.00_04

考察

先のインデックス(?)での記録のされ方から,正式な CPAN モジュールは local/cache/authors/id/S/SO/SOMEONE/... ってなるけど,オレオレモジュールはそうならないのが原因っぽいのはなんとなくわかります><

オレオレモジュールでも CPANID が付与される方法があるのかどうか,そのあたりでしょうかね...

解決編

orepan.pl コマンド(スクリプト)で PAUSE ID を指定して登録することで,上記の悩みを解決できます.

% cd /users/issm/path/to/app
% orepan.pl -d local/cache -p ISSM /path/to/my/nora/modules/PDF-API2-Koromo-0.00_04-no-Image-Magick/PDF-API2-Koromo-0.00_04.tar.gz
2012-11-29T21:40:56 [INFO] put the archive to repository at /Users/issm/.perlbrew/libs/perl-5.14.3@myapp/bin/orepan.pl line 522012-11-29T21:40:56 [INFO] get package names at /Users/issm/.perlbrew/libs/perl-5.14.3@myapp/bin/orepan.pl line 58
2012-11-29T21:40:56 [INFO] retrieve meta data at /Users/issm/.perlbrew/libs/perl-5.14.3@myapp/lib/perl5/OrePAN/Archive.pm line 72
2012-11-29T21:40:56 [INFO] files at /Users/issm/.perlbrew/libs/perl-5.14.3@myapp/lib/perl5/OrePAN/Archive.pm line 1842012-11-29T21:40:56 [INFO] ok files at /Users/issm/.perlbrew/libs/perl-5.14.3@myapp/lib/perl5/OrePAN/Archive.pm line 187
2012-11-29T21:40:56 [INFO] parsing: /var/folders/vk/959p08hd1fxckylcr4gcflm80000gn/T/ZrZCm75sBt/PDF-API2-Koromo-0.00_04/lib/PDF/API2/Koromo.pm at /Users/issm/.perlbrew/libs/perl-5.14.3@myapp/lib/perl5/OrePAN/Archive.pm line 193
2012-11-29T21:40:56 [INFO] parsed: PDF::API2::Koromo version: 0.00_04 at /Users/issm/.perlbrew/libs/perl-5.14.3@myapp/lib/perl5/OrePAN/Archive.pm line 1952012-11-29T21:40:56 [INFO] parsing: /var/folders/vk/959p08hd1fxckylcr4gcflm80000gn/T/ZrZCm75sBt/PDF-API2-Koromo-0.00_04/lib/PDF/API2/Koromo/Types.pm at /Users/issm/.perlbrew/libs/perl-5.14.3@myapp/lib/perl5/OrePAN/Archive.pm line 193
2012-11-29T21:40:56 [INFO] parsed: PDF::API2::Koromo::Types version: none at /Users/issm/.perlbrew/libs/perl-5.14.3@myapp/lib/perl5/OrePAN/Archive.pm line 1952012-11-29T21:40:56 [INFO] make index at /Users/issm/.perlbrew/libs/perl-5.14.3@myapp/bin/orepan.pl line 62
2012-11-29T21:40:56 [INFO] Adding PDF-API2-Koromo-0.00_04 at /Users/issm/.perlbrew/libs/perl-5.14.3@myapp/lib/perl5/OrePAN/Package/Index.pm line 63
2012-11-29T21:40:56 [INFO] Save local/cache/modules/02packages.details.txt.gz at /Users/issm/.perlbrew/libs/perl-5.14.3@myapp/lib/perl5/OrePAN/Package/Index.pm line 91
% find local/cache -name PDF-API2-Koromo\*
local/cache/authors/id/I/IS/ISSM/PDF-API2-Koromo-0.00_04.tar.gz
% gunzip -c local/cache/modules/02packages.details.txt.gz | grep PDF::API2::Koromo
PDF::API2::Koromo       0.00_04 I/IS/ISSM/PDF-API2-Koromo-0.00_04.tar.gz
PDF::API2::Koromo::Types        undef   I/IS/ISSM/PDF-API2-Koromo-0.00_04.tar.gz

登録されました!

そして,依存モジュールを持ってきます:

% cpanm --save-dists=local/cache -L_dummy --installdeps --mirror file:///Users/issm/path/to/app/local/cache PDF::API2::Koromo
! Finding PDF::API2::Koromo on cpanmetadb failed.
! Finding PDF::API2::Koromo on search.cpan.org failed.
--> Working on PDF::API2::Koromo
Fetching file:////Users/issm/path/to/app/local/cache/authors/id/I/IS/ISSM/PDF-API2-Koromo-0.00_04.tar.gz ... OK==> Found dependencies: ExtUtils::MakeMaker
--> Working on ExtUtils::MakeMaker
Fetching file:////Users/issm/path/to/app/local/cache/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.62.tar.gz ... FAIL
! Download file:////Users/issm/path/to/app/local/cache/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.62.tar.gz failed. Retrying ... 
! Download file:////Users/issm/path/to/app/local/cache/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.62.tar.gz failed. Retrying ... 
! Download file:////Users/issm/path/to/app/local/cache/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.62.tar.gz failed. Retrying ... 
! Failed to download file:////Users/issm/path/to/app/local/cache/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.62.tar.gz
! Failed to fetch distribution ExtUtils-MakeMaker-6.62
! Bailing out the installation for PDF-API2-Koromo-0.00_04. Retry with --prompt or --force.

あら, --mirror-only オプションはつけてないけど公式の方へ取りにいってないですね.では,http://www.cpan.org/ もミラーに追加してみましょう:

% cpanm --save-dists=local/cache -L_dummy --installdeps --mirror file:///$PWD/local/cache --mirror http://www.cpan.org/ PDF::API2::Koromo
! Finding PDF::API2::Koromo on cpanmetadb failed.
! Finding PDF::API2::Koromo on search.cpan.org failed.
--> Working on PDF::API2::Koromo
Fetching file:////Users/issm/path/to/app/local/cache/authors/id/I/IS/ISSM/PDF-API2-Koromo-0.00_04.tar.gz ... OK==> Found dependencies: ExtUtils::MakeMaker
--> Working on ExtUtils::MakeMaker
Fetching file:////Users/issm/path/to/app/local/cache/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.62.tar.gz ... FAIL
! Download file:////Users/issm/path/to/app/local/cache/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.62.tar.gz failed. Retrying ... 
! Download file:////Users/issm/path/to/app/local/cache/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.62.tar.gz failed. Retrying ... 
! Download file:////Users/issm/path/to/app/local/cache/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.62.tar.gz failed. Retrying ... 
! Failed to download file:////Users/issm/path/to/app/local/cache/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.62.tar.gz
Fetching http://www.cpan.org/authors/id/M/MS/MSCHWERN/ExtUtils-MakeMaker-6.62.tar.gz ... OK
Configuring ExtUtils-MakeMaker-6.62 ... OK
Building and testing ExtUtils-MakeMaker-6.62 ... OK
Successfully installed ExtUtils-MakeMaker-6.62 (upgraded from 6.57_05)
Configuring PDF-API2-Koromo-0.00_04 ... OK
==> Found dependencies: Try::Tiny, Image::Size, Class::Accessor::Lite, PDF::API2, Data::Validator, MouseX::Types, Furl
--> Working on Try::Tiny
Fetching file:////Users/issm/path/to/app/local/cache/authors/id/D/DO/DOY/Try-Tiny-0.11.tar.gz ... FAIL
! Download file:////Users/issm/path/to/app/local/cache/authors/id/D/DO/DOY/Try-Tiny-0.11.tar.gz failed. Retrying ... 
! Download file:////Users/issm/path/to/app/local/cache/authors/id/D/DO/DOY/Try-Tiny-0.11.tar.gz failed. Retrying ... 
! Download file:////Users/issm/path/to/app/local/cache/authors/id/D/DO/DOY/Try-Tiny-0.11.tar.gz failed. Retrying ... 
! Failed to download file:////Users/issm/path/to/app/local/cache/authors/id/D/DO/DOY/Try-Tiny-0.11.tar.gz
Fetching http://www.cpan.org/authors/id/D/DO/DOY/Try-Tiny-0.11.tar.gz ... OK
Configuring Try-Tiny-0.11 ... OK
Building and testing Try-Tiny-0.11 ... OK
Successfully installed Try-Tiny-0.11
 
...
 
Successfully installed HTTP-Parser-XS-0.15
Building and testing Furl-1.00 ... OK
Successfully installed Furl-1.00
<== Installed dependencies for PDF::API2::Koromo. Finishing.
19 distributions installed

FAIL だらけでアレですが,依存モジュールが local/cache 下に入りました.ここで orepan_index.pl を実行します:

% orepan_index.pl -r local/cache
...

local/cached 下のモジュールのみで PDF::API2::Koromo のインストールが可能かどうかを試してみます:

% carton install --cached PDF::API2::Koromo
Installing modules from the command line
Successfully installed ExtUtils-MakeMaker-6.62 (upgraded from 6.57_05)
Successfully installed Try-Tiny-0.11
Successfully installed Module-Build-0.4003 (upgraded from 0.3800)
Successfully installed Image-Size-3.232
Successfully installed Class-Accessor-Lite-0.05
Successfully installed IO-String-1.08
Successfully installed Font-TTF-1.02
Successfully installed PDF-API2-2.019
Successfully installed Test-Requires-0.06
Successfully installed Mouse-1.02
Successfully installed Data-Validator-1.02
Successfully installed Sub-Uplevel-0.24
Successfully installed Test-Exception-0.31
Successfully installed Any-Moose-0.18
Successfully installed MouseX-Types-0.06
Successfully installed Test-SharedFork-0.21
Successfully installed Test-TCP-1.18
Successfully installed HTTP-Parser-XS-0.15
Successfully installed Furl-1.00
Successfully installed PDF-API2-Koromo-0.00_04
20 distributions installed
Complete! Modules were installed into local

できました!