Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PATCH] ignore PERL_*_BACKEND variables during core builds #15486

Closed
p5pRT opened this issue Jul 29, 2016 · 18 comments
Closed

[PATCH] ignore PERL_*_BACKEND variables during core builds #15486

p5pRT opened this issue Jul 29, 2016 · 18 comments
Labels

Comments

@p5pRT
Copy link

p5pRT commented Jul 29, 2016

Migrated from rt.perl.org#128775 (status was 'resolved')

Searchable as RT128775$

@p5pRT
Copy link
Author

p5pRT commented Jul 29, 2016

From @karenetheridge

This patch is against maint-5.24, and addresses the same issue as Perl-Toolchain-Gang/CPAN-Meta#119.  It updates Parse​::CPAN​::Meta to ignore PERL_YAML_BACKEND and PERL_JSON_BACKEND while building core itself, where other backends are not installed yet.

@p5pRT
Copy link
Author

p5pRT commented Jul 29, 2016

From @karenetheridge

0001-patch-Parse-CPAN-Meta-to-ignore-PERL_YAML_BACKEND-PE.patch
From 51382e6cef1c0de566c482652883b4eaa8bf686d Mon Sep 17 00:00:00 2001
From: Karen Etheridge <ether@cpan.org>
Date: Fri, 29 Jul 2016 14:55:29 -0700
Subject: [PATCH] patch Parse::CPAN::Meta to ignore PERL_YAML_BACKEND,
 PERL_JSON_BACKEND when PERL_CORE=1

---
 Porting/Maintainers.pl                      |  2 ++
 cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm |  6 +++---
 cpan/Parse-CPAN-Meta/t/02_api.t             | 22 ++++++++++++----------
 3 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index 27ec5e9..bf47b40 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -1005,6 +1005,8 @@ use File::Glob qw(:case);
             qw[t/00-report-prereqs.t],
             qr{^xt},
         ],
