CPANのo confがいい人

問題

Meadowのために設定した$HOMEだったけど、Cygwinでもホームディレクトリのパスとして使われるらしいからD:に移動してみた。

ところが、CPANのキャッシュファイルが相変わらずMeadowのとこに来ちゃう。

直ったのが嬉しいのでメモっておく。

やっちまった例

いろいろ調べるとCPAN/Config.pmを編集するといいことがわかった。それっぽいところを編集し、例えばImage::Infoあたりを入れようとしてみると、


install Image::Info
cpan[1]> CPAN: Storable loaded ok (v2.20)
Going to read '~/.cpan/Metadata'
  Database was generated on Sat, 12 Feb 2011 17:29:48 GMTp
Running install for module 'Image::Info'
CPAN: YAML loaded ok (v0.71)
Running make for S/SR/SREZIC/Image-Info-1.31.tar.gz
CPAN: Digest::SHA loaded ok (v5.47)
CPAN: Compress::Zlib loaded ok (v2.02)
Checksum for ~/.cpan/sources/authors/id/S/SR/SREZIC/Image-Info-1.31.tar.gz ok
Scanning cache ~/.cpan/build for sizes
............................................................................DONE
DEL(1/1): ~/.cpan/build/tmp-4236
Cannot gzopen ~/.cpan/sources/authors/id/S/SR/SREZIC/Image-Info-1.31.tar.gz: cannot open file '~/.cpan/sources/authors/id/S/SR/SREZIC/Image-Info-1.31.tar.gz': No such file or directory
CPAN: Archive::Tar loaded ok (v1.52)
Could not open '~/.cpan/sources/authors/id/S/SR/SREZIC/Image-Info-1.31.tar.gz' for reading: No such file or directory at /usr/lib/perl5/5.10/CPAN/Tarzip.pm line 320
No data could be read from file at /usr/lib/perl5/5.10/CPAN/Tarzip.pm line 320
CPAN: File::Temp loaded ok (v0.22)
Catching error: "Error in tempdir() using ~/.cpan/build/SREZIC-XXXXXX: Parent directory (~/.cpan/build) does not exist at /usr/lib/perl5/5.10/CPAN/Distribution.pm line 503\cJ" at /usr/lib/perl5/5.10/CPAN.pm line 391
	CPAN::shell() called at /usr/bin/cpan line 198
Failed during this command:
 SREZIC/Image-Info-1.31.tar.gz                : unwrapped NO -- untar failed

とひどいことになった。わかると明らかなのだが、パスの部分をところどころ間違うとこういうことになる。

直った例

o conf initすると


o conf init
cpan[1]> 

CPAN is the world-wide archive of perl resources. It consists of about
300 sites that all replicate the same contents around the globe. Many
countries have at least one CPAN site already. The resources found on
CPAN are easily accessible with the CPAN.pm module. If you want to use
CPAN.pm, lots of things have to be configured. Fortunately, most of
them can be determined automatically. If you prefer the automatic
configuration, answer 'yes' below.

