Skip Menu |
 

This queue is for tickets about the Module-Install CPAN distribution.

Report information
The Basics
Id: 56564
Status: rejected
Priority: 0/
Queue: Module-Install

People
Owner: Nobody in particular
Requestors: florent.angly [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Correct deployment of bundled modules
Download (untitled) / with headers
text/plain 470b
Hi, Included is a patch against Module::Install SVN revision 11928. It affects only file Module/Install/Bundle.pm. The first time a user deploys a package that has bundled modules (be it with auto_bundle_deps, bundle_deps, auto_bundle, or bundle), the bundled modules (read from inc/BUNDLE.yml) are added to the list of modules to process for installation. Also, I added a checks to make sure that the directory where a bundled module lives is valid. Cheers, Florent
Subject: bundle.diff
Download bundle.diff
text/x-diff 3k
Index: Bundle.pm =================================================================== --- Bundle.pm (revision 11928) +++ Bundle.pm (working copy) @@ -35,6 +35,19 @@ my $bundle_dir = $self->_top->{bundle}; $bundle_dir =~ s/\W+/\\W+/g; + # The first time here as a user, process all modules bundled + if ( (scalar keys %$bundles > 0) && (not $self->{_bundle_processed}) ) { + while ( my ($mod_name, $dist_source_dir) = each %{$bundles} ) { + my $version = 0; + if ($dist_source_dir =~ m/^$bundle_dir\W+.*-(.+?)$/i) { + $version = $1; + } + # Prepend bundled modules to list of modules to process + unshift @_, $mod_name, $version; + } + $self->{_bundle_processed} = 1; + } + while (my ($mod_name, $version) = splice(@_, 0, 2)) { $version ||= 0; @@ -51,16 +64,22 @@ # Move distribution to package root for deployment by make my $dist_target_dir = File::Basename::basename($dist_source_dir); - mkdir( $dist_target_dir, 0777 ) or die $! unless -d $dist_target_dir; - File::Find::find({ - wanted => sub { - my $out = $_; - $out =~ s/$bundle_dir/./i; - mkdir( $out, 0777 ) if -d; - File::Copy::copy($_ => $out) unless -d; - }, - no_chdir => 1, - }, $dist_source_dir); + if (not -d $dist_target_dir) { + if (not -d $dist_source_dir) { + warn "Warning: Cannot find expected dir $dist_source_dir\n"; + next; + } + mkdir( $dist_target_dir, 0777 ) or die $!; + File::Find::find({ + wanted => sub { + my $out = $_; + $out =~ s/$bundle_dir/./i; + mkdir( $out, 0777 ) if -d; + File::Copy::copy($_ => $out) unless -d; + }, + no_chdir => 1, + }, $dist_source_dir); + } # Delete this build directory upon "make clean" $self->clean_files( $dist_target_dir ); @@ -102,20 +121,22 @@ my @core = map @$_, map @$_, grep ref, $self->requires; while (my ($name, $version) = splice(@core, 0, 2)) { next unless $name; - $self->bundle_deps($name, $version); + $self->bundle_deps($name, $version); } } sub bundle_deps { my ($self, $pkg, $version) = @_; my $deps = $self->admin->scan_dependencies($pkg); - if (scalar keys %$deps == 0) { - # Probably a user trying to install the package, read the dependencies from META.yml - %$deps = ( map { $$_[0] => undef } (@{$self->requires()}) ); + if ($deps) { + # Bundle the dependencies found by the admin + foreach my $key (sort keys %$deps) { + $self->bundle($key, ($key eq $pkg) ? $version : 0); + } + } else { + # Users process the bundled dependencies + $self->bundle(); } - foreach my $key (sort keys %$deps) { - $self->bundle($key, ($key eq $pkg) ? $version : 0); - } } 1;
Hi, I refactored ::Bundle at revision 11930 before I noticed you sent me this patch. As I also fixed subdirectory handling of M:I, we don't need to tweak bundled distributions like the previous implementation anymore. So, sorry to say this but I don't apply your patch this time. There're still several issues left for mine including Build.PL handling and minor test issues (notably, pod test often fails), but please try and see how it works for you (more documentation will hopefully follow in a day or two). Thanks. On 2010-4-13 Tue 10:34:08, FANGLY wrote: Show quoted text
> Hi, > > Included is a patch against Module::Install SVN revision 11928. > > It affects only file Module/Install/Bundle.pm. The first time a user > deploys a package that has bundled modules (be it with
auto_bundle_deps, Show quoted text
> bundle_deps, auto_bundle, or bundle), the bundled modules (read from > inc/BUNDLE.yml) are added to the list of modules to process for > installation. Also, I added a checks to make sure that the directory > where a bundled module lives is valid. > > Cheers, > > Florent
Download (untitled) / with headers
text/plain 401b
No problem Kenichi. I am glad that Bundle is getting some attention. With the patch I proposed, I noticed too that the installation stalled because there was no Makefile present in the subdir of a module that uses the ./Build process. FYI, I also had an issue with a bundled module that uses autoinstall(). Not sure how easy it would be to prevent bundled modules that autoinstall from doing this.
Download (untitled) / with headers
text/plain 464b
On Tue Apr 13 19:04:22 2010, FANGLY wrote: Show quoted text
> No problem Kenichi. I am glad that Bundle is getting some attention. > > With the patch I proposed, I noticed too that the installation stalled > because there was no Makefile present in the subdir of a module that > uses the ./Build process. FYI, I also had an issue with a bundled module > that uses autoinstall(). Not sure how easy it would be to prevent > bundled modules that autoinstall from doing this. > >


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.