首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >为依赖模块安装补丁:手动安装补丁模块后,cpanm仍尝试安装损坏的模块

为依赖模块安装补丁:手动安装补丁模块后,cpanm仍尝试安装损坏的模块
EN

Stack Overflow用户
提问于 2020-04-25 04:09:39
回答 2查看 244关注 0票数 1

我正在尝试使用cpanm (从perlbrewperl版本5.30)安装Net::SSH::Perl。安装失败,并显示以下错误:

代码语言:javascript
复制
$ 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.

this issue中描述了安装Crypt::Curve25519的问题。我下载了有问题的模块Crypt::Curve25519并给它打了补丁:

代码语言:javascript
复制
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安装损坏的模块:

代码语言:javascript
复制
$ 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的安装,因为它已经安装)?

EN

回答 2

Stack Overflow用户

发布于 2020-04-25 04:22:17

有几件事需要检查:

  • cpanm知道哪里可以找到您的补丁版本。
  • 打过补丁的版本比CPAN上的版本高。CPAN中的模块思想假设您总是需要最新版本,因此请确保您的是最新版本。
  • 您不想在标准位置安装打补丁的模块,因为您不想让cpan客户端覆盖它。

还可以做一些其他的事情:

  • 强制安装模块并忽略故障(cpanm具有--notest功能)。
  • 将你的补丁版本放在一个单独的目录中,这个目录位于@INC的前面,所以你的程序会首先找到它。这将有效地隐藏CPAN版本。
票数 1
EN

Stack Overflow用户

发布于 2020-04-25 05:13:33

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

代码语言:javascript
复制
our $VERSION = 0.06; 

到文件lib/Crypt/Curve25519.pm的顶部,然后重新安装,然后安装cpanm Net::SSH::Perl工作得很好(它接受打了补丁的安装,不会尝试下载损坏的版本)。

这是我用来lib/Crypt/Curve25519.pm的补丁

代码语言:javascript
复制
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;
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/61416648

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档