If you prefer to enter a dialog instead, you can answer 'no' to this
question and I'll let you configure in small steps one thing after the
other. (Note: you can revisit this dialog anytime later by typing 'o
conf init' at the cpan prompt.)
Would you like me to configure as much as possible automatically? [yes] no

こまごま設定できる。これで頑張ってみたところ、


cpan[5]> install Image::Info
Running install for module 'Image::Info'
Running make for S/SR/SREZIC/Image-Info-1.31.tar.gz
Unwrapping had some problem, won't try again without force
  Had problems unarchiving. Please build manually
Running make test
  Make had some problems, won't test
Running make install
  Make had some problems, won't install

けんもほろろな状態に。

設定は以下の様になっている。


cpan[4]> o conf
$CPAN::Config options from '/usr/lib/perl5/5.10/CPAN/Config.pm':
    commit             [Commit changes to disk]
    defaults           [Reload defaults from disk]
    help               [Short help about 'o conf' usage]
    init               [Interactive setting of all options]

    applypatch         []
    auto_commit        [0]
    build_cache        [100]
    build_dir          [/cygdrive/d/home/.cpan/build]
    build_dir_reuse    [0]
    build_requires_install_policy [ask/yes]
    bzip2              [/usr/bin/bzip2]
    cache_metadata     [1]
    check_sigs         [0]
    colorize_debug     [black on_cyan]
    colorize_output    [0]
    colorize_print     [bold blue on_white]
    colorize_warn      [bold red on_white]
    commandnumber_in_prompt [1]
    commands_quote     undef
    connect_to_internet_ok [1]
    cpan_home          [/cygdrive/d/home/.cpan]
    curl               [/usr/bin/curl]
    dontload_hash      undef
    dontload_list      undef
    ftp                [/usr/bin/ftp]
    ftp_passive        [1]
    ftp_proxy          []
    ftpstats_period    undef
    ftpstats_size      undef
    getcwd             [cwd]
    gpg                [/usr/bin/gpg]
    gzip               [/usr/bin/gzip]
    halt_on_failure    [0]
    histfile           [/cygdrive/d/home/.cpan/histfile]
    histsize           [100]
    http_proxy         []
    inactivity_timeout [0]
    index_expire       [1]
    inhibit_startup_message [0]
    keep_source_where  [/cygdrive/d/home/.cpan/sources]
    load_module_verbosity [v]
    lynx               [/usr/bin/lynx]
    make               [/usr/bin/make]
    make_arg           []
    make_install_arg   []
    make_install_make_command [/usr/bin/make]
    makepl_arg         []
    mbuild_arg         []
    mbuild_install_arg []
    mbuild_install_build_command [./Build]
    mbuildpl_arg       []
    ncftp              undef
    ncftpget           [/usr/bin/ncftpget]
    no_proxy           []
    pager              [/usr/bin/less]
    password           undef
    patch              [/usr/bin/patch]
    patches_dir        undef
    perl5lib_verbosity [v]
    prefer_installer   [MB]
    prefs_dir          [/cygdrive/d/home/.cpan/prefs]
    prerequisites_policy [ask]
    proxy_pass         undef
    proxy_user         undef
    randomize_urllist  undef
    scan_cache         [atstart]
    shell              [cmdproxy]
    show_unparsable_versions [0]
    show_upload_date   [0]
    show_zero_versions [0]
    tar                [/usr/bin/tar]
    tar_verbosity      [v]
    term_is_latin      [1]
    term_ornaments     [1]
    test_report        [0]
    trust_test_report_history [0]
    unzip              [/usr/bin/unzip]
    urllist
	0 [ftp://ftp.dti.ad.jp/pub/lang/CPAN/]
	1 [ftp://ftp.jaist.ac.jp/pub/CPAN/]
	2 [ftp://ftp.kddilabs.jp/CPAN/]
	3 [ftp://ftp.nara.wide.ad.jp/pub/CPAN/]
    use_sqlite         [1]
    username           undef
    wait_list          undef
    wget               [/usr/bin/wget]
    yaml_load_code     [0]
    yaml_module        [YAML]

ところが、cpanを再起動後、o conf initしてyesと答えてみたところ、


install Image::Info
cpan[1]> CPAN::SQLite not installed, trying to work without
CPAN: Storable loaded ok (v2.20)
Going to read '/cygdrive/d/home/.cpan/Metadata'
  Database was generated on Sat, 12 Feb 2011 16:29:45 GMT
Running install for module 'Image::Info'
CPAN: YAML loaded ok (v0.71)
Running make for S/SR/SREZIC/Image-Info-1.31.tar.gz
CPAN: LWP::UserAgent loaded ok (v5.835)
CPAN: Time::HiRes loaded ok (v1.9719)
Fetching with LWP:
  ftp://ftp.dti.ad.jp/pub/lang/CPAN/authors/id/S/SR/SREZIC/Image-Info-1.31.tar.gz
CPAN: Digest::SHA loaded ok (v5.47)
Fetching with LWP:
  ftp://ftp.dti.ad.jp/pub/lang/CPAN/authors/id/S/SR/SREZIC/CHECKSUMS
CPAN: Compress::Zlib loaded ok (v2.02)
Checksum for /cygdrive/d/home/.cpan/sources/authors/id/S/SR/SREZIC/Image-Info-1.31.tar.gz ok
Scanning cache /cygdrive/d/home/.cpan/build for sizes
............................................................................DONE
CPAN: Archive::Tar loaded ok (v1.52)
Image-Info-1.31/
---以下略---

動いた。

再起動が効いたと思われる。

まとめ

これまで不治の病と思っていたCPAN関係のトラブルだったが、o conf initと真剣に向き合うことによって解決した。

CPANの再起動を忘れずにね。

One Comment

  1. Posted 2017年3月8日 at 1:01 AM | Permalink

    Thanks for the marvelous posting! I genuinely enjoyed reading it, you will be a great author.
    I will be sure to bookmark your blog and will often come back
    someday. I want to encourage you to definitely continue your
    great writing, have a nice evening!

Post a Comment

Your email is never shared.

引く

PageTop