blib/lib/Perl/Dist/APPerl.pm

filter: Statementstmt 10.6% 73 / 687 Branchbran 1.4% 5 / 352 Conditioncond 3.3% 3 / 91 MC/DCmcdc 0.0% 0 / 56 Subroutinesub 38.8% 21 / 54 Podpod 0.0% 0 / 8 totaltotal 8.1% 102 / 1248 CC 242 SCAR 65.9
CC
242
Cov
7%
Build
2652.0
_load_apperl_config
1056.0
Checkout
757.7
CRAP 727.2
↑ Summary
1 package Perl::Dist::APPerl;
2 # Copyright (c) 2026 Gavin Hayes, see LICENSE in the root of the project
3 1 ▶use version 0.77; our $VERSION = qv(v0.8.0);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use JSON::PP 2.0104 qw(decode_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use File::Path 2.07 qw(make_path remove_tree);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Cwd qw(abs_path getcwd);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Data::Dumper qw(Dumper);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use File::Basename qw(basename dirname);
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use File::Copy qw(copy move cp);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use FindBin qw();
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Fcntl qw(SEEK_SET);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Getopt::Long qw(GetOptionsFromArray);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 Getopt::Long::Configure qw(gnu_getopt);
16  
17 1 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 START_WD => getcwd(),
19 PROJECT_FILE => 'apperl-project.json',
20 1 };
21 1 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 PROJECT_TMP_DIR => (START_WD.'/.apperl'),
23 1 };
24 1 ▶use constant {
Subroutine BEGIN: called CC=3 SCAR=13.1
25 # DEFDATAROOT is used if the XDG base directories cannot be found
26 DEFDATAROOT => defined($ENV{HOME}) ? $ENV{HOME}
27 1 ▶ : defined($ENV{APPDATA}) ? $ENV{APPDATA} .'/apperl'
Branch: 2 branches
BranchTrueFalseTotal
defined $ENV{'HOME'} ? : 1 0 1
defined $ENV{'APPDATA'} ? : 0 0 0
28 : PROJECT_TMP_DIR.'/site',
29 PROJECT_TMP_CONFIG_FILE => (PROJECT_TMP_DIR.'/user-project.json'),
30 1 };
31 1 ▶use constant {
Subroutine BEGIN: called CC=3 SCAR=11.7
32 SITE_CONFIG_DIR => ($ENV{XDG_CONFIG_HOME} // (DEFDATAROOT.'/.config')) . '/apperl',
33 1 ▶ SITE_REPO_DIR => ($ENV{XDG_DATA_HOME} // (DEFDATAROOT.'/.local/share')).'/apperl',
Condition50%2/4
$ENV{"XDG_CONFIG_HOME"} // "/home/cpancover/.config"
l!l
01
$ENV{"XDG_DATA_HOME"} // "/home/cpancover/.local/share"
l!l
01
MC/DC0%0/1
$ENV{"XDG_CONFIG_HOME"} // "/home/cpancover/.config"
$ENV{"XDG_CONFIG_HOME"}
MC/DC0%0/1
$ENV{"XDG_DATA_HOME"} // "/home/cpancover/.local/share"
$ENV{"XDG_DATA_HOME"}
Truth table50%1/2
A
A= $ENV{"XDG_CONFIG_HOME"}
Aresult
11
00
Truth table50%1/2
A
A= $ENV{"XDG_DATA_HOME"}
Aresult
11
00
34 1 };
35 1 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.0
36 1 SITE_CONFIG_FILE => (SITE_CONFIG_DIR."/site.json"),
37 1 };
38 1 ▶use constant {
Subroutine BEGIN: called CC=1 SCAR=0.1
39 1 ▶ SHARE_DIR => sub {
Subroutine __ANON__: called CC=6 SCAR=18.5
40 1 my $thispath = abs_path(__FILE__);
41 1 ▶ defined($thispath) or die(__FILE__.'issues?');
Branch: 1 branch
BranchTrueFalseTotal
defined $thispath or die "/home/cpancover/.cpan/build/Perl-Dist-APPerl-v0.8.0-0/blib/lib/Perl/Dist/APPerl.pmissues?" 1 0 1
42 1 my $sharedir = dirname($thispath)."/../../../share";
43 1 ▶ if (! -d $sharedir) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $sharedir) 1 0 1
44 1 $sharedir = '/zip/lib/perl5/auto/share/dist/Perl-Dist-APPerl';
45 }
46 1 ▶ if (! -d $sharedir) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $sharedir) 1 0 1
47 1 ▶ eval "use File::ShareDir; 1" or die "Failed to load File::ShareDir";
Subroutine BEGIN: called CC=1 SCAR=0.0
Branch: 1 branch
BranchTrueFalseTotal
eval "use File::ShareDir; 1" or die "Failed to load File::ShareDir" 1 0 1
48 1 $sharedir = File::ShareDir::dist_dir('Perl-Dist-APPerl');
49 }
50 1 ▶ $sharedir = abs_path($sharedir) // die "Failed to load sharedir";
Condition50%1/2
abs_path($sharedir) // die("Failed to load sharedir")
l!l
10
MC/DC0%0/1
abs_path($sharedir) // die("Failed to load sharedir")
abs_path($sharedir)
Truth table50%1/2
A
A= abs_path($sharedir)
Aresult
11
00
51 1 return $sharedir;
52 1 }->()
53 1 };
54  
55 0 ▶sub _load_apperl_configs {
Subroutine _load_apperl_configs: not called CC=4 SCAR=30.0
56  
57 # https://packages.debian.org/experimental/amd64/perl-base/filelist with tweaks
58 0 my @smallmanifest = (
59 '__perllib__/AutoLoader.pm',
60 '__perllib__/Carp.pm',
61 '__perllib__/Carp/Heavy.pm',
62 '__perlarchlib__/Config.pm',
63 '__perlarchlib__/Config_git.pl',
64 '__perlarchlib__/Config_heavy.pl',
65 '__perlarchlib__/Cwd.pm',
66 '__perlarchlib__/DynaLoader.pm',
67 '__perlarchlib__/Errno.pm',
68 '__perlarchlib__/ErrnoRuntime.pm',
69 '__perllib__/Exporter.pm',
70 '__perllib__/Exporter/Heavy.pm',
71 '__perlarchlib__/Fcntl.pm',
72 '__perllib__/File/Basename.pm',
73 '__perlarchlib__/File/Glob.pm',
74 '__perllib__/File/Path.pm',
75 '__perlarchlib__/File/Spec.pm',
76 '__perlarchlib__/File/Spec/Unix.pm',
77 '__perllib__/File/Temp.pm',
78 '__perllib__/FileHandle.pm',
79 '__perllib__/Getopt/Long.pm',
80 '__perlarchlib__/Hash/Util.pm',
81 '__perlarchlib__/IO.pm',
82 '__perlarchlib__/IO/File.pm',
83 '__perlarchlib__/IO/Handle.pm',
84 '__perlarchlib__/IO/Pipe.pm',
85 '__perlarchlib__/IO/Seekable.pm',
86 '__perlarchlib__/IO/Select.pm',
87 '__perlarchlib__/IO/Socket.pm',
88 '__perlarchlib__/IO/Socket/INET.pm',
89 '__perllib__/IO/Socket/IP.pm',
90 '__perlarchlib__/IO/Socket/UNIX.pm',
91 '__perllib__/IPC/Open2.pm',
92 '__perllib__/IPC/Open3.pm',
93 '__perlarchlib__/List/Util.pm',
94 '__perlarchlib__/POSIX.pm',
95 '__perlarchlib__/Scalar/Util.pm',
96 '__perllib__/SelectSaver.pm',
97 '__perlarchlib__/Socket.pm',
98 '__perllib__/Symbol.pm',
99 '__perllib__/Text/ParseWords.pm',
100 '__perllib__/Text/Tabs.pm',
101 '__perllib__/Text/Wrap.pm',
102 '__perllib__/Tie/Hash.pm',
103 '__perllib__/XSLoader.pm',
104 '__perlarchlib__/attributes.pm',
105 '__perllib__/base.pm',
106 '__perllib__/builtin.pm',
107 '__perllib__/bytes.pm',
108 '__perllib__/bytes_heavy.pl',
109 '__perllib__/constant.pm',
110 '__perllib__/feature.pm',
111 '__perllib__/fields.pm',
112 '__perllib__/integer.pm',
113 '__perlarchlib__/lib.pm',
114 '__perllib__/locale.pm',
115 '__perllib__/overload.pm',
116 '__perllib__/overloading.pm',
117 '__perllib__/parent.pm',
118 '__perlarchlib__/re.pm',
119 '__perllib__/strict.pm',
120 '__perllib__/unicore/To/Age.pl',
121 '__perllib__/unicore/To/Bc.pl',
122 '__perllib__/unicore/To/Bmg.pl',
123 '__perllib__/unicore/To/Bpb.pl',
124 '__perllib__/unicore/To/Bpt.pl',
125 '__perllib__/unicore/To/Cf.pl',
126 '__perllib__/unicore/To/Ea.pl',
127 '__perllib__/unicore/To/EqUIdeo.pl',
128 '__perllib__/unicore/To/GCB.pl',
129 '__perllib__/unicore/To/Gc.pl',
130 '__perllib__/unicore/To/Hst.pl',
131 '__perllib__/unicore/To/Identif2.pl',
132 '__perllib__/unicore/To/Identifi.pl',
133 '__perllib__/unicore/To/InPC.pl',
134 '__perllib__/unicore/To/InSC.pl',
135 '__perllib__/unicore/To/Isc.pl',
136 '__perllib__/unicore/To/Jg.pl',
137 '__perllib__/unicore/To/Jt.pl',
138 '__perllib__/unicore/To/Lb.pl',
139 '__perllib__/unicore/To/Lc.pl',
140 '__perllib__/unicore/To/NFCQC.pl',
141 '__perllib__/unicore/To/NFDQC.pl',
142 '__perllib__/unicore/To/NFKCCF.pl',
143 '__perllib__/unicore/To/NFKCQC.pl',
144 '__perllib__/unicore/To/NFKDQC.pl',
145 '__perllib__/unicore/To/Na1.pl',
146 '__perllib__/unicore/To/NameAlia.pl',
147 '__perllib__/unicore/To/Nt.pl',
148 '__perllib__/unicore/To/Nv.pl',
149 '__perllib__/unicore/To/PerlDeci.pl',
150 '__perllib__/unicore/To/SB.pl',
151 '__perllib__/unicore/To/Sc.pl',
152 '__perllib__/unicore/To/Scx.pl',
153 '__perllib__/unicore/To/Tc.pl',
154 '__perllib__/unicore/To/Uc.pl',
155 '__perllib__/unicore/To/Vo.pl',
156 '__perllib__/unicore/To/WB.pl',
157 '__perllib__/unicore/To/_PerlLB.pl',
158 '__perllib__/unicore/To/_PerlSCX.pl',
159 '__perllib__/unicore/lib/Age/NA.pl',
160 '__perllib__/unicore/lib/Age/V100.pl',
161 '__perllib__/unicore/lib/Age/V11.pl',
162 '__perllib__/unicore/lib/Age/V110.pl',
163 '__perllib__/unicore/lib/Age/V120.pl',
164 '__perllib__/unicore/lib/Age/V130.pl',
165 '__perllib__/unicore/lib/Age/V140.pl',
166 '__perllib__/unicore/lib/Age/V20.pl',
167 '__perllib__/unicore/lib/Age/V30.pl',
168 '__perllib__/unicore/lib/Age/V31.pl',
169 '__perllib__/unicore/lib/Age/V32.pl',
170 '__perllib__/unicore/lib/Age/V40.pl',
171 '__perllib__/unicore/lib/Age/V41.pl',
172 '__perllib__/unicore/lib/Age/V50.pl',
173 '__perllib__/unicore/lib/Age/V51.pl',
174 '__perllib__/unicore/lib/Age/V52.pl',
175 '__perllib__/unicore/lib/Age/V60.pl',
176 '__perllib__/unicore/lib/Age/V61.pl',
177 '__perllib__/unicore/lib/Age/V70.pl',
178 '__perllib__/unicore/lib/Age/V80.pl',
179 '__perllib__/unicore/lib/Age/V90.pl',
180 '__perllib__/unicore/lib/Alpha/Y.pl',
181 '__perllib__/unicore/lib/Bc/AL.pl',
182 '__perllib__/unicore/lib/Bc/AN.pl',
183 '__perllib__/unicore/lib/Bc/B.pl',
184 '__perllib__/unicore/lib/Bc/BN.pl',
185 '__perllib__/unicore/lib/Bc/CS.pl',
186 '__perllib__/unicore/lib/Bc/EN.pl',
187 '__perllib__/unicore/lib/Bc/ES.pl',
188 '__perllib__/unicore/lib/Bc/ET.pl',
189 '__perllib__/unicore/lib/Bc/L.pl',
190 '__perllib__/unicore/lib/Bc/NSM.pl',
191 '__perllib__/unicore/lib/Bc/ON.pl',
192 '__perllib__/unicore/lib/Bc/R.pl',
193 '__perllib__/unicore/lib/Bc/WS.pl',
194 '__perllib__/unicore/lib/BidiC/Y.pl',
195 '__perllib__/unicore/lib/BidiM/Y.pl',
196 '__perllib__/unicore/lib/Blk/NB.pl',
197 '__perllib__/unicore/lib/Bpt/C.pl',
198 '__perllib__/unicore/lib/Bpt/N.pl',
199 '__perllib__/unicore/lib/Bpt/O.pl',
200 '__perllib__/unicore/lib/CE/Y.pl',
201 '__perllib__/unicore/lib/CI/Y.pl',
202 '__perllib__/unicore/lib/CWCF/Y.pl',
203 '__perllib__/unicore/lib/CWCM/Y.pl',
204 '__perllib__/unicore/lib/CWKCF/Y.pl',
205 '__perllib__/unicore/lib/CWL/Y.pl',
206 '__perllib__/unicore/lib/CWT/Y.pl',
207 '__perllib__/unicore/lib/CWU/Y.pl',
208 '__perllib__/unicore/lib/Cased/Y.pl',
209 '__perllib__/unicore/lib/Ccc/A.pl',
210 '__perllib__/unicore/lib/Ccc/AL.pl',
211 '__perllib__/unicore/lib/Ccc/AR.pl',
212 '__perllib__/unicore/lib/Ccc/ATAR.pl',
213 '__perllib__/unicore/lib/Ccc/B.pl',
214 '__perllib__/unicore/lib/Ccc/BR.pl',
215 '__perllib__/unicore/lib/Ccc/DB.pl',
216 '__perllib__/unicore/lib/Ccc/NK.pl',
217 '__perllib__/unicore/lib/Ccc/NR.pl',
218 '__perllib__/unicore/lib/Ccc/OV.pl',
219 '__perllib__/unicore/lib/Ccc/VR.pl',
220 '__perllib__/unicore/lib/CompEx/Y.pl',
221 '__perllib__/unicore/lib/DI/Y.pl',
222 '__perllib__/unicore/lib/Dash/Y.pl',
223 '__perllib__/unicore/lib/Dep/Y.pl',
224 '__perllib__/unicore/lib/Dia/Y.pl',
225 '__perllib__/unicore/lib/Dt/Com.pl',
226 '__perllib__/unicore/lib/Dt/Enc.pl',
227 '__perllib__/unicore/lib/Dt/Fin.pl',
228 '__perllib__/unicore/lib/Dt/Font.pl',
229 '__perllib__/unicore/lib/Dt/Init.pl',
230 '__perllib__/unicore/lib/Dt/Iso.pl',
231 '__perllib__/unicore/lib/Dt/Med.pl',
232 '__perllib__/unicore/lib/Dt/Nar.pl',
233 '__perllib__/unicore/lib/Dt/Nb.pl',
234 '__perllib__/unicore/lib/Dt/NonCanon.pl',
235 '__perllib__/unicore/lib/Dt/Sqr.pl',
236 '__perllib__/unicore/lib/Dt/Sub.pl',
237 '__perllib__/unicore/lib/Dt/Sup.pl',
238 '__perllib__/unicore/lib/Dt/Vert.pl',
239 '__perllib__/unicore/lib/EBase/Y.pl',
240 '__perllib__/unicore/lib/EComp/Y.pl',
241 '__perllib__/unicore/lib/EPres/Y.pl',
242 '__perllib__/unicore/lib/Ea/A.pl',
243 '__perllib__/unicore/lib/Ea/H.pl',
244 '__perllib__/unicore/lib/Ea/N.pl',
245 '__perllib__/unicore/lib/Ea/Na.pl',
246 '__perllib__/unicore/lib/Ea/W.pl',
247 '__perllib__/unicore/lib/Emoji/Y.pl',
248 '__perllib__/unicore/lib/Ext/Y.pl',
249 '__perllib__/unicore/lib/ExtPict/Y.pl',
250 '__perllib__/unicore/lib/GCB/CN.pl',
251 '__perllib__/unicore/lib/GCB/EX.pl',
252 '__perllib__/unicore/lib/GCB/LV.pl',
253 '__perllib__/unicore/lib/GCB/LVT.pl',
254 '__perllib__/unicore/lib/GCB/PP.pl',
255 '__perllib__/unicore/lib/GCB/SM.pl',
256 '__perllib__/unicore/lib/GCB/XX.pl',
257 '__perllib__/unicore/lib/Gc/C.pl',
258 '__perllib__/unicore/lib/Gc/Cf.pl',
259 '__perllib__/unicore/lib/Gc/Cn.pl',
260 '__perllib__/unicore/lib/Gc/L.pl',
261 '__perllib__/unicore/lib/Gc/LC.pl',
262 '__perllib__/unicore/lib/Gc/Ll.pl',
263 '__perllib__/unicore/lib/Gc/Lm.pl',
264 '__perllib__/unicore/lib/Gc/Lo.pl',
265 '__perllib__/unicore/lib/Gc/Lu.pl',
266 '__perllib__/unicore/lib/Gc/M.pl',
267 '__perllib__/unicore/lib/Gc/Mc.pl',
268 '__perllib__/unicore/lib/Gc/Me.pl',
269 '__perllib__/unicore/lib/Gc/Mn.pl',
270 '__perllib__/unicore/lib/Gc/N.pl',
271 '__perllib__/unicore/lib/Gc/Nd.pl',
272 '__perllib__/unicore/lib/Gc/Nl.pl',
273 '__perllib__/unicore/lib/Gc/No.pl',
274 '__perllib__/unicore/lib/Gc/P.pl',
275 '__perllib__/unicore/lib/Gc/Pc.pl',
276 '__perllib__/unicore/lib/Gc/Pd.pl',
277 '__perllib__/unicore/lib/Gc/Pe.pl',
278 '__perllib__/unicore/lib/Gc/Pf.pl',
279 '__perllib__/unicore/lib/Gc/Pi.pl',
280 '__perllib__/unicore/lib/Gc/Po.pl',
281 '__perllib__/unicore/lib/Gc/Ps.pl',
282 '__perllib__/unicore/lib/Gc/S.pl',
283 '__perllib__/unicore/lib/Gc/Sc.pl',
284 '__perllib__/unicore/lib/Gc/Sk.pl',
285 '__perllib__/unicore/lib/Gc/Sm.pl',
286 '__perllib__/unicore/lib/Gc/So.pl',
287 '__perllib__/unicore/lib/Gc/Z.pl',
288 '__perllib__/unicore/lib/Gc/Zs.pl',
289 '__perllib__/unicore/lib/GrBase/Y.pl',
290 '__perllib__/unicore/lib/GrExt/Y.pl',
291 '__perllib__/unicore/lib/Hex/Y.pl',
292 '__perllib__/unicore/lib/Hst/NA.pl',
293 '__perllib__/unicore/lib/Hyphen/T.pl',
294 '__perllib__/unicore/lib/IDC/Y.pl',
295 '__perllib__/unicore/lib/IDS/Y.pl',
296 '__perllib__/unicore/lib/IdStatus/Allowed.pl',
297 '__perllib__/unicore/lib/IdStatus/Restrict.pl',
298 '__perllib__/unicore/lib/IdType/DefaultI.pl',
299 '__perllib__/unicore/lib/IdType/Exclusio.pl',
300 '__perllib__/unicore/lib/IdType/Inclusio.pl',
301 '__perllib__/unicore/lib/IdType/LimitedU.pl',
302 '__perllib__/unicore/lib/IdType/NotChara.pl',
303 '__perllib__/unicore/lib/IdType/NotNFKC.pl',
304 '__perllib__/unicore/lib/IdType/NotXID.pl',
305 '__perllib__/unicore/lib/IdType/Obsolete.pl',
306 '__perllib__/unicore/lib/IdType/Recommen.pl',
307 '__perllib__/unicore/lib/IdType/Technica.pl',
308 '__perllib__/unicore/lib/IdType/Uncommon.pl',
309 '__perllib__/unicore/lib/Ideo/Y.pl',
310 '__perllib__/unicore/lib/In/10_0.pl',
311 '__perllib__/unicore/lib/In/11_0.pl',
312 '__perllib__/unicore/lib/In/12_0.pl',
313 '__perllib__/unicore/lib/In/12_1.pl',
314 '__perllib__/unicore/lib/In/13_0.pl',
315 '__perllib__/unicore/lib/In/14_0.pl',
316 '__perllib__/unicore/lib/In/2_0.pl',
317 '__perllib__/unicore/lib/In/2_1.pl',
318 '__perllib__/unicore/lib/In/3_0.pl',
319 '__perllib__/unicore/lib/In/3_1.pl',
320 '__perllib__/unicore/lib/In/3_2.pl',
321 '__perllib__/unicore/lib/In/4_0.pl',
322 '__perllib__/unicore/lib/In/4_1.pl',
323 '__perllib__/unicore/lib/In/5_0.pl',
324 '__perllib__/unicore/lib/In/5_1.pl',
325 '__perllib__/unicore/lib/In/5_2.pl',
326 '__perllib__/unicore/lib/In/6_0.pl',
327 '__perllib__/unicore/lib/In/6_1.pl',
328 '__perllib__/unicore/lib/In/6_2.pl',
329 '__perllib__/unicore/lib/In/6_3.pl',
330 '__perllib__/unicore/lib/In/7_0.pl',
331 '__perllib__/unicore/lib/In/8_0.pl',
332 '__perllib__/unicore/lib/In/9_0.pl',
333 '__perllib__/unicore/lib/InPC/Bottom.pl',
334 '__perllib__/unicore/lib/InPC/BottomAn.pl',
335 '__perllib__/unicore/lib/InPC/Left.pl',
336 '__perllib__/unicore/lib/InPC/LeftAndR.pl',
337 '__perllib__/unicore/lib/InPC/NA.pl',
338 '__perllib__/unicore/lib/InPC/Overstru.pl',
339 '__perllib__/unicore/lib/InPC/Right.pl',
340 '__perllib__/unicore/lib/InPC/Top.pl',
341 '__perllib__/unicore/lib/InPC/TopAndBo.pl',
342 '__perllib__/unicore/lib/InPC/TopAndL2.pl',
343 '__perllib__/unicore/lib/InPC/TopAndLe.pl',
344 '__perllib__/unicore/lib/InPC/TopAndRi.pl',
345 '__perllib__/unicore/lib/InPC/VisualOr.pl',
346 '__perllib__/unicore/lib/InSC/Avagraha.pl',
347 '__perllib__/unicore/lib/InSC/Bindu.pl',
348 '__perllib__/unicore/lib/InSC/Cantilla.pl',
349 '__perllib__/unicore/lib/InSC/Consona2.pl',
350 '__perllib__/unicore/lib/InSC/Consona3.pl',
351 '__perllib__/unicore/lib/InSC/Consona4.pl',
352 '__perllib__/unicore/lib/InSC/Consona5.pl',
353 '__perllib__/unicore/lib/InSC/Consona6.pl',
354 '__perllib__/unicore/lib/InSC/Consona7.pl',
355 '__perllib__/unicore/lib/InSC/Consona8.pl',
356 '__perllib__/unicore/lib/InSC/Consonan.pl',
357 '__perllib__/unicore/lib/InSC/Invisibl.pl',
358 '__perllib__/unicore/lib/InSC/Nukta.pl',
359 '__perllib__/unicore/lib/InSC/Number.pl',
360 '__perllib__/unicore/lib/InSC/Other.pl',
361 '__perllib__/unicore/lib/InSC/PureKill.pl',
362 '__perllib__/unicore/lib/InSC/Syllable.pl',
363 '__perllib__/unicore/lib/InSC/ToneMark.pl',
364 '__perllib__/unicore/lib/InSC/Virama.pl',
365 '__perllib__/unicore/lib/InSC/Visarga.pl',
366 '__perllib__/unicore/lib/InSC/Vowel.pl',
367 '__perllib__/unicore/lib/InSC/VowelDep.pl',
368 '__perllib__/unicore/lib/InSC/VowelInd.pl',
369 '__perllib__/unicore/lib/Jg/Ain.pl',
370 '__perllib__/unicore/lib/Jg/Alef.pl',
371 '__perllib__/unicore/lib/Jg/Beh.pl',
372 '__perllib__/unicore/lib/Jg/Dal.pl',
373 '__perllib__/unicore/lib/Jg/FarsiYeh.pl',
374 '__perllib__/unicore/lib/Jg/Feh.pl',
375 '__perllib__/unicore/lib/Jg/Gaf.pl',
376 '__perllib__/unicore/lib/Jg/Hah.pl',
377 '__perllib__/unicore/lib/Jg/HanifiRo.pl',
378 '__perllib__/unicore/lib/Jg/Kaf.pl',
379 '__perllib__/unicore/lib/Jg/Lam.pl',
380 '__perllib__/unicore/lib/Jg/NoJoinin.pl',
381 '__perllib__/unicore/lib/Jg/Noon.pl',
382 '__perllib__/unicore/lib/Jg/Qaf.pl',
383 '__perllib__/unicore/lib/Jg/Reh.pl',
384 '__perllib__/unicore/lib/Jg/Sad.pl',
385 '__perllib__/unicore/lib/Jg/Seen.pl',
386 '__perllib__/unicore/lib/Jg/Tah.pl',
387 '__perllib__/unicore/lib/Jg/Waw.pl',
388 '__perllib__/unicore/lib/Jg/Yeh.pl',
389 '__perllib__/unicore/lib/Jt/C.pl',
390 '__perllib__/unicore/lib/Jt/D.pl',
391 '__perllib__/unicore/lib/Jt/L.pl',
392 '__perllib__/unicore/lib/Jt/R.pl',
393 '__perllib__/unicore/lib/Jt/T.pl',
394 '__perllib__/unicore/lib/Jt/U.pl',
395 '__perllib__/unicore/lib/Lb/AI.pl',
396 '__perllib__/unicore/lib/Lb/AL.pl',
397 '__perllib__/unicore/lib/Lb/BA.pl',
398 '__perllib__/unicore/lib/Lb/BB.pl',
399 '__perllib__/unicore/lib/Lb/CJ.pl',
400 '__perllib__/unicore/lib/Lb/CL.pl',
401 '__perllib__/unicore/lib/Lb/CM.pl',
402 '__perllib__/unicore/lib/Lb/EX.pl',
403 '__perllib__/unicore/lib/Lb/GL.pl',
404 '__perllib__/unicore/lib/Lb/ID.pl',
405 '__perllib__/unicore/lib/Lb/IN.pl',
406 '__perllib__/unicore/lib/Lb/IS.pl',
407 '__perllib__/unicore/lib/Lb/NS.pl',
408 '__perllib__/unicore/lib/Lb/NU.pl',
409 '__perllib__/unicore/lib/Lb/OP.pl',
410 '__perllib__/unicore/lib/Lb/PO.pl',
411 '__perllib__/unicore/lib/Lb/PR.pl',
412 '__perllib__/unicore/lib/Lb/QU.pl',
413 '__perllib__/unicore/lib/Lb/SA.pl',
414 '__perllib__/unicore/lib/Lb/XX.pl',
415 '__perllib__/unicore/lib/Lower/Y.pl',
416 '__perllib__/unicore/lib/Math/Y.pl',
417 '__perllib__/unicore/lib/NFCQC/M.pl',
418 '__perllib__/unicore/lib/NFCQC/Y.pl',
419 '__perllib__/unicore/lib/NFDQC/N.pl',
420 '__perllib__/unicore/lib/NFDQC/Y.pl',
421 '__perllib__/unicore/lib/NFKCQC/N.pl',
422 '__perllib__/unicore/lib/NFKCQC/Y.pl',
423 '__perllib__/unicore/lib/NFKDQC/N.pl',
424 '__perllib__/unicore/lib/NFKDQC/Y.pl',
425 '__perllib__/unicore/lib/Nt/Di.pl',
426 '__perllib__/unicore/lib/Nt/None.pl',
427 '__perllib__/unicore/lib/Nt/Nu.pl',
428 '__perllib__/unicore/lib/Nv/0.pl',
429 '__perllib__/unicore/lib/Nv/1.pl',
430 '__perllib__/unicore/lib/Nv/10.pl',
431 '__perllib__/unicore/lib/Nv/100.pl',
432 '__perllib__/unicore/lib/Nv/1000.pl',
433 '__perllib__/unicore/lib/Nv/10000.pl',
434 '__perllib__/unicore/lib/Nv/100000.pl',
435 '__perllib__/unicore/lib/Nv/11.pl',
436 '__perllib__/unicore/lib/Nv/12.pl',
437 '__perllib__/unicore/lib/Nv/13.pl',
438 '__perllib__/unicore/lib/Nv/14.pl',
439 '__perllib__/unicore/lib/Nv/15.pl',
440 '__perllib__/unicore/lib/Nv/16.pl',
441 '__perllib__/unicore/lib/Nv/17.pl',
442 '__perllib__/unicore/lib/Nv/18.pl',
443 '__perllib__/unicore/lib/Nv/19.pl',
444 '__perllib__/unicore/lib/Nv/1_16.pl',
445 '__perllib__/unicore/lib/Nv/1_2.pl',
446 '__perllib__/unicore/lib/Nv/1_3.pl',
447 '__perllib__/unicore/lib/Nv/1_4.pl',
448 '__perllib__/unicore/lib/Nv/1_6.pl',
449 '__perllib__/unicore/lib/Nv/1_8.pl',
450 '__perllib__/unicore/lib/Nv/2.pl',
451 '__perllib__/unicore/lib/Nv/20.pl',
452 '__perllib__/unicore/lib/Nv/200.pl',
453 '__perllib__/unicore/lib/Nv/2000.pl',
454 '__perllib__/unicore/lib/Nv/20000.pl',
455 '__perllib__/unicore/lib/Nv/2_3.pl',
456 '__perllib__/unicore/lib/Nv/3.pl',
457 '__perllib__/unicore/lib/Nv/30.pl',
458 '__perllib__/unicore/lib/Nv/300.pl',
459 '__perllib__/unicore/lib/Nv/3000.pl',
460 '__perllib__/unicore/lib/Nv/30000.pl',
461 '__perllib__/unicore/lib/Nv/3_16.pl',
462 '__perllib__/unicore/lib/Nv/3_4.pl',
463 '__perllib__/unicore/lib/Nv/4.pl',
464 '__perllib__/unicore/lib/Nv/40.pl',
465 '__perllib__/unicore/lib/Nv/400.pl',
466 '__perllib__/unicore/lib/Nv/4000.pl',
467 '__perllib__/unicore/lib/Nv/40000.pl',
468 '__perllib__/unicore/lib/Nv/5.pl',
469 '__perllib__/unicore/lib/Nv/50.pl',
470 '__perllib__/unicore/lib/Nv/500.pl',
471 '__perllib__/unicore/lib/Nv/5000.pl',
472 '__perllib__/unicore/lib/Nv/50000.pl',
473 '__perllib__/unicore/lib/Nv/6.pl',
474 '__perllib__/unicore/lib/Nv/60.pl',
475 '__perllib__/unicore/lib/Nv/600.pl',
476 '__perllib__/unicore/lib/Nv/6000.pl',
477 '__perllib__/unicore/lib/Nv/60000.pl',
478 '__perllib__/unicore/lib/Nv/7.pl',
479 '__perllib__/unicore/lib/Nv/70.pl',
480 '__perllib__/unicore/lib/Nv/700.pl',
481 '__perllib__/unicore/lib/Nv/7000.pl',
482 '__perllib__/unicore/lib/Nv/70000.pl',
483 '__perllib__/unicore/lib/Nv/8.pl',
484 '__perllib__/unicore/lib/Nv/80.pl',
485 '__perllib__/unicore/lib/Nv/800.pl',
486 '__perllib__/unicore/lib/Nv/8000.pl',
487 '__perllib__/unicore/lib/Nv/80000.pl',
488 '__perllib__/unicore/lib/Nv/9.pl',
489 '__perllib__/unicore/lib/Nv/90.pl',
490 '__perllib__/unicore/lib/Nv/900.pl',
491 '__perllib__/unicore/lib/Nv/9000.pl',
492 '__perllib__/unicore/lib/Nv/90000.pl',
493 '__perllib__/unicore/lib/PCM/Y.pl',
494 '__perllib__/unicore/lib/PatSyn/Y.pl',
495 '__perllib__/unicore/lib/Perl/Alnum.pl',
496 '__perllib__/unicore/lib/Perl/Assigned.pl',
497 '__perllib__/unicore/lib/Perl/Blank.pl',
498 '__perllib__/unicore/lib/Perl/Graph.pl',
499 '__perllib__/unicore/lib/Perl/PerlWord.pl',
500 '__perllib__/unicore/lib/Perl/PosixPun.pl',
501 '__perllib__/unicore/lib/Perl/Print.pl',
502 '__perllib__/unicore/lib/Perl/SpacePer.pl',
503 '__perllib__/unicore/lib/Perl/Title.pl',
504 '__perllib__/unicore/lib/Perl/Word.pl',
505 '__perllib__/unicore/lib/Perl/XPosixPu.pl',
506 '__perllib__/unicore/lib/Perl/_PerlAny.pl',
507 '__perllib__/unicore/lib/Perl/_PerlCh2.pl',
508 '__perllib__/unicore/lib/Perl/_PerlCha.pl',
509 '__perllib__/unicore/lib/Perl/_PerlFol.pl',
510 '__perllib__/unicore/lib/Perl/_PerlIDC.pl',
511 '__perllib__/unicore/lib/Perl/_PerlIDS.pl',
512 '__perllib__/unicore/lib/Perl/_PerlIsI.pl',
513 '__perllib__/unicore/lib/Perl/_PerlNch.pl',
514 '__perllib__/unicore/lib/Perl/_PerlPat.pl',
515 '__perllib__/unicore/lib/Perl/_PerlPr2.pl',
516 '__perllib__/unicore/lib/Perl/_PerlPro.pl',
517 '__perllib__/unicore/lib/Perl/_PerlQuo.pl',
518 '__perllib__/unicore/lib/QMark/Y.pl',
519 '__perllib__/unicore/lib/SB/AT.pl',
520 '__perllib__/unicore/lib/SB/CL.pl',
521 '__perllib__/unicore/lib/SB/EX.pl',
522 '__perllib__/unicore/lib/SB/FO.pl',
523 '__perllib__/unicore/lib/SB/LE.pl',
524 '__perllib__/unicore/lib/SB/LO.pl',
525 '__perllib__/unicore/lib/SB/NU.pl',
526 '__perllib__/unicore/lib/SB/SC.pl',
527 '__perllib__/unicore/lib/SB/ST.pl',
528 '__perllib__/unicore/lib/SB/Sp.pl',
529 '__perllib__/unicore/lib/SB/UP.pl',
530 '__perllib__/unicore/lib/SB/XX.pl',
531 '__perllib__/unicore/lib/SD/Y.pl',
532 '__perllib__/unicore/lib/STerm/Y.pl',
533 '__perllib__/unicore/lib/Sc/Arab.pl',
534 '__perllib__/unicore/lib/Sc/Beng.pl',
535 '__perllib__/unicore/lib/Sc/Cprt.pl',
536 '__perllib__/unicore/lib/Sc/Cyrl.pl',
537 '__perllib__/unicore/lib/Sc/Deva.pl',
538 '__perllib__/unicore/lib/Sc/Dupl.pl',
539 '__perllib__/unicore/lib/Sc/Geor.pl',
540 '__perllib__/unicore/lib/Sc/Glag.pl',
541 '__perllib__/unicore/lib/Sc/Gong.pl',
542 '__perllib__/unicore/lib/Sc/Gonm.pl',
543 '__perllib__/unicore/lib/Sc/Gran.pl',
544 '__perllib__/unicore/lib/Sc/Grek.pl',
545 '__perllib__/unicore/lib/Sc/Gujr.pl',
546 '__perllib__/unicore/lib/Sc/Guru.pl',
547 '__perllib__/unicore/lib/Sc/Han.pl',
548 '__perllib__/unicore/lib/Sc/Hang.pl',
549 '__perllib__/unicore/lib/Sc/Hira.pl',
550 '__perllib__/unicore/lib/Sc/Kana.pl',
551 '__perllib__/unicore/lib/Sc/Knda.pl',
552 '__perllib__/unicore/lib/Sc/Latn.pl',
553 '__perllib__/unicore/lib/Sc/Limb.pl',
554 '__perllib__/unicore/lib/Sc/Linb.pl',
555 '__perllib__/unicore/lib/Sc/Mlym.pl',
556 '__perllib__/unicore/lib/Sc/Mong.pl',
557 '__perllib__/unicore/lib/Sc/Mult.pl',
558 '__perllib__/unicore/lib/Sc/Orya.pl',
559 '__perllib__/unicore/lib/Sc/Sinh.pl',
560 '__perllib__/unicore/lib/Sc/Syrc.pl',
561 '__perllib__/unicore/lib/Sc/Taml.pl',
562 '__perllib__/unicore/lib/Sc/Telu.pl',
563 '__perllib__/unicore/lib/Sc/Zinh.pl',
564 '__perllib__/unicore/lib/Sc/Zyyy.pl',
565 '__perllib__/unicore/lib/Scx/Adlm.pl',
566 '__perllib__/unicore/lib/Scx/Arab.pl',
567 '__perllib__/unicore/lib/Scx/Armn.pl',
568 '__perllib__/unicore/lib/Scx/Beng.pl',
569 '__perllib__/unicore/lib/Scx/Bhks.pl',
570 '__perllib__/unicore/lib/Scx/Bopo.pl',
571 '__perllib__/unicore/lib/Scx/Cakm.pl',
572 '__perllib__/unicore/lib/Scx/Cham.pl',
573 '__perllib__/unicore/lib/Scx/Copt.pl',
574 '__perllib__/unicore/lib/Scx/Cprt.pl',
575 '__perllib__/unicore/lib/Scx/Cyrl.pl',
576 '__perllib__/unicore/lib/Scx/Deva.pl',
577 '__perllib__/unicore/lib/Scx/Diak.pl',
578 '__perllib__/unicore/lib/Scx/Dupl.pl',
579 '__perllib__/unicore/lib/Scx/Ethi.pl',
580 '__perllib__/unicore/lib/Scx/Geor.pl',
581 '__perllib__/unicore/lib/Scx/Glag.pl',
582 '__perllib__/unicore/lib/Scx/Gong.pl',
583 '__perllib__/unicore/lib/Scx/Gonm.pl',
584 '__perllib__/unicore/lib/Scx/Gran.pl',
585 '__perllib__/unicore/lib/Scx/Grek.pl',
586 '__perllib__/unicore/lib/Scx/Gujr.pl',
587 '__perllib__/unicore/lib/Scx/Guru.pl',
588 '__perllib__/unicore/lib/Scx/Han.pl',
589 '__perllib__/unicore/lib/Scx/Hang.pl',
590 '__perllib__/unicore/lib/Scx/Hebr.pl',
591 '__perllib__/unicore/lib/Scx/Hira.pl',
592 '__perllib__/unicore/lib/Scx/Hmng.pl',
593 '__perllib__/unicore/lib/Scx/Hmnp.pl',
594 '__perllib__/unicore/lib/Scx/Kana.pl',
595 '__perllib__/unicore/lib/Scx/Khar.pl',
596 '__perllib__/unicore/lib/Scx/Khmr.pl',
597 '__perllib__/unicore/lib/Scx/Khoj.pl',
598 '__perllib__/unicore/lib/Scx/Knda.pl',
599 '__perllib__/unicore/lib/Scx/Kthi.pl',
600 '__perllib__/unicore/lib/Scx/Lana.pl',
601 '__perllib__/unicore/lib/Scx/Lao.pl',
602 '__perllib__/unicore/lib/Scx/Latn.pl',
603 '__perllib__/unicore/lib/Scx/Limb.pl',
604 '__perllib__/unicore/lib/Scx/Lina.pl',
605 '__perllib__/unicore/lib/Scx/Linb.pl',
606 '__perllib__/unicore/lib/Scx/Mlym.pl',
607 '__perllib__/unicore/lib/Scx/Mong.pl',
608 '__perllib__/unicore/lib/Scx/Mult.pl',
609 '__perllib__/unicore/lib/Scx/Mymr.pl',
610 '__perllib__/unicore/lib/Scx/Nand.pl',
611 '__perllib__/unicore/lib/Scx/Nko.pl',
612 '__perllib__/unicore/lib/Scx/Orya.pl',
613 '__perllib__/unicore/lib/Scx/Phlp.pl',
614 '__perllib__/unicore/lib/Scx/Rohg.pl',
615 '__perllib__/unicore/lib/Scx/Shrd.pl',
616 '__perllib__/unicore/lib/Scx/Sind.pl',
617 '__perllib__/unicore/lib/Scx/Sinh.pl',
618 '__perllib__/unicore/lib/Scx/Syrc.pl',
619 '__perllib__/unicore/lib/Scx/Tagb.pl',
620 '__perllib__/unicore/lib/Scx/Takr.pl',
621 '__perllib__/unicore/lib/Scx/Talu.pl',
622 '__perllib__/unicore/lib/Scx/Taml.pl',
623 '__perllib__/unicore/lib/Scx/Tang.pl',
624 '__perllib__/unicore/lib/Scx/Telu.pl',
625 '__perllib__/unicore/lib/Scx/Thaa.pl',
626 '__perllib__/unicore/lib/Scx/Tibt.pl',
627 '__perllib__/unicore/lib/Scx/Tirh.pl',
628 '__perllib__/unicore/lib/Scx/Vith.pl',
629 '__perllib__/unicore/lib/Scx/Xsux.pl',
630 '__perllib__/unicore/lib/Scx/Yezi.pl',
631 '__perllib__/unicore/lib/Scx/Yi.pl',
632 '__perllib__/unicore/lib/Scx/Zinh.pl',
633 '__perllib__/unicore/lib/Scx/Zyyy.pl',
634 '__perllib__/unicore/lib/Scx/Zzzz.pl',
635 '__perllib__/unicore/lib/Term/Y.pl',
636 '__perllib__/unicore/lib/UIdeo/Y.pl',
637 '__perllib__/unicore/lib/Upper/Y.pl',
638 '__perllib__/unicore/lib/VS/Y.pl',
639 '__perllib__/unicore/lib/Vo/R.pl',
640 '__perllib__/unicore/lib/Vo/Tr.pl',
641 '__perllib__/unicore/lib/Vo/Tu.pl',
642 '__perllib__/unicore/lib/Vo/U.pl',
643 '__perllib__/unicore/lib/WB/EX.pl',
644 '__perllib__/unicore/lib/WB/Extend.pl',
645 '__perllib__/unicore/lib/WB/FO.pl',
646 '__perllib__/unicore/lib/WB/HL.pl',
647 '__perllib__/unicore/lib/WB/KA.pl',
648 '__perllib__/unicore/lib/WB/LE.pl',
649 '__perllib__/unicore/lib/WB/MB.pl',
650 '__perllib__/unicore/lib/WB/ML.pl',
651 '__perllib__/unicore/lib/WB/MN.pl',
652 '__perllib__/unicore/lib/WB/NU.pl',
653 '__perllib__/unicore/lib/WB/WSegSpac.pl',
654 '__perllib__/unicore/lib/WB/XX.pl',
655 '__perllib__/unicore/lib/XIDC/Y.pl',
656 '__perllib__/unicore/lib/XIDS/Y.pl',
657 '__perllib__/utf8.pm',
658 '__perllib__/vars.pm',
659 '__perllib__/warnings.pm',
660 '__perllib__/warnings/register.pm',
661 );
662  
663 0 my %defconfig = (
664 cosmo_remotes => {
665 origin => 'https://github.com/G4Vi/cosmopolitan',
666 upstream => 'https://github.com/jart/cosmopolitan',
667 },
668 perl_remotes => {
669 origin => 'https://github.com/G4Vi/perl5',
670 },
671 apperl_configs => {
672 'nobuild-v0.1.0' => {
673 desc => 'use nobuild as base instead of this',
674 dest => 'perl-nobuild.com',
675 MANIFEST => ['lib', 'bin'],
676 zip_extra_files => {},
677 nobuild_perl_bin => ['src/perl.com', $^X],
678 },
679 'v5.36.0-full-v0.1.0-vista' => {
680 desc => 'Full perl v5.36.0, but with non-standard Cosmopolitan Libc that still supports vista',
681 perl_id => 'b22da6b83c37604132694ead0bdcf61690f74a53',
682 cosmo_id => '9c5a7795add7add5a214afce27d896084e0861c5',
683 cosmo_mode => '',
684 cosmo_ape_loader => 'ape-no-modify-self.o',
685 dest => 'perl-vista.com',
686 perl_flags => ['-Dprefix=/zip', '-Uversiononly', '-Dmyhostname=cosmo', '-Dmydomain=invalid'],
687 perl_extra_flags => ['-Doptimize=-Os', '-de'],
688 MANIFEST => ['lib', 'bin'],
689 'include_Perl-Dist-APPerl' => 1,
690 perl_repo_files => {},
691 zip_extra_files => {},
692 },
693 'v5.36.0-small-v0.1.0-vista' => {
694 desc => 'small perl v5.36.0, but with non-standard Cosmopolitan Libc that still supports vista',
695 base => 'v5.36.0-full-v0.1.0-vista',
696 perl_onlyextensions => [qw(Cwd Fcntl File/Glob Hash/Util IO List/Util POSIX Socket attributes re)],
697 MANIFEST => \@smallmanifest,
698 'include_Perl-Dist-APPerl' => 0,
699 dest => 'perl-small-vista.com',
700 },
701 'full-vista' => { desc => 'moving target: full for vista', base => 'v5.36.0-full-v0.1.0-vista', perl_id => '239a05bbef291b8de3309c95852d41fc027cacab', cosmo_id => 'fea68b142e59b5861fe09375eb5bcb256b69b70e', '+perl_extra_flags' => ['-Dprivlib=/zip/lib/perl5', '-Darchlib=/zip/lib/perl5/x86_64-cosmo', '-Dsitelib=/zip/lib/perl5/site_perl', '-Dsitearch=/zip/lib/perl5/site_perl/x86_64-cosmo']},
702 'small-vista' => { desc => 'moving target: small for vista', base => 'v5.36.0-small-v0.1.0-vista', perl_id => '239a05bbef291b8de3309c95852d41fc027cacab', cosmo_id => 'fea68b142e59b5861fe09375eb5bcb256b69b70e', '+perl_extra_flags' => ['-Dprivlib=/zip/lib/perl5', '-Darchlib=/zip/lib/perl5/x86_64-cosmo', '-Dsitelib=/zip/lib/perl5/site_perl', '-Dsitearch=/zip/lib/perl5/site_perl/x86_64-cosmo']},
703 'full-536' => {
704 desc => 'moving target: full-536',
705 perl_flags => ['-Dprefix=/zip', '-Uversiononly', '-Dmyhostname=cosmo', '-Dmydomain=invalid'],
706 perl_extra_flags => ['-Doptimize=-Os', '-de', '-Dprivlib=/zip/lib/perl5', '-Darchlib=/zip/lib/perl5/x86_64-cosmo', '-Dsitelib=/zip/lib/perl5/site_perl', '-Dsitearch=/zip/lib/perl5/site_perl/x86_64-cosmo'],
707 MANIFEST => ['lib', 'bin'],
708 'include_Perl-Dist-APPerl' => 1,
709 perl_repo_files => {},
710 zip_extra_files => {},
711 cosmo3 => 1,
712 dest => 'perl-536.com',
713 perl_url => 'https://github.com/Perl/perl5/archive/refs/tags/v5.36.3.tar.gz',
714 patches => ['__sharedir__/5.36-cosmo3.patch', '__sharedir__/5.36-cosmo-apperl.patch'],
715 install_modules => [],
716 },
717 'small-536' => {
718 desc => 'moving target: small-536',
719 base => 'full-536',
720 perl_onlyextensions => [qw(Cwd ErrnoRuntime Fcntl File/Glob Hash/Util IO List/Util POSIX Socket attributes re)],
721 MANIFEST => \@smallmanifest,
722 'include_Perl-Dist-APPerl' => 0,
723 dest => 'perl-536-small.com',
724 install_modules => [],
725 },
726 'full-540' => {
727 desc => 'moving target: full-540',
728 perl_flags => ['-Dprefix=/zip', '-Uversiononly', '-Dmyhostname=cosmo', '-Dmydomain=invalid'],
729 perl_extra_flags => ['-Doptimize=-Os', '-de', '-Dprivlib=/zip/lib/perl5', '-Darchlib=/zip/lib/perl5/x86_64-cosmo', '-Dsitelib=/zip/lib/perl5/site_perl', '-Dsitearch=/zip/lib/perl5/site_perl/x86_64-cosmo'],
730 MANIFEST => ['lib', 'bin'],
731 'include_Perl-Dist-APPerl' => 1,
732 perl_repo_files => {},
733 zip_extra_files => {},
734 cosmo3 => 1,
735 dest => 'perl-540.com',
736 perl_url => 'https://github.com/Perl/perl5/archive/refs/tags/v5.40.4.tar.gz',
737 patches => ['__sharedir__/5.40-cosmo3.patch', '__sharedir__/5.36-cosmo-apperl.patch'],
738 install_modules => [],
739 },
740 'small-540' => {
741 desc => 'moving target: small-540',
742 base => 'full-540',
743 perl_onlyextensions => [qw(Cwd ErrnoRuntime Fcntl File/Glob Hash/Util IO List/Util POSIX Socket attributes re)],
744 MANIFEST => \@smallmanifest,
745 'include_Perl-Dist-APPerl' => 0,
746 dest => 'perl-540-small.com',
747 install_modules => [],
748 },
749 'full-542' => {
750 desc => 'moving target: full-542',
751 perl_flags => ['-Dprefix=/zip', '-Uversiononly', '-Dmyhostname=cosmo', '-Dmydomain=invalid'],
752 perl_extra_flags => ['-Doptimize=-Os', '-de', '-Dprivlib=/zip/lib/perl5', '-Darchlib=/zip/lib/perl5/x86_64-cosmo', '-Dsitelib=/zip/lib/perl5/site_perl', '-Dsitearch=/zip/lib/perl5/site_perl/x86_64-cosmo'],
753 MANIFEST => ['lib', 'bin'],
754 'include_Perl-Dist-APPerl' => 1,
755 perl_repo_files => {},
756 zip_extra_files => {},
757 cosmo3 => 1,
758 dest => 'perl-542.com',
759 perl_url => 'https://github.com/Perl/perl5/archive/refs/tags/v5.42.2.tar.gz',
760 patches => ['__sharedir__/5.40-cosmo3.patch', '__sharedir__/5.36-cosmo-apperl.patch'],
761 install_modules => [],
762 },
763 'small-542' => {
764 desc => 'moving target: small-542',
765 base => 'full-542',
766 perl_onlyextensions => [qw(Cwd ErrnoRuntime Fcntl File/Glob Hash/Util IO List/Util POSIX Socket attributes re)],
767 MANIFEST => \@smallmanifest,
768 'include_Perl-Dist-APPerl' => 0,
769 dest => 'perl-542-small.com',
770 install_modules => [],
771 },
772 'full-544' => {
773 desc => 'moving target: full-544',
774 perl_flags => ['-Dprefix=/zip', '-Uversiononly', '-Dmyhostname=cosmo', '-Dmydomain=invalid'],
775 perl_extra_flags => ['-Doptimize=-Os', '-de', '-Dprivlib=/zip/lib/perl5', '-Darchlib=/zip/lib/perl5/x86_64-cosmo', '-Dsitelib=/zip/lib/perl5/site_perl', '-Dsitearch=/zip/lib/perl5/site_perl/x86_64-cosmo'],
776 MANIFEST => ['lib', 'bin'],
777 'include_Perl-Dist-APPerl' => 1,
778 perl_repo_files => {},
779 zip_extra_files => {},
780 cosmo3 => 1,
781 dest => 'perl-544.com',
782 perl_url => 'https://github.com/Perl/perl5/archive/refs/tags/v5.44.0.tar.gz',
783 patches => ['__sharedir__/5.44-cosmo3.patch', '__sharedir__/5.44-apperl.patch'],
784 install_modules => [],
785 },
786 'small-544' => {
787 desc => 'moving target: small-544',
788 base => 'full-544',
789 perl_onlyextensions => [qw(Cwd ErrnoRuntime Fcntl File/Glob Hash/Util IO List/Util POSIX Socket attributes re)],
790 MANIFEST => \@smallmanifest,
791 'include_Perl-Dist-APPerl' => 0,
792 dest => 'perl-544-small.com',
793 install_modules => [],
794 },
795 'full' => {
796 desc => 'moving target: full',
797 base => 'full-544',
798 dest => 'perl.com',
799 },
800 'small' => {
801 desc => 'moving target: small',
802 base => 'small-544',
803 dest => 'perl-small.com',
804 },
805 'nobuild' => {
806 desc => 'base nobuild config',
807 dest => 'perl-nobuild.com',
808 MANIFEST => ['lib', 'bin'],
809 zip_extra_files => {},
810 nobuild_perl_bin => ['src/perl.com', $^X],
811 },
812 # development configs
813 perl_cosmo_dev_536 => {
814 desc => "For developing cosmo platform perl without apperl additions",
815 base => 'full',
816 perl_id => 'v5.36.3',
817 perl_url => undef,
818 patches => ['__sharedir__/5.36-cosmo3.patch'],
819 },
820 # static builds on 5.38 are broken https://github.com/Perl/perl5/issues/21319
821 perl_cosmo_dev_538 => {
822 desc => "For developing cosmo platform perl without apperl additions",
823 base => 'full',
824 perl_id => 'v5.38.5',
825 perl_url => undef,
826 patches => ['__sharedir__/5.38-cosmo3.patch'],
827 },
828 perl_cosmo_dev_540 => {
829 desc => "For developing cosmo platform perl without apperl additions",
830 base => 'full',
831 perl_id => 'v5.40.4',
832 perl_url => undef,
833 patches => ['__sharedir__/5.40-cosmo3.patch'],
834 },
835 perl_cosmo_dev_542 => {
836 desc => "For developing cosmo platform perl without apperl additions",
837 base => 'full',
838 perl_id => 'v5.42.2',
839 perl_url => undef,
840 patches => ['__sharedir__/5.40-cosmo3.patch'],
841 },
842 perl_cosmo_dev_544 => {
843 desc => "For developing cosmo platform perl without apperl additions",
844 base => 'full',
845 perl_id => 'v5.44.0',
846 perl_url => undef,
847 patches => ['__sharedir__/5.44-cosmo3.patch'],
848 },
849 perl_cosmo_dev => {
850 desc => "For developing cosmo platform perl without apperl additions",
851 base => 'perl_cosmo_dev_544',
852 },
853 perl_apperl_dev_536 => {
854 desc => "For developing apperl",
855 base => 'perl_cosmo_dev_536',
856 '+patches' => ['__sharedir__/5.36-cosmo-apperl.patch'],
857 },
858 perl_apperl_dev_540 => {
859 desc => "For developing apperl",
860 base => 'perl_cosmo_dev_540',
861 '+patches' => ['__sharedir__/5.36-cosmo-apperl.patch'],
862 },
863 perl_apperl_dev_542 => {
864 desc => "For developing apperl",
865 base => 'perl_cosmo_dev_542',
866 '+patches' => ['__sharedir__/5.36-cosmo-apperl.patch'],
867 },
868 perl_apperl_dev_544 => {
869 desc => "For developing apperl",
870 base => 'perl_cosmo_dev_544',
871 '+patches' => ['__sharedir__/5.44-apperl.patch'],
872 },
873 perl_apperl_dev => {
874 desc => "For developing apperl",
875 base => 'perl_apperl_dev_544',
876 },
877 }
878 );
879 0 $defconfig{defaultconfig} = 'full';
880  
881 0 my $projectconfig = _load_json(PROJECT_FILE);
882 0 ▶ if($projectconfig) {
Branch: 1 branch
BranchTrueFalseTotal
if ($projectconfig) 0 0 0
883 0 foreach my $projkey (keys %$projectconfig) {
884 0 ▶ if($projkey ne 'apperl_configs') {
Branch: 1 branch
BranchTrueFalseTotal
if ($projkey ne 'apperl_configs') { } 0 0 0
885 0 $defconfig{$projkey} = $projectconfig->{$projkey};
886 }
887 else {
888 0 $defconfig{$projkey} = {%{$defconfig{$projkey}}, %{$projectconfig->{$projkey}}};
889 }
890 }
891 }
892 0 return \%defconfig;
893 }
894  
895 0 ▶sub _build_def_config {
Subroutine _build_def_config: not called CC=2 SCAR=17.9
896 return {
897 0 ▶ base => ($_[0] // 'nobuild'),
Condition0%0/2
$_[0] // "nobuild"
l!l
00
MC/DC0%0/1
$_[0] // "nobuild"
$_[0]
Truth table0%0/2
A
A= $_[0]
Aresult
11
00
898 desc => 'description of this config',
899 dest => 'perl.com'
900 };
901 }
902  
903 0 ▶sub Init {
Subroutine Init: not called CC=9 SCAR=45.0
Pod undocumented
904 0 my ($defaultconfig, $base) = @_;
905 # validate
906 0 ▶ die "Cannot create project config, it already exists ".PROJECT_FILE if(-e PROJECT_FILE);
Branch: 1 branch
BranchTrueFalseTotal
if -e "apperl-project.json" 0 0 0
907 0 my $Configs = _load_apperl_configs();
908 0 ▶ if(defined $base) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $base) 0 0 0
909 0 ▶ $defaultconfig or die "Cannot set base without name for new config";
Branch: 1 branch
BranchTrueFalseTotal
$defaultconfig or die "Cannot set base without name for new config" 0 0 0
910 0 ▶ if(exists $Configs->{apperl_configs}{$defaultconfig}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $Configs->{"apperl_configs"}{$defaultconfig}) 0 0 0
911 0 die "Cannot set base for $defaultconfig, $defaultconfig already exists ";
912 }
913 0 ▶ exists $Configs->{apperl_configs}{$base} or die "base config $base does not exist";
Branch: 1 branch
BranchTrueFalseTotal
exists $Configs->{"apperl_configs"}{$base} or die "base config $base does not exist" 0 0 0
914 }
915  
916 # create project config
917 0 ▶ my %jsondata = ( 'defaultconfig' => ($defaultconfig // 'nobuild'));
Condition0%0/2
$defaultconfig // "nobuild"
l!l
00
MC/DC0%0/1
$defaultconfig // "nobuild"
$defaultconfig
Truth table0%0/2
A
A= $defaultconfig
Aresult
11
00
918 0 ▶ if($defaultconfig && ! exists $Configs->{apperl_configs}{$defaultconfig}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($defaultconfig and not exists $Configs->{"apperl_configs"}{$defaultconfig}) 0 0 0
Condition0%0/3
$defaultconfig and not exists $Configs->{"apperl_configs"}{$defaultconfig}
!ll&&!rl&&r
000
MC/DC0%0/2
$defaultconfig and not exists $Configs->{"apperl_configs"}{$defaultconfig}
$defaultconfig not exists $Configs->{"apperl_configs"}{$defaultconfig}
Truth table0%0/3
A and not(B)
A= $defaultconfigB= not exists $Configs->{"apperl_configs"}{$defaultconfig}
ABresult
0X0
100
111
919 $jsondata{apperl_configs} = {
920 0 $defaultconfig => _build_def_config($base),
921 };
922 }
923 0 print "writing new project\n";
924 0 _write_json(PROJECT_FILE, \%jsondata);
925  
926 # checkout default config
927 0 Checkout($jsondata{defaultconfig});
928 }
929  
930 0 ▶sub NewConfig {
Subroutine NewConfig: not called CC=6 SCAR=37.4
Pod undocumented
931 0 my ($name, $base) = @_;
932 0 ▶ $name or die "Name required to add new config";
Branch: 1 branch
BranchTrueFalseTotal
$name or die "Name required to add new config" 0 0 0
933 0 my $Configs = _load_apperl_configs();
934 0 ▶ ! exists $Configs->{apperl_configs}{$name} or die "Cannot create already existing config";
Branch: 1 branch
BranchTrueFalseTotal
exists $Configs->{"apperl_configs"}{$name} and die "Cannot create already existing config" 0 0 0
935 0 ▶ if(defined $base) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $base) 0 0 0
936 0 ▶ exists $Configs->{apperl_configs}{$base} or die "base config $base does not exist";
Branch: 1 branch
BranchTrueFalseTotal
exists $Configs->{"apperl_configs"}{$base} or die "base config $base does not exist" 0 0 0
937 }
938 0 ▶ my $projectconfig = _load_json(PROJECT_FILE) or die "project file must already exist";
Branch: 1 branch
BranchTrueFalseTotal
my $projectconfig = _load_json("apperl-project.json") or die "project file must already exist" 0 0 0
939 0 $projectconfig->{apperl_configs}{$name} = _build_def_config($base);
940 0 print "rewriting project\n";
941 0 _write_json(PROJECT_FILE, $projectconfig);
942 }
943  
944 0 ▶sub _install_cosmocc {
Subroutine _install_cosmocc: not called CC=4 SCAR=30.0
945 0 my ($SiteConfig, $version) = @_;
946 0 ▶ $version //= '3.3.10';
Condition0%0/2
$version //= "3.3.10"
l!l
00
MC/DC0%0/1
$version //= "3.3.10"
$version
Truth table0%0/2
A
A= $version
Aresult
11
00
947 0 my $cosmocc = SITE_REPO_DIR."/cosmocc";
948 0 print "rm -rf $cosmocc\n";
949 0 remove_tree($cosmocc);
950 0 print "mkdir -p $cosmocc\n";
951 0 make_path($cosmocc);
952 0 print "cd $cosmocc\n";
953 0 my $before = getcwd();
954 0 ▶ chdir($cosmocc) or die "Failed to chdir $cosmocc";
Branch: 1 branch
BranchTrueFalseTotal
chdir $cosmocc or die "Failed to chdir $cosmocc" 0 0 0
955 0 my $filename = "cosmocc-$version.zip";
956 0 _command_or_die('wget', "https://cosmo.zip/pub/cosmocc/$filename");
957 0 _command_or_die('unzip', $filename);
958 0 ▶ chdir($before) or die "error resetting directory";
Branch: 1 branch
BranchTrueFalseTotal
chdir $before or die "error resetting directory" 0 0 0
959 0 $SiteConfig->{cosmocc} = $cosmocc;
960 0 make_path(SITE_CONFIG_DIR);
961 0 _write_json(SITE_CONFIG_FILE, $SiteConfig);
962 }
963  
964 0 ▶sub InstallBuildDeps {
Subroutine InstallBuildDeps: not called CC=8 SCAR=42.8
Pod undocumented
965 0 my ($perlrepo, $cosmorepo) = @_;
966 0 my $SiteConfig = _load_json(SITE_CONFIG_FILE);
967 0 ▶ $SiteConfig //= {};
Condition0%0/2
$SiteConfig //= {}
l!l
00
MC/DC0%0/1
$SiteConfig //= {}
$SiteConfig
Truth table0%0/2
A
A= $SiteConfig
Aresult
11
00
968  
969 # if a repo is not set, set one up by default
970 0 ▶ if(!exists $SiteConfig->{perl_repo} && !$perlrepo) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $SiteConfig->{"perl_repo"} or $perlrepo) 0 0 0
Condition0%0/3
exists $SiteConfig->{"perl_repo"} or $perlrepo
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $SiteConfig->{"perl_repo"} or $perlrepo
exists $SiteConfig->{"perl_repo"} $perlrepo
Truth table0%0/3
A or B
A= exists $SiteConfig->{"perl_repo"}B= $perlrepo
ABresult
1X1
011
000
971 0 $perlrepo = SITE_REPO_DIR."/perl5";
972 0 _setup_repo($perlrepo, _load_apperl_configs()->{perl_remotes});
973 0 print "apperlm install-build-deps: setup perl repo\n";
974 }
975 0 ▶ if(!exists $SiteConfig->{cosmo_repo} && !$cosmorepo) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $SiteConfig->{"cosmo_repo"} or $cosmorepo) 0 0 0
Condition0%0/3
exists $SiteConfig->{"cosmo_repo"} or $cosmorepo
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $SiteConfig->{"cosmo_repo"} or $cosmorepo
exists $SiteConfig->{"cosmo_repo"} $cosmorepo
Truth table0%0/3
A or B
A= exists $SiteConfig->{"cosmo_repo"}B= $cosmorepo
ABresult
1X1
011
000
976 0 $cosmorepo = SITE_REPO_DIR."/cosmopolitan";
977 0 _setup_repo( $cosmorepo, _load_apperl_configs()->{cosmo_remotes});
978 0 print "apperlm install-build-deps: setup cosmo repo\n";
979 }
980  
981 # (re)write site config
982 0 ▶ $perlrepo //= $SiteConfig->{perl_repo};
Condition0%0/3
$perlrepo //= $SiteConfig->{"perl_repo"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$perlrepo //= $SiteConfig->{"perl_repo"}
$perlrepo $SiteConfig->{"perl_repo"}
Truth table0%0/3
A //= B
A= $perlrepoB= $SiteConfig->{"perl_repo"}
ABresult
1X1
011
000
983 0 ▶ $cosmorepo //= $SiteConfig->{cosmo_repo};
Condition0%0/3
$cosmorepo //= $SiteConfig->{"cosmo_repo"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$cosmorepo //= $SiteConfig->{"cosmo_repo"}
$cosmorepo $SiteConfig->{"cosmo_repo"}
Truth table0%0/3
A //= B
A= $cosmorepoB= $SiteConfig->{"cosmo_repo"}
ABresult
1X1
011
000
984 0 $SiteConfig->{perl_repo} = abs_path($perlrepo);
985 0 $SiteConfig->{cosmo_repo} = abs_path($cosmorepo);
986 0 make_path(SITE_CONFIG_DIR);
987 0 _write_json(SITE_CONFIG_FILE, $SiteConfig);
988 0 print "apperlm install-build-deps: wrote site config to ".SITE_CONFIG_FILE."\n";
989 }
990  
991 0 ▶sub _remove_arr_items_from_arr {
Subroutine _remove_arr_items_from_arr: not called CC=5 SCAR=34.0
992 0 my ($src, $toremove) = @_;
993 0 my @remove = @{$toremove};
994 0 foreach my $srcindex (reverse 0..$#{$src}) {
995 0 for my $removeindex (reverse 0..$#remove) {
996 0 ▶ if ($src->[$srcindex] eq $remove[$removeindex]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($src->[$srcindex] eq $remove[$removeindex]) 0 0 0
997 0 splice(@$src, $srcindex, 1);
998 0 ▶ return if (scalar(@remove) == 1);
Branch: 1 branch
BranchTrueFalseTotal
if scalar @remove == 1 0 0 0
999 0 splice(@remove, $removeindex, 1);
1000 0 last;
1001 }
1002 }
1003 }
1004 }
1005  
1006 0 ▶sub Status {
Subroutine Status: not called CC=14 SCAR=53.5
Pod undocumented
1007 0 my $Configs = _load_apperl_configs();
1008 0 my @configlist = sort(keys %{$Configs->{apperl_configs}});
1009 0 my $UserProjectConfig = _load_user_project_config();
1010 0 my $CurAPPerlName;
1011 0 ▶ if($UserProjectConfig) {
Branch: 1 branch
BranchTrueFalseTotal
if ($UserProjectConfig) 0 0 0
1012 0 ▶ if(exists $UserProjectConfig->{current_apperl}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $UserProjectConfig->{"current_apperl"}) 0 0 0
1013 0 $CurAPPerlName = $UserProjectConfig->{current_apperl};
1014 0 ▶ exists $Configs->{apperl_configs}{$CurAPPerlName} or die("non-existent apperl config $CurAPPerlName in user project config");
Branch: 1 branch
BranchTrueFalseTotal
exists $Configs->{"apperl_configs"}{$CurAPPerlName} or die "non-existent apperl config $CurAPPerlName in user project config" 0 0 0
1015 }
1016 }
1017 0 ▶ if(!defined $CurAPPerlName && exists $Configs->{'defaultconfig'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not defined $CurAPPerlName and exists $Configs->{"defaultconfig"}) 0 0 0
Condition0%0/3
not defined $CurAPPerlName and exists $Configs->{"defaultconfig"}
!ll&&!rl&&r
000
MC/DC0%0/2
not defined $CurAPPerlName and exists $Configs->{"defaultconfig"}
not defined $CurAPPerlName exists $Configs->{"defaultconfig"}
Truth table0%0/3
not(A) and B
A= not defined $CurAPPerlNameB= exists $Configs->{"defaultconfig"}
ABresult
0X0
100
111
1018 0 $CurAPPerlName = $Configs->{'defaultconfig'};
1019 0 ▶ exists $Configs->{apperl_configs}{$CurAPPerlName} or die("non-existent default apperl config $CurAPPerlName");
Branch: 1 branch
BranchTrueFalseTotal
exists $Configs->{"apperl_configs"}{$CurAPPerlName} or die "non-existent default apperl config $CurAPPerlName" 0 0 0
1020 }
1021  
1022 0 my @projectitems;
1023 0 my $projectconfig = _load_json(PROJECT_FILE);
1024 0 ▶ if($projectconfig && exists $projectconfig->{apperl_configs}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($projectconfig and exists $projectconfig->{"apperl_configs"}) 0 0 0
Condition0%0/3
$projectconfig and exists $projectconfig->{"apperl_configs"}
!ll&&!rl&&r
000
MC/DC0%0/2
$projectconfig and exists $projectconfig->{"apperl_configs"}
$projectconfig exists $projectconfig->{"apperl_configs"}
Truth table0%0/3
A and B
A= $projectconfigB= exists $projectconfig->{"apperl_configs"}
ABresult
0X0
100
111
1025 0 @projectitems = sort (keys %{$projectconfig->{apperl_configs}});
1026 0 _remove_arr_items_from_arr(\@configlist, \@projectitems);
1027 }
1028 0 my @rolling = grep(/^(full|small|nobuild|full-540|small-540|full-542|small-542)$/, @configlist);
1029 {
1030 0 my %preferences = ( full => 0, small => 1, 'full-542' => 2, 'small-542' => 3, 'full-540' => 4, 'small-540' => 5, nobuild => 6);
1031 0 @rolling = sort {$preferences{$a} <=> $preferences{$b}} @rolling;
1032 }
1033 0 _remove_arr_items_from_arr(\@configlist, \@rolling);
1034 0 my @internal = grep(/^(perl_cosmo_dev|perl_apperl_dev|dbg)/, @configlist);
1035 0 _remove_arr_items_from_arr(\@configlist, \@internal);
1036 0 my @deprecated = grep(/(\-vista|v0\.1\.0|536)$/, @configlist);
1037 0 _remove_arr_items_from_arr(\@configlist, \@deprecated);
1038 0 my @stable = grep( /v\d+\.\d+\.\d+$/, @configlist);
1039 0 _remove_arr_items_from_arr(\@configlist, \@stable);
1040 0 my @categories = (
1041 ['PROJECT', \@projectitems],
1042 ['STABLE', \@stable],
1043 ['ROLLING', \@rolling],
1044 ['DEPRECATED', \@deprecated],
1045 ['UNSTABLE/INTERNAL', \@internal],
1046 ['UNKNOWN', \@configlist]
1047 );
1048 0 foreach my $cat (@categories) {
1049 0 foreach my $item (@{$cat->[1]}) {
1050 0 ▶ print (sprintf "%s %-30.30s | %-17.17s |%s\n", $CurAPPerlName && ($item eq $CurAPPerlName) ? '*' : ' ', $item, $cat->[0], ($Configs->{apperl_configs}{$item}{desc} // ''));
Branch: 1 branch
BranchTrueFalseTotal
$CurAPPerlName && $item eq $CurAPPerlName ? : 0 0 0
Condition0%0/5
$CurAPPerlName and $item eq $CurAPPerlName
!ll&&!rl&&r
000
$Configs->{"apperl_configs"}{$item}{"desc"} // ""
l!l
00
MC/DC0%0/2
$CurAPPerlName and $item eq $CurAPPerlName
$CurAPPerlName $item eq $CurAPPerlName
MC/DC0%0/1
$Configs->{"apperl_configs"}{$item}{"desc"} // ""
$Configs->{"apperl_configs"}{$item}{"desc"}
Truth table0%0/3
A and B
A= $CurAPPerlNameB= $item eq $CurAPPerlName
ABresult
0X0
100
111
Truth table0%0/2
A
A= $Configs->{"apperl_configs"}{$item}{"desc"}
Aresult
11
00
1051 }
1052 }
1053 }
1054  
1055 # unfortunately this needs to be called in several places to try to keep them in sync
1056 # as perl's make trips up when trying to build an symlinked extension
1057 0 ▶sub _install_perl_src_files {
Subroutine _install_perl_src_files: not called CC=3 SCAR=24.8
1058 0 my ($itemconfig, $perl_build_dir) = @_;
1059 0 foreach my $dest (keys %{$itemconfig->{perl_repo_files}}) {
1060 0 foreach my $file (@{$itemconfig->{perl_repo_files}{$dest}}) {
1061 0 _copy_recursive(START_WD."/$file", "$perl_build_dir/$dest");
1062 }
1063 }
1064 }
1065  
1066 0 ▶sub Checkout {
Subroutine Checkout: not called CC=28 SCAR=66.3
Pod undocumented
1067 0 my ($cfgname) = @_;
1068 0 my $UserProjectConfig = _load_user_project_config();
1069 0 ▶ if($UserProjectConfig) {
Branch: 1 branch
BranchTrueFalseTotal
if ($UserProjectConfig) { } 0 0 0
1070 0 delete $UserProjectConfig->{nobuild_perl_bin};
1071 }
1072 else {
1073 0 $UserProjectConfig = {};
1074 }
1075 0 ▶ $UserProjectConfig->{apperl_output} //= PROJECT_TMP_DIR."/o";
Condition0%0/2
$UserProjectConfig->{"apperl_output"} //= "/home/cpancover/.cpan/build/Perl-Dist-APPerl-v0.8.0-0/tests_temp/.apperl/o"
l!l
00
MC/DC0%0/1
$UserProjectConfig->{"apperl_output"} //= "/home/cpancover/.cpan/build/Perl-Dist-APPerl-v0.8.0-0/tests_temp/.apperl/o"
$UserProjectConfig->{"apperl_output"}
Truth table0%0/2
A
A= $UserProjectConfig->{"apperl_output"}
Aresult
11
00
1076 0 $UserProjectConfig->{current_apperl} = $cfgname;
1077 0 my $itemconfig = _load_apperl_config(_load_apperl_configs()->{apperl_configs}, $cfgname);
1078 0 print Dumper($itemconfig);
1079 0 ▶ if(! exists $itemconfig->{nobuild_perl_bin}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $itemconfig->{'nobuild_perl_bin'}) { } 0 0 0
1080 0 my $SiteConfig = _load_valid_site_config($itemconfig->{cosmo3});
1081 0 ▶ if(! $itemconfig->{cosmo3}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($itemconfig->{"cosmo3"}) 0 0 0
1082 0 print "cd ".$SiteConfig->{cosmo_repo}."\n";
1083 0 ▶ chdir($SiteConfig->{cosmo_repo}) or die "Failed to enter cosmo repo";
Branch: 1 branch
BranchTrueFalseTotal
chdir $SiteConfig->{"cosmo_repo"} or die "Failed to enter cosmo repo" 0 0 0
1084 0 _command_or_die('git', 'checkout', $itemconfig->{cosmo_id});
1085 }
1086 0 ▶ $UserProjectConfig->{configs}{$cfgname}{perl_build_dir} //= $SiteConfig->{perl_repo} if !$itemconfig->{perl_url};
Branch: 1 branch
BranchTrueFalseTotal
unless $itemconfig->{"perl_url"} 0 0 0
Condition0%0/3
$UserProjectConfig->{"configs"}{$cfgname}{"perl_build_dir"} //= $SiteConfig->{"perl_repo"}
l!l&&r!l&&!r
000
MC/DC0%0/2
$UserProjectConfig->{"configs"}{$cfgname}{"perl_build_dir"} //= $SiteConfig->{"perl_repo"}
$UserProjectConfig->{"configs"}{$cfgname}{"perl_build_dir"} $SiteConfig->{"perl_repo"}
Truth table0%0/3
A //= B
A= $UserProjectConfig->{"configs"}{$cfgname}{"perl_build_dir"}B= $SiteConfig->{"perl_repo"}
ABresult
1X1
011
000
1087 0 ▶ $UserProjectConfig->{configs}{$cfgname}{perl_build_dir} //= "$UserProjectConfig->{apperl_output}/$cfgname/tmp/perl5";
Condition0%0/2
$UserProjectConfig->{"configs"}{$cfgname}{"perl_build_dir"} //= qq[$UserProjectConfig->{"apperl_output"}/$cfgname/tmp/perl5]
l!l
00
MC/DC0%0/1
$UserProjectConfig->{"configs"}{$cfgname}{"perl_build_dir"} //= qq[$UserProjectConfig->{"apperl_output"}/$cfgname/tmp/perl5]
$UserProjectConfig->{"configs"}{$cfgname}{"perl_build_dir"}
Truth table0%0/2
A
A= $UserProjectConfig->{"configs"}{$cfgname}{"perl_build_dir"}
Aresult
11
00
1088 0 my $perl_build_dir = $UserProjectConfig->{configs}{$cfgname}{perl_build_dir};
1089 0 ▶ if (! $itemconfig->{perl_url}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $itemconfig->{'perl_url'}) { } 0 0 0
1090 0 ▶ -d $perl_build_dir or die $perl_build_dir .' is not directory';
Branch: 1 branch
BranchTrueFalseTotal
-d $perl_build_dir or die $perl_build_dir . ' is not directory' 0 0 0
1091 0 print "cd ".$perl_build_dir."\n";
1092 0 ▶ chdir($perl_build_dir) or die "Failed to enter perl repo";
Branch: 1 branch
BranchTrueFalseTotal
chdir $perl_build_dir or die "Failed to enter perl repo" 0 0 0
1093 0 print "make veryclean\n";
1094 0 system("make", "veryclean");
1095 0 foreach my $todelete ('miniperl.com', 'perl.com', 'miniperl.elf', 'miniperl.com.dbg', 'perl.elf', 'perl.com.dbg') {
1096 0 print "rm $todelete\n";
1097 0 ▶ unlink($todelete) || $!{ENOENT} or die "failed to delete $todelete";
Subroutine BEGIN: called CC=1 SCAR=2.6
Branch: 1 branch
BranchTrueFalseTotal
unlink $todelete or $!{"ENOENT"} or die "failed to delete $todelete" 0 0 0
Condition0%0/3
unlink $todelete or $!{"ENOENT"}
l!l&&r!l&&!r
000
MC/DC0%0/2
unlink $todelete or $!{"ENOENT"}
unlink $todelete $!{"ENOENT"}
Truth table0%0/3
A or B
A= unlink $todeleteB= $!{"ENOENT"}
ABresult
1X1
011
000
1098 }
1099 0 _command_or_die('git', 'checkout', '-f', $itemconfig->{perl_id});
1100 0 _command_or_die('git', 'clean', '-f', '-e.vscode', '-d');
1101 0 ▶ $itemconfig->{patches} //= [];
Condition0%0/2
$itemconfig->{"patches"} //= []
l!l
00
MC/DC0%0/1
$itemconfig->{"patches"} //= []
$itemconfig->{"patches"}
Truth table0%0/2
A
A= $itemconfig->{"patches"}
Aresult
11
00
1102 } else {
1103 0 my $tarball_name = basename($itemconfig->{perl_url});
1104 0 my $download_dir = $UserProjectConfig->{apperl_output};
1105 0 print "mkdir -p $download_dir\n";
1106 0 make_path($download_dir);
1107 0 ▶ chdir($download_dir) or die "Failed to enter download dir";
Branch: 1 branch
BranchTrueFalseTotal
chdir $download_dir or die "Failed to enter download dir" 0 0 0
1108 0 ▶ if (! -f $tarball_name) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-f $tarball_name) 0 0 0
1109 0 _command_or_die('wget', $itemconfig->{perl_url});
1110 }
1111 0 _command_or_die('tar', '-xf', $tarball_name);
1112 0 print "rm -rf $perl_build_dir\n";
1113 0 remove_tree($perl_build_dir);
1114 0 my ($version) = $tarball_name =~ /^v(\d+\.\d+\.\d+(?:\-RC\d+)?)\.tar/;
1115 0 my $perl_build_dir_dir = dirname($perl_build_dir);
1116 0 print "mkdir -p $perl_build_dir_dir\n";
1117 0 make_path($perl_build_dir_dir);
1118 0 my $tomove = "perl5-$version";
1119 0 print "mv $tomove $perl_build_dir\n";
1120 0 ▶ move($tomove, $perl_build_dir) or die "Failed to move perl src";
Branch: 1 branch
BranchTrueFalseTotal
move($tomove, $perl_build_dir) or die "Failed to move perl src" 0 0 0
1121 0 print "cd $perl_build_dir\n";
1122 0 ▶ chdir($perl_build_dir) or die "Failed to enter perl build_dir";
Branch: 1 branch
BranchTrueFalseTotal
chdir $perl_build_dir or die "Failed to enter perl build_dir" 0 0 0
1123 }
1124 0 foreach my $patch (@{$itemconfig->{patches}}) {
1125 0 my $realpatch = _fix_bases($patch, {__sharedir__ => SHARE_DIR});
1126 # can't `git apply` to ignored files within a git repository :(
1127 0 _cmdinputfile_or_die('patch', '-p1', '--merge', $realpatch);
1128 }
1129 0 print "cd ".START_WD."\n";
1130 0 ▶ chdir(START_WD) or die "Failed to restore cwd";
Branch: 1 branch
BranchTrueFalseTotal
chdir "/home/cpancover/.cpan/build/Perl-Dist-APPerl-v0.8.0-0/tests_temp" or die "Failed to restore cwd" 0 0 0
1131 0 _install_perl_src_files($itemconfig, $perl_build_dir);
1132 }
1133 else {
1134 0 my $validperl;
1135 0 foreach my $perlbin (@{$itemconfig->{nobuild_perl_bin}}) {
1136 0 print "perlbin $perlbin\n";
1137 0 ▶ if(-f $perlbin) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $perlbin) 0 0 0
1138 0 ▶ if(( $perlbin eq $^X) && (! -d '/zip')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($perlbin eq $^X and not -d "/zip") 0 0 0
Condition0%0/3
$perlbin eq $^X and not -d "/zip"
!ll&&!rl&&r
000
MC/DC0%0/2
$perlbin eq $^X and not -d "/zip"
$perlbin eq $^X not -d "/zip"
Truth table0%0/3
A and not(B)
A= $perlbin eq $^XB= not -d "/zip"
ABresult
0X0
100
111
1139 0 print "skipping $perlbin, it appears to not be APPerl\n";
1140 0 next;
1141 }
1142 0 $validperl = $perlbin;
1143 0 last;
1144 }
1145 }
1146 0 ▶ $validperl or die "no valid perl found to use for nobuild config";
Branch: 1 branch
BranchTrueFalseTotal
$validperl or die "no valid perl found to use for nobuild config" 0 0 0
1147 0 $validperl = abs_path($validperl);
1148 0 ▶ $validperl or die "no valid perl found to use for nobuild config";
Branch: 1 branch
BranchTrueFalseTotal
$validperl or die "no valid perl found to use for nobuild config" 0 0 0
1149 0 $UserProjectConfig->{nobuild_perl_bin} = $validperl;
1150 0 print "Checkout UserProjectConfig to nobuild_perl-bin to $validperl\n";
1151 }
1152 0 _write_user_project_config($UserProjectConfig);
1153 0 print "$0: Successfully switched to $cfgname\n";
1154 }
1155  
1156 0 ▶sub Configure {
Subroutine Configure: not called CC=8 SCAR=42.8
Pod undocumented
1157 0 ▶ my ($UserProjectConfig, $CurAPPerlName, $itemconfig) = _load_valid_configs() or die "cannot Configure without valid UserProjectConfig";
Branch: 1 branch
BranchTrueFalseTotal
() = _load_valid_configs() or die "cannot Configure without valid UserProjectConfig" 0 0 0
1158 0 ▶ ! exists $UserProjectConfig->{nobuild_perl_bin} or die "nobuild perl cannot be configured";
Branch: 1 branch
BranchTrueFalseTotal
exists $UserProjectConfig->{"nobuild_perl_bin"} and die "nobuild perl cannot be configured" 0 0 0
1159 0 my $perl_build_dir = $UserProjectConfig->{configs}{$CurAPPerlName}{perl_build_dir};
1160 0 ▶ $perl_build_dir && -d $perl_build_dir or die "$perl_build_dir is not a directory";
Branch: 1 branch
BranchTrueFalseTotal
$perl_build_dir and -d $perl_build_dir or die "$perl_build_dir is not a directory" 0 0 0
Condition0%0/3
$perl_build_dir and -d $perl_build_dir
!ll&&!rl&&r
000
MC/DC0%0/2
$perl_build_dir and -d $perl_build_dir
$perl_build_dir -d $perl_build_dir
Truth table0%0/3
A and B
A= $perl_build_dirB= -d $perl_build_dir
ABresult
0X0
100
111
1161 0 _install_perl_src_files($itemconfig, $perl_build_dir);
1162 0 my $SiteConfig = _load_valid_site_config($itemconfig->{cosmo3});
1163 0 ▶ if(! $itemconfig->{cosmo3}) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $itemconfig->{'cosmo3'}) { } 0 0 0
1164 # build toolchain
1165 0 _command_or_die('make', '-C', $SiteConfig->{cosmo_repo}, '-j', 'toolchain', 'MODE=', 'ARCH=x86_64');
1166 # build cosmo
1167 0 print "$0: Building cosmo, COSMO_MODE=$itemconfig->{cosmo_mode} COSMO_APE_LOADER=$itemconfig->{cosmo_ape_loader}\n";
1168 0 _command_or_die('make', '-C', $SiteConfig->{cosmo_repo}, '-j4', "MODE=$itemconfig->{cosmo_mode}",
1169 "o/$itemconfig->{cosmo_mode}/cosmopolitan.a",
1170 "o/$itemconfig->{cosmo_mode}/libc/crt/crt.o",
1171 "o/$itemconfig->{cosmo_mode}/ape/public/ape.lds",
1172 "o/$itemconfig->{cosmo_mode}/ape/$itemconfig->{cosmo_ape_loader}",
1173 );
1174 0 $ENV{COSMO_MODE} = $itemconfig->{cosmo_mode};
1175 0 $ENV{COSMO_APE_LOADER} = $itemconfig->{cosmo_ape_loader};
1176 0 $ENV{COSMO_REPO} = $SiteConfig->{cosmo_repo};
1177 } else {
1178 0 $ENV{COSMOCC} = $SiteConfig->{cosmocc};
1179 }
1180  
1181 # Finally Configure perl
1182 0 print "cd $perl_build_dir\n";
1183 0 ▶ chdir($perl_build_dir) or die "Failed to enter perl repo";
Branch: 1 branch
BranchTrueFalseTotal
chdir $perl_build_dir or die "Failed to enter perl repo" 0 0 0
1184 0 my @onlyextensions = ();
1185 0 ▶ push @onlyextensions, ("-Donlyextensions= ".join(' ', sort @{$itemconfig->{perl_onlyextensions}}).' ') if(exists $itemconfig->{perl_onlyextensions});
Branch: 1 branch
BranchTrueFalseTotal
if exists $itemconfig->{"perl_onlyextensions"} 0 0 0
1186 0 _command_or_die('sh', 'Configure', @{$itemconfig->{perl_flags}}, @onlyextensions, @{$itemconfig->{perl_extra_flags}}, @_);
1187 0 print "$0: Configure successful, time for apperlm build\n";
1188 }
1189  
1190 0 ▶sub _fix_bases {
Subroutine _fix_bases: not called CC=2 SCAR=17.9
1191 0 my ($in, $aliasmap) = @_;
1192 0 foreach my $key (keys %{$aliasmap}) {
1193 0 $in =~ s/^$key/$aliasmap->{$key}/;
1194 }
1195 0 return $in;
1196 }
1197  
1198 # system is pretty broken on APPerl when running on Windows
1199 # let's search PATH ourselves ...
1200 0 ▶sub _find_zip {
Subroutine _find_zip: not called CC=5 SCAR=34.0
1201 0 ▶ if(($^O ne 'cosmo') || (! -f '/C/Windows/System32/cmd.exe')) {
Branch: 1 branch
BranchTrueFalseTotal
if ($^O ne 'cosmo' or not -f '/C/Windows/System32/cmd.exe') { } 0 0 0
Condition0%0/3
$^O ne "cosmo" or not -f "/C/Windows/System32/cmd.exe"
l!l&&r!l&&!r
000
MC/DC0%0/2
$^O ne "cosmo" or not -f "/C/Windows/System32/cmd.exe"
$^O ne "cosmo" not -f "/C/Windows/System32/cmd.exe"
Truth table0%0/3
A or not(B)
A= $^O ne "cosmo"B= not -f "/C/Windows/System32/cmd.exe"
ABresult
1X1
011
000
1202 0 return 'zip';
1203 }
1204 else {
1205 0 foreach my $dir (split(':', $ENV{PATH})) {
1206 0 my $zippath = "$dir/zip.exe";
1207 0 ▶ return $zippath if(-f $zippath);
Branch: 1 branch
BranchTrueFalseTotal
if -f $zippath 0 0 0
1208 }
1209 }
1210 0 die("Failed to find zip.exe, did you download Info-Zip and add the folder containing zip.exe to \%PATH\%?");
1211 }
1212  
1213 0 ▶sub Build {
Subroutine Build: not called CC=51 SCAR=78.8
Pod undocumented
1214 0 my ($zippath) = @_;
1215 0 ▶ my ($UserProjectConfig, $CurAPPerlName, $itemconfig) = _load_valid_configs() or die "cannot Build without valid UserProjectConfig";
Branch: 1 branch
BranchTrueFalseTotal
() = _load_valid_configs() or die "cannot Build without valid UserProjectConfig" 0 0 0
1216 0 my $startdir = abs_path('./');
1217  
1218 0 my $PERL_APE;
1219 my @perl_config_cmd;
1220 # build cosmo perl if this isn't a nobuild config
1221 0 ▶ if(! exists $UserProjectConfig->{nobuild_perl_bin}){
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $UserProjectConfig->{'nobuild_perl_bin'}) { } 0 0 0
1222 0 my $SiteConfig = _load_valid_site_config($itemconfig->{cosmo3});
1223 0 my $perl_build_dir = $UserProjectConfig->{configs}{$CurAPPerlName}{perl_build_dir};
1224 0 ▶ $perl_build_dir && -d $perl_build_dir or die "$perl_build_dir is not a directory";
Branch: 1 branch
BranchTrueFalseTotal
$perl_build_dir and -d $perl_build_dir or die "$perl_build_dir is not a directory" 0 0 0
Condition0%0/3
$perl_build_dir and -d $perl_build_dir
!ll&&!rl&&r
000
MC/DC0%0/2
$perl_build_dir and -d $perl_build_dir
$perl_build_dir -d $perl_build_dir
Truth table0%0/3
A and B
A= $perl_build_dirB= -d $perl_build_dir
ABresult
0X0
100
111
1225 0 _install_perl_src_files($itemconfig, $perl_build_dir);
1226 0 print "cd $perl_build_dir\n";
1227 0 ▶ chdir($perl_build_dir) or die "Failed to enter perl repo";
Branch: 1 branch
BranchTrueFalseTotal
chdir $perl_build_dir or die "Failed to enter perl repo" 0 0 0
1228 0 _command_or_die('make');
1229 0 $PERL_APE = "$perl_build_dir/perl.com";
1230 0 @perl_config_cmd = ('./perl', '-Ilib');
1231 }
1232 else {
1233 0 $PERL_APE = $UserProjectConfig->{nobuild_perl_bin};
1234 0 @perl_config_cmd = ($PERL_APE);
1235 }
1236  
1237 # prepare for install and pack
1238 0 ▶ -f $PERL_APE or die "apperlm build: perl ape not found";
Branch: 1 branch
BranchTrueFalseTotal
-f $PERL_APE or die "apperlm build: perl ape not found" 0 0 0
1239 0 my $OUTPUTDIR = "$UserProjectConfig->{apperl_output}/$CurAPPerlName/o";
1240 0 ▶ if(-d $OUTPUTDIR) {
Branch: 1 branch
BranchTrueFalseTotal
if (-d $OUTPUTDIR) 0 0 0
1241 0 print "rm -rf $OUTPUTDIR\n";
1242 0 remove_tree($OUTPUTDIR);
1243 }
1244 0 my $TEMPDIR = "$OUTPUTDIR/tmp";
1245 0 print "mkdir -p $TEMPDIR\n";
1246 0 make_path($TEMPDIR);
1247 0 my %proxyConfig;
1248 0 foreach my $item (qw(prefix version archname cc installprivlib installarchlib installsitelib installsitearch installprefixexp installbin installman1dir installman3dir)) {
1249 0 $proxyConfig{$item} = _cmdoutput_or_die(@perl_config_cmd, '-e', "use Config; print \$Config{$item}");
1250 }
1251 my %aliasmap = (
1252 '__perllib__' => $proxyConfig{installprivlib},
1253 '__perlarchlib__' => $proxyConfig{installarchlib},
1254 '__sitelib__' => $proxyConfig{installsitelib},
1255 '__sitearchlib__' => $proxyConfig{installsitearch}
1256 0 );
1257 0 foreach my $libdir (keys %aliasmap) {
1258 0 $aliasmap{$libdir} =~ s/$proxyConfig{installprefixexp}\///;
1259 }
1260 0 my @zipfiles = map { _fix_bases($_, \%aliasmap) } @{$itemconfig->{MANIFEST}};
1261 0 my $ZIP_ROOT = "$TEMPDIR$proxyConfig{installprefixexp}";
1262  
1263 # install cosmo perl if this isn't a nobuild config
1264 0 ▶ if(! exists $UserProjectConfig->{nobuild_perl_bin}){
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $UserProjectConfig->{'nobuild_perl_bin'}) { } 0 0 0
1265 0 _command_or_die('make', "DESTDIR=$TEMPDIR", 'install');
1266 0 my @toremove = ("$TEMPDIR$proxyConfig{installbin}/perl", "$TEMPDIR$proxyConfig{installbin}/perl$proxyConfig{version}");
1267 0 print 'rm '.join(' ', @toremove)."\n";
1268 0 ▶ unlink(@toremove) == scalar(@toremove) or die "Failed to unlink some files";
Branch: 1 branch
BranchTrueFalseTotal
unlink(@toremove) == scalar @toremove or die "Failed to unlink some files" 0 0 0
1269 # HACK install Devel::PPort lib as this doesn't get done for some reason
1270 0 ▶ if (-f "$TEMPDIR$proxyConfig{installarchlib}/Devel/PPPort.pm") {
Branch: 1 branch
BranchTrueFalseTotal
if (-f qq[$TEMPDIR$proxyConfig{"installarchlib"}/Devel/PPPort.pm]) 0 0 0
1271 0 _copy_recursive("lib/auto/Devel/PPPort", "$TEMPDIR$proxyConfig{installarchlib}/auto/Devel");
1272 0 unlink("$TEMPDIR$proxyConfig{installarchlib}/auto/Devel/PPPort/.exists");
1273 }
1274 }
1275 else {
1276 0 make_path($ZIP_ROOT);
1277 }
1278  
1279 # add zip_extra_files to the tree
1280 0 foreach my $destkey (keys %{$itemconfig->{zip_extra_files}}) {
1281 0 my $dest = "$ZIP_ROOT/"._fix_bases($destkey, \%aliasmap);
1282 0 foreach my $file (@{$itemconfig->{zip_extra_files}{$destkey}}) {
1283 0 _copy_recursive($file, $dest);
1284 }
1285 }
1286  
1287 # pack
1288 0 my $APPPATH = "$TEMPDIR/".basename($PERL_APE);
1289 0 my $PERLPATH = "$TEMPDIR/perl";
1290 0 ▶ my $packAPE = sub {
Subroutine __ANON__: not called CC=7 SCAR=40.3
1291 0 ▶ my $copyexe = sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
1292 0 my ($srcpath, $destpath) = @_;
1293 0 print "cp $srcpath $destpath\n";
1294 0 ▶ copy($srcpath, $destpath) or die "copy failed: $!";
Branch: 1 branch
BranchTrueFalseTotal
copy($srcpath, $destpath) or die "copy failed: $!" 0 0 0
1295 0 print "chmod 755 $destpath\n";
1296 0 ▶ chmod(0755, $destpath) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
chmod 0755, $destpath or die $! 0 0 0
1297 0 };
1298 0 $copyexe->($PERL_APE, $APPPATH);
1299 0 my $srcdbg = "$PERL_APE.dbg";
1300 0 for(1..2) {
1301 0 ▶ if(-f $srcdbg) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $srcdbg) 0 0 0
1302 0 $copyexe->($srcdbg, "$APPPATH.dbg");
1303 0 last;
1304 }
1305 0 $srcdbg = $PERL_APE;
1306 0 $srcdbg =~ s/com$/elf/;
1307 }
1308 0 ▶ if((! exists $UserProjectConfig->{nobuild_perl_bin}) || scalar(keys %{$itemconfig->{zip_extra_files}})) {
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $UserProjectConfig->{"nobuild_perl_bin"} or scalar keys %{$$itemconfig{"zip_extra_files"};}) 0 0 0
Condition0%0/2
not exists $UserProjectConfig->{"nobuild_perl_bin"} or scalar keys %{$$itemconfig{"zip_extra_files"};}
l!l
00
MC/DC0%0/1
not exists $UserProjectConfig->{"nobuild_perl_bin"} or scalar keys %{$$itemconfig{"zip_extra_files"};}
not exists $UserProjectConfig->{"nobuild_perl_bin"}
Truth table0%0/2
not(A)
A= not exists $UserProjectConfig->{"nobuild_perl_bin"}
Aresult
11
00
1309 0 print "cd $ZIP_ROOT\n";
1310 0 ▶ chdir($ZIP_ROOT) or die "failed to enter ziproot";
Branch: 1 branch
BranchTrueFalseTotal
chdir $ZIP_ROOT or die "failed to enter ziproot" 0 0 0
1311 0 ▶ _command_or_die($zippath // _find_zip(), '-r', $APPPATH, @zipfiles);
Condition0%0/3
$zippath // _find_zip()
l!l&&r!l&&!r
000
MC/DC0%0/2
$zippath // _find_zip()
$zippath _find_zip()
Truth table0%0/3
A // B
A= $zippathB= _find_zip()
ABresult
1X1
011
000
1312 }
1313 0 $copyexe->($APPPATH, $PERLPATH);
1314 0 _command_or_die($PERLPATH, '--assimilate');
1315 0 };
1316 0 $packAPE->();
1317  
1318 # install modules
1319 0 ▶ if(exists $itemconfig->{install_modules}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $itemconfig->{"install_modules"}) 0 0 0
1320 0 my $perlman1 = "$TEMPDIR$proxyConfig{installman1dir}";
1321 0 my $perlman3 = "$TEMPDIR$proxyConfig{installman3dir}";
1322 0 my $perlbin = "$TEMPDIR$proxyConfig{installbin}";
1323 0 my $perllib = "$TEMPDIR$proxyConfig{installprivlib}";
1324 0 my $perlarchlib = "$TEMPDIR$proxyConfig{installarchlib}";
1325 0 ▶ my $mmopt = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
1326 0 my @mmopt = ("PERL_LIB=$perllib", "PERL_ARCHLIB=$perlarchlib",
1327 #"MAP_TARGET=perl.com.dbg",
1328 "MAP_TARGET=perl.com",
1329 "INSTALLDIRS=perl",
1330 "INSTALLARCHLIB=$perlarchlib",
1331 "INSTALLPRIVLIB=$perllib",
1332 "INSTALLBIN=$perlbin",
1333 "INSTALLSCRIPT=$perlbin",
1334 "INSTALLMAN1DIR=$perlman1",
1335 "INSTALLMAN3DIR=$perlman3"
1336 );
1337 0 my $str;
1338 0 $str .= qq["$_" ] foreach @mmopt;
1339 0 chop $str;
1340 0 return $str;
1341 0 }->();
1342 0 ▶ my $mbopt = sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
1343 0 my %mbinstall_path = (
1344 lib => $perllib,
1345 arch => $perlarchlib,
1346 script => $perlbin,
1347 bin => $perlbin,
1348 bindoc => $perlman1,
1349 libdoc => $perlman3
1350 );
1351 0 my $mbopt;
1352 0 foreach my $key (keys %mbinstall_path) {
1353 0 $mbopt .= qq[--install_path $key=$mbinstall_path{$key} ];
1354 };
1355 0 chop $mbopt;
1356 0 return $mbopt;
1357 0 }->();
1358 0 local $ENV{PERL_MB_OPT} = $mbopt;
1359 0 local $ENV{PERL_MM_OPT} = $mmopt;
1360 0 local $ENV{PERL5LIB} = $perllib;
1361 0 local $ENV{PERL_LOCAL_LIB_ROOT} = '';
1362 # Some distributions such as CPanel-JSON-XS depend on the core perl
1363 # scripts (such as pod2text). Add apperl's versions of them to PATH so
1364 # they get picked up instead of the system's versions.
1365 0 my $perlbindir = "$TEMPDIR/perlbin";
1366 0 print "mkdir -p $perlbindir\n";
1367 0 make_path($perlbindir);
1368 0 print "Mapping core scripts to run with $PERLPATH\n";
1369 0 ▶ opendir(my $dh, $perlbin) or die "failed to open perlbin";
Branch: 1 branch
BranchTrueFalseTotal
opendir my $dh, $perlbin or die "failed to open perlbin" 0 0 0
1370 0 ▶ while (my $file = readdir($dh)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $file = readdir $dh)) 0 0 0
1371 0 ▶ next if ($file eq '.' || $file eq '..');
Branch: 1 branch
BranchTrueFalseTotal
if $file eq "." or $file eq ".." 0 0 0
Condition0%0/3
$file eq "." or $file eq ".."
l!l&&r!l&&!r
000
MC/DC0%0/2
$file eq "." or $file eq ".."
$file eq "." $file eq ".."
Truth table0%0/3
A or B
A= $file eq "."B= $file eq ".."
ABresult
1X1
011
000
1372 0 my $rdpath = "$perlbin/$file";
1373 0 ▶ open(my $rh, '<', $rdpath) or die "failed to open $rdpath";
Branch: 1 branch
BranchTrueFalseTotal
open my $rh, "<", $rdpath or die "failed to open $rdpath" 0 0 0
1374 0 <$rh>;
1375 0 my $wrpath = "$perlbindir/$file";
1376 0 ▶ open(my $wh, '>', $wrpath) or die "failed to open $wrpath";
Branch: 1 branch
BranchTrueFalseTotal
open my $wh, ">", $wrpath or die "failed to open $wrpath" 0 0 0
1377 0 print $wh "#!$PERLPATH\n";
1378 0 local $/;
1379 0 my $script = <$rh>;
1380 0 print $wh $script;
1381 0 print "chmod 755 $wrpath\n";
1382 0 ▶ chmod(0755, $wrpath) or die $!;
Branch: 1 branch
BranchTrueFalseTotal
chmod 0755, $wrpath or die $! 0 0 0
1383 }
1384 0 local $ENV{PATH} = "$perlbindir:".$ENV{PATH};
1385 0 foreach my $module (@{$itemconfig->{install_modules}}) {
1386 0 my $modulepath = "$startdir/$module";
1387 0 ▶ if(-d $modulepath) {
Branch: 2 branches
BranchTrueFalseTotal
if (-d $modulepath) { } 0 0 0
elsif (-f _) { } 0 0 0
1388 0 _copy_recursive($modulepath, $TEMPDIR);
1389 0 $modulepath = "$TEMPDIR/".basename($modulepath);
1390 }
1391 elsif( -f _) {
1392 0 _command_or_die('tar', 'xvf', $modulepath, '-C', $TEMPDIR);
1393 0 $modulepath = "$TEMPDIR/".basename($modulepath);
1394 0 $modulepath =~ s/\.tar.*$//;
1395 }
1396 else {
1397 0 die "Module must be a directory or tarball";
1398 }
1399  
1400 0 print "cd $modulepath\n";
1401 0 ▶ chdir($modulepath) or die "Failed to enter module dir";
Branch: 1 branch
BranchTrueFalseTotal
chdir $modulepath or die "Failed to enter module dir" 0 0 0
1402 # Module::Build (including installing Module::Build)
1403 # Beware, Module::Build has no support for relinking the Perl binary like EU::MM - https://rt.cpan.org/Public/Bug/Display.html?id=47282
1404 0 ▶ if(-f 'Build.PL') {
Branch: 2 branches
BranchTrueFalseTotal
if (-f 'Build.PL') { } 0 0 0
elsif (-f 'Makefile.PL') { } 0 0 0
1405 0 _command_or_die($APPPATH, 'Build.PL');
1406 0 _command_or_die($APPPATH, 'Build');
1407 0 _command_or_die($APPPATH, 'Build', 'install');
1408 }
1409 # ExtUtils::MakeMaker
1410 elsif( -f 'Makefile.PL') {
1411 # build
1412 0 _command_or_die($APPPATH, 'Makefile.PL');
1413 0 _command_or_die('make');
1414 # install into the src tree
1415 0 _command_or_die('make', 'install');
1416 # build a new perl binary, convert to APE, and repack zip
1417 #_command_or_die('make', 'perl.com.dbg');
1418 #_command_or_die(dirname($proxyConfig{cc})."/x86_64-linux-musl-objcopy", '-S', '-O', 'binary', 'perl.com.dbg', 'perl.com');
1419 0 _command_or_die('make', 'Makefile.aperl');
1420 # HACK, add in DynaLoader as it's missing
1421 0 ▶ open(my $makefile, '<', 'Makefile.aperl') or die "failed to open Makefile.aperl";
Branch: 1 branch
BranchTrueFalseTotal
open my $makefile, "<", "Makefile.aperl" or die "failed to open Makefile.aperl" 0 0 0
1422 0 my @newlines = map { $_ =~ s/writemain\((grep[^\)]+\))/writemain((DynaLoader, $1)/; $_} <$makefile>;
1423 0 close($makefile);
1424 0 ▶ open(my $newmakefile, '>', 'Makefile.aperl') or die "failed to open Makefile.aperl for writing";
Branch: 1 branch
BranchTrueFalseTotal
open my $newmakefile, ">", "Makefile.aperl" or die "failed to open Makefile.aperl for writing" 0 0 0
1425 0 print $newmakefile $_ foreach @newlines;
1426 0 close($newmakefile);
1427 # finally rebuild perl
1428 0 _command_or_die('make', '-f', 'Makefile.aperl', 'perl.com');
1429 0 $PERL_APE = abs_path('./perl.com');
1430 }
1431 else {
1432 0 die "No Makefile.PL or Build.PL found, unable to install module";
1433 }
1434 0 $packAPE->();
1435 }
1436 }
1437  
1438 # patch default script
1439 0 ▶ if(exists $itemconfig->{default_script}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $itemconfig->{"default_script"}) 0 0 0
1440 0 ▶ length($itemconfig->{default_script}) <= 255 or die "default script path is too long";
Branch: 1 branch
BranchTrueFalseTotal
length $itemconfig->{"default_script"} <= 255 or die "default script path is too long" 0 0 0
1441 0 ▶ open(my $fh, '+<:raw', $APPPATH) or die "$!";
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "+<:raw", $APPPATH or die "$!" 0 0 0
1442 0 my $fsize = (stat($fh))[7];
1443 0 my $bread = read($fh, my $outdata, $fsize);
1444 0 ▶ $bread && $bread == $fsize or die "failed to read full file $APPPATH";
Branch: 1 branch
BranchTrueFalseTotal
$bread and $bread == $fsize or die "failed to read full file $APPPATH" 0 0 0
Condition0%0/3
$bread and $bread == $fsize
!ll&&!rl&&r
000
MC/DC0%0/2
$bread and $bread == $fsize
$bread $bread == $fsize
Truth table0%0/3
A and B
A= $breadB= $bread == $fsize
ABresult
0X0
100
111
1445 0 my $sentinel = "APPERL_DEFAULT_SCRIPT\x00";
1446 0 my $sentinelpos = index($outdata, $sentinel);
1447 0 ▶ $sentinelpos != -1 or die "Failed to find APPERL_DEFAULT_SCRIPT, is this an old APPerl binary?";
Branch: 1 branch
BranchTrueFalseTotal
$sentinelpos != -1 or die "Failed to find APPERL_DEFAULT_SCRIPT, is this an old APPerl binary?" 0 0 0
1448 0 my $patchpos = $sentinelpos+length($sentinel);
1449 0 print "patching default script at $patchpos\n";
1450 0 ▶ seek($fh, $patchpos, SEEK_SET) or die "$!";
Branch: 1 branch
BranchTrueFalseTotal
seek $fh, $patchpos, 0 or die "$!" 0 0 0
1451 0 ▶ print $fh $itemconfig->{default_script}."\0" or die "$!";
Branch: 1 branch
BranchTrueFalseTotal
print $fh $itemconfig->{"default_script"} . "\000" or die "$!" 0 0 0
1452 0 close($fh);
1453 }
1454  
1455 0 foreach my $file ('perl.com', 'perl.com.dbg') {
1456 0 my $srcpath = "$TEMPDIR/$file";
1457 0 ▶ -e $srcpath or next;
Branch: 1 branch
BranchTrueFalseTotal
-e $srcpath or next 0 0 0
1458 0 my $destpath = "$OUTPUTDIR/$file";
1459 0 print "mv $srcpath $destpath\n";
1460 0 ▶ move($srcpath, $destpath) or die "move failed: $!";
Branch: 1 branch
BranchTrueFalseTotal
move($srcpath, $destpath) or die "move failed: $!" 0 0 0
1461 }
1462  
1463 # copy to user specified location
1464 0 ▶ if(exists $itemconfig->{dest}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $itemconfig->{"dest"}) 0 0 0
1465 0 print "cd ".START_WD."\n";
1466 0 ▶ chdir(START_WD) or die "Failed to restore cwd";
Branch: 1 branch
BranchTrueFalseTotal
chdir "/home/cpancover/.cpan/build/Perl-Dist-APPerl-v0.8.0-0/tests_temp" or die "Failed to restore cwd" 0 0 0
1467 0 foreach my $srcfile ('perl.com', 'perl.com.dbg') {
1468 0 my $destfile = $itemconfig->{dest};
1469 0 ▶ $destfile .= '.dbg' if ($srcfile =~ /dbg$/);
Branch: 1 branch
BranchTrueFalseTotal
if $srcfile =~ /dbg$/ 0 0 0
1470 0 ▶ if (-f $destfile) {
Branch: 1 branch
BranchTrueFalseTotal
if (-f $destfile) 0 0 0
1471 # avoid bus error by renaming the existing executable
1472 0 my $olddest = "$destfile.old";
1473 0 print "mv $destfile $olddest\n";
1474 0 ▶ move($destfile, $olddest) or die "move failed: $!";
Branch: 1 branch
BranchTrueFalseTotal
move($destfile, $olddest) or die "move failed: $!" 0 0 0
1475 }
1476 0 my @args = ("$UserProjectConfig->{apperl_output}/$CurAPPerlName/o/$srcfile", $destfile);
1477 0 ▶ -e $args[0] or next;
Branch: 1 branch
BranchTrueFalseTotal
-e $args[0] or next 0 0 0
1478 0 print 'cp '.join(' ', @args)."\n";
1479 0 ▶ cp(@args) or die "copy failed: $!";
Branch: 1 branch
BranchTrueFalseTotal
cp(@args) or die "copy failed: $!" 0 0 0
1480 }
1481 }
1482 }
1483  
1484 0 ▶sub apperlm {
Subroutine apperlm: not called CC=25 SCAR=64.8
Pod undocumented
1485 0 my $generic_usage = <<'END_USAGE';
1486 apperlm <command> [...]
1487 List of commands, try apperlm <command> --help for info about a command
1488 list | List available APPerl configurations
1489 init | Create an APPerl project in the current dir
1490 new-config | Add a new APPerl configuration to the project
1491 checkout | Switch to another APPerl configurations
1492 install-build-deps | Install build dependencies for APPerl
1493 configure | `Configure` Perl (only valid with build config)
1494 build | Build APPerl
1495 help | Prints this message
1496  
1497 Actually Portable Perl Manager (apperlm) handles configuring and
1498 building Actually Portable Perl (APPerl). See
1499 `perldoc Perl::Dist::APPerl` for more info.
1500 END_USAGE
1501 0 ▶ my $command = shift(@_) if(@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
1502 0 ▶ $command or die($generic_usage);
Branch: 1 branch
BranchTrueFalseTotal
$command or die $generic_usage 0 0 0
1503 0 ▶ if($command eq 'list') {
Branch: 10 branches
BranchTrueFalseTotal
if ($command eq 'list') { } 0 0 0
elsif ($command eq 'build') { } 0 0 0
elsif ($command eq 'configure') { } 0 0 0
elsif ($command =~ /^(\-)*(halp|help|h)$/i) { } 0 0 0
elsif ($command =~ /^(\-)*(version|v)$/i) { } 0 0 0
elsif ($command eq 'checkout') { } 0 0 0
elsif ($command eq 'init') { } 0 0 0
elsif ($command eq 'install-build-deps') { } 0 0 0
elsif ($command eq 'new-config') { } 0 0 0
elsif ($command eq 'get-config-key') { } 0 0 0
1504 0 my $usage = <<'END_USAGE';
1505 apperlm list
1506 List available APPerl configs; checks apperl-project.json and built-in
1507 to Perl::Dist::APPerl configs. If a current config is set it is denoted
1508 with a '*'.
1509 END_USAGE
1510 0 ▶ die($usage) if(@_);
Branch: 1 branch
BranchTrueFalseTotal
if @_ 0 0 0
1511 0 Perl::Dist::APPerl::Status();
1512 }
1513 elsif($command eq 'build') {
1514 0 my $usage = <<'END_USAGE';
1515 apperlm build [-z|--zippath <zip_binary_path>]
1516 -z|--zippath Path to InfoZip zip executable
1517 Build APPerl. If the current config is a from-scratch build, you must
1518 run `apperlm configure` first.
1519 END_USAGE
1520 0 my $zippath;
1521 my $help;
1522 0 ▶ GetOptionsFromArray(\@_, "zippath|z=s" => \$zippath,
Branch: 1 branch
BranchTrueFalseTotal
&GetOptionsFromArray(\@_, "zippath|z=s", \$zippath, "help|h", \$help) or die $usage 0 0 0
1523 "help|h" => \$help,
1524 ) or die($usage);
1525 0 ▶ if($help) {
Branch: 1 branch
BranchTrueFalseTotal
if ($help) 0 0 0
1526 0 print $usage;
1527 0 exit 0;
1528 }
1529 0 Perl::Dist::APPerl::Build($zippath);
1530 }
1531 elsif($command eq 'configure') {
1532 0 Perl::Dist::APPerl::Configure(@_);
1533 }
1534 elsif($command =~ /^(\-)*(halp|help|h)$/i) {
1535 0 print $generic_usage;
1536 }
1537 elsif($command =~ /^(\-)*(version|v)$/i) {
1538 0 my $message = <<"END_USAGE";
1539 apperlm $VERSION
1540 Copyright (C) 2026 Gavin Arthur Hayes
1541 This is free software; you can redistribute it and/or modify it under
1542 the same terms as the Perl 5 programming language system itself.
1543 END_USAGE
1544 0 print $message;
1545 }
1546 elsif($command eq 'checkout') {
1547 0 ▶ scalar(@_) == 1 or die('bad args');
Branch: 1 branch
BranchTrueFalseTotal
scalar @_ == 1 or die "bad args" 0 0 0
1548 0 my $cfgname = $_[0];
1549 0 Perl::Dist::APPerl::Checkout($cfgname);
1550 }
1551 elsif($command eq 'init') {
1552 0 my $usage = <<'END_USAGE';
1553 apperlm init [-h|--help] [-n|--name <name>] [-b|--base <base>]
1554 -n|--name name of the default config
1555 -b|--base base class of the config
1556 -h|--help Show this message
1557 Create an APPerl project, create a config if -n specified and it
1558 doesn't already exist, checkout the config.
1559 END_USAGE
1560 0 my $name;
1561 my $base;
1562 0 my $help;
1563 0 ▶ GetOptionsFromArray(\@_, "name|n=s" => \$name,
Branch: 1 branch
BranchTrueFalseTotal
&GetOptionsFromArray(\@_, "name|n=s", \$name, "base|b=s", \$base, "help|h", \$help) or die $usage 0 0 0
1564 "base|b=s" => \$base,
1565 "help|h" => \$help,
1566 ) or die($usage);
1567 0 ▶ if($help) {
Branch: 1 branch
BranchTrueFalseTotal
if ($help) 0 0 0
1568 0 print $usage;
1569 0 exit 0;
1570 }
1571 0 Perl::Dist::APPerl::Init($name, $base);
1572 }
1573 elsif($command eq 'install-build-deps') {
1574 0 my $usage = <<'END_USAGE';
1575 apperlm install-build-deps [-h|--help] [-c|--cosmo <path>] [-p|--perl <path>]
1576 -c|--cosmo <path> set path to cosmopolitan repo (skips git initialization)
1577 -p|--perl <path> set path to perl repo (skips git initialization)
1578 -h|--help Show this message
1579 Install build dependencies for APPerl, use -c or -p to skip initializing
1580 those repos by providing a path to it.
1581 END_USAGE
1582 0 my $cosmo;
1583 my $perl;
1584 0 my $help;
1585 0 ▶ GetOptionsFromArray(\@_, "cosmo|c=s" => \$cosmo,
Branch: 1 branch
BranchTrueFalseTotal
&GetOptionsFromArray(\@_, "cosmo|c=s", \$cosmo, "perl|p=s", \$perl, "help|h", \$help) or die $usage 0 0 0
1586 "perl|p=s" => \$perl,
1587 "help|h" => \$help,
1588 ) or die($usage);
1589 0 ▶ if($help) {
Branch: 1 branch
BranchTrueFalseTotal
if ($help) 0 0 0
1590 0 print $usage;
1591 0 exit 0;
1592 }
1593 0 Perl::Dist::APPerl::InstallBuildDeps($perl, $cosmo);
1594 }
1595 elsif($command eq 'new-config') {
1596 0 my $usage = <<'END_USAGE';
1597 apperlm new-config [-h|--help] [-n|--name <name>] [-b|--base <base>]
1598 -n|--name name of the default config
1599 -b|--base base class of the config
1600 -h|--help Show this message
1601 Create a new APPerl config and add it to the project
1602 END_USAGE
1603 0 my $name;
1604 my $base;
1605 0 my $help;
1606 0 ▶ GetOptionsFromArray(\@_, "name|n=s" => \$name,
Branch: 1 branch
BranchTrueFalseTotal
&GetOptionsFromArray(\@_, "name|n=s", \$name, "base|b=s", \$base, "help|h", \$help) or die $usage 0 0 0
1607 "base|b=s" => \$base,
1608 "help|h" => \$help,
1609 ) or die($usage);
1610 0 ▶ if($help) {
Branch: 1 branch
BranchTrueFalseTotal
if ($help) 0 0 0
1611 0 print $usage;
1612 0 exit 0;
1613 }
1614 0 Perl::Dist::APPerl::NewConfig($name, $base);
1615 }
1616 elsif($command eq 'get-config-key') {
1617 0 ▶ scalar(@_) == 2 or die('bad args');
Branch: 1 branch
BranchTrueFalseTotal
scalar @_ == 2 or die "bad args" 0 0 0
1618 0 my $itemconfig = _load_apperl_config(_load_apperl_configs()->{apperl_configs}, $_[0]);
1619 0 ▶ exists $itemconfig->{$_[1]} or die "'".$_[1]."'".' does not exist in config '."'".$_[0]."'";
Branch: 1 branch
BranchTrueFalseTotal
exists $$itemconfig{$_[1]} or die q['] . $_[1] . q['] . " does not exist in config " . q['] . $_[0] . q['] 0 0 0
1620 0 print $itemconfig->{$_[1]};
1621 }
1622 else {
1623 0 die($generic_usage);
1624 }
1625 0 1;
1626 }
1627  
1628 0 ▶sub _command_or_die {
Subroutine _command_or_die: not called CC=2 SCAR=17.9
1629 0 print join(' ', @_), "\n";
1630 0 ▶ (system { $_[0] } @_) == 0 or die;
Branch: 1 branch
BranchTrueFalseTotal
system({$_[0];} @_) == 0 or die 0 0 0
1631 }
1632  
1633 0 ▶sub _cmdoutput_or_die {
Subroutine _cmdoutput_or_die: not called CC=3 SCAR=24.8
1634 0 print join(' ', @_), "\n";
1635 0 ▶ my $kid = open(my $from_kid, '-|', @_) or die "can't fork $!";
Branch: 1 branch
BranchTrueFalseTotal
my $kid = open(my $from_kid, "-|", @_) or die "can't fork $!" 0 0 0
1636 0 my $output = do { local $/; <$from_kid> };
1637 0 waitpid($kid, 0);
1638 0 ▶ (($? >> 8) == 0) or die("child failed");
Branch: 1 branch
BranchTrueFalseTotal
$? >> 8 == 0 or die "child failed" 0 0 0
1639 0 return $output;
1640 }
1641  
1642 0 ▶sub _cmdinputfile_or_die {
Subroutine _cmdinputfile_or_die: not called CC=4 SCAR=30.0
1643 0 my $input_file = pop @_;
1644 0 print join(' ', @_), " < $input_file\n";
1645 0 $SIG{PIPE} = "IGNORE";
1646 0 ▶ open(my $to_kid, '|-', @_) or die "Can't fork: $!";
Branch: 1 branch
BranchTrueFalseTotal
open my $to_kid, "|-", @_ or die "Can't fork: $!" 0 0 0
1647 0 ▶ copy($input_file, $to_kid) or die "failed to copy $!";
Branch: 1 branch
BranchTrueFalseTotal
copy($input_file, $to_kid) or die "failed to copy $!" 0 0 0
1648 0 close($to_kid);
1649 0 ▶ (($? >> 8) == 0) or die "child failed $?";
Branch: 1 branch
BranchTrueFalseTotal
$? >> 8 == 0 or die "child failed $?" 0 0 0
1650 }
1651  
1652 0 ▶sub _setup_repo {
Subroutine _setup_repo: not called CC=3 SCAR=24.8
1653 0 my ($repopath, $remotes) = @_;
1654 0 print "mkdir -p $repopath\n";
1655 0 make_path($repopath);
1656 0 print "cd $repopath\n";
1657 0 ▶ chdir($repopath) or die "Failed to chdir $repopath";
Branch: 1 branch
BranchTrueFalseTotal
chdir $repopath or die "Failed to chdir $repopath" 0 0 0
1658 0 _command_or_die('git', 'init');
1659 0 _command_or_die('git', 'checkout', '-b', 'placeholder_dont_use');
1660 0 foreach my $remote (keys %{$remotes}) {
1661 0 _command_or_die('git', 'remote', 'add', $remote, $remotes->{$remote});
1662 0 _command_or_die('git', 'fetch', $remote);
1663 }
1664 }
1665  
1666 0 ▶sub _write_json {
Subroutine _write_json: not called CC=2 SCAR=17.9
1667 0 my ($destpath, $obj) = @_;
1668 0 ▶ open(my $fh, '>', $destpath) or die("Failed to open $destpath for writing");
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, ">", $destpath or die "Failed to open $destpath for writing" 0 0 0
1669 0 print $fh JSON::PP->new->pretty->encode($obj);
1670 0 close($fh);
1671 }
1672  
1673 0 ▶sub _load_json {
Subroutine _load_json: not called CC=2 SCAR=17.9
1674 0 my ($jsonpath) = @_;
1675 0 ▶ open(my $fh, '<', $jsonpath) or return undef;
Branch: 1 branch
BranchTrueFalseTotal
open my $fh, "<", $jsonpath or return undef 0 0 0
1676 0 my $file_content = do { local $/; <$fh> };
1677 0 close($fh);
1678 0 return decode_json($file_content);
1679 }
1680  
1681 0 ▶sub _load_apperl_config {
Subroutine _load_apperl_config: not called CC=32 SCAR=69.6
1682 0 my ($apperlconfigs, $cfgname) = @_;
1683 0 ▶ exists $apperlconfigs->{$cfgname} or die "Unknown config: $cfgname";
Branch: 1 branch
BranchTrueFalseTotal
exists $apperlconfigs->{$cfgname} or die "Unknown config: $cfgname" 0 0 0
1684  
1685 # find the base classes
1686 0 my $item = $apperlconfigs->{$cfgname};
1687 0 my @configlist = ($item);
1688 0 ▶ while(exists $item->{base}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $item->{"base"}) 0 0 0
1689 0 $item = $apperlconfigs->{$item->{base}};
1690 0 push @configlist, $item;
1691 }
1692 0 @configlist = reverse @configlist;
1693  
1694 # build the config from oldest to newest
1695 # keys that start with '+' are appended to the non-plus variant instead of replacing
1696 # keys that start with '-' are removed from the non-plus variant instead of replacing
1697 # Removing a key added the same stage or vice versa is undefined
1698 0 my %itemconfig;
1699 0 foreach my $config (@configlist) {
1700 0 foreach my $key (keys %$config) {
1701 0 ▶ if($key =~ /^(\+|\-)(.+)/) {
Branch: 1 branch
BranchTrueFalseTotal
if ($key =~ /^(\+|\-)(.+)/) { } 0 0 0
1702 0 my $append = $1 eq '+';
1703 0 my $realkey = $2;
1704 0 ▶ exists $itemconfig{$realkey} or die "cannot append without existing key: $realkey";
Branch: 1 branch
BranchTrueFalseTotal
exists $itemconfig{$realkey} or die "cannot append without existing key: $realkey" 0 0 0
1705 0 my $rtype = ref($itemconfig{$realkey});
1706 0 ▶ $rtype or die("not ref");
Branch: 1 branch
BranchTrueFalseTotal
$rtype or die "not ref" 0 0 0
1707 0 ▶ if($append) {
Branch: 1 branch
BranchTrueFalseTotal
if ($append) { } 0 0 0
1708 0 ▶ if($rtype eq 'ARRAY') {
Branch: 2 branches
BranchTrueFalseTotal
if ($rtype eq 'ARRAY') { } 0 0 0
elsif ($rtype eq 'HASH') { } 0 0 0
1709 0 $itemconfig{$realkey} = [@{$itemconfig{$realkey}}, @{$config->{$key}}];
1710 }
1711 elsif($rtype eq 'HASH') {
1712 0 foreach my $dest (keys %{$config->{$key}}) {
1713 0 push @{$itemconfig{$realkey}{$dest}}, @{$config->{$key}{$dest}};
1714 }
1715 }
1716 else {
1717 0 die($rtype);
1718 }
1719 }
1720 else {
1721 0 ▶ if($rtype eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if ($rtype eq 'ARRAY') { } 0 0 0
1722 0 _remove_arr_items_from_arr($itemconfig{$realkey}, $config->{$key});
1723 }
1724 else {
1725 0 die($rtype);
1726 }
1727 }
1728 }
1729 else {
1730 0 $itemconfig{$key} = $config->{$key};
1731 }
1732 }
1733 }
1734  
1735 # switch these from relative paths to abs paths
1736 0 foreach my $destdir (keys %{$itemconfig{zip_extra_files}}) {
1737 0 foreach my $path (@{$itemconfig{zip_extra_files}{$destdir}}) {
1738 0 $path = abs_path($path);
1739 0 ▶ $path or die "zip_extra_files: check that all files exist for destdir: $destdir";
Branch: 1 branch
BranchTrueFalseTotal
$path or die "zip_extra_files: check that all files exist for destdir: $destdir" 0 0 0
1740 0 ▶ -e $path or die "zip_extra_files: missing file $path";
Branch: 1 branch
BranchTrueFalseTotal
-e $path or die "zip_extra_files: missing file $path" 0 0 0
1741 }
1742 }
1743  
1744 # add in ourselves for bootstrapping, this even works when running internal Perl::Dist::APPerl from a bootstrapped build
1745 0 ▶ if(exists $itemconfig{'include_Perl-Dist-APPerl'} && $itemconfig{'include_Perl-Dist-APPerl'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $itemconfig{"include_Perl-Dist-APPerl"} and $itemconfig{"include_Perl-Dist-APPerl"}) 0 0 0
Condition0%0/3
exists $itemconfig{"include_Perl-Dist-APPerl"} and $itemconfig{"include_Perl-Dist-APPerl"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $itemconfig{"include_Perl-Dist-APPerl"} and $itemconfig{"include_Perl-Dist-APPerl"}
exists $itemconfig{"include_Perl-Dist-APPerl"} $itemconfig{"include_Perl-Dist-APPerl"}
Truth table0%0/3
A and B
A= exists $itemconfig{"include_Perl-Dist-APPerl"}B= $itemconfig{"include_Perl-Dist-APPerl"}
ABresult
0X0
100
111
1746 0 my $thispath = abs_path(__FILE__);
1747 0 ▶ defined($thispath) or die(__FILE__.'issues?');
Branch: 1 branch
BranchTrueFalseTotal
defined $thispath or die "/home/cpancover/.cpan/build/Perl-Dist-APPerl-v0.8.0-0/blib/lib/Perl/Dist/APPerl.pmissues?" 0 0 0
1748 0 push @{$itemconfig{zip_extra_files}{"__perllib__/Perl/Dist"}}, $thispath;
1749 0 my $apperlm = $0;
1750 0 ▶ if(basename($0) ne 'apperlm') {
Branch: 1 branch
BranchTrueFalseTotal
if (basename($0) ne "apperlm") 0 0 0
1751 0 $apperlm = dirname($thispath)."/../../../script/apperlm";
1752 }
1753 0 $apperlm = abs_path($apperlm);
1754 0 ▶ defined($apperlm) or die "error getting path to apperlm";
Branch: 1 branch
BranchTrueFalseTotal
defined $apperlm or die "error getting path to apperlm" 0 0 0
1755 0 my @additionalfiles = ($apperlm);
1756 0 ▶ -e $_ or die("$_ $!") foreach @additionalfiles;
Branch: 1 branch
BranchTrueFalseTotal
-e $_ or die "$_ $!" 0 0 0
1757 0 push @{$itemconfig{zip_extra_files}{bin}}, @additionalfiles;
1758 0 ▶ opendir(my $dh, SHARE_DIR) or die "error opening patch dir";
Branch: 1 branch
BranchTrueFalseTotal
opendir my $dh, "/home/cpancover/.cpan/build/Perl-Dist-APPerl-v0.8.0-0/blib/lib/auto/share/dist/Perl-Dist-APPerl" or die "error opening patch dir" 0 0 0
1759 0 ▶ while(my $file = readdir $dh) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $file = readdir $dh)) 0 0 0
1760 0 ▶ next if(($file eq '.') || ($file eq '..'));
Branch: 1 branch
BranchTrueFalseTotal
if $file eq "." or $file eq ".." 0 0 0
Condition0%0/3
$file eq "." or $file eq ".."
l!l&&r!l&&!r
000
MC/DC0%0/2
$file eq "." or $file eq ".."
$file eq "." $file eq ".."
Truth table0%0/3
A or B
A= $file eq "."B= $file eq ".."
ABresult
1X1
011
000
1761 0 push @{$itemconfig{zip_extra_files}{"__perllib__/auto/share/dist/Perl-Dist-APPerl"}}, SHARE_DIR."/$file";
1762 }
1763 }
1764  
1765 # verify apperl config sanity
1766 0 ▶ if(! exists $itemconfig{nobuild_perl_bin}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $itemconfig{"nobuild_perl_bin"}) 0 0 0
1767 0 ▶ $itemconfig{cosmo_ape_loader} //= 'ape-no-modify-self.o';
Condition0%0/2
$itemconfig{"cosmo_ape_loader"} //= "ape-no-modify-self.o"
l!l
00
MC/DC0%0/1
$itemconfig{"cosmo_ape_loader"} //= "ape-no-modify-self.o"
$itemconfig{"cosmo_ape_loader"}
Truth table0%0/2
A
A= $itemconfig{"cosmo_ape_loader"}
Aresult
11
00
1768 0 ▶ ($itemconfig{cosmo_ape_loader} eq 'ape-no-modify-self.o') || ($itemconfig{cosmo_ape_loader} eq 'ape.o') or die "Unknown ape loader: " . $itemconfig{cosmo_ape_loader};
Branch: 1 branch
BranchTrueFalseTotal
$itemconfig{"cosmo_ape_loader"} eq "ape-no-modify-self.o" or $itemconfig{"cosmo_ape_loader"} eq "ape.o" or die 'Unknown ape loader: ' . $itemconfig{"cosmo_ape_loader"} 0 0 0
Condition0%0/3
$itemconfig{"cosmo_ape_loader"} eq "ape-no-modify-self.o" or $itemconfig{"cosmo_ape_loader"} eq "ape.o"
l!l&&r!l&&!r
000
MC/DC0%0/2
$itemconfig{"cosmo_ape_loader"} eq "ape-no-modify-self.o" or $itemconfig{"cosmo_ape_loader"} eq "ape.o"
$itemconfig{"cosmo_ape_loader"} eq "ape-no-modify-self.o" $itemconfig{"cosmo_ape_loader"} eq "ape.o"
Truth table0%0/3
A or B
A= $itemconfig{"cosmo_ape_loader"} eq "ape-no-modify-self.o"B= $itemconfig{"cosmo_ape_loader"} eq "ape.o"
ABresult
1X1
011
000
1769 }
1770  
1771 0 return \%itemconfig;
1772 }
1773  
1774 0 ▶sub _load_user_project_config {
Subroutine _load_user_project_config: not called CC=1 SCAR=6.9
1775 0 return _load_json(PROJECT_TMP_CONFIG_FILE);
1776 }
1777  
1778 0 ▶sub _load_valid_user_project_config {
Subroutine _load_valid_user_project_config: not called CC=4 SCAR=30.0
1779 0 my ($Configs) = @_;
1780 0 my $UserProjectConfig = _load_user_project_config();
1781 0 ▶ if($UserProjectConfig) {
Branch: 1 branch
BranchTrueFalseTotal
if ($UserProjectConfig) 0 0 0
1782 0 ▶ if(exists $UserProjectConfig->{current_apperl}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $UserProjectConfig->{"current_apperl"}) 0 0 0
1783 0 my $CurAPPerlName = $UserProjectConfig->{current_apperl};
1784 0 ▶ exists $Configs->{apperl_configs}{$CurAPPerlName} or die("non-existent apperl config $CurAPPerlName in user project config");
Branch: 1 branch
BranchTrueFalseTotal
exists $Configs->{"apperl_configs"}{$CurAPPerlName} or die "non-existent apperl config $CurAPPerlName in user project config" 0 0 0
1785 0 my $itemconfig = _load_apperl_config($Configs->{apperl_configs}, $CurAPPerlName);
1786 0 return ($UserProjectConfig, $CurAPPerlName, $itemconfig);
1787 }
1788 }
1789 0 return ();
1790 }
1791  
1792 0 ▶sub _load_valid_configs {
Subroutine _load_valid_configs: not called CC=3 SCAR=24.8
1793 0 my $apperlconfigs = _load_apperl_configs();
1794 0 my @configs = _load_valid_user_project_config($apperlconfigs);
1795 0 ▶ return @configs if(@configs);
Branch: 1 branch
BranchTrueFalseTotal
if @configs 0 0 0
1796 0 ▶ return () if(!exists $apperlconfigs->{defaultconfig});
Branch: 1 branch
BranchTrueFalseTotal
unless exists $apperlconfigs->{"defaultconfig"} 0 0 0
1797 0 Checkout($apperlconfigs->{defaultconfig});
1798 0 return _load_valid_user_project_config($apperlconfigs);
1799 }
1800  
1801 0 ▶sub _load_valid_site_config {
Subroutine _load_valid_site_config: not called CC=7 SCAR=40.3
1802 0 my ($is_cosmo3) = @_;
1803 0 my $SiteConfig = _load_json(SITE_CONFIG_FILE);
1804 0 ▶ if ($is_cosmo3) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_cosmo3) { } 0 0 0
1805 0 ▶ $SiteConfig //= {};
Condition0%0/2
$SiteConfig //= {}
l!l
00
MC/DC0%0/1
$SiteConfig //= {}
$SiteConfig
Truth table0%0/2
A
A= $SiteConfig
Aresult
11
00
1806 0 ▶ if (! exists $SiteConfig->{cosmocc}) {
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $SiteConfig->{"cosmocc"}) 0 0 0
1807 0 print "cosmocc not found in " . SITE_CONFIG_FILE . " attempting to install cosmocc\n";
1808 0 _install_cosmocc($SiteConfig);
1809 }
1810 0 ▶ -d $SiteConfig->{cosmocc} or die $SiteConfig->{cosmocc} . ' is not a directory, please edit or remove the entry in ' . SITE_CONFIG_FILE;
Branch: 1 branch
BranchTrueFalseTotal
-d $SiteConfig->{"cosmocc"} or die $SiteConfig->{"cosmocc"} . ' is not a directory, please edit or remove the entry in ' . "/home/cpancover/.config/apperl/site.json" 0 0 0
1811 } else {
1812 0 ▶ $SiteConfig or die "Failed to load SiteConfig, run apperlm install-build-deps";
Branch: 1 branch
BranchTrueFalseTotal
$SiteConfig or die "Failed to load SiteConfig, run apperlm install-build-deps" 0 0 0
1813 0 ▶ -d $SiteConfig->{cosmo_repo} or die $SiteConfig->{cosmo_repo} ." is not directory, reconfigure with `apperlm install-build-deps`. Note to redownload if its already there edit ".SITE_CONFIG_FILE;
Branch: 1 branch
BranchTrueFalseTotal
-d $SiteConfig->{"cosmo_repo"} or die $SiteConfig->{"cosmo_repo"} . ' is not directory, reconfigure with `apperlm install-build-deps`. Note to redownload if its already there edit ' . "/home/cpancover/.config/apperl/site.json" 0 0 0
1814 }
1815 0 return $SiteConfig;
1816 }
1817  
1818 0 ▶sub _write_user_project_config {
Subroutine _write_user_project_config: not called CC=2 SCAR=17.9
1819 0 my ($config) = @_;
1820 0 ▶ if(! -d PROJECT_TMP_DIR) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d "/home/cpancover/.cpan/build/Perl-Dist-APPerl-v0.8.0-0/tests_temp/.apperl") 0 0 0
1821 0 make_path(PROJECT_TMP_DIR);
1822 };
1823 0 _write_json(PROJECT_TMP_CONFIG_FILE, $config);
1824 }
1825  
1826 0 ▶sub _copy_recursive {
Subroutine _copy_recursive: not called CC=2 SCAR=17.9
1827 0 my ($src, $dest) = @_;
1828 0 ▶ if(! -d $dest) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $dest) 0 0 0
1829 0 make_path($dest);
1830 }
1831 0 goto &_copy_recursive_inner;
1832 }
1833  
1834 0 ▶sub _copy_recursive_inner {
Subroutine _copy_recursive_inner: not called CC=10 SCAR=47.0
1835 0 my ($src, $dest) = @_;
1836 0 print "_copy_recursive $src $dest\n";
1837 0 ▶ if(-f $src) {
Branch: 2 branches
BranchTrueFalseTotal
if (-f $src) { } 0 0 0
elsif (-d $src) { } 0 0 0
1838 0 ▶ copy($src, $dest) or die("Failed to copy $!");
Branch: 1 branch
BranchTrueFalseTotal
copy($src, $dest) or die "Failed to copy $!" 0 0 0
1839 }
1840 elsif(-d $src) {
1841 0 my $dest = "$dest/".basename($src);
1842 0 ▶ if(! -d $dest) {
Branch: 1 branch
BranchTrueFalseTotal
unless (-d $dest) 0 0 0
1843 0 ▶ mkdir($dest) or die("Failed to mkdir $!");
Branch: 1 branch
BranchTrueFalseTotal
mkdir $dest or die "Failed to mkdir $!" 0 0 0
1844 }
1845 0 ▶ opendir(my $dh, $src) or die("Failed to opendir");
Branch: 1 branch
BranchTrueFalseTotal
opendir my $dh, $src or die "Failed to opendir" 0 0 0
1846 0 ▶ while(my $file = readdir($dh)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $file = readdir $dh)) 0 0 0
1847 0 ▶ next if(($file eq '.') || ($file eq '..'));
Branch: 1 branch
BranchTrueFalseTotal
if $file eq "." or $file eq ".." 0 0 0
Condition0%0/3
$file eq "." or $file eq ".."
l!l&&r!l&&!r
000
MC/DC0%0/2
$file eq "." or $file eq ".."
$file eq "." $file eq ".."
Truth table0%0/3
A or B
A= $file eq "."B= $file eq ".."
ABresult
1X1
011
000
1848 0 _copy_recursive("$src/$file", $dest);
1849 }
1850 0 closedir($dh);
1851 }
1852 else {
1853 0 die "Unhandled file type for $src";
1854 }
1855 }
1856  
1857 1 1;
1858  
1859 __END__
↑ Summary