+        # https://github.com/Perl-Toolchain-Gang/CPAN-Meta/pull/119
+        'CUSTOMIZED'   => [ qw[ lib/Parse/CPAN/Meta.pm t/02_api.t ] ],
     },
 
     'PathTools' => {
diff --git a/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm b/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm
index 77a0764..56eecb4 100644
--- a/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm
+++ b/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm
@@ -3,7 +3,7 @@ use strict;
 package Parse::CPAN::Meta;
 # ABSTRACT: Parse META.yml and META.json CPAN metadata files
 
-our $VERSION = '1.4417';
+our $VERSION = '1.4417_001';
 
 use Exporter;
 use Carp 'croak';
@@ -56,7 +56,7 @@ sub load_json_string {
 }
 
 sub yaml_backend {
-  if (! defined $ENV{PERL_YAML_BACKEND} ) {
+  if ($ENV{PERL_CORE} or not defined $ENV{PERL_YAML_BACKEND} ) {
     _can_load( 'CPAN::Meta::YAML', 0.011 )
       or croak "CPAN::Meta::YAML 0.011 is not available\n";
     return "CPAN::Meta::YAML";
@@ -72,7 +72,7 @@ sub yaml_backend {
 }
 
 sub json_backend {
-  if (! $ENV{PERL_JSON_BACKEND} or $ENV{PERL_JSON_BACKEND} eq 'JSON::PP') {
+  if ($ENV{PERL_CORE} or ! $ENV{PERL_JSON_BACKEND} or $ENV{PERL_JSON_BACKEND} eq 'JSON::PP') {
     _can_load( 'JSON::PP' => 2.27103 )
       or croak "JSON::PP 2.27103 is not available\n";
     return 'JSON::PP';
diff --git a/cpan/Parse-CPAN-Meta/t/02_api.t b/cpan/Parse-CPAN-Meta/t/02_api.t
index 5f94bc7..d17fb80 100644
--- a/cpan/Parse-CPAN-Meta/t/02_api.t
+++ b/cpan/Parse-CPAN-Meta/t/02_api.t
@@ -58,7 +58,7 @@ my $bad_yaml_meta = catfile( test_data_directory(), 'BadMETA.yml' );
 
 ### YAML tests
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
 
   is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
   my $from_yaml = Parse::CPAN::Meta->load_file( $meta_yaml );
@@ -66,7 +66,7 @@ my $bad_yaml_meta = catfile( test_data_directory(), 'BadMETA.yml' );
 }
 
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
 
   note '';
   is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
@@ -75,7 +75,7 @@ my $bad_yaml_meta = catfile( test_data_directory(), 'BadMETA.yml' );
 }
 
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
 
   note '';
   is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
@@ -84,7 +84,7 @@ my $bad_yaml_meta = catfile( test_data_directory(), 'BadMETA.yml' );
 }
 
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
 
   note '';
   is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
@@ -94,7 +94,7 @@ my $bad_yaml_meta = catfile( test_data_directory(), 'BadMETA.yml' );
 }
 
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
 
   note '';
   is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
@@ -105,6 +105,7 @@ my $bad_yaml_meta = catfile( test_data_directory(), 'BadMETA.yml' );
 
 SKIP: {
   note '';
+  skip 'these tests are for cpan builds only', 2 if $ENV{PERL_CORE};
   skip "YAML module not installed", 2
     unless eval "require YAML; 1";
   local $ENV{PERL_YAML_BACKEND} = 'YAML';
@@ -118,7 +119,7 @@ SKIP: {
 ### JSON tests
 {
   # JSON tests with JSON::PP
-  local $ENV{PERL_JSON_BACKEND}; # ensure we get JSON::PP
+  local $ENV{PERL_JSON_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get JSON::PP
 
   note '';
   is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
@@ -128,7 +129,7 @@ SKIP: {
 
 {
   # JSON tests with JSON::PP
-  local $ENV{PERL_JSON_BACKEND}; # ensure we get JSON::PP
+  local $ENV{PERL_JSON_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get JSON::PP
 
   note '';
   is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
@@ -138,7 +139,7 @@ SKIP: {
 
 {
   # JSON tests with JSON::PP
-  local $ENV{PERL_JSON_BACKEND}; # ensure we get JSON::PP
+  local $ENV{PERL_JSON_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get JSON::PP
 
   note '';
   is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
@@ -149,7 +150,7 @@ SKIP: {
 
 {
   # JSON tests with JSON::PP, take 2
-  local $ENV{PERL_JSON_BACKEND} = 0; # request JSON::PP
+  local $ENV{PERL_JSON_BACKEND} = 0 if not $ENV{PERL_CORE}; # request JSON::PP
 
   note '';
   is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
@@ -160,7 +161,7 @@ SKIP: {
 
 {
   # JSON tests with JSON::PP, take 3
-  local $ENV{PERL_JSON_BACKEND} = 'JSON::PP'; # request JSON::PP
+  local $ENV{PERL_JSON_BACKEND} = 'JSON::PP' if not $ENV{PERL_CORE}; # request JSON::PP
 
   note '';
   is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
@@ -171,6 +172,7 @@ SKIP: {
 
 SKIP: {
   note '';
+  skip 'these tests are for cpan builds only', 2 if $ENV{PERL_CORE};
   skip "JSON module version 2.5 not installed", 2
     unless eval "require JSON; JSON->VERSION(2.5); 1";
   local $ENV{PERL_JSON_BACKEND} = 1;
-- 
2.8.3

@p5pRT
Copy link
Author

p5pRT commented Jul 29, 2016

From @karenetheridge

Apologies! I neglected to regenerate the customized.dat checksums. Attached is a fixed patch.

@p5pRT
Copy link
Author

p5pRT commented Jul 29, 2016

From @karenetheridge

0001-patch-Parse-CPAN-Meta-to-ignore-PERL_YAML_BACKEND-PE.patch
From 608a62660ceca265616fdaab020ffe39f322ecfd Mon Sep 17 00:00:00 2001
From: Karen Etheridge <ether@cpan.org>
Date: Fri, 29 Jul 2016 14:55:29 -0700
Subject: [PATCH] patch Parse::CPAN::Meta to ignore PERL_YAML_BACKEND,
 PERL_JSON_BACKEND when PERL_CORE=1

---
 Porting/Maintainers.pl                      |  2 ++
 cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm |  6 +++---
 cpan/Parse-CPAN-Meta/t/02_api.t             | 22 ++++++++++++----------
 t/porting/customized.dat                    |  2 ++
 4 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index 27ec5e9..bf47b40 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -1005,6 +1005,8 @@ use File::Glob qw(:case);
             qw[t/00-report-prereqs.t],
             qr{^xt},
         ],
+        # https://github.com/Perl-Toolchain-Gang/CPAN-Meta/pull/119
+        'CUSTOMIZED'   => [ qw[ lib/Parse/CPAN/Meta.pm t/02_api.t ] ],
     },
 
     'PathTools' => {
diff --git a/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm b/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm
index 77a0764..56eecb4 100644
--- a/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm
+++ b/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm
@@ -3,7 +3,7 @@ use strict;
 package Parse::CPAN::Meta;
 # ABSTRACT: Parse META.yml and META.json CPAN metadata files
 
-our $VERSION = '1.4417';
+our $VERSION = '1.4417_001';
 
 use Exporter;
 use Carp 'croak';
@@ -56,7 +56,7 @@ sub load_json_string {
 }
 
 sub yaml_backend {
-  if (! defined $ENV{PERL_YAML_BACKEND} ) {
+  if ($ENV{PERL_CORE} or not defined $ENV{PERL_YAML_BACKEND} ) {
     _can_load( 'CPAN::Meta::YAML', 0.011 )
       or croak "CPAN::Meta::YAML 0.011 is not available\n";
     return "CPAN::Meta::YAML";
@@ -72,7 +72,7 @@ sub yaml_backend {
 }
 
 sub json_backend {
-  if (! $ENV{PERL_JSON_BACKEND} or $ENV{PERL_JSON_BACKEND} eq 'JSON::PP') {
+  if ($ENV{PERL_CORE} or ! $ENV{PERL_JSON_BACKEND} or $ENV{PERL_JSON_BACKEND} eq 'JSON::PP') {
     _can_load( 'JSON::PP' => 2.27103 )
       or croak "JSON::PP 2.27103 is not available\n";
     return 'JSON::PP';
diff --git a/cpan/Parse-CPAN-Meta/t/02_api.t b/cpan/Parse-CPAN-Meta/t/02_api.t
index 5f94bc7..d17fb80 100644
--- a/cpan/Parse-CPAN-Meta/t/02_api.t
+++ b/cpan/Parse-CPAN-Meta/t/02_api.t
@@ -58,7 +58,7 @@ my $bad_yaml_meta = catfile( test_data_directory(), 'BadMETA.yml' );
 
 ### YAML tests
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
 
   is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
   my $from_yaml = Parse::CPAN::Meta->load_file( $meta_yaml );
@@ -66,7 +66,7 @@ my $bad_yaml_meta = catfile( test_data_directory(), 'BadMETA.yml' );
 }
 
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
 
   note '';
   is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
@@ -75,7 +75,7 @@ my $bad_yaml_meta = catfile( test_data_directory(), 'BadMETA.yml' );
 }
 
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
 
   note '';
   is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
@@ -84,7 +84,7 @@ my $bad_yaml_meta = catfile( test_data_directory(), 'BadMETA.yml' );
 }
 
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
 
   note '';
   is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
@@ -94,7 +94,7 @@ my $bad_yaml_meta = catfile( test_data_directory(), 'BadMETA.yml' );
 }
 
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get CPAN::META::YAML
 
   note '';
   is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend(): CPAN::Meta::YAML');
@@ -105,6 +105,7 @@ my $bad_yaml_meta = catfile( test_data_directory(), 'BadMETA.yml' );
 
 SKIP: {
   note '';
+  skip 'these tests are for cpan builds only', 2 if $ENV{PERL_CORE};
   skip "YAML module not installed", 2
     unless eval "require YAML; 1";
   local $ENV{PERL_YAML_BACKEND} = 'YAML';
@@ -118,7 +119,7 @@ SKIP: {
 ### JSON tests
 {
   # JSON tests with JSON::PP
-  local $ENV{PERL_JSON_BACKEND}; # ensure we get JSON::PP
+  local $ENV{PERL_JSON_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get JSON::PP
 
   note '';
   is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
@@ -128,7 +129,7 @@ SKIP: {
 
 {
   # JSON tests with JSON::PP
-  local $ENV{PERL_JSON_BACKEND}; # ensure we get JSON::PP
+  local $ENV{PERL_JSON_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get JSON::PP
 
   note '';
   is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
@@ -138,7 +139,7 @@ SKIP: {
 
 {
   # JSON tests with JSON::PP
-  local $ENV{PERL_JSON_BACKEND}; # ensure we get JSON::PP
+  local $ENV{PERL_JSON_BACKEND} if not $ENV{PERL_CORE}; # ensure we always get JSON::PP
 
   note '';
   is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
@@ -149,7 +150,7 @@ SKIP: {
 
 {
   # JSON tests with JSON::PP, take 2
-  local $ENV{PERL_JSON_BACKEND} = 0; # request JSON::PP
+  local $ENV{PERL_JSON_BACKEND} = 0 if not $ENV{PERL_CORE}; # request JSON::PP
 
   note '';
   is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
@@ -160,7 +161,7 @@ SKIP: {
 
 {
   # JSON tests with JSON::PP, take 3
-  local $ENV{PERL_JSON_BACKEND} = 'JSON::PP'; # request JSON::PP
+  local $ENV{PERL_JSON_BACKEND} = 'JSON::PP' if not $ENV{PERL_CORE}; # request JSON::PP
 
   note '';
   is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend(): JSON::PP');
@@ -171,6 +172,7 @@ SKIP: {
 
 SKIP: {
   note '';
+  skip 'these tests are for cpan builds only', 2 if $ENV{PERL_CORE};
   skip "JSON module version 2.5 not installed", 2
     unless eval "require JSON; JSON->VERSION(2.5); 1";
   local $ENV{PERL_JSON_BACKEND} = 1;
diff --git a/t/porting/customized.dat b/t/porting/customized.dat
index be5f8e7..139acd0 100644
--- a/t/porting/customized.dat
+++ b/t/porting/customized.dat
@@ -97,6 +97,8 @@ JSON::PP cpan/JSON-PP/lib/JSON/PP.pm 817730a21b9be855d844e4d26023758960039e99
 Locale::Maketext::Simple cpan/Locale-Maketext-Simple/lib/Locale/Maketext/Simple.pm 57ed38905791a17c150210cd6f42ead22a7707b6
 Math::BigRat cpan/Math-BigRat/lib/Math/BigRat.pm 6eabc68e04f67694f6fe523e64eb013fc337ca5b
 Memoize cpan/Memoize/Memoize.pm 902092ff91cdec9c7b4bd06202eb179e1ce26ca2
+Parse::CPAN::Meta cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm 2de9f411463eda2bd5f57163c12edab9a00dc598
+Parse::CPAN::Meta cpan/Parse-CPAN-Meta/t/02_api.t a692c9a7e52b08a14a954d6c405a22c0dab1cd43
 Pod::Perldoc cpan/Pod-Perldoc/lib/Pod/Perldoc.pm ba3072a6af793b410b02594ed8fe109ac16a1d43
 Scalar-List-Utils cpan/Scalar-List-Utils/lib/List/Util.pm 3b501b7332480b34929bc4df5d48581df3307267
 Scalar-List-Utils cpan/Scalar-List-Utils/lib/List/Util/XS.pm ebd169113d3df79d31ad5535dbd7a538a8c14fd2
-- 
2.8.3

@p5pRT
Copy link
Author

p5pRT commented Jul 30, 2016

From @cpansprout

On Fri Jul 29 15​:37​:40 2016, ether wrote​:

Apologies! I neglected to regenerate the customized.dat checksums.
Attached is a fixed patch.

Thank you. Looks good. But....

Why is this not being applied to the CPAN repo if CPAN is upstream for this module. What is the rush to get it into blead before the next Parse​::CPAN​::Meta release?

(I don’t mean to challenge you. I’m just asking.)

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 30, 2016

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Jul 31, 2016

From @ribasushi

On 07/30/2016 02​:56 AM, Father Chrysostomos via RT wrote​:

Thank you. Looks good. But....

Why is this not being applied to the CPAN repo if CPAN is upstream for this module. What is the rush to get it into blead before the next Parse​::CPAN​::Meta release?

The patch has one purpose only​: to allow one to build perl itself in an
environment where PERL_YAML_BACKEND is set to something that is expected
to be installed ahead of time. As it currently stands perl's
post-compilation test run (which includes tests of P​::C​::M) will fail.

The perceived rush is so that people who do have a nonstandard ENV will
not have to wait another month before they can compile random bleadperl
without the need to sanitize their environment.

@p5pRT
Copy link
Author

p5pRT commented Jul 31, 2016

From @cpansprout

On Sun Jul 31 03​:12​:36 2016, rabbit-p5p@​rabbit.us wrote​:

On 07/30/2016 02​:56 AM, Father Chrysostomos via RT wrote​:

Thank you. Looks good. But....

Why is this not being applied to the CPAN repo if CPAN is upstream
for this module. What is the rush to get it into blead before the
next Parse​::CPAN​::Meta release?

The patch has one purpose only​: to allow one to build perl itself in
an
environment where PERL_YAML_BACKEND is set to something that is
expected
to be installed ahead of time. As it currently stands perl's
post-compilation test run (which includes tests of P​::C​::M) will fail.

The perceived rush is so that people who do have a nonstandard ENV
will
not have to wait another month before they can compile random
bleadperl
without the need to sanitize their environment.

Thank you for the explanation. I failed to read the ‘against maint-5.24‘ part!

I believe this is unprecedented, but I also believe that the maint ‘policy’ consists of *guidelines* as to what is acceptable for maint.

This patch makes sense, so it gets my +1.

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Jul 31, 2016

From @karenetheridge

Correct, this patch is for the 5.24 series.

I have prepared a more complete patch, against the newer modifications in Parse​::CPAN​::Meta, in the cpan repository here​: Perl-Toolchain-Gang/CPAN-Meta#119

However if there is a delay in getting that released (for me to pull the changes into blead), then the patch in this ticket is also suitable for blead as the same version of Parse​::CPAN​::Meta is there as in maint-5.24.

@p5pRT
Copy link
Author

p5pRT commented Jul 31, 2016

From @cpansprout

On Sun Jul 31 06​:39​:20 2016, sprout wrote​:

Thank you for the explanation. I failed to read the ‘against maint-
5.24‘ part!

I believe this is unprecedented,

No, it’s not. It is actually a regression, since perl did not always fail its tests with those env vars set. (This is comparable to the test fix backported to 5.12 that made it pass with HTTPS_PROXY set.)

--

Father Chrysostomos

@p5pRT
Copy link
Author

p5pRT commented Aug 1, 2016

From @steve-m-hay

On 31 July 2016 at 19​:06, Father Chrysostomos via RT
<perlbug-followup@​perl.org> wrote​:

On Sun Jul 31 06​:39​:20 2016, sprout wrote​:

Thank you for the explanation. I failed to read the ‘against maint-
5.24‘ part!

I believe this is unprecedented,

No, it’s not. It is actually a regression, since perl did not always fail its tests with those env vars set. (This is comparable to the test fix backported to 5.12 that made it pass with HTTPS_PROXY set.)

Taking Father C's +1 and Peter Rabbitson's implicit +1 (if that's
ok?!), plus my own vote, I will go ahead and pull this into
maint-5.24.

Presumably the same changes also need porting to maint-5.22? The patch
againt maint-5.24 doesn't apply well, but I've made the changes
manually -- see attached patch. If this is correct (and necessary?)
then I will pull this in too.

@p5pRT
Copy link
Author

p5pRT commented Aug 1, 2016

From @steve-m-hay

0001-patch-Parse-CPAN-Meta-to-ignore-PERL_YAML_BACKEND-PE-5.22.patch
From 04f7594e04e0aa46d8b168978ae07a080cb49b47 Mon Sep 17 00:00:00 2001
From: Karen Etheridge <ether@cpan.org>
Date: Mon, 1 Aug 2016 14:03:32 +0100
Subject: [PATCH] patch Parse::CPAN::Meta to ignore PERL_YAML_BACKEND,
 PERL_JSON_BACKEND when PERL_CORE=1

---
 Porting/Maintainers.pl                      |  2 ++
 cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm |  6 +++---
 cpan/Parse-CPAN-Meta/t/02_api.t             | 22 ++++++++++++----------
 t/porting/customized.dat                    |  2 ++
 4 files changed, 19 insertions(+), 13 deletions(-)

diff --git a/Porting/Maintainers.pl b/Porting/Maintainers.pl
index 058676b..d66e120 100755
--- a/Porting/Maintainers.pl
+++ b/Porting/Maintainers.pl
@@ -985,6 +985,8 @@ use File::Glob qw(:case);
             qw[t/00-report-prereqs.t],
             qr{^xt},
         ],
+        # https://github.com/Perl-Toolchain-Gang/CPAN-Meta/pull/119
+        'CUSTOMIZED'   => [ qw[ lib/Parse/CPAN/Meta.pm t/02_api.t ] ],
     },
 
     'PathTools' => {
diff --git a/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm b/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm
index 7888d1c..1285ad5 100644
--- a/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm
+++ b/cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm
@@ -2,7 +2,7 @@ use 5.008001;
 use strict;
 package Parse::CPAN::Meta;
 # ABSTRACT: Parse META.yml and META.json CPAN metadata files
-our $VERSION = '1.4414'; # VERSION
+our $VERSION = '1.4414_001'; # VERSION
 
 use Exporter;
 use Carp 'croak';
@@ -55,7 +55,7 @@ sub load_json_string {
 }
 
 sub yaml_backend {
-  if (! defined $ENV{PERL_YAML_BACKEND} ) {
+  if ($ENV{PERL_CORE} or not defined $ENV{PERL_YAML_BACKEND} ) {
     _can_load( 'CPAN::Meta::YAML', 0.011 )
       or croak "CPAN::Meta::YAML 0.011 is not available\n";
     return "CPAN::Meta::YAML";
@@ -71,7 +71,7 @@ sub yaml_backend {
 }
 
 sub json_backend {
-  if (! $ENV{PERL_JSON_BACKEND} or $ENV{PERL_JSON_BACKEND} eq 'JSON::PP') {
+  if ($ENV{PERL_CORE} or ! $ENV{PERL_JSON_BACKEND} or $ENV{PERL_JSON_BACKEND} eq 'JSON::PP') {
     _can_load( 'JSON::PP' => 2.27103 )
       or croak "JSON::PP 2.27103 is not available\n";
     return 'JSON::PP';
diff --git a/cpan/Parse-CPAN-Meta/t/02_api.t b/cpan/Parse-CPAN-Meta/t/02_api.t
index 72bfccf..2791c25 100644
--- a/cpan/Parse-CPAN-Meta/t/02_api.t
+++ b/cpan/Parse-CPAN-Meta/t/02_api.t
@@ -57,7 +57,7 @@ my $bare_yaml_meta = catfile( test_data_directory(), 'bareyaml.meta' );
 
 ### YAML tests
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we get CPAN::META::YAML
 
   is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend()');
   my $from_yaml = Parse::CPAN::Meta->load_file( $meta_yaml );
@@ -65,7 +65,7 @@ my $bare_yaml_meta = catfile( test_data_directory(), 'bareyaml.meta' );
 }
 
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we get CPAN::META::YAML
 
   is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend()');
   my $from_yaml = Parse::CPAN::Meta->load_file( $yaml_meta );
@@ -73,7 +73,7 @@ my $bare_yaml_meta = catfile( test_data_directory(), 'bareyaml.meta' );
 }
 
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we get CPAN::META::YAML
 
   is(Parse::CPAN::Meta->yaml_backend(), 'CPAN::Meta::YAML', 'yaml_backend()');
   my $from_yaml = Parse::CPAN::Meta->load_file( $bare_yaml_meta );
@@ -81,7 +81,7 @@ my $bare_yaml_meta = catfile( test_data_directory(), 'bareyaml.meta' );
 }
 
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we get CPAN::META::YAML
 
   my $yaml   = load_ok( 'META-VR.yml', $meta_yaml, 100);
   my $from_yaml = Parse::CPAN::Meta->load_yaml_string( $yaml );
@@ -89,7 +89,7 @@ my $bare_yaml_meta = catfile( test_data_directory(), 'bareyaml.meta' );
 }
 
 {
-  local $ENV{PERL_YAML_BACKEND}; # ensure we get CPAN::META::YAML
+  local $ENV{PERL_YAML_BACKEND} if not $ENV{PERL_CORE}; # ensure we get CPAN::META::YAML
 
   my @yaml   = Parse::CPAN::Meta::LoadFile( 't/data/BadMETA.yml' );
   is($yaml[0]{author}[0], 'Olivier Mengu\xE9', "Bad UTF-8 is replaced");
@@ -97,6 +97,7 @@ my $bare_yaml_meta = catfile( test_data_directory(), 'bareyaml.meta' );
 
 
 SKIP: {
+  skip 'these tests are for cpan builds only', 2 if $ENV{PERL_CORE};
   skip "YAML module not installed", 2
     unless eval "require YAML; 1";
   local $ENV{PERL_YAML_BACKEND} = 'YAML';
@@ -110,7 +111,7 @@ SKIP: {
 ### JSON tests
 {
   # JSON tests with JSON::PP
-  local $ENV{PERL_JSON_BACKEND}; # ensure we get JSON::PP
+  local $ENV{PERL_JSON_BACKEND} if not $ENV{PERL_CORE}; # ensure we get JSON::PP
 
   is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend()');
   my $from_json = Parse::CPAN::Meta->load_file( $meta_json );
@@ -119,7 +120,7 @@ SKIP: {
 
 {
   # JSON tests with JSON::PP
-  local $ENV{PERL_JSON_BACKEND}; # ensure we get JSON::PP
+  local $ENV{PERL_JSON_BACKEND} if not $ENV{PERL_CORE}; # ensure we get JSON::PP
 
   is(Parse::CPAN::Meta->json_backend(), 'JSON::PP', 'json_backend()');
   my $from_json = Parse::CPAN::Meta->load_file( $json_meta );
@@ -128,7 +129,7 @@ SKIP: {
 
 {
   # JSON tests with JSON::PP
-  local $ENV{PERL_JSON_BACKEND}; # ensure we get JSON::PP
+  local $ENV{PERL_JSON_BACKEND} if not $ENV{PERL_CORE}; # ensure we get JSON::PP
 
   my $json   = load_ok( 'META-VR.json', $meta_json, 100);
   my $from_json = Parse::CPAN::Meta->load_json_string( $json );
@@ -137,7 +138,7 @@ SKIP: {
 
 {
   # JSON tests with JSON::PP, take 2
-  local $ENV{PERL_JSON_BACKEND} = 0; # request JSON::PP
+  local $ENV{PERL_JSON_BACKEND} = 0 if not $ENV{PERL_CORE}; # request JSON::PP
 
   my $json   = load_ok( 'META-VR.json', $meta_json, 100);
   my $from_json = Parse::CPAN::Meta->load_json_string( $json );
@@ -146,7 +147,7 @@ SKIP: {
 
 {
   # JSON tests with JSON::PP, take 3
-  local $ENV{PERL_JSON_BACKEND} = 'JSON::PP'; # request JSON::PP
+  local $ENV{PERL_JSON_BACKEND} = 'JSON::PP' if not $ENV{PERL_CORE}; # request JSON::PP
 
   my $json   = load_ok( 'META-VR.json', $meta_json, 100);
   my $from_json = Parse::CPAN::Meta->load_json_string( $json );
@@ -154,6 +155,7 @@ SKIP: {
 }
 
 SKIP: {
+  skip 'these tests are for cpan builds only', 2 if $ENV{PERL_CORE};
   skip "JSON module version 2.5 not installed", 2
     unless eval "require JSON; JSON->VERSION(2.5); 1";
   local $ENV{PERL_JSON_BACKEND} = 1;
diff --git a/t/porting/customized.dat b/t/porting/customized.dat
index ccc5afd..ca01243 100644
--- a/t/porting/customized.dat
+++ b/t/porting/customized.dat
@@ -86,6 +86,8 @@ JSON::PP cpan/JSON-PP/bin/json_pp 22e1b3760ec2b2cfd7ff0d2165f6e88907b94c70
 JSON::PP cpan/JSON-PP/lib/JSON/PP.pm 817730a21b9be855d844e4d26023758960039e99
 Locale::Maketext::Simple cpan/Locale-Maketext-Simple/lib/Locale/Maketext/Simple.pm 57ed38905791a17c150210cd6f42ead22a7707b6
 Memoize cpan/Memoize/Memoize.pm 902092ff91cdec9c7b4bd06202eb179e1ce26ca2
+Parse::CPAN::Meta cpan/Parse-CPAN-Meta/lib/Parse/CPAN/Meta.pm ab6b77a820c2a7779b5d81c4244e15822e9e1a7b
+Parse::CPAN::Meta cpan/Parse-CPAN-Meta/t/02_api.t 43bddf467352c5bb1d017971d37e64ec90461df0
 Pod::Perldoc cpan/Pod-Perldoc/lib/Pod/Perldoc.pm 6928fb8a381cfba8204886c656844bcf1abc60f5
 Sys::Syslog cpan/Sys-Syslog/Syslog.pm 181d7541a6aa2a0a4d15f5beec32d16c17c76caf
 Test cpan/Test/lib/Test.pm 785c02014198ec3dae35e41def2cb24766fcf1cb
-- 
1.9.5.msysgit.1

@p5pRT
Copy link
Author

p5pRT commented Aug 1, 2016

From @karenetheridge

On Mon Aug 01 06​:11​:58 2016, shay wrote​:

Presumably the same changes also need porting to maint-5.22? The patch
againt maint-5.24 doesn't apply well, but I've made the changes
manually -- see attached patch. If this is correct (and necessary?)
then I will pull this in too.

Yes please, and your mait-5.22 patch looks good!

@p5pRT
Copy link
Author

p5pRT commented Aug 2, 2016

From @steve-m-hay

On 1 August 2016 at 21​:21, Karen Etheridge via RT
<perlbug-followup@​perl.org> wrote​:

On Mon Aug 01 06​:11​:58 2016, shay wrote​:

Presumably the same changes also need porting to maint-5.22? The patch
againt maint-5.24 doesn't apply well, but I've made the changes
manually -- see attached patch. If this is correct (and necessary?)
then I will pull this in too.

Yes please, and your mait-5.22 patch looks good!

Now pushed to both maint-5.22 and maint-5.24. Thanks.

@p5pRT
Copy link
Author

p5pRT commented Aug 15, 2016

From @tonycoz

On Mon Aug 01 13​:21​:36 2016, ether wrote​:

On Mon Aug 01 06​:11​:58 2016, shay wrote​:

Presumably the same changes also need porting to maint-5.22? The patch
againt maint-5.24 doesn't apply well, but I've made the changes
manually -- see attached patch. If this is correct (and necessary?)
then I will pull this in too.

Yes please, and your mait-5.22 patch looks good!

This doesn't seem to be a problem in blead (though I don't similar changes
in blead), can this be closed?

Tony

@p5pRT
Copy link
Author

p5pRT commented Aug 15, 2016

From @karenetheridge

On Sun Aug 14 18​:48​:50 2016, tonyc wrote​:

On Mon Aug 01 13​:21​:36 2016, ether wrote​:

On Mon Aug 01 06​:11​:58 2016, shay wrote​:

Presumably the same changes also need porting to maint-5.22? The patch
againt maint-5.24 doesn't apply well, but I've made the changes
manually -- see attached patch. If this is correct (and necessary?)
then I will pull this in too.

Yes please, and your mait-5.22 patch looks good!

This doesn't seem to be a problem in blead (though I don't similar changes
in blead), can this be closed?

It is still a problem in blead; since the same version of CPAN-Meta is here as in maint-5.24, the same patch is good to be applied here. I was hoping it wouldn't be necessary as a new release of CPAN-Meta would soon be applied on top, but a new release hasn't happened yet.

@p5pRT
Copy link
Author

p5pRT commented Aug 18, 2016

From @karenetheridge

On Sun Aug 14 19​:00​:16 2016, ether wrote​:

It is still a problem in blead; since the same version of CPAN-Meta is
here as in maint-5.24, the same patch is good to be applied here. I
was hoping it wouldn't be necessary as a new release of CPAN-Meta
would soon be applied on top, but a new release hasn't happened yet.

CPAN-Meta-2.150010 was just released and I submitted a patch to update it in blead (RT#128987), so this ticket is now complete with nothing further to be done.

@p5pRT
Copy link
Author

p5pRT commented Aug 18, 2016

@karenetheridge - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant