1

我正在尝试Net::SSH::Perl使用cpanm(从版本 5.30 开始)perlbrew安装。perl安装失败并显示:

$ cpanm Net::SSH::Perl
--> Working on Net::SSH::Perl
Fetching http://www.cpan.org/authors/id/S/SC/SCHWIGON/Net-SSH-Perl-2.14.tar.gz ... OK
Configuring Net-SSH-Perl-2.14 ... OK
==> Found dependencies: Crypt::Curve25519
--> Working on Crypt::Curve25519
Fetching http://www.cpan.org/authors/id/A/AJ/AJGB/Crypt-Curve25519-0.06.tar.gz ... OK
Configuring Crypt-Curve25519-0.06 ... OK
Building and testing Crypt-Curve25519-0.06 ... FAIL
! Installing Crypt::Curve25519 failed. See /home/hakon/.cpanm/work/1587758019.381709/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Missing version info for module 'Crypt::Curve25519'
! Bailing out the installation for Net-SSH-Perl-2.14.

Crypt::Curve25519问题中描述了安装问题。我下载了有问题的模块并对其进行了修补:Crypt::Curve25519

git clone git@github.com:ajgb/crypt-curve25519.git
wget https://www.cpan.org/authors/id/S/SR/SREZIC/patches/Crypt-Curve25519-0.06-PR10-ANOTHERLINK.patch
cd crypt-curve25519
git apply ../Crypt-Curve25519-0.06-PR10-ANOTHERLINK.patch
perl Makefile.PL
make  # No errors now
make test
make install

但是,当我再次尝试安装时,Crypt::Curve25519它仍然会尝试从 CPAN 安装损坏的模块:

$ cpanm Net::SSH::Perl
--> Working on Net::SSH::Perl
Fetching http://www.cpan.org/authors/id/S/SC/SCHWIGON/Net-SSH-Perl-2.14.tar.gz ... OK
Configuring Net-SSH-Perl-2.14 ... OK
==> Found dependencies: Crypt::Curve25519
--> Working on Crypt::Curve25519
Fetching http://www.cpan.org/authors/id/A/AJ/AJGB/Crypt-Curve25519-0.06.tar.gz ... OK
Configuring Crypt-Curve25519-0.06 ... OK
Building and testing Crypt-Curve25519-0.06 ... FAIL
! Installing Crypt::Curve25519 failed. See /home/hakon/.cpanm/work/1587758833.382749/build.log for details. Retry with --force to force install it.
! Installing the dependencies failed: Missing version info for module 'Crypt::Curve25519'
! Bailing out the installation for Net-SSH-Perl-2.14.

我怎样才能cpanm使用已安装的补丁(即跳过安装,Crypt::Curve25519因为它已经安装)?

4

2 回答 2

1

问题似乎是VERSION模块中缺少信息。通过添加一行

our $VERSION = 0.06; 

到文件顶部lib/Crypt/Curve25519.pm然后重新安装,然后安装cpanm Net::SSH::Perl工作正常(它接受了修补安装并且没有尝试下载损坏的版本)。

这是我以前的补丁lib/Crypt/Curve25519.pm

diff --git a/lib/Crypt/Curve25519.pm b/lib/Crypt/Curve25519.pm
index 686b706..d9c2b3d 100644
--- a/lib/Crypt/Curve25519.pm
+++ b/lib/Crypt/Curve25519.pm
@@ -1,4 +1,5 @@
 package Crypt::Curve25519;
+our $VERSION = 0.06;
 #ABSTRACT: Generate shared secret using elliptic-curve Diffie-Hellman function

 use strict;
于 2020-04-24T21:13:33.470 回答
1

There's a few things to check:

  • cpanm knows where to find your patched version.
  • The patched version has a version that's higher than the one on CPAN. The module idea in CPAN assumes that you always want the latest, so ensure that yours is.
  • You don't want to install a patched module at the standard location because you don't want a cpan client to overwrite it.

Some other things that can work:

  • Force install the module and ignore the failures (cpanm has a --notest feature). The CPAN version is still installed, but that doesn't matter.
  • Have your patched version in a separate directory that's at the front of @INC so your program finds it first. This effectively hides the CPAN version.
于 2020-04-24T20:22:16.900 回答