1 | #!/usr/bin/env bash
|
2 | #
|
3 | # The big Oils release process.
|
4 | #
|
5 | # Usage:
|
6 | # devtools/release.sh <function name>
|
7 | #
|
8 | # Steps:
|
9 | # edit oils-version.txt, build/doc.sh update-src-versions, bump devtools/release-note.sh
|
10 | # $0 make-release-branch
|
11 | # $0 two-tarballs # CPython, then oils-for-unix, which is INSTALLED
|
12 | # demo/osh-debug.sh osh-for-release: Start a shell to dogfood
|
13 | # build/cpython-defs.sh {oil-py-names,filter-methods}
|
14 | # (regenerate C source)
|
15 | #
|
16 | # Run on each machine:
|
17 | # $0 auto-machine1
|
18 | # $0 auto-machine2 ($0 dep-benchmarks first)
|
19 | #
|
20 | # In between:
|
21 | # [switch benchmarks-data repo] commit src/oil-for-unix-* and push to flanders.
|
22 | # TODO: Make sure benchmark-data directory is clean!
|
23 | #
|
24 | # Resume manual work
|
25 | #
|
26 | # Commit files to oilshell/benchmark-data repo and sync.
|
27 | # benchmarks/report.sh all
|
28 | # $0 deploy-tar # needed to publish tarball checksum in HTML
|
29 | # build/doc.sh run-for-release
|
30 | # $0 compress
|
31 | # devtools/release-version.sh git-changelog-$VERSION
|
32 | # devtools/release-version.sh announcement-$VERSION
|
33 | # MAYBE: ./local.sh test-release-tree if you want to preview it
|
34 | # $0 deploy-doc (makes releases.html)
|
35 | #
|
36 | # demo/osh-debug.sh analyze # see what you ran
|
37 | #
|
38 | # - Go to oils.pub repo and do:
|
39 | # ./deploy.sh site # copy release
|
40 | # ./deploy.sh bump-index-version
|
41 | # make
|
42 | # ./deploy.sh site # copy new index
|
43 | # ./deploy.sh bump-release-version
|
44 | # - Go to oils.pub__deploy and "git add release/$VERSION".
|
45 | # - git commit -a
|
46 |
|
47 | set -o nounset
|
48 | set -o pipefail
|
49 | set -o errexit
|
50 |
|
51 | shopt -s strict:all 2>/dev/null || true # dogfood for OSH
|
52 |
|
53 | REPO_ROOT=$(cd $(dirname $0)/.. ; pwd)
|
54 | OIL_VERSION=$(head -n 1 oils-version.txt)
|
55 |
|
56 | source devtools/common.sh # banner
|
57 | source benchmarks/common.sh # BENCHMARK_DATA_OILS, OSH_CPP_BENCHMARK_DATA
|
58 | # redefines OIL_VERSION as readonly
|
59 |
|
60 | readonly OSH_RELEASE_BINARY=$REPO_ROOT/_tmp/oil-tar-test/oil-$OIL_VERSION/_bin/osh
|
61 | readonly YSH_RELEASE_BINARY=$REPO_ROOT/_tmp/oil-tar-test/oil-$OIL_VERSION/_bin/ysh
|
62 |
|
63 | log() {
|
64 | echo "$@" 1>&2
|
65 | }
|
66 |
|
67 | make-release-branch() {
|
68 | git checkout master
|
69 | local name=release/$OIL_VERSION
|
70 | git checkout -b $name
|
71 | git push -u origin $name
|
72 | }
|
73 |
|
74 | ensure-smooth-build() {
|
75 | # Stray files can mess up the unit tests
|
76 | devtools/git.sh error-if-untracked
|
77 |
|
78 | build/clean.sh
|
79 |
|
80 | sudo -k; sudo true # clear and re-cache credentials
|
81 |
|
82 | # Install with root privileges
|
83 | _install
|
84 | }
|
85 |
|
86 | # For redoing a release. This is everything until you have to 'git pull' the
|
87 | # benchmark-data repo to make reports.
|
88 | #
|
89 | # PRECONDITION: $0 two-tarballs was run manually, which runs
|
90 | # ensure-smooth-build.
|
91 | auto-machine1() {
|
92 | local resume=${1:-} # workaround for spec test flakiness bug
|
93 | local resume2=${2:-} # skip past spec sanity check
|
94 | local resume3=${3:-} # skip past metrics and wild tests
|
95 | local resume4=${4:-} # skip past full spec tests
|
96 |
|
97 | if test -z "$resume"; then
|
98 | $0 build-and-test
|
99 | fi
|
100 |
|
101 | if test -z "$resume2"; then
|
102 | _spec-sanity-check # just run a few spec tests
|
103 | fi
|
104 |
|
105 | if test -z "$resume3"; then
|
106 | $0 metrics # this can catch bugs
|
107 | test/wild.sh all
|
108 | fi
|
109 |
|
110 | if test -z "$resume4"; then
|
111 | $0 spec-all # full spec test run
|
112 | fi
|
113 |
|
114 | $0 benchmark-run do_machine1
|
115 | }
|
116 |
|
117 | # Note: needs dep-benchmarks to run
|
118 | auto-machine2() {
|
119 | ensure-smooth-build
|
120 |
|
121 | # Note: this can't be done until we sync the oils-for-unix source from
|
122 | # machine 1.
|
123 | $0 benchmark-build
|
124 | $0 benchmark-run
|
125 | }
|
126 |
|
127 | # TODO:
|
128 | # - enforce that there is a release/$VERSION branch?
|
129 |
|
130 | # oils.pub__deploy/
|
131 | # releases.html
|
132 | # release/
|
133 | # $VERSION/
|
134 | # index.html # release page, from doc/release-index.md
|
135 | # oils-version.txt
|
136 | # release-date.txt
|
137 | # announcement.html # HTML redirect
|
138 | # changelog.html
|
139 | # doc/
|
140 | # index.html
|
141 | # ...
|
142 | # test/ # results
|
143 | # spec.wwz/
|
144 | # machine-lisa/
|
145 | # wild.wwz/
|
146 | # unit.wwz/
|
147 | # other.wwz/
|
148 | # gold.txt
|
149 | # parse-errors.txt
|
150 | # runtime-errors.txt
|
151 | # tools-deps.txt
|
152 | # osh-usage.txt
|
153 | # lossless.txt
|
154 | # tarball/ # log of building and running the tarball?
|
155 | # asan/ # spec tests or other?
|
156 | # # or it can be put under test/{spec,wild}
|
157 | # metrics.wwz/ # static metrics on source code?
|
158 | # line-counts/
|
159 | # nativedeps.txt (build/stats.sh line counts)
|
160 | # bytecode size, number of PyCodeObject
|
161 | # number of functions, classes, etc.?
|
162 | # bytecode/bundle size (binary size on x86_64 is in ovm-build.sh)
|
163 | # tarball size?
|
164 | # coverage.wwz/
|
165 | # unified/ # clang-coverage
|
166 | # benchmarks.wwz/
|
167 | # compute
|
168 | # osh-parser/
|
169 | # osh-runtime/
|
170 | # vm-baseline/
|
171 | # ...
|
172 | # startup/
|
173 | # download/ # What about native binaries?
|
174 | # 0.0.0/
|
175 | # oil-0.0.0.tar.xz
|
176 |
|
177 | _test-tarball() {
|
178 | local name=${1:-hello}
|
179 | local version=${2:-0.0.0}
|
180 | local install=${3:-}
|
181 |
|
182 | local tmp=_tmp/${name}-tar-test
|
183 | rm -r -f $tmp
|
184 | mkdir -p $tmp
|
185 |
|
186 | pushd $tmp
|
187 | tar --extract -z < ../../_release/$name-$version.tar.gz
|
188 |
|
189 | cd $name-$version
|
190 | ./configure
|
191 |
|
192 | # Build the fast one for a test.
|
193 | # TODO: Maybe edit the Makefile to change the top target.
|
194 | local bin=_bin/${name}.ovm # not dbg
|
195 | time make $bin
|
196 | $bin --version
|
197 |
|
198 | if test -n "$install"; then
|
199 | sudo ./install
|
200 | fi
|
201 | popd
|
202 | }
|
203 |
|
204 | test-oil-tar() {
|
205 | local install=${1:-} # non-empty to install
|
206 | _test-tarball oil $(head -n 1 oils-version.txt) "$install"
|
207 | }
|
208 |
|
209 | _release-build() {
|
210 | # NOTE: deps/from-tar.sh {configure,build}-python is assumed
|
211 |
|
212 | # Build the oil tar
|
213 | $0 oil
|
214 |
|
215 | test-oil-tar
|
216 |
|
217 | # For _spec-sanity-check
|
218 | ln -s -f --no-target-directory -v oil.ovm $OSH_RELEASE_BINARY
|
219 | ln -s -f --no-target-directory -v oil.ovm $YSH_RELEASE_BINARY
|
220 | }
|
221 |
|
222 | readonly HAVE_ROOT=1
|
223 |
|
224 | readonly -a MORE_TESTS=(
|
225 | process-table
|
226 | gold
|
227 | ysh-ify
|
228 | parse-errors runtime-errors
|
229 | ysh-runtime-errors
|
230 | ysh-parse-errors
|
231 | ysh-every-string
|
232 | lossless
|
233 | osh-usage tools-deps
|
234 | syscall
|
235 | )
|
236 | # TODO: Unify with CI, and clean up
|
237 | # doc/error-catalog.sh
|
238 | # data_lang/j8-errors.sh
|
239 | # ysh/run.sh
|
240 |
|
241 | run-more-tests() {
|
242 | for name in "${MORE_TESTS[@]}"; do
|
243 | case $name in
|
244 | gold)
|
245 | if test -n "${OILS_HIJACK_SHEBANG:-}"; then
|
246 | cat >&2 <<'EOF'
|
247 | =====
|
248 | WARNING: Skipping gold tests because $OILS_HIJACK_SHEBANG is set.'
|
249 | Run them manually with:
|
250 |
|
251 | test/gold.sh run-for-release
|
252 | =====
|
253 | EOF
|
254 | continue
|
255 | fi
|
256 | ;;
|
257 | *)
|
258 | banner "Test suite: $name"
|
259 | ;;
|
260 | esac
|
261 |
|
262 | test/$name.sh run-for-release
|
263 | done
|
264 |
|
265 | ysh/run.sh run-for-release
|
266 |
|
267 | data_lang/j8-errors.sh run-for-release
|
268 | }
|
269 |
|
270 | _spec-sanity-check() {
|
271 | # Quick early test for _bin/osh and _bin/ysh
|
272 |
|
273 | # TODO: Use --ovm-bin-dir
|
274 | # Note: MAX_PROCS=1 prevents [#oil-dev > Random Spec Test Stoppages]
|
275 | # Still need to fix that bug
|
276 | MAX_PROCS=1 NUM_SPEC_TASKS=2 OSH_LIST="$OSH_RELEASE_BINARY" test/spec-py.sh osh-all
|
277 | MAX_PROCS=1 NUM_SPEC_TASKS=2 YSH_LIST="$YSH_RELEASE_BINARY" test/spec-py.sh ysh-all
|
278 | }
|
279 |
|
280 | spec-all() {
|
281 | ### Run all spec tests
|
282 |
|
283 | test/stateful.sh soil-run # Same as CI
|
284 |
|
285 | # Create the tests we're running
|
286 | test/smoosh.sh make-spec
|
287 |
|
288 | # TODO: Use --ovm-bin-dir
|
289 | export OSH_LIST="$REPO_ROOT/bin/osh $OSH_RELEASE_BINARY"
|
290 | export YSH_LIST="$REPO_ROOT/bin/ysh $YSH_RELEASE_BINARY"
|
291 | test/spec-py.sh all-and-smoosh
|
292 |
|
293 | # Build $OSH_CPP_BENCHMARK_DATA
|
294 | _build-oils-benchmark-data
|
295 |
|
296 | # TODO: Use --oils-cpp-bin-dir
|
297 | # Collect and publish stats about the C++ translation.
|
298 | OSH_CC="$OSH_CPP_BENCHMARK_DATA" test/spec-cpp.sh osh-all
|
299 | YSH_CC="$YSH_CPP_BENCHMARK_DATA" test/spec-cpp.sh ysh-all
|
300 | }
|
301 |
|
302 | spec-cpp() {
|
303 | ### For repair
|
304 |
|
305 | # TODO: Use --oils-cpp-bin-dir
|
306 |
|
307 | # Quick
|
308 | # NUM_SPEC_TASKS=2 OSH_CC="$OSH_CPP_BENCHMARK_DATA" test/spec-cpp.sh all
|
309 | OSH_CC="$OSH_CPP_BENCHMARK_DATA" test/spec-cpp.sh all
|
310 | }
|
311 |
|
312 | # For quickly debugging failures that don't happen in dev mode.
|
313 | spec-one() {
|
314 | export OSH_LIST="$REPO_ROOT/bin/osh $OSH_RELEASE_BINARY"
|
315 | export YSH_LIST="$REPO_ROOT/bin/ysh $YSH_RELEASE_BINARY"
|
316 | test/spec.sh "$@"
|
317 | }
|
318 |
|
319 | build-and-test() {
|
320 | ### Build tarballs and test them. And preliminaries like unit tests.
|
321 |
|
322 | # TODO: Log this whole thing? Include logs with the /release/ page?
|
323 |
|
324 | # Before doing anything
|
325 | test/lint.sh soil-run
|
326 |
|
327 | test/unit.sh run-for-release # Python unit tests
|
328 |
|
329 | test/coverage.sh run-for-release # C++ unit tests
|
330 |
|
331 | # App bundle
|
332 | _release-build
|
333 |
|
334 | # TODO: test oils-for-unix in Alpine chroot too.
|
335 | # NOTE: Need test/alpine.sh download;extract;setup-dns,add-oil-build-deps,
|
336 | # etc.
|
337 | if test -n "$HAVE_ROOT"; then
|
338 | # TODO: Factor out test/alpine.sh to test/chroot.sh
|
339 | test/alpine.sh copy-tar '' oil
|
340 | test/alpine.sh test-tar '' oil
|
341 | fi
|
342 |
|
343 | test/spec.sh smoke # Initial smoke test, slightly redundant.
|
344 |
|
345 | run-more-tests
|
346 | }
|
347 |
|
348 | _install() {
|
349 | test/spec-bin.sh install-shells-with-apt
|
350 |
|
351 | # A subset of build/py.sh ubuntu-deps. (Do we need build-essential?)
|
352 | #sudo apt install python-dev
|
353 | }
|
354 |
|
355 | _build-oils-benchmark-data() {
|
356 | pushd $BENCHMARK_DATA_OILS
|
357 | ./configure
|
358 | for variant in dbg opt; do
|
359 | # DWARF version 4 is a hack for bloaty, which doesn't support version 5.
|
360 | # I don't think this should affect benchmarks besides
|
361 | # metrics/native-code.sh, so we don't bother building a separate binary.
|
362 | # The Soil CI runs without this flag.
|
363 | CXXFLAGS=-gdwarf-4 _build/oils.sh --variant "$variant" --skip-rebuild
|
364 | done
|
365 | popd
|
366 | }
|
367 |
|
368 | benchmark-build() {
|
369 | ### Build function on machine 2.
|
370 |
|
371 | build/clean.sh
|
372 | if test -n "$HAVE_ROOT"; then
|
373 | _install
|
374 | fi
|
375 | build/py.sh all
|
376 | _release-build
|
377 | }
|
378 |
|
379 | # Run benchmarks with the binary built out of the tarball.
|
380 | benchmark-run() {
|
381 | local do_machine1=${1:-}
|
382 |
|
383 | _build-oils-benchmark-data
|
384 | OSH_OVM=$OSH_RELEASE_BINARY benchmarks/auto.sh all "$do_machine1"
|
385 | }
|
386 |
|
387 | _compressed-tarball() {
|
388 | local name=${1:-hello}
|
389 | local version=${2:-0.0.0}
|
390 |
|
391 | local in=_release/$name.tar
|
392 | local out=_release/$name-$version.tar.gz
|
393 |
|
394 | # Overwrite it to cause rebuild of oil.tar
|
395 | build/stamp.sh write-release-date
|
396 |
|
397 | #make -d -r $in # To debug
|
398 | make $in
|
399 | time gzip -c $in > $out
|
400 | ls -l $out
|
401 |
|
402 | # xz version is considerably smaller. 1.15 MB vs. 1.59 MB.
|
403 | local out2=_release/$name-$version.tar.xz
|
404 | time xz -c $in > $out2
|
405 | ls -l $out2
|
406 | }
|
407 |
|
408 | oil() {
|
409 | _compressed-tarball oil $OIL_VERSION
|
410 | }
|
411 |
|
412 | hello() {
|
413 | _compressed-tarball hello $(head -n 1 build/testdata/hello-version.txt)
|
414 | }
|
415 |
|
416 |
|
417 | _link() {
|
418 | ln -s -f -v --no-target-directory "$@"
|
419 | }
|
420 |
|
421 | compress() {
|
422 | local root=$PWD/_release/VERSION/
|
423 |
|
424 | log '--- more-tests'
|
425 | local out="$root/more-tests.wwz"
|
426 | pushd _tmp
|
427 | time zip -r -q $out suite-logs unit syscall process-table
|
428 | popd
|
429 |
|
430 | # This has HTML reports, .profraw files, and logs of stdout, e.g.
|
431 | # mycpp-unit/gc_heap_test.log
|
432 | # About 1.5 MB
|
433 | log "--- coverage"
|
434 | local out="$root/test/coverage.wwz"
|
435 | pushd _test/clang-coverage
|
436 | # This also saves the logs
|
437 | time zip -r -q $out .
|
438 | popd
|
439 |
|
440 | log "--- test/spec"
|
441 | local out="$root/test/spec.wwz"
|
442 | pushd _tmp/spec
|
443 | time zip -r -q $out . # recursive, quiet
|
444 | popd
|
445 |
|
446 | log "--- test/wild"
|
447 | local out="$root/test/wild.wwz"
|
448 | pushd _tmp/wild-www
|
449 | time zip -r -q $out . # recursive, quiet
|
450 | popd
|
451 |
|
452 | # NOTE: must be /pub/metrics.wwz so that relative URLs like
|
453 | # ../../../web/line-counts.css work. The Soil UI also relies on such
|
454 | # relative URLs.
|
455 | log "--- metrics"
|
456 | local out="$root/pub/metrics.wwz"
|
457 | pushd _tmp/metrics
|
458 | time zip -r -q $out . # recursive, quiet
|
459 | popd
|
460 |
|
461 | # Ditto: pub/src-tree.wwz lines up with URLs in Soil
|
462 | log "--- src-tree"
|
463 | local out="$root/pub/src-tree.wwz"
|
464 | pushd _tmp/src-tree-www
|
465 | time zip -r -q $out . # recursive, quiet
|
466 | popd
|
467 |
|
468 | compress-benchmarks
|
469 |
|
470 | tree _release/VERSION
|
471 | }
|
472 |
|
473 | compress-benchmarks() {
|
474 | local root=$PWD/_release/VERSION/
|
475 | mkdir -p $root
|
476 |
|
477 | log "--- benchmarks"
|
478 |
|
479 | local out="$root/benchmarks.wwz"
|
480 |
|
481 | # - For benchmarks that run on multiple machines, technically we only need
|
482 | # index.html, but include stage1 and stage2.
|
483 | # - For those that run on single machines, we also archive the raw/ dir.
|
484 | # - Although benchmarks/compute is saved in oilshell/benchmark-data
|
485 | # - Note: _tmp/uftrace/{raw,stage1} are big (hundreds of MB), so leave them
|
486 | # out
|
487 |
|
488 | pushd _tmp
|
489 | find \
|
490 | osh-parser/{stage1,stage2,index.html} \
|
491 | osh-runtime/{stage1,stage2,index.html} \
|
492 | vm-baseline/{stage1,stage2,index.html} \
|
493 | ovm-build/{stage1,stage2,index.html} \
|
494 | compute/{raw,stage1,stage2,index.html} \
|
495 | gc/{raw,stage2,index.html} \
|
496 | gc-cachegrind/{raw,stage2,index.html} \
|
497 | mycpp-examples/{raw,stage2,index.html} \
|
498 | uftrace/{stage2,index.html} \
|
499 | -type f \
|
500 | | xargs --verbose -- zip -q $out
|
501 | popd
|
502 | }
|
503 |
|
504 | line-counts() {
|
505 | local out_dir=$1 # should be an absolute path
|
506 | mkdir -p $out_dir
|
507 |
|
508 | # Counting directly from the build.
|
509 | metrics/tarball.sh linecount-pydeps > $out_dir/pydeps.txt
|
510 | metrics/tarball.sh linecount-nativedeps > $out_dir/nativedeps.txt
|
511 | metrics/tarball.sh linecount-oils-cpp > $out_dir/oils-cpp.txt
|
512 |
|
513 | metrics/source-code.sh write-reports $out_dir # for-translation and overview
|
514 | metrics/source-code.sh cloc-report > $out_dir/cloc-report.txt
|
515 |
|
516 | # goes to _tmp/metrics/preprocessed
|
517 | metrics/source-code.sh preprocessed
|
518 | }
|
519 |
|
520 | metrics() {
|
521 | local out=_tmp/metrics
|
522 | mkdir -p $out
|
523 |
|
524 | line-counts $PWD/$out/line-counts
|
525 |
|
526 | # For another .wwz file
|
527 | doctools/src-tree.sh soil-run
|
528 |
|
529 | metrics/bytecode.sh run-for-release
|
530 | metrics/native-code.sh run-for-release
|
531 | # Disabled 2024-12
|
532 | # build/cpython-defs.sh run-for-release
|
533 |
|
534 | tree $out
|
535 | }
|
536 |
|
537 | deploy-doc() {
|
538 | local deploy_repo='../oils.pub__deploy'
|
539 | local release_root_dir="$deploy_repo/release"
|
540 | local release_dir="$release_root_dir/$OIL_VERSION"
|
541 |
|
542 | mkdir -p $release_dir
|
543 | cp -v -r --force --no-target-directory \
|
544 | _release/VERSION/ $release_dir/
|
545 |
|
546 | # Generate release index.
|
547 | html-index $release_root_dir _tmp/releases.html
|
548 | cp -v _tmp/releases.html $deploy_repo
|
549 |
|
550 | tree -L 3 $release_root_dir
|
551 |
|
552 | ls -l $deploy_repo/releases.html
|
553 | }
|
554 |
|
555 | readonly DOWNLOAD_DIR='../oils.pub__deploy/download/'
|
556 |
|
557 | # Generating releases.html requires the old tarballs!
|
558 | sync-old-tar() {
|
559 | local user=$1 # required username
|
560 | rsync --archive --verbose \
|
561 | $user@oilshell.org:oilshell.org/download/ $DOWNLOAD_DIR
|
562 | }
|
563 |
|
564 | # I think these aren't checked into git? They can just be managed separately?
|
565 | # Or should you check in the sha checksums? Those will be in releases.html,
|
566 | # but a CSV might be nice.
|
567 | deploy-tar() {
|
568 | mkdir -p $DOWNLOAD_DIR
|
569 |
|
570 | cp -v \
|
571 | _release/oil-$OIL_VERSION.tar.* _release/oils-for-unix-$OIL_VERSION.tar.* \
|
572 | $DOWNLOAD_DIR
|
573 |
|
574 | ls -l $DOWNLOAD_DIR
|
575 | }
|
576 |
|
577 | #
|
578 | # Generate releases.html.
|
579 | #
|
580 |
|
581 | # Examples of similar release HTML pages:
|
582 | # - https://golang.org/dl/ - "Older versions", sha1 / sha256.
|
583 | # - Python has all point releases in chronological order, and then a separate
|
584 | # page for each changelog. There is too much boilerplate maybe?
|
585 | # - It has release notes before the downloads. Not sure I like that.
|
586 | # - node.js: https://nodejs.org/en/
|
587 | # - user agent detection for the right binary -- meh I don't want that
|
588 | # - Ruby: https://www.ruby-lang.org/en/downloads/releases/
|
589 | # - https://www.lua.org/download.html
|
590 |
|
591 | # Columns: Date / Version / Docs / / Files
|
592 | # Changelog .xz
|
593 | # Install
|
594 | # Docs/
|
595 | #
|
596 | # The files could be a separate page and separate table? I could provide
|
597 | # pre-built versions eventually? Linux static versions?
|
598 |
|
599 | # TODO: Each of these would be a good candidate for a data frame! Data vs.
|
600 | # presentation.
|
601 |
|
602 | # Simple UI:
|
603 | # - home page shows latest version (source release for now, binary release later?)
|
604 | # - link to Changelog, INSTALL, doc index
|
605 | # - or see all releases
|
606 | # - Grey out older releases?
|
607 |
|
608 | # TODO: Should be sorted by date? How to do that, with bash array? Or Awk?
|
609 | # $timestamp $version $timestamp file? And then sort -n I guess? Change
|
610 | # the release date format. It will use Unix timestamp (OK until 2038!)
|
611 |
|
612 | _html-index() {
|
613 | local release_root_dir=$1 # the directory we want to make an index of
|
614 |
|
615 | for entry in $release_root_dir/*; do
|
616 | if ! test -d $entry; then
|
617 | continue
|
618 | fi
|
619 | local dir=$entry
|
620 |
|
621 | local version
|
622 | version=$(head -n 1 $dir/oils-version.txt)
|
623 | local release_date
|
624 | release_date=$(head -n 1 $dir/release-date.txt)
|
625 |
|
626 | log "-- $dir"
|
627 | log "Version: $version"
|
628 | log "Release Date: $release_date"
|
629 | log ""
|
630 |
|
631 | echo "$release_date $version"
|
632 | done > _tmp/release-meta.txt
|
633 |
|
634 | # Reverse sort by release date
|
635 | sort -r _tmp/release-meta.txt > _tmp/sorted-releases.txt
|
636 |
|
637 | while read date _ version; do
|
638 | log "Release Date: $date"
|
639 | log "Version: $version"
|
640 |
|
641 | # anchor
|
642 | cat <<EOF
|
643 | <tr>
|
644 | <td>
|
645 | <span class="date">$date</span>
|
646 | </td>
|
647 | <td>
|
648 | <a name="$version"></a>
|
649 | <span class="version-number">$version</span>
|
650 | </td>
|
651 | <td>
|
652 | <p> <a href="release/$version/announcement.html">Announcement</a>
|
653 | | <a href="release/$version/">Docs and Details</a>
|
654 | </p>
|
655 | </td>
|
656 | </tr>
|
657 | EOF
|
658 |
|
659 | build/doc.sh tarball-links-row-html $version
|
660 |
|
661 | cat <<EOF
|
662 | <tr>
|
663 | <td colspan="3">
|
664 | <div style="padding: 1em;" >
|
665 | </div>
|
666 | </td>
|
667 | </tr>
|
668 |
|
669 | EOF
|
670 |
|
671 | done < _tmp/sorted-releases.txt
|
672 | }
|
673 |
|
674 | _releases-html-header() {
|
675 | # TODO: use html-head here, and publish web/*.css somewhere outside of
|
676 | # /release/$VERSION/? The list of all releases isn't versioned for obvious
|
677 | # reasons. Other docs are in the oilshell.org repo using the all-2020.css
|
678 | # bundle.
|
679 |
|
680 | cat <<EOF
|
681 | <!DOCTYPE html>
|
682 | <html>
|
683 | <head>
|
684 | <meta name="viewport" content="width=device-width, initial-scale=1">
|
685 | <title>Oils Releases</title>
|
686 | <style>
|
687 | EOF
|
688 |
|
689 | cat web/base.css
|
690 | cat web/release-index.css
|
691 |
|
692 | cat <<EOF
|
693 | h1 {
|
694 | text-align: center;
|
695 | }
|
696 | </style>
|
697 | </head>
|
698 | <body class="width50">
|
699 | <p id="home-link">
|
700 | <a href="/">oils.pub</a>
|
701 | </p>
|
702 | <h1>Oils Releases</h1>
|
703 |
|
704 | <table class="release-table">
|
705 | EOF
|
706 | }
|
707 |
|
708 | html-index() {
|
709 | local release_root_dir=$1
|
710 | local out=${2:-_tmp/releases.html}
|
711 |
|
712 | { _releases-html-header
|
713 | _html-index $release_root_dir
|
714 |
|
715 | cat <<EOF
|
716 | </table>
|
717 | </body>
|
718 | </html>
|
719 | EOF
|
720 |
|
721 | } > $out
|
722 |
|
723 | ls -l $out
|
724 | }
|
725 |
|
726 | # For quickly iterating on tarball size reductions.
|
727 | tarball-size() {
|
728 | make clean-repo
|
729 | make _bin/oil.ovm-dbg # faster way to build bytecode
|
730 | oil # make tarball
|
731 | test-oil-tar # Ctrl-C this, then run metrics/tarball.sh
|
732 | }
|
733 |
|
734 | dep-smoosh() {
|
735 | local repo=~/git/languages/smoosh
|
736 | if ! test -d $repo; then
|
737 | local base_dir=$(dirname $repo)
|
738 | mkdir -p $base_dir
|
739 | pushd $base_dir
|
740 | git clone git@github.com:mgree/smoosh.git
|
741 | popd
|
742 | fi
|
743 | }
|
744 |
|
745 | dep-benchmarks() {
|
746 | ### Before auto-machine2
|
747 |
|
748 | # 2023-07: Also need deps/from-tar.sh {configure,build}-cpython
|
749 |
|
750 | benchmarks/osh-runtime.sh download
|
751 | benchmarks/osh-runtime.sh extract
|
752 |
|
753 | benchmarks/ovm-build.sh download
|
754 | benchmarks/ovm-build.sh extract-other
|
755 |
|
756 | # For ovm-build benchmark.
|
757 | deps/from-binary.sh download-clang
|
758 | deps/from-binary.sh extract-clang
|
759 | }
|
760 |
|
761 | more-release-deps() {
|
762 | # List of deps that are NOT in soil/worker.sh here
|
763 | # https://github.com/oilshell/oil/issues/926
|
764 |
|
765 | # TODO: Make a container image for these.
|
766 | if false; then
|
767 | # TODO: Did this manually
|
768 | # test/alpine.sh
|
769 | # dep-alpine
|
770 |
|
771 | # test/smoosh.sh
|
772 | dep-smoosh
|
773 |
|
774 | dep-benchmarks
|
775 | fi
|
776 | }
|
777 |
|
778 | py-tarball() {
|
779 | local in=_release/oil.tar
|
780 | local out=_release/oil-$OIL_VERSION.tar.gz
|
781 |
|
782 | make $in
|
783 | time gzip -c $in > $out
|
784 | ls -l $out
|
785 |
|
786 | test-oil-tar
|
787 | }
|
788 |
|
789 | native-tarball() {
|
790 | # oils-for-unix
|
791 | devtools/release-native.sh make-tar
|
792 | # Also install as root
|
793 | devtools/release-native.sh extract-for-benchmarks INSTALL
|
794 | }
|
795 |
|
796 | two-tarballs() {
|
797 | ### First step of release. Assume that CI passes
|
798 |
|
799 | ensure-smooth-build
|
800 |
|
801 | build/py.sh all
|
802 | # "Base state" for repo scripts
|
803 | ./NINJA-config.sh
|
804 |
|
805 | py-tarball
|
806 |
|
807 | native-tarball
|
808 | }
|
809 |
|
810 | upload-tmp() {
|
811 | local tarball=$1
|
812 | local user=$2
|
813 |
|
814 | scp $tarball $user@oilshell.org:tmp/
|
815 | }
|
816 |
|
817 | sync-tmp() {
|
818 | local user=$1
|
819 | local dest=${2:-_tmp/candidates}
|
820 | mkdir -p $dest
|
821 | rsync --archive --verbose $user@oilshell.org:tmp/ $dest
|
822 | }
|
823 |
|
824 | "$@"
|