[carton] 29/472: Try to reinstall from build file
Lucas Kanashiro
kanashiro-guest at moszumanska.debian.org
Fri Jul 24 00:38:29 UTC 2015
This is an automated email from the git hooks/post-receive script.
kanashiro-guest pushed a commit to branch master
in repository carton.
commit f3cac18cbcae773679bde60443ed903121fcf0b1
Author: Tatsuhiko Miyagawa <miyagawa at bulknews.net>
Date: Sun Jun 26 00:50:18 2011 -0700
Try to reinstall from build file
---
lib/Carton.pm | 30 +++++++++++++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/lib/Carton.pm b/lib/Carton.pm
index 4a8c165..4c58a41 100644
--- a/lib/Carton.pm
+++ b/lib/Carton.pm
@@ -21,10 +21,26 @@ sub configure_cpanm {
sub install_from_build_file {
my($self, $file) = @_;
- $self->run_cpanm("--installdeps", ".")
+
+ my @modules = $self->show_deps();
+ $self->run_cpanm(@modules)
or die "Installing modules failed\n";
}
+sub show_deps {
+ my $self = shift;
+
+ my @output = $self->run_cpanm_output("--showdeps", ".");
+ my @deps;
+ for my $line (@output) {
+ chomp $line;
+ my($mod, $ver) = split / /, $line, 2;
+ push @deps, $mod;
+ }
+
+ return @deps;
+}
+
sub install_modules {
my($self, $modules) = @_;
$self->run_cpanm(@$modules)
@@ -181,6 +197,18 @@ sub build_deps {
return @deps;
}
+sub run_cpanm_output {
+ my($self, @args) = @_;
+
+ my $pid = open(my $kid, "-|"); # XXX portability
+ if ($pid) {
+ return <$kid>;
+ } else {
+ local $ENV{PERL_CPANM_OPT};
+ exec $self->{cpanm}, "--quiet", "-L", $self->{path}, @args;
+ }
+}
+
sub run_cpanm {
my($self, @args) = @_;
local $ENV{PERL_CPANM_OPT};
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/carton.git
More information about the Pkg-perl-cvs-commits
mailing list