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