… | |
… | |
21 | =cut |
21 | =cut |
22 | |
22 | |
23 | package Canary::Stability; |
23 | package Canary::Stability; |
24 | |
24 | |
25 | BEGIN { |
25 | BEGIN { |
26 | $VERSION = 2006; |
26 | $VERSION = 2013; |
27 | } |
27 | } |
28 | |
28 | |
29 | sub sgr { |
29 | sub sgr { |
30 | # we just assume ANSI almost everywhere |
30 | # we just assume ANSI almost everywhere |
31 | # red 31, yellow 33, green 32 |
31 | # red 31, yellow 33, green 32 |
|
|
32 | local $| = 1; |
32 | |
33 | |
33 | $ENV{PERL_CANARY_STABILITY_COLOUR} ne 0 |
34 | $ENV{PERL_CANARY_STABILITY_COLOUR} ne 0 |
34 | and ((-t STDOUT and length $ENV{TERM}) or $ENV{PERL_CANARY_STABILITY_COLOUR}) |
35 | and ((-t STDOUT and length $ENV{TERM}) or $ENV{PERL_CANARY_STABILITY_COLOUR}) |
35 | and print "\e[$_[0]m"; |
36 | and print "\e[$_[0]m"; |
36 | } |
37 | } |
… | |
… | |
41 | $ENV{PERL_CANARY_STABILITY_DISABLE} |
42 | $ENV{PERL_CANARY_STABILITY_DISABLE} |
42 | and return; |
43 | and return; |
43 | |
44 | |
44 | $minperl ||= 5.008002; |
45 | $minperl ||= 5.008002; |
45 | |
46 | |
|
|
47 | print <<EOF; |
|
|
48 | |
|
|
49 | *** |
|
|
50 | *** Canary::Stability COMPATIBILITY AND SUPPORT CHECK |
|
|
51 | *** ================================================= |
|
|
52 | *** |
|
|
53 | *** Hi! |
|
|
54 | *** |
|
|
55 | *** I do my best to provide predictable and reliable software. |
|
|
56 | *** |
|
|
57 | *** However, in recent releases, P5P (who maintain perl) have been |
|
|
58 | *** introducing regressions that are sometimes subtle and at other times |
|
|
59 | *** catastrophic, often for personal preferences with little or no concern |
|
|
60 | *** for existing code, most notably CPAN. |
|
|
61 | *** |
|
|
62 | *** For this reason, it has become very hard for me to maintain the level |
|
|
63 | *** of reliability and support I have committed myself to in the past, at |
|
|
64 | *** least with some perl versions: I simply can't keep up working around new |
|
|
65 | *** bugs or gratituous incompatibilities, and in turn you might suffer from |
|
|
66 | *** unanticipated problems. |
|
|
67 | *** |
|
|
68 | *** Therefore I have introduced a support and compatibility check, the results |
|
|
69 | *** of which follow below, together with a FAQ and some recommendations. |
|
|
70 | *** |
|
|
71 | *** This check is just to let you know that there might be a risk, so you can |
|
|
72 | *** make judgement calls on how to proceed - it will not keep the module from |
|
|
73 | *** installing or working. |
|
|
74 | *** |
|
|
75 | EOF |
|
|
76 | |
46 | if ($minvers > $VERSION) { |
77 | if ($minvers > $VERSION) { |
47 | sgr 33; |
78 | sgr 33; |
48 | print <<EOF; |
79 | print <<EOF; |
49 | |
|
|
50 | *** |
|
|
51 | *** The stability canary says: (nothing, it died of old age). |
80 | *** The stability canary says: (nothing, it died of old age). |
52 | *** |
81 | *** |
53 | *** Your Canary::Stability module (used by $distname) is too old. |
82 | *** Your Canary::Stability module (used by $distname) is too old. |
54 | *** This is not a fatal problem - while you might want to upgrade to version |
83 | *** This is not a fatal problem - while you might want to upgrade to version |
55 | *** $minvers (currently installed version: $VERSION) to get better support |
84 | *** $minvers (currently installed version: $VERSION) to get better support |
56 | *** status testing, you might also not want to care at all, and all will |
85 | *** status testing, you might also not want to care at all, and all will |
57 | *** be well as long $distname works well enough for you, as the stability |
86 | *** be well as long $distname works well enough for you, as the stability |
58 | *** canary is only used when installing the distribution. |
87 | *** canary is only used when installing the distribution. |
59 | *** |
88 | *** |
60 | |
|
|
61 | EOF |
89 | EOF |
62 | } elsif ($] < $minperl) { |
90 | } elsif ($] < $minperl) { |
63 | |
91 | |
64 | sgr 33; |
92 | sgr 33; |
65 | print <<EOF; |
93 | print <<EOF; |
66 | |
|
|
67 | *** |
|
|
68 | *** The stability canary says: chirp (it seems concerned about something). |
94 | *** The stability canary says: chirp (it seems concerned about something). |
69 | *** |
95 | *** |
70 | *** Your perl version ($]) is older than the $distname distribution |
96 | *** Your perl version ($]) is older than the $distname distribution |
71 | *** likes ($minperl). This is not a fatal problem - the module might work |
97 | *** likes ($minperl). This is not a fatal problem - the module might work |
72 | *** well with your version of perl, but it does mean the author likely |
98 | *** well with your version of perl, but it does mean the author likely |
73 | *** won't do anything to make it work if it breaks. |
99 | *** won't do anything to make it work if it breaks. |
74 | *** |
100 | *** |
75 | |
|
|
76 | EOF |
101 | EOF |
|
|
102 | |
|
|
103 | if ($ENV{AUTOMATED_TESTING}) { |
|
|
104 | print <<EOF; |
|
|
105 | *** Since this is an AUTOMATED_TESTING environment, the stability canary |
|
|
106 | *** decided to fail cleanly here, rather than to generate a false test |
|
|
107 | *** result. |
|
|
108 | *** |
|
|
109 | EOF |
|
|
110 | exit 0; |
|
|
111 | } |
|
|
112 | |
77 | } elsif (defined $Internals::StabilityBranchVersion) { |
113 | } elsif (defined $Internals::StabilityBranchVersion) { |
78 | # note to people studying this modules sources: |
114 | # note to people studying this modules sources: |
79 | # the above test is not considered a clean or stable way to |
115 | # the above test is not considered a clean or stable way to |
80 | # test for the stability branch. |
116 | # test for the stability branch. |
81 | |
117 | |
82 | sgr 32; |
118 | sgr 32; |
83 | print <<EOF; |
119 | print <<EOF; |
84 | |
|
|
85 | *** |
|
|
86 | *** The stability canary says: chirp! chirp! (it seems to be quite excited) |
120 | *** The stability canary says: chirp! chirp! (it seems to be quite excited) |
87 | *** |
121 | *** |
88 | *** It seems you are running schmorp's stability branch of perl. |
122 | *** It seems you are running schmorp's stability branch of perl. |
89 | *** All should be well, and if it isn't, you should report this as a bug |
123 | *** All should be well, and if it isn't, you should report this as a bug |
90 | *** to the $distname author. |
124 | *** to the $distname author. |
91 | *** |
125 | *** |
92 | |
|
|
93 | EOF |
126 | EOF |
94 | } elsif ($] < 5.021) { |
127 | } elsif ($] < 5.021) { |
95 | #sgr 32; |
128 | #sgr 32; |
96 | print <<EOF; |
129 | print <<EOF; |
97 | |
|
|
98 | *** |
|
|
99 | *** The stability canary says: chirp! chirp! (it seems to be quite happy) |
130 | *** The stability canary says: chirp! chirp! (it seems to be quite happy) |
100 | *** |
131 | *** |
101 | *** Your version of perl ($]) is quite supported by $distname, nothing |
132 | *** Your version of perl ($]) is quite supported by $distname, nothing |
102 | *** else to be said, hope it comes in handy. |
133 | *** else to be said, hope it comes in handy. |
103 | *** |
134 | *** |
104 | |
|
|
105 | EOF |
135 | EOF |
106 | } else { |
136 | } else { |
107 | sgr 31; |
137 | sgr 31; |
108 | print <<EOF; |
138 | print <<EOF; |
109 | |
|
|
110 | *** |
|
|
111 | *** The stability canary says: (nothing, it was driven away by harsh weather) |
139 | *** The stability canary says: (nothing, it was driven away by harsh weather) |
112 | *** |
140 | *** |
113 | *** It seems you are running perl version $], likely the "official" or |
141 | *** It seems you are running perl version $], likely the "official" or |
114 | *** "standard" version. While there is nothing wrong with doing that, |
142 | *** "standard" version. While there is nothing wrong with doing that, |
115 | *** standard perl versions 5.022 and up are not supported by $distname. |
143 | *** standard perl versions 5.022 and up are not supported by $distname. |
… | |
… | |
120 | *** If everything works fine, you can ignore this message. |
148 | *** If everything works fine, you can ignore this message. |
121 | *** |
149 | *** |
122 | EOF |
150 | EOF |
123 | sgr 0; |
151 | sgr 0; |
124 | print <<EOF; |
152 | print <<EOF; |
|
|
153 | *** |
125 | *** Stability canary mini-FAQ: |
154 | *** Stability canary mini-FAQ: |
126 | *** |
155 | *** |
127 | *** Do I need to do anything? |
156 | *** Do I need to do anything? |
128 | *** With luck, no. While some distributions are known to fail |
157 | *** With luck, no. While some distributions are known to fail |
129 | *** already, most should probably work. This message is here |
158 | *** already, most should probably work. This message is here |
… | |
… | |
179 | |
208 | |
180 | =item C<PERL_CANARY_STABILITY_DISABLE=1> |
209 | =item C<PERL_CANARY_STABILITY_DISABLE=1> |
181 | |
210 | |
182 | Disable this modules functionality completely. |
211 | Disable this modules functionality completely. |
183 | |
212 | |
|
|
213 | =item C<AUTOMATED_TESTING=1> |
|
|
214 | |
|
|
215 | When this variable is set to a true value and the perl minimum version |
|
|
216 | requirement is not met, the module will exit, which should skip testing |
|
|
217 | under automated testing environments. |
|
|
218 | |
|
|
219 | This is done to avoid false failure or success reports when the chances of |
|
|
220 | success are already quite low and the failures are not supported by the |
|
|
221 | author. |
|
|
222 | |
184 | =back |
223 | =back |
185 | |
224 | |
186 | =head1 AUTHOR |
225 | =head1 AUTHOR |
187 | |
226 | |
188 | Marc Lehmann <schmorp@schmorp.de> |
227 | Marc Lehmann <schmorp@schmorp.de> |