1 |
Hi! |
2 |
|
3 |
I've no idea is installing perl modules from CPAN using |
4 |
cpan/cpansite/manually instead of using emerge is supported by Gentoo, but |
5 |
the truth is, dev-perl/ has only 772 packages now while CPAN has much much |
6 |
more and so it's unavoidable to install a lot of modules from CPAN using |
7 |
cpan/cpansite/manually if you do a lot of perl development. |
8 |
|
9 |
Probably g-cpan tool may help here, but I've not tried it yet. |
10 |
Is it able to: |
11 |
- automatically resolve and install deep perl module dependencies |
12 |
- handle interactive Makefile.PL |
13 |
- run tests for all modules by default (without forcing make test on all |
14 |
other packages in portage) |
15 |
- force install on failed tests |
16 |
- local cpan overlays (like cpansite from CPAN::Site) |
17 |
? |
18 |
|
19 |
After installing many modules using cpan/cpansite/manually you find |
20 |
yourself managing some perl modules using emerge and others using cpan - |
21 |
that's not ease and finally you'll unmerge all modules and will |
22 |
install/update *all* modules using cpan/cpansite. (You will have to add |
23 |
some perl modules to /etc/portage/profile/package.provided to stop portage |
24 |
from emerging them.) |
25 |
|
26 |
|
27 |
Now, we've a problem. After (re-)emerging perl, module Scalar::Util become |
28 |
broken (and so many other modules which need weaken() function): |
29 |
|
30 |
$ perl -e 'use Scalar::Util; print "ok\n"' |
31 |
ok |
32 |
|
33 |
$ perl -e 'use Scalar::Util qw( weaken ); print "ok\n"' |
34 |
Weak references are not implemented in the version of perl at -e line 1 |
35 |
BEGIN failed--compilation aborted at -e line 1. |
36 |
|
37 |
$ perl -e 'use Compress::Zlib; print "ok\n"' |
38 |
is only avaliable with the XS version at /usr/lib/perl5/site_perl/5.8.8/Compress/Zlib.pm line 9 |
39 |
BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.8.8/Compress/Zlib.pm line 9. |
40 |
Compilation failed in require at -e line 1. |
41 |
BEGIN failed--compilation aborted at -e line 1. |
42 |
|
43 |
This bug probably related to http://bugs.gentoo.org/show_bug.cgi?id=247585 |
44 |
|
45 |
Because of broken Compress::Zlib we can't use cpan command anymore to |
46 |
reinstall Scalar::Util, and have to download/unpack/install it manually. |
47 |
|
48 |
So, it looks like only way to work around this issue is use hook in |
49 |
/etc/portage/bashrc to reinstall Scalar::Util on "postinst" EBUILD_PHASE |
50 |
for dev-lang/perl package. Is there any better solution exists? |
51 |
|
52 |
|
53 |
P.S. Here is my /etc/portage/bashrc.d/dev-lang/perl.postinst: |
54 |
---cut--- |
55 |
#!/bin/bash |
56 |
ewarn "Reinstalling Scalar::Util!" |
57 |
latest=$(lynx -dump -listonly http://cpan.org/modules/by-module/Scalar/ | |
58 |
grep '/Scalar-List-Utils-.*\.tar\.gz' | |
59 |
awk '{print $2}' | |
60 |
perl -Mversion -ne ' |
61 |
($n)=/-([\d.]+)/; ($p,$s)=($n,$_) if qv($p)<qv($n); END{print$s} |
62 |
') |
63 |
if [ "x$latest" != "x" ]; then |
64 |
mkdir /tmp/perl-$$/ |
65 |
wget -q -O - "$latest" | tar xzf - -C /tmp/perl-$$/ |
66 |
( cd /tmp/perl-$$/* && perl Makefile.PL && make && make install ) |
67 |
rm -rf /tmp/perl-$$/ |
68 |
fi |
69 |
---cut--- |
70 |
|
71 |
-- |
72 |
WBR, Alex. |