summaryrefslogtreecommitdiff
path: root/perl-core/Archive-Tar/files/Archive-Tar-2.30-makefileptar.patch
blob: dad52df5d3440602cf131d38caf60ba92eea3c04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
From 14ecca4632b44461d3c23344027ec30eedba1b0a Mon Sep 17 00:00:00 2001
From: Kent Fredric <kentnl@gentoo.org>
Date: Fri, 6 Jul 2018 17:20:30 +1200
Subject: Patch ptardiff support out conditional on ENV

- Toggle installation and testing of ptardiff functionality to only
  trigger when requested

- Toggle testing of bzip2 support only when requested

- Disable mechanics intended for user-perl environments where
  installation is to somewhere that may fall outside PATH
---
 Makefile.PL     | 46 +++++++++-------------------------------------
 t/07_ptardiff.t | 11 +++++++++--
 2 files changed, 18 insertions(+), 39 deletions(-)

diff --git a/Makefile.PL b/Makefile.PL
index fe093bd..0289409 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -9,19 +9,12 @@ unless( $] >= 5.005_03 ) {
     die qq[Archive::Tar requires perl version 5.005_03 or higher to run\n];
 }
 
-if( !eval { require IO::Compress::Bzip2; 1 } and !$opt->{n} ) {
-    warn    qq[You do not have IO::Compress::Bzip2 installed. This means you can ].
-            qq[not read or write bzip2 compressed archives!\n] .
-            qq[Note: you can disable this warning (and the prerequisite) ].
-            qq[by invoking Makefile.PL with '-n'\n];
+if( $ENV{GENTOO_TAR_BZIP2} ) {
+  require IO::Compress::Bzip2;
 }
 
-if( !$opt->{d} and not eval { require Text::Diff; 1 } ) {
-    print   qq[\nArchive::Tar comes with a utility called 'ptardiff' which ].
-            qq[lets you run diffs against tar archives.\n\nHowever, this ].
-            qq[utility requires you to have Text::Diff installed.\n\n].
-            qq[To add Text::Diff as a prerequisite, please supply the ].
-            qq['-d' option when invoking this Makefile.PL.\n\n];
+if ( $ENV{GENTOO_TAR_PTARDIFF} ) {
+  require Text::Diff;
 }
 
 my $prereqs = {
@@ -45,10 +38,10 @@ unless ($Config{useperlio}) {
 }
 
 ### ok, you didn't want IO::Zlib ###
-delete $prereqs->{'IO::Compress::Bzip2'} if $opt->{n};
+delete $prereqs->{'IO::Compress::Bzip2'} unless $ENV{GENTOO_TAR_BZIP2};
 
 ### so you want text::diff ###
-$prereqs->{'Text::Diff'} = 0 if $opt->{d};
+$prereqs->{'Text::Diff'} = 0 if $ENV{GENTOO_TAR_PTARDIFF};
 
 
 WriteMakefile1(
@@ -68,7 +61,6 @@ WriteMakefile1(
     #EXE_FILES       => ['bin/ptar', 'bin/ptardiff'],
     EXE_FILES       => [ _scripts() ],
     PREREQ_PM       => $prereqs,
-    INSTALLDIRS     => ( $] >= 5.009003 && $] < 5.012 ? 'perl' : 'site' ),
     AUTHOR          => 'Jos Boumans <kane[at]cpan.org>',
     ABSTRACT        => 'Manipulates TAR archives',
 );
@@ -84,29 +76,9 @@ sub _scripts {
          File::Copy::copy( $_, "$_$version" ) for @scripts;
          @scripts = glob("bin/*$version");
     }
-    if ( $] >= 5.012 && $Config::Config{installscript} ne $Config::Config{installsitescript} ) {
-      my $script = $Config::Config{installscript};
-      my $site   = $Config::Config{installsitescript};
-      warn <<"WARNING";
-###############################################################
-##
-##    Hi! Your script and sitescript locations are different
-##
-##    As your perl is v5.12.0 or greater the script included
-##    in this distribution will be installed into sitescript
-##
-##    You might want to check that the following location is
-##    in your PATH environment variable:
-##
-##    '$site'
-##
-##    Many thanks.
-##
-###############################################################
-
-WARNING
-      sleep 10;
-    }
+  }
+  if ( not $ENV{GENTOO_TAR_PTARDIFF} ) {
+    @scripts = grep { $_ !~ /ptardiff/ } @scripts;
   }
   return @scripts;
 }
diff --git a/t/07_ptardiff.t b/t/07_ptardiff.t
index 6935fc6..da4ea29 100644
--- a/t/07_ptardiff.t
+++ b/t/07_ptardiff.t
@@ -1,5 +1,13 @@
 use strict;
 use warnings;
+
+BEGIN {
+  unless ( $ENV{GENTOO_TAR_PTARDIFF} ) {
+    print "1..0 # SKIP this test requires GENTOO_TAR_PTARDIFF set";
+    exit
+  }
+}
+
 use Test::More;
 
 use File::Spec;
@@ -14,8 +22,7 @@ my $tarfile = File::Spec->catfile("t", "ptardiff.tar");
 my $ptardiff = File::Spec->catfile($Bin, "..", "bin", "ptardiff");
 my $cmd = "$^X $ptardiff $tarfile";
 
-eval { require Text::Diff; };
-plan skip_all => 'Text::Diff required to test ptardiff' if $@;
+require Text::Diff;
 plan tests => 1;
 
 # create directory/files
-- 
2.17.1