-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathprinter.pl
767 lines (586 loc) · 22.3 KB
/
printer.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
/*
Author: Pieter Van den Abeele
E-mail: [email protected]
Copyright (c) 2005-2024, Pieter Van den Abeele
Distributed under the terms of the LICENSE file in the root directory of this
project.
*/
/** <module> PRINTER
The Printer takes a plan from the Planner and pretty prints it.
*/
:- module(printer, []).
% ********************
% PRINTER declarations
% ********************
%! printer:printable_element(+Literal)
%
% Declares which Literals are printable
printer:printable_element(rule(uri(_,_,_),_)) :- !.
printer:printable_element(rule(uri(_),_)) :- !.
printer:printable_element(rule(_Repository://_Entry:run,_)) :- !.
printer:printable_element(rule(_Repository://_Entry:run,_)) :- !.
printer:printable_element(rule(_Repository://_Entry:download,_)) :- !.
printer:printable_element(rule(_Repository://_Entry:install,_)) :- !.
printer:printable_element(assumed(rule(_Repository://_Entry:_Action,_))) :- !.
printer:printable_element(assumed(rule(package_dependency(_,_,_,_,_,_,_,_,_),_))) :- !.
printer:printable_element(rule(assumed(package_dependency(_,_,_,_,_,_,_,_,_)),_)) :- !.
% Uncomment if you want 'confirm' steps shown in the plan:
% printer:printable_element(rule(package_dependency(_,run,_,_,_,_,_,_,_),_)) :- !.
%! printer:element_weight(+Literal)
%
% Declares a weight for ordering elements of a step in a plan
printer:element_weight(assumed(_), 0) :- !. % assumed
printer:element_weight(rule(assumed(_),_), 0) :- !. % assumed
printer:element_weight(rule(uri(_),_), 0) :- !. % provide
printer:element_weight(rule(uri(_,_,_),_), 1) :- !. % fetch
printer:element_weight(rule(package_dependency(_,_,_,_,_,_,_,_,_),_),1) :- !. % confirm
printer:element_weight(rule(_Repository://_Entry:verify,_), 2) :- !. % verify
printer:element_weight(rule(_Repository://_Entry:run,_), 3) :- !. % run
printer:element_weight(rule(_Repository://_Entry:download,_), 4) :- !. % download
printer:element_weight(rule(_Repository://_Entry:install,_), 5) :- !. % install
printer:element_weight(_, 6) :- !. % everything else
%! printer:sort_by_weight(+Comparator,+Literal,+Literal)
%
% Sorts elements in a plan by weight
printer:sort_by_weight(C,L1,L2) :-
printer:element_weight(L1,W1),
printer:element_weight(L2,W2),
compare(C,W1:L1,W2:L2).
%! printer:print_element(+Printable)
%
% Prints a printable Literal
% ---------------------------------------------
% CASE: simple package, is a target of the plan
% ---------------------------------------------
%printer:print_element(Repository://Entry:Action,rule(Repository://Entry:Action,_)) :-
printer:print_element(Target,rule(Repository://Entry:Action,_)) :-
member(Repository://Entry:Action,Target),
!,
message:color(cyan),
message:print(Action),
message:style(bold),
message:color(green),
message:column(38,Repository://Entry),
message:color(normal),
printer:print_config(Repository://Entry:Action).
% -------------------------------------------------
% CASE: simple package, is not a target of the plan
% -------------------------------------------------
printer:print_element(_,rule(Repository://Entry:Action,_)) :-
message:color(cyan),
message:print(Action),
message:color(green),
message:column(33,Repository://Entry),
message:color(normal),
printer:print_config(Repository://Entry:Action).
% --------------------------------------------------------------
% CASE: verify that packages that need to be running are running
% --------------------------------------------------------------
printer:print_element(_,rule(package_dependency(_,run,_,_C,_N,_,_,_,_),[Repository://Entry:_Action])) :-
!,
message:color(cyan),
message:print('confirm'),
message:color(green),
message:column(33,Repository://Entry),
message:color(normal).
% ----------------
% CASE: a download
% ----------------
printer:print_element(_,rule(uri(Protocol,Remote,_Local),_)) :-
!,
message:color(cyan),
message:print('fetch'),
message:color(green),
message:column(33,Protocol://Remote),
message:color(normal).
printer:print_element(_,rule(uri(Local),_)) :-
!,
message:color(cyan),
message:print('provide'),
message:color(green),
message:column(33,Local),
message:color(normal).
% ---------------------------------------------------------------
% CASE: an assumed dependency on a non-existent installed package
% ---------------------------------------------------------------
printer:print_element(_,rule(assumed(package_dependency(_,install,_,C,N,_,_,_,_)),[])) :-
message:color(red),
message:print('verify'),
atomic_list_concat([C,'/',N],P),
message:column(28,P),
message:print([' (non-existent, assumed installed)']),
message:color(normal).
% -------------------------------------------------------------
% CASE: an assumed dependency on a non-existent running package
% -------------------------------------------------------------
printer:print_element(_,rule(assumed(package_dependency(_,run,_,C,N,_,_,_,_)),[])) :-
message:color(red),
message:print('verify'),
atomic_list_concat([C,'/',N],P),
message:column(28,P),
message:print([' (non-existent, assumed running)']),
message:color(normal).
% ----------------------------------
% CASE: an assumed installed package
% ----------------------------------
printer:print_element(_,assumed(rule(Repository://Entry:install,_Body))) :-
message:color(red),
message:print('verify'),
message:column(28,Repository://Entry),
message:print(' (assumed installed)'),
message:color(normal).
% --------------------------------
% CASE: an assumed running package
% --------------------------------
printer:print_element(_,assumed(rule(Repository://Entry:run,_Body))) :-
message:color(red),
message:print('verify'),
message:column(28,Repository://Entry),
message:print(' (assumed running) '),
message:color(normal).
% -------------------------------------
% CASE: an assumed installed dependency
% -------------------------------------
printer:print_element(_,assumed(rule(package_dependency(_,install,_,C,N,_,_,_,_),_Body))) :-
message:color(red),
message:print('verify'),
atomic_list_concat([C,'/',N],P),
message:column(28,P),
message:print(' (assumed installed) '),
message:color(normal).
% -----------------------------------
% CASE: an assumed running dependency
% -----------------------------------
printer:print_element(_,assumed(rule(package_dependency(_,run,_,C,N,_,_,_,_),_Body))) :-
message:color(red),
message:print('verify'),
atomic_list_concat([C,'/',N],P),
message:column(28,P),
message:print(' (assumed running) '),
message:color(normal).
%! printer:print_config_prefix(+Word)
%
% prints the prefix for a config item
% -------------------------------
% CASE: Fancy build plan printing
% -------------------------------
printer:print_config_prefix(Word) :-
config:printing_style('fancy'),!,
nl,write(' │ '),
message:color(darkgray),
message:print('└─ '),
message:print(Word),
message:print(' ─┤ '),
message:color(normal).
% -------------------------------
% CASE: Short build plan printing
% -------------------------------
printer:print_config_prefix(_Word) :-
config:printing_style('short'),!,
write(' ').
% --------------------------------
% CASE: Column build plan printing
% --------------------------------
printer:print_config_prefix(_Word) :-
config:printing_style('column'),!,
message:column(95,' ').
%! printer:print_config_prefix
%
% prints the prefix for a config item
printer:print_config_prefix :-
config:printing_style('fancy'),!,
nl,write(' │ '),
message:color(darkgray),
message:print(' │ '),
message:color(normal).
printer:print_config_prefix :-
config:printing_style('short'),!,
write(' ').
printer:print_config_prefix :-
config:printing_style('column'),!,
nl,write(' │ '),
message:column(80,' ').
%! printer:print_config(+Repository://+Entry:+Action)
%
% Prints the configuration for a given repository entry (USE flags, USE expand, ...)
% ---------------------
% CASE: download action
% ---------------------
% live downloads
printer:print_config(Repository://Ebuild:download) :-
ebuild:is_live(Repository://Ebuild),!,
printer:print_config_prefix('live'),
printer:print_config_item('download','git repository','live').
% no downloads
printer:print_config(Repository://Ebuild:download) :-
not(kb:query(manifest(_,_,_),Repository://Ebuild)),!.
% at least one download
printer:print_config(Repository://Ebuild:download) :-
findall([File,Size],kb:query(manifest(_,File,Size),Repository://Ebuild),[[FirstFile,FirstSize]|Rest]),!,
printer:print_config_prefix('file'),
printer:print_config_item('download',FirstFile,FirstSize),
forall(member([RestFile,RestSize],Rest),
(printer:print_config_prefix,
printer:print_config_item('download',RestFile,RestSize))).
% --------------------
% CASE: Install action
% --------------------
% iuse empty
printer:print_config(Repository://Entry:install) :-
not(kb:query(iuse(_),Repository://Entry)),!.
% use flags to show - to rework: performance
printer:print_config(Repository://Entry:install) :-
findall([Reason,Group], group_by(Reason, Use, kb:query(iuse_filtered(Use,Reason),Repository://Entry), Group), Useflags),
(Useflags == [] ;
(printer:print_config_prefix('conf'), % Use flags not empty
printer:print_config_item('use',Useflags))). % Use flags not empty
%config:print_expand_use(false) ; (
%findall([Key,Keyflags], ( preference:use_expand_hidden(Key),
% Statement =.. [Key,Use,Reason],
% (findall([Reason,Group],
% group_by(Reason,Use,kb:query(Statement,Repository://Entry), Group),
% Keyflags ) ),
% not(Keyflags == [])),
% Expandedkeys),
% (forall(member([Key,Keyflags],Expandedkeys),
% ((Useflags == [] -> % Expandedkeys not empty
% printer:print_config_prefix('conf'); % Expandedkeys not empty, use flags empty
% printer:print_config_prefix), % Expandedkeys not empty, use flags not empty
% printer:print_config_item(Key,Keyflags))))),!. % Expandedkeys not empty
% ----------------
% CASE: Run action
% ----------------
printer:print_config(_://_:run) :- !.
% -------------------
% CASE: Other actions
% -------------------
printer:print_config(_://_:_) :- !.
%! printer:print_config_item(+Key,+Value)
%
% Prints a configuration item for a given repository entry
printer:print_config_item('download',File,'live') :-
!,
message:color(darkgray),
message:print_bytes('live'),
message:color(darkgray),
message:print(' '),
message:print(File),
message:color(normal).
printer:print_config_item('download',File,Size) :-
!,
message:color(magenta),
message:print_bytes(Size),
message:color(normal),
message:print(' '),
message:print(File).
%! printer:print_config_item(+Key,List) % PosPref,PosEbui,NegPref,NegEbui,NegDefa)
%
% Prints a configuration item for a given repository entry
printer:print_config_item(Key,List) :- % PosPref,PosEbui,NegPref,NegEbui,NegDefa) :-
!,
upcase_atom(Key,KeyU),
message:print(KeyU),
message:print('="'),
printer:print_use_flag_sets(List),
message:print('"').
%! printer:print_use_flag_sets(+List)
%
% Prints a list of Enabled and Disabled Use flags
printer:print_use_flag_sets(List) :-
!,
(memberchk([negative:default,NegDefa],List); NegDefa=[]),
(memberchk([negative:ebuild,NegEbui],List); NegEbui=[]),
(memberchk([negative:preference,NegPref],List); NegPref=[]),
(memberchk([positive:ebuild,PosEbui],List); PosEbui=[]),
(memberchk([positive:preference,PosPref],List); PosPref=[]),
printer:print_use_flag_set(positive:preference,PosPref,'',D1),
printer:print_between(D1,PosEbui),
printer:print_use_flag_set(positive:ebuild,PosEbui,D1,D2),
printer:print_between(D2,NegPref),
printer:print_use_flag_set(negative:preference,NegPref,D2,D3),
printer:print_between(D3,NegEbui),
printer:print_use_flag_set(negative:ebuild,NegEbui,D3,D4),
printer:print_between(D4,NegDefa),
printer:print_use_flag_set(negative:default,NegDefa,D4,_).
%! printer:print_between_use_flag_set(D,Future)
%
% Prints a delayed char is future is non-empty
printer:print_between(_,[]) :- !.
printer:print_between(D,_) :- !,
write(D).
%! printer:print_use_flag_set(+Flags)
%
% Sorts, then prints a list of USE flags
printer:print_use_flag_set(_,[],D,D) :- !.
printer:print_use_flag_set(Type,Flags,_,' ') :-
sort(Flags,Orderedflags),
printer:print_use_flag(Type,Orderedflags).
%! printer:print_use_flag(+Flags)
%
% Prints a list of USE flags
printer:print_use_flag(_,[]) :-
!.
printer:print_use_flag(positive:preference,[Flag]) :-
message:color(lightred),
message:style(bold),
message:print(Flag),
message:color(normal),
!.
printer:print_use_flag(positive:preference,[Flag|Rest]) :-
message:color(lightred),
message:style(bold),
message:print(Flag),
message:print(' '),
message:color(normal),!,
printer:print_use_flag(positive:preference,Rest).
printer:print_use_flag(positive:ebuild,[Flag]) :-
message:color(red),
message:style(italic),
message:print(Flag),
message:color(normal),
!.
printer:print_use_flag(positive:ebuild,[Flag|Rest]) :-
message:color(red),
message:style(italic),
message:print(Flag),
message:print(' '),
message:color(normal),!,
printer:print_use_flag(positive:ebuild,Rest).
printer:print_use_flag(negative:preference,[Flag]) :-
message:color(blue),
message:style(bold),
message:print('-'),
message:print(Flag),
message:color(normal),
!.
printer:print_use_flag(negative:preference,[Flag|Rest]) :-
message:color(blue),
message:style(bold),
message:print('-'),
message:print(Flag),
message:print(' '),
message:color(normal),!,
printer:print_use_flag(negative:preference,Rest).
printer:print_use_flag(negative:ebuild,[Flag]) :-
message:color(lightblue),
message:style(italic),
message:print('-'),
message:print(Flag),
message:color(normal),
!.
printer:print_use_flag(negative:ebuild,[Flag|Rest]) :-
message:color(lightblue),
message:style(italic),
message:print('-'),
message:print(Flag),
message:print(' '),
message:color(normal),!,
printer:print_use_flag(negative:ebuild,Rest).
printer:print_use_flag(negative:default,[Flag]) :-
message:color(darkgray),
message:style(italic),
message:print('-'),
message:print(Flag),
message:color(normal),
!.
printer:print_use_flag(negative:default,[Flag|Rest]) :-
message:color(darkgray),
message:style(italic),
message:print('-'),
message:print(Flag),
message:print(' '),
message:color(normal),!,
printer:print_use_flag(negative:default,Rest).
%! printer:check_assumptions(+Model)
%
% Checks whether the Model contains assumptions
printer:check_assumptions(Model) :-
member(assumed(_),Model),!.
%! printer:print_header(+Target)
%
% Prints the header for a given target
printer:print_header(Target) :-
message:header('Emerging ',Target),
message:color(green),
message:print('These are the packages that would be merged, in order:'),nl,
nl,
message:color(normal),
message:print('Calculating dependencies... done!'),nl,
nl.
%! printer:print_debug(+Model,+Proof,+Plan)
%
% Prints debug info for a given Model, Proof and Plan
printer:print_debug(_Model,_Proof,Plan) :-
message:color(darkgray),
% message:inform(['Model : ',Model]),nl,
% message:inform(['Proof : ',Proof]),nl,
forall(member(X,Plan),(write(' -> '),writeln(X))),nl,
message:color(normal).
%! printer:print_body(+Plan,+Model,+Call,-Steps)
%
% Prints the body for a given plan and model, returns the number of printed steps
printer:print_body(Target,Plan,Call,Steps) :-
printer:print_steps_in_plan(Target,Plan,Call,0,Steps).
%! printer:print_steps(+Target,+Plan,+Call,+Count,-NewCount)
%
% Print the steps in a plan
printer:print_steps_in_plan(_,[],_,Count,Count) :- !.
printer:print_steps_in_plan(Target,[Step|Rest],Call,Count,CountFinal) :-
predsort(printer:sort_by_weight,Step,SortedStep),
printer:print_first_in_step(Target,SortedStep,Count,CountNew),
call(Call,SortedStep),!,
printer:print_steps_in_plan(Target,Rest,Call,CountNew,CountFinal).
%! printer:print_first_in_step(+Target,+Step,+Call,+Count,-NewCount)
%
% Print a step in a plan
printer:print_first_in_step(_,[],Count,Count) :- !.
printer:print_first_in_step(Target,[Rule|Rest],Count,NewCount) :-
printer:printable_element(Rule),
NewCount is Count + 1,
format(atom(AtomNewCount),'~t~0f~2|',[NewCount]),
!,
write(' └─ step '),write(AtomNewCount), write(' ─┤ '),
printer:print_element(Target,Rule),
printer:print_next_in_step(Target,Rest).
printer:print_first_in_step(Target,[_|Rest],Count,NewCount) :-
printer:print_first_in_step(Target,Rest,Count,NewCount).
%! printer:print_next_in_step(+Target,+Step)
%
% Print a step in a plan
printer:print_next_in_step(_,[]) :- nl,nl,!.
printer:print_next_in_step(Target,[Rule|Rest]) :-
printer:printable_element(Rule),
!,
nl,
write(' │ '),
printer:print_element(Target,Rule),
printer:print_next_in_step(Target,Rest).
printer:print_next_in_step(Target,[_|Rest]) :-
!,
printer:print_next_in_step(Target,Rest).
%! printer:print_footer(+Plan)
%
% Print the footer for a given plan
printer:print_footer(Plan,Model,PrintedSteps) :-
countlist(assumed(_),Model,_Assumptions),
countlist(constraint(_),Model,_Constraints),
countlist(naf(_),Model,_Nafs),
countlist(_://_:_,Model,Actions),
aggregate_all(sum(T),(member(R://E:download,Model),ebuild:download_size(R://E,T)),TotalDownloadSize),
countlist(_://_:download,Model,Downloads),
countlist(_://_:run,Model,Runs),
countlist(_://_:install,Model,Installs),
countlist(package_dependency(run,_,_,_,_,_,_,_),Model,_Verifs),
Total is Actions, % + Verifs,
length(Plan,_Steps),
message:print(['Total: ', Total, ' actions (', Downloads, ' downloads, ', Installs,' installs, ', Runs,' runs), grouped into ',PrintedSteps,' steps.' ]),nl,
message:print([' ']),
message:convert_bytes(TotalDownloadSize,A),
message:print([A,' to be downloaded.']),nl,
nl.
%! printer:print_warnings(+Model, +Proof)
%
% Print the assumptions taken by the prover
printer:print_warnings(Model,Proof) :-
printer:check_assumptions(Model),!,
message:color(red),message:print('Error: '),
message:print('The proof for your build plan contains assumptions. Please verify:'),nl,nl,
forall(member(assumed(rule(C,_)),Proof),
(message:print([' - Circular dependency: ',C]),nl)),
forall(member(rule(assumed(U),_),Proof),
(message:print([' - Non-existent ebuild: ',U]),nl)),
nl,
message:color(normal),nl.
printer:print_warnings(_Model,_Proof) :- !, nl.
%! printer:print(+Target,+Model,+Proof,+Plan)
%
% Print a given plan for a given target, with a given model, proof and plan
% Calls the printer:dry_run predicate for building a step
printer:print(Target,Model,Proof,Plan) :-
printer:print(Target,Model,Proof,Plan,printer:dry_run).
%! printer:print(+Target,+Model,+Proof,+Plan,+Call)
%
% Print a given plan for a given target, with a given model, proof and plan
% Calls the given call for elements of the build plan
printer:print(Target,Model,Proof,Plan,Call) :-
printer:print_header(Target),
% printer:print_debug(Model,Proof,Plan),
printer:print_body(Target,Plan,Call,Steps),
printer:print_footer(Plan,Model,Steps),
printer:print_warnings(Model,Proof).
%! printer:dry_run(+Step)
%
% Default execution strategy for building steps in a plan
printer:dry_run(_Step) :-
true.
%message:color(darkgray),
%message:print(['building step : ',Step]),nl,
%message:color(normal).
%! Some helper predicates
unify(A,B) :- unifiable(A,B,_),!.
countlist(Predicate,List,Count) :-
include(unify(Predicate),List,Sublist),!,
length(Sublist,Count).
countlist(_,_,0) :- !.
allempty([],[]).
allempty([],[],[]).
allempty([],[],[],[]).
allempty([],[],[],[],[]).
allempty([],[],[],[],[],[]).
allempty([],[],[],[],[],[],[]).
%! printer:test(+Repository)
%
% Proves and prints every entry in a given repository, reports using the default reporting style
printer:test(Repository) :-
config:test_style(Style),
printer:test(Repository,Style).
%! printer:test(+Repository,+Style)
%
% Proves and prints every entry in a given repository, reports using a given reporting style
printer:test(Repository,parallel_fast) :-
!,
printer:test(Repository,parallel_verbose).
printer:test(Repository,Style) :-
config:proving_target(Action),
tester:test(Style,
'Printing',
Repository://Entry,
(Repository:entry(Entry)),
(with_q(prover:prove(Repository://Entry:Action,[],Proof,[],Model,[],_Constraints)),
with_q(planner:plan(Proof,[],[],Plan))),
(printer:print([Repository://Entry:Action],Model,Proof,Plan)),
false).
%! printer:test_latest(+Repository,+Style)
%
% Same as printer:test(+Repository,+Style), but only tests highest version of very package
printer:test_latest(Repository,parallel_fast) :-
!,
printer:test_latest(Repository,parallel_verbose).
printer:test_latest(Repository,Style) :-
config:proving_target(Action),
tester:test(Style,
'Printing plan for',
Repository://Entry,
(Repository:package(C,N),once(Repository:ebuild(Entry,C,N,_))),
(with_q(prover:prove(Repository://Entry:Action,[],Proof,[],Model,[],_Constraints)),
with_q(planner:plan(Proof,[],[],Plan))),
(printer:print([Repository://Entry:Action],Model,Proof,Plan)),
false).
%! printer:write_plans(+Directory,+Repository)
%
% Proves and writes plan for every entry in a given repository to a proof file
% Assumes graph directory exists. (grapher:prepare_directory)
printer:write_plans(Repository,Directory) :-
pkg:create_repository_dirs(Repository,Directory),
config:proving_target(Action),
tester:test(parallel_verbose,
'Writing plan for',
Repository://Entry,
(Repository:entry(Entry)),
(with_q(prover:prove(Repository://Entry:Action,[],Proof,[],Model,[],_Constraints)),
with_q(planner:plan(Proof,[],[],Plan)),
atomic_list_concat([Directory,'/',Entry,'.plan'],File)),
(tell(File),
printer:print([Repository://Entry:Action],Model,Proof,Plan),
told),
true).