OILS / regtest / aports-html.sh View on Github | oils.pub

827 lines, 379 significant
1#!/usr/bin/env bash
2#
3# Make HTML reports
4#
5# Usage:
6# regtest/aports-html.sh <function name>
7#
8# Examples:
9# $0 sync-results he.oils.pub
10# $0 write-all-reports
11# $0 make-wwz _tmp/aports-report/2025-08-03
12# $0 deploy-wwz-op _tmp/aports-report/2025-08-03.wwz # deploy to op.oils.pub
13
14: ${LIB_OSH=stdlib/osh}
15source $LIB_OSH/bash-strict.sh
16source $LIB_OSH/task-five.sh
17
18source regtest/aports-common.sh
19
20REPO_ROOT=$(cd "$(dirname $0)/.."; pwd)
21source test/tsv-lib.sh # tsv2html3
22source web/table/html.sh # table-sort-{begin,end}
23source benchmarks/common.sh # cmark
24source build/dev-shell.sh # python2
25
26sqlite-tabs-headers() {
27 sqlite3 \
28 -cmd '.mode tabs' \
29 -cmd '.headers on' \
30 "$@"
31}
32
33html-head() {
34 # python3 because we're outside containers
35 PYTHONPATH=. python3 doctools/html_head.py "$@"
36}
37
38index-html() {
39 local base_url='../../../../web'
40 html-head --title "aports Build" \
41 "$base_url/base.css"
42
43 # TODO:
44 # - Stats for each config:
45 # - number of non-zero exit codes, total packages
46
47 cmark <<'EOF'
48<body class="width35">
49
50<p id="home-link">
51 <a href="/">Home</a>
52</p>
53
54# aports Build
55
56Configurations:
57
58- [baseline](baseline/packages.html) - [raw tasks](baseline/tasks.html) - [metrics](baseline/metrics.txt)
59- [osh-as-sh](osh-as-sh/packages.html) - [raw tasks](osh-as-sh/tasks.html) - [metrics](osh-as-sh/metrics.txt)
60
61## Baseline versus osh-as-sh
62
63- [diff_baseline](diff_baseline.html)
64
65## osh-as-sh versus osh-as-bash
66
67TODO
68
69</body>
70EOF
71}
72
73diff-metrics-html() {
74 local db=${1:-_tmp/aports-report/2025-08-03/diff_merged.db}
75
76 sqlite3 $db < regtest/aports/summary.sql
77}
78
79table-page-html() {
80 local base_dir=${1:-$REPORT_DIR/$EPOCH}
81 local name=${2:-diff_baseline}
82 local base_url=${3:-'../../../../web'}
83 local title=${4:-'OSH Disagreements - regtest/aports'}
84
85 html-head --title "$title" \
86 "$base_url/ajax.js" \
87 "$base_url/table/table-sort.js" \
88 "$base_url/table/table-sort.css" \
89 "$base_url/base.css"
90
91 table-sort-begin 'width60'
92
93 cmark <<EOF
94<p id="home-link">
95 <a href="../index.html">Up</a> |
96 <a href="/">Home</a>
97</p>
98
99# $title
100
101EOF
102
103 tsv2html3 $base_dir/$name.tsv
104
105 cmark <<EOF
106
107[$name.tsv]($name.tsv)
108EOF
109
110 table-sort-end "$name" # ID for sorting
111}
112
113merge-diff-html() {
114 local base_dir=${1:-$REPORT_DIR/$EPOCH}
115 local base_url=${2:-'../../../../web'}
116 local title=${3:-'OSH Disagreements - regtest/aports'}
117
118 html-head --title "$title" \
119 "$base_url/ajax.js" \
120 "$base_url/table/table-sort.js" \
121 "$base_url/table/table-sort.css" \
122 "$base_url/base.css"
123
124 table-sort-begin 'width60' # <body> <p>
125
126 cmark <<EOF
127<p id="home-link">
128 <a href="../index.html">Up</a> |
129 <a href="/">Home</a>
130</p>
131
132# $title
133
134EOF
135
136 diff-metrics-html $base_dir/diff_merged.db
137
138 cmark << 'EOF'
139[tree](tree.html) &nbsp;&nbsp; [metrics](metrics.html) &nbsp;&nbsp; [disagree-packages.txt](disagree-packages.txt)
140
141## Notable Disagreements
142
143<div style="color: #666;">
144
145(Hint: **click** on the cause column header to sort)
146
147</div>
148
149EOF
150
151 local name=notable_disagree
152 tsv2html3 $base_dir/$name.tsv
153
154 cmark <<EOF
155
156[$name.tsv]($name.tsv)
157
158## Baseline-Only Failures
159EOF
160
161 name=baseline_only
162 table-sort-begin 'width60'
163 tsv2html3 $base_dir/$name.tsv
164
165 cmark <<EOF
166[$name.tsv]($name.tsv)
167
168## Other Failures
169EOF
170
171 name=other_fail
172 table-sort-begin 'width60'
173 tsv2html3 $base_dir/$name.tsv
174
175 cmark <<EOF
176
177[$name.tsv]($name.tsv)
178
179## Timeouts
180EOF
181
182 name=timeout
183 table-sort-begin 'width60'
184 tsv2html3 $base_dir/$name.tsv
185
186 cmark <<EOF
187
188[$name.tsv]($name.tsv)
189EOF
190
191 # Sort these 3 tables
192 table-sort-end-many notable_disagree baseline_only other_fail timeout
193}
194
195tasks-html() {
196 local tsv=$1
197 # note: escaping problems with title
198 # it gets interpolated into markdown and html
199 local title=$2
200
201 local base_url='../../../../../web'
202 html-head --title "$title" \
203 "$base_url/ajax.js" \
204 "$base_url/table/table-sort.js" \
205 "$base_url/table/table-sort.css" \
206 "$base_url/base.css"
207
208 table-sort-begin 'width60'
209
210 cmark <<EOF
211<p id="home-link">
212 <a href="../index.html">Up</a> |
213 <a href="/">Home</a>
214</p>
215
216# $title
217EOF
218
219 tsv2html3 $tsv
220
221 local id=$(basename $tsv .tsv)
222 cmark <<EOF
223
224[$id.tsv]($id.tsv)
225EOF
226
227 table-sort-end "$id" # ID for sorting
228}
229
230published-html() {
231 local base_url='../../web'
232
233 local title='regtest/aports'
234
235 html-head --title "$title" \
236 "$base_url/base.css"
237
238 echo '
239 <body class="width35">
240 <style>
241 code { color: green; }
242 </style>
243
244 <p id="home-link">
245 <a href="/">Home</a> |
246 <a href="https://oils.pub/">oils.pub</a>
247 </p>
248 '
249
250 { echo "## $title"
251 echo '
252Testing OSH on decades worth of shell scripts. [Source code](https://github.com/oils-for-unix/oils/tree/master/regtest).
253
254The `aports/main` repo has 1595 `APKBUILD` files, and `aports/community` has
2557168. A disagreement is when the package succeeds normally, but fails when
256`osh` becomes the system shell. Caveats: timeouts and flakiness.
257
258### main
259
260- [2025-08-07-fix](2025-08-07-fix.wwz/_tmp/aports-report/2025-08-07-fix/diff_merged.html) - **131** disagreements
261- [2025-08-14-fix](2025-08-14-fix.wwz/_tmp/aports-report/2025-08-14-fix/diff_merged.html)
262- [2025-08-26-ifs](2025-08-26-ifs.wwz/_tmp/aports-report/2025-08-26-ifs/diff_merged.html) - **62** after `IFS` fix
263 - new causes: [2025-09-06-edit](2025-09-06-edit.wwz/_tmp/aports-report/2025-09-06-edit/diff_merged.html)
264- [2025-09-07](2025-09-07.wwz/_tmp/aports-report/2025-09-07/diff_merged.html)
265- [2025-09-08](2025-09-08.wwz/_tmp/aports-report/2025-09-08/diff_merged.html)
266 - [2025-09-08-edit](2025-09-08-edit.wwz/_tmp/aports-report/2025-09-08-edit/diff_merged.html)
267 - [2025-09-08-notable](2025-09-08-notable.wwz/_tmp/aports-report/2025-09-08-notable/diff_merged.html)
268- [2025-09-10-overlayfs](2025-09-10-overlayfs.wwz/_tmp/aports-report/2025-09-10-overlayfs/diff_merged.html)
269- [2025-09-11-match](2025-09-11-match.wwz/_tmp/aports-report/2025-09-11-match/diff_merged.html)
270- [2025-09-15-order](2025-09-15-order.wwz/_tmp/aports-report/2025-09-15-order/diff_merged.html) - **32** disagreements with `osh` as `/bin/sh`
271
272After this success, we expanded our testing:
273
274- [2025-09-17-ash2](2025-09-17-ash2.wwz/_tmp/aports-report/2025-09-17-ash2/diff_merged.html) - **37**, after adding `osh` as `/bin/ash`
275- [2025-09-18-bash](2025-09-18-bash.wwz/_tmp/aports-report/2025-09-18-bash/diff_merged.html) - **43**, after adding `osh` as `/bin/bash`
276 - only run on packages that disagree: [2025-09-27-disagree](2025-09-27-disagree.wwz/_tmp/aports-report/2025-09-27-disagree/diff_merged.html)
277 - new causes: [2025-10-03-causes](2025-10-03-causes.wwz/_tmp/aports-report/2025-10-03-causes/diff_merged.html)
278- [2025-10-15-main](2025-10-15-main.wwz/_tmp/aports-report/2025-10-15-main/diff_merged.html) - **38** disagreements
279 - [2025-10-16](2025-10-16.wwz/_tmp/aports-report/2025-10-16/diff_merged.html) - down to **35** after `x=1>` and `cd x y` fixes
280 - [2025-10-22](2025-10-22.wwz/_tmp/aports-report/2025-10-22/diff_merged.html) - down to **24** after `((` and `$(false)` fixes
281 - [2025-10-26-cause](2025-10-26-cause.wwz/_tmp/aports-report/2025-10-26-cause/diff_merged.html) - updated causes
282 - [2025-11-01-main-cause](2025-11-01-main-cause.wwz/_tmp/aports-report/2025-11-01-main-cause/diff_merged.html) - updated causes
283 - [2025-11-01-main-again](2025-11-01-main-again.wwz/_tmp/aports-report/2025-11-01-main-again/diff_merged.html) - **18** disagreements
284 - [2025-11-02-main-patch](2025-11-02-main-patch.wwz/_tmp/aports-report/2025-11-02-main-patch/diff_merged.html) - **14** disagreements
285 - [2025-11-09-main-cause](2025-11-09-main-cause.wwz/_tmp/aports-report/2025-11-09-main-cause/diff_merged.html) - updated causes
286
287### community
288
289- [2025-10-08-comm](2025-10-08-comm.wwz/_tmp/aports-report/2025-10-08-comm/diff_merged.html) - **86** disagreements
290 - [2025-10-16-comm-disagree](2025-10-16-comm-disagree.wwz/_tmp/aports-report/2025-10-16-comm-disagree/diff_merged.html) - **71** disagreements
291 - [2025-10-22-comm](2025-10-22-comm.wwz/_tmp/aports-report/2025-10-22-comm/diff_merged.html) - down to **65** after `((` and `$(false)` fixes
292 - [2025-10-26-comm-cause](2025-10-26-comm-cause.wwz/_tmp/aports-report/2025-10-26-comm-cause/diff_merged.html) - updated causes
293 - [2025-11-01-comm-cause](2025-11-01-comm-cause.wwz/_tmp/aports-report/2025-11-01-comm-cause/diff_merged.html) - updated causes
294 - [2025-11-02-comm-patch](2025-11-02-comm-patch.wwz/_tmp/aports-report/2025-11-02-comm-patch/diff_merged.html) - **64** disagreements, **45** of unknown cause
295 - [2025-11-09-comm-cause](2025-11-09-comm-cause.wwz/_tmp/aports-report/2025-11-09-comm-cause/diff_merged.html) - updated causes, **20** of unknown cause
296
297';
298 } | cmark
299
300 echo '
301 </body>
302</html>
303'
304}
305
306typed-tsv-to-sql() {
307 local tsv=${1:-$BASE_DIR/big/tasks.tsv}
308 local name
309 name=${2:-$(basename $tsv .tsv)}
310
311 local schema="${tsv%'.tsv'}.schema.tsv"
312 #echo $name $schema
313
314 echo "CREATE TABLE $name ("
315 web/table/schema2sqlite.py $schema
316 echo ');'
317
318 echo "
319-- use this temp import because we already created the table, and
320-- '.headers on' is not expected in that case
321
322.import $tsv temp_import
323insert into $name select * from temp_import;
324drop table temp_import;
325
326-- select * from $name limit 5;
327 "
328}
329
330my-rsync() {
331 #rsync --archive --verbose --dry-run "$@"
332 rsync --archive --verbose "$@"
333}
334
335readonly EPOCH=${EPOCH:-'2025-07-28-100'}
336readonly BUILD_HOST=he.oils.pub
337#readonly BUILD_HOST=lenny.local
338
339sync-results() {
340 local host=${1:-$BUILD_HOST}
341 local prefix=${2:-}
342 mkdir -p $REPORT_DIR
343
344 # Exclude .apk files, because they are large. We only need the metadata
345 my-rsync \
346 --exclude '*.apk' \
347 "$host:~/git/oils-for-unix/oils/_tmp/aports-build/$prefix*" \
348 $REPORT_DIR/
349}
350
351local-sync() {
352 mkdir -p $REPORT_DIR
353
354 #my-rsync --dry-run $BASE_DIR/ $REPORT_DIR/
355 my-rsync $BASE_DIR/ $REPORT_DIR/
356}
357
358make-package-table() {
359 local base_dir=${1:-$REPORT_DIR/$EPOCH}
360 local config=${2:-baseline}
361
362 local db=$PWD/$base_dir/$config/tables.db
363 rm -f $db
364
365 typed-tsv-to-sql $base_dir/$config/tasks.tsv | sqlite-tabs-headers $db
366
367 sqlite3 -cmd '.mode columns' $db < regtest/aports/tasks.sql
368
369 pushd $base_dir/$config > /dev/null
370
371 db-to-tsv $db packages
372
373 # Set precision
374 echo "
375 alter table packages_schema add column precision;
376
377 update packages_schema set precision = 1 where column_name = 'elapsed_secs';
378 update packages_schema set precision = 1 where column_name = 'user_elapsed_ratio';
379 update packages_schema set precision = 1 where column_name = 'user_sys_ratio';
380 update packages_schema set precision = 1 where column_name = 'max_rss_MB';
381 " | sqlite3 $db
382
383 # Count .apk for this config
384 # Note: we could also create an 'apk' table, in addition to 'packages', and diff
385 # But that's a bunch of overhead
386
387 local num_apk
388 num_apk=$(cat apk.txt | wc -l)
389
390 sqlite3 $db >metrics.txt <<EOF
391update metrics
392set num_apk = $num_apk
393where id = 1;
394
395.mode column
396select * from metrics;
397EOF
398
399 popd > /dev/null
400
401 #cat $base_dir/$config/packages.schema.tsv
402}
403
404tasks-schema() {
405 here-schema-tsv-4col <<EOF
406column_name type precision strftime
407status integer 0 -
408elapsed_secs float 1 -
409start_time float 1 %H:%M:%S
410end_time float 1 %H:%M:%S
411user_secs float 1 -
412sys_secs float 1 -
413max_rss_KiB integer 0 -
414xargs_slot integer 0 -
415pkg string 0 -
416pkg_HREF string 0 -
417EOF
418}
419
420write-tables-for-config() {
421 local base_dir=${1:-$REPORT_DIR/$EPOCH}
422 local config=${2:-baseline}
423
424 local tasks_tsv=$base_dir/$config/tasks.tsv
425 mkdir -p $base_dir/$config
426
427 tasks-schema >$base_dir/$config/tasks.schema.tsv
428
429 local out=$base_dir/$config/tasks.html
430 tasks-html $tasks_tsv "tasks: $config" > $out
431 log "Wrote $out"
432
433 make-package-table "$base_dir" "$config"
434
435 local packages_tsv=$base_dir/$config/packages.tsv
436
437 local out=$base_dir/$config/packages.html
438 tasks-html $packages_tsv "packages: $config" > $out
439 log "Wrote $out"
440}
441
442make-diff-db() {
443 local base_dir=$1
444 local name=${2:-diff_baseline}
445
446 local db=$name.db
447
448 local diff_sql=$PWD/regtest/aports/diff.sql
449 local cause_awk=$PWD/regtest/aports/cause.awk
450 local cause_sql=$PWD/regtest/aports/cause.sql
451
452 pushd $base_dir > /dev/null
453
454 rm -f $db
455 sqlite3 $db < $diff_sql
456
457 #
458 # Now make diffs
459 #
460
461 sqlite3 $db >failed-packages.txt <<EOF
462.mode tabs
463-- this is a text file, so headers are OFF
464.headers off
465
466select pkg from diff_baseline;
467EOF
468
469 mkdir -p error
470 cat failed-packages.txt | while read -r pkg; do
471 #local left=baseline/log/$pkg.log.txt
472 local right=osh-as-sh/log/$pkg.log.txt
473
474 # lower case 'error fail' are more noisy, e.g. command line flags
475 egrep 'Error|ERROR|Fail|FAIL|test-suite.log' $right > error/$pkg.txt || true
476 done
477
478 { echo "pkg${TAB}cause${TAB}suite${TAB}suite_HREF"
479 cat failed-packages.txt | while read -r pkg; do
480 local right=osh-as-sh/log/$pkg.log.txt
481
482 local cause
483 cause=$(awk -f $cause_awk $right)
484
485 local suite=''
486 local suite_HREF=''
487 local suite_path="osh-as-sh/test-suite/$pkg/test-suite.log.txt"
488 if test -f "$suite_path"; then
489 suite='suite'
490 suite_HREF=$suite_path # shard added in regtest/aports/merge.sql
491 fi
492
493 echo "${pkg}${TAB}${cause}${TAB}${suite}${TAB}${suite_HREF}"
494 done
495 } > causes.tsv
496
497 # Import causes.tsv and add columns
498 sqlite-tabs-headers \
499 -cmd '.import causes.tsv causes' \
500 $db < $cause_sql
501
502 # The DB is diff_baseline.db, with table diff_baseline
503 db-to-tsv $db diff_baseline
504
505 popd > /dev/null
506}
507
508db-to-tsv() {
509 local db=$1
510 local table_name=$2
511 local order_by=${3:-}
512
513 echo "
514 select * from ${table_name} ${order_by};
515 " | sqlite-tabs-headers $db >$table_name.tsv
516
517 echo "
518 create table ${table_name}_schema as
519 select
520 name as column_name,
521 case
522 when UPPER(type) like '%INT%' then 'integer'
523 when UPPER(type) = 'REAL' then 'float'
524 when UPPER(type) = 'TEXT' then 'string'
525 else LOWER(type)
526 end as type
527 from PRAGMA_TABLE_INFO('${table_name}');
528
529 select * from ${table_name}_schema;
530 " | sqlite-tabs-headers $db >$table_name.schema.tsv
531}
532
533merge-diffs-sql() {
534 local -a SHARDS=( "$@" )
535
536 local is_first_shard=T
537
538 # Now insert data from all the shards
539 for ((i=0; i<${#SHARDS[@]}; i++)); do
540 local shard_dir="${SHARDS[i]}"
541 shard_name=$(basename $shard_dir)
542
543 # Handle incomplete shard
544 if ! test -d $shard_dir/baseline || ! test -d $shard_dir/osh-as-sh; then
545 continue
546 fi
547
548 echo "ATTACH DATABASE '$shard_dir/diff_baseline.db' AS temp_shard;"
549
550 if test -n "$is_first_shard"; then
551 # Create table from first shard
552 echo "
553 CREATE TABLE diff_merged AS
554 SELECT *, CAST('' as TEXT) as shard FROM temp_shard.diff_baseline where 1=0;
555
556 CREATE TABLE metrics AS
557 SELECT *, CAST('' as TEXT) as shard FROM temp_shard.metrics where 1=0;
558 "
559 is_first_shard='' # don't create table next time
560 fi
561
562 # Now insert data
563 echo "
564 INSERT INTO diff_merged
565 SELECT *, '$shard_name' as shard FROM temp_shard.diff_baseline;
566
567 INSERT INTO metrics
568 SELECT *, '$shard_name' as shard FROM temp_shard.metrics;
569
570 DETACH DATABASE temp_shard;
571 "
572 done
573
574 # Does not involve metaprogramming
575 cat regtest/aports/merge.sql
576}
577
578merge-diffs() {
579 local epoch_dir=${1:-_tmp/aports-report/2025-10-15-main}
580 local do_disagree=${2:-}
581
582 local db=$PWD/$epoch_dir/diff_merged.db
583 rm -f $db
584
585 local -a shards
586 if test -n "$do_disagree"; then
587 # Hack: distinguish disagree-2025 from disagree-packages.txt
588 shards=( $epoch_dir/disagree-2* ) # Usually 1 shard
589 else
590 shards=( $epoch_dir/shard* )
591 fi
592
593 echo SHARDS "${shards[@]}"
594
595 merge-diffs-sql "${shards[@]}" | sqlite3 $db
596 #echo $db
597
598 # copied from above
599 pushd $epoch_dir > /dev/null
600
601 db-to-tsv $db diff_merged 'order by pkg'
602 db-to-tsv $db metrics
603
604 db-to-tsv $db notable_disagree 'order by pkg'
605 db-to-tsv $db baseline_only 'order by pkg'
606 db-to-tsv $db other_fail 'order by pkg'
607 db-to-tsv $db timeout 'order by pkg'
608
609 # For re-running failures
610 sqlite3 diff_merged.db >disagree-packages.txt <<EOF
611.headers off
612select pkg from diff_merged where disagree = 1 and timeout = 0;
613EOF
614 #wc -l disagree-packages.txt
615
616 popd > /dev/null
617
618 local title1='OSH Disagreements - regtest/aports'
619 local out=$epoch_dir/diff_merged.html
620 merge-diff-html $epoch_dir '../../../web' "$title1" > $out
621 echo "Wrote $out"
622
623 local name2=metrics
624 local title2='Metrics - regtest/aports'
625 local out=$epoch_dir/$name2.html
626 table-page-html $epoch_dir $name2 '../../../web' "$title2" > $out
627 echo "Wrote $out"
628
629 # After merging, regenerate other stuff too
630
631 html-tree "$epoch_dir"
632
633 update-published # also done in deploy-published
634}
635
636write-shard-reports() {
637 local base_dir=$1 # e.g. _tmp/aports-report/2025-08-02/shard3
638
639 index-html > $base_dir/index.html
640
641 for config in baseline osh-as-sh; do
642 # Incomplete shard
643 if ! test -d "$base_dir/$config"; then
644 return
645 fi
646 write-tables-for-config "$base_dir" "$config"
647 done
648
649 local name=diff_baseline
650 local title="$base_dir differences"
651 make-diff-db $base_dir
652 table-page-html $base_dir $name '' "$title" > $base_dir/$name.html
653 echo "Wrote $base_dir/$name.html"
654}
655
656write-all-reports() {
657 local epoch_dir=${1:-_tmp/aports-report/2025-08-03}
658
659 for shard_dir in $epoch_dir/shard*; do
660 write-shard-reports "$shard_dir"
661 done
662
663 merge-diffs "$epoch_dir"
664}
665
666write-disagree-reports() {
667 local epoch_dir=${1:-_tmp/aports-build/2025-09-27}
668
669 # Hack: distinguish disagree-2025 from disagree-packages.txt
670 for shard_dir in $epoch_dir/disagree-2*; do
671 write-shard-reports "$shard_dir"
672 done
673
674 merge-diffs "$epoch_dir" T
675}
676
677html-tree() {
678 local epoch_dir=${1:-_tmp/aports-report/2025-08-07-fix}
679
680 local epoch
681 epoch=$(basename $epoch_dir)
682
683 pushd $epoch_dir
684 # -L 3 goes 3 levels deeps, omitting logs
685 tree \
686 -H './' \
687 -T "regtest/aports - $epoch" \
688 -L 3 \
689 --charset=ascii \
690 > tree.html
691 popd
692
693 echo "Wrote $epoch_dir/tree.html"
694}
695
696update-published() {
697 local out=$REPORT_DIR/published.html
698 published-html > $out
699 echo "Wrote $out"
700}
701
702remove-apk() {
703 local base_dir=${1:-$REPORT_DIR/2025-09-07}
704 # temporary
705
706 find $base_dir -name '*.apk' -o -name 'APKINDEX*' | xargs -d $'\n' --verbose -- rm -v
707}
708
709make-wwz() {
710 local base_dir=${1:-$REPORT_DIR/2025-08-03}
711
712 # must not end with slash
713 base_dir=${base_dir%'/'}
714
715 local wwz=$base_dir.wwz
716 rm -f -v $wwz
717
718 zip -r $wwz $base_dir web/
719
720 echo "Wrote $wwz"
721}
722
723readonly WEB_HOST=op.oils.pub
724
725deploy-wwz-op() {
726 local wwz=${1:-$REPORT_DIR/2025-08-03.wwz}
727
728 local dest_dir=$WEB_HOST/aports-build
729
730 update-published # slightly redundant
731
732 ssh $WEB_HOST mkdir -p $dest_dir
733
734 scp $wwz $REPORT_DIR/published.html \
735 $WEB_HOST:$dest_dir/
736
737 echo "Visit https://$dest_dir/published.html"
738 echo " https://$dest_dir/$(basename $wwz)/"
739}
740
741deploy-published() {
742 local dest_dir=$WEB_HOST/aports-build
743
744 update-published # slightly redundant
745
746 scp $REPORT_DIR/published.html \
747 $WEB_HOST:$dest_dir/
748
749 echo "Visit https://$dest_dir/published.html"
750}
751
752#
753# For editing
754#
755
756readonly EDIT_DIR=_tmp/aports-edit
757
758readonly EDITING_APORTS_EPOCH='2025-11-02-main-patch.wwz'
759
760sync-old-wwz() {
761 local wwz=${1:-$EDITING_APORTS_EPOCH}
762
763 mkdir -p $EDIT_DIR
764 rm -f -v $EDIT_DIR/$wwz
765
766 wget --directory $EDIT_DIR \
767 "https://$WEB_HOST/aports-build/$wwz"
768
769 ls -l $EDIT_DIR
770 #echo "Wrote $wwz"
771}
772
773extract-old-wwz() {
774 local new_epoch=$1
775 local wwz=${2:-$EDITING_APORTS_EPOCH}
776
777 # Extract the whole thing into a temp dir
778 local tmp_dir=$EDIT_DIR/$new_epoch
779 rm -r -f $tmp_dir
780 mkdir -p $tmp_dir
781
782 pushd $tmp_dir
783 unzip ../$wwz
784 popd
785
786 # Now re-create the old structure under _tmp/aports-report/2025-09-06-edit
787
788 local dest_dir=$REPORT_DIR/$new_epoch
789 mkdir -p $dest_dir
790
791 local old_epoch
792 old_epoch=$(basename $wwz .wwz)
793 mv -v --no-target-directory $tmp_dir/_tmp/aports-report/$old_epoch $dest_dir
794}
795
796rebuild-both() {
797 for a_repo in main comm; do
798 local old=2025-11-02-${a_repo}-patch.wwz
799 sync-old-wwz $old
800 local new=2025-11-09-${a_repo}-cause
801
802 rm -r -f _tmp/aports-report/$new
803
804 extract-old-wwz $new $old
805
806 write-disagree-reports _tmp/aports-report/$new
807
808 make-wwz _tmp/aports-report/$new
809
810 deploy-wwz-op _tmp/aports-report/$new.wwz
811 done
812}
813
814#
815# Dev tools
816#
817
818out-of-vm() {
819 local dest=~/vm-shared/$EPOCH
820 mkdir -p $dest
821 cp $REPORT_DIR/$EPOCH.wwz $dest
822 pushd ~/vm-shared/$EPOCH
823 unzip $EPOCH.wwz
824 popd
825}
826
827task-five "$@"