Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix removal of redundant dep/makedep.

If a dist depends on a module in build.requires of the META.json, for
example, and also depends on a module in runtime.requires then the
runtime.requires version will always be removed. Internally, CPP lumps
the build.requires list in with the runtime.requires before we get the list
so it is very hard to tell which is which.

A hackish fix is to not remove the runtime requires if the versions
described in the dependencies are not exactly the same.

See Params::Validate for an example of this.
  • Loading branch information...
commit 5fd84948797080582a91d72cd364dd6d51840e2e 1 parent 3a3b176
@juster authored
Showing with 24 additions and 4 deletions.
  1. +24 −4 lib/CPANPLUS/Dist/Arch.pm
View
28 lib/CPANPLUS/Dist/Arch.pm
@@ -948,6 +948,7 @@ sub _translate_cpan_deps
# Sometimes a perl version is given as a prerequisite
if ( $modname eq 'perl' ) {
$pkgdeps{perl} = _translate_perl_ver( $depver );
+ _DEBUG "req on perl $depver -> $pkgdeps{perl}";
next CPAN_DEP_LOOP;
}
@@ -1018,6 +1019,8 @@ sub _get_pkg_deps
# convert them into packages names for 'depends' and 'makedepends'
# inside of a PKGBUILD.
+ printf STDERR "DBG: prereqs = %s\n", pp($prereqs);
+
my $pkgdeps_ref = $self->_translate_cpan_deps( $prereqs );
my $makedeps_ref = $self->_extract_makedepends( $pkgdeps_ref );
@@ -1028,15 +1031,25 @@ sub _get_pkg_deps
map { $self->status->metadeps->{ $_ } }
qw/ cfg build / );
+ use Data::Dump qw(pp);
+ printf STDERR "DBG: pkgdeps = %s\nDBG: makedeps = %s\nDBG: builddeps = %s\n",
+ pp($pkgdeps_ref), pp($makedeps_ref), pp($builddeps_ref);
+
# 'configure_requires' from META.yml don't show in the prereqs()
- # results but 'build_requires' do... remove them.
- delete $pkgdeps_ref->{ $_ } for ( keys %$builddeps_ref );
+ # results but 'build_requires' do... remove duplicates.
+ for my $d ( keys %$builddeps_ref ) {
+ if ( eval { $pkgdeps_ref->{$d} eq $builddeps_ref->{$d} } ) {
+ delete $pkgdeps_ref->{$d}
+ }
+ }
_merge_deps( $makedeps_ref, $cfgdeps_ref );
_merge_deps( $makedeps_ref, $builddeps_ref );
# Merge in the XS C library package deps...
my $xs_deps = $self->_translate_xs_deps;
_merge_deps( $pkgdeps_ref, $xs_deps );
+ printf STDERR "DBG: pkgdeps = %s\nDBG: makedeps = %s\n",
+ pp($pkgdeps_ref), pp($makedeps_ref);
# Require perl unless we have a dependency on a module or perl itself.
$pkgdeps_ref->{'perl'} = 0 unless grep { /^perl/ } keys %$pkgdeps_ref;
@@ -1236,8 +1249,15 @@ sub _scan_metayml
# Default to an empty list of deps
$status->metadeps( { 'cfg' => {}, 'build' => {} } );
- my $metapath = catfile( $modobj->status->extract, 'META.yml' );
- return unless -f $metapath;
+ my $metapath;
+ for my $ext (qw/json yml/) {
+ my $p = catfile( $modobj->status->extract, "META.$ext" );
+ if ( -f $p ) {
+ $metapath = $p;
+ last;
+ }
+ }
+ return unless $metapath;
my $meta_ref = eval { Parse::CPAN::Meta::LoadFile( $metapath ) }
or return;
Please sign in to comment.
Something went wrong with that request. Please try again.