| 1 | #!/usr/bin/env bash
 | 
| 2 | #
 | 
| 3 | # Usage:
 | 
| 4 | #   devtools/release-note.sh <function name>
 | 
| 5 | #
 | 
| 6 | # Example:
 | 
| 7 | #   $0 fetch-issues
 | 
| 8 | #   $0 write-template
 | 
| 9 | 
 | 
| 10 | set -o nounset
 | 
| 11 | set -o pipefail
 | 
| 12 | set -o errexit
 | 
| 13 | 
 | 
| 14 | source build/dev-shell.sh  # PYTHONPATH
 | 
| 15 | source devtools/release-version.sh  # for escape-segments
 | 
| 16 | 
 | 
| 17 | readonly OILS_VERSION=$(head -n 1 oil-version.txt)
 | 
| 18 | readonly PREV_VERSION='0.21.0'
 | 
| 19 | 
 | 
| 20 | # adapted from release-version.sh
 | 
| 21 | _git-changelog-body() {
 | 
| 22 |   local commit=$1
 | 
| 23 | 
 | 
| 24 |   # - a trick for HTML escaping (avoid XSS): surround %s with unlikely bytes,
 | 
| 25 |   #   \x00 and \x01.  Then pipe Python to escape.
 | 
| 26 |   # --reverse makes it go in forward chronlogical order.
 | 
| 27 | 
 | 
| 28 |   # %x00 generates the byte \x00
 | 
| 29 |   local format='<tr>
 | 
| 30 |     <td><a class="checksum"
 | 
| 31 |            href="https://github.com/oilshell/oil/commit/%H">%h</a>
 | 
| 32 |     </td>
 | 
| 33 |     <td>%x00%an%x01</td>
 | 
| 34 |     <td class="subject">%x00%s%x01</td>
 | 
| 35 |   </tr>'
 | 
| 36 |   git log \
 | 
| 37 |     --reverse \
 | 
| 38 |     --pretty="format:$format" \
 | 
| 39 |     --date=short \
 | 
| 40 |     -n 1 \
 | 
| 41 |     $commit \
 | 
| 42 |   | escape-segments
 | 
| 43 | }
 | 
| 44 | 
 | 
| 45 | contrib-commit-table() {
 | 
| 46 |   # Filter out my commits, then pass back to git log
 | 
| 47 | 
 | 
| 48 |   # 2023-07: Deoptimized due to git breakage
 | 
| 49 |   # https://stackoverflow.com/questions/6889830/equivalence-of-git-log-exclude-author
 | 
| 50 | 
 | 
| 51 |   git log --format='%H %an' "release/$PREV_VERSION..release/$OILS_VERSION" |
 | 
| 52 |     grep -v 'Andy C' |
 | 
| 53 |     cut -d ' ' -f 1  |
 | 
| 54 |     xargs -n 1 $0 _git-changelog-body
 | 
| 55 | 
 | 
| 56 |     #xargs -n 1 -- git log -n 1
 | 
| 57 | }
 | 
| 58 | 
 | 
| 59 | fetch-issues() {
 | 
| 60 |   local url='https://api.github.com/repos/oilshell/oil/issues?labels=pending-release'
 | 
| 61 |   curl "$url" > _tmp/issues.json
 | 
| 62 | }
 | 
| 63 | 
 | 
| 64 | issues-table() {
 | 
| 65 |   cat _tmp/issues.json | devtools/services/github_issues.py
 | 
| 66 | }
 | 
| 67 | 
 | 
| 68 | readonly DATE_DIR=$(date +%Y/%m)
 | 
| 69 | readonly BLOG_DIR="../oilshell.org/blog/$DATE_DIR"
 | 
| 70 | 
 | 
| 71 | write-template() {
 | 
| 72 |   ### New blog post
 | 
| 73 | 
 | 
| 74 |   local out=$BLOG_DIR/_release-$OILS_VERSION.md
 | 
| 75 |   print-template > $out
 | 
| 76 |   echo "Wrote $out"
 | 
| 77 | }
 | 
| 78 | 
 | 
| 79 | write-zulip-thread() {
 | 
| 80 |   local bot_email=$1
 | 
| 81 |   local bot_api_key=$2
 | 
| 82 |   
 | 
| 83 |   local out=$BLOG_DIR/release-thread.txt
 | 
| 84 |   devtools/services/zulip.sh print-thread \
 | 
| 85 |     "$bot_email" "$bot_api_key" oil-dev "Oils $OILS_VERSION Release" \
 | 
| 86 |     | tee $out
 | 
| 87 | 
 | 
| 88 |   echo
 | 
| 89 |   echo "Wrote $out"
 | 
| 90 | }
 | 
| 91 | 
 | 
| 92 | preview-template() {
 | 
| 93 |   local out=_tmp/release-note.html
 | 
| 94 | 
 | 
| 95 |   # This isn't right because it doesn't split the --- front matter
 | 
| 96 |   # But good enough for now
 | 
| 97 | 
 | 
| 98 |   print-template | doctools/cmark.py > $out
 | 
| 99 |   log "Wrote $out"
 | 
| 100 | }
 | 
| 101 | 
 | 
| 102 | print-template() {
 | 
| 103 |   local metric_prev=${1:-$PREV_VERSION}
 | 
| 104 | 
 | 
| 105 |   cat <<EOF
 | 
| 106 | ---
 | 
| 107 | title: Oils $OILS_VERSION - Foo Foo
 | 
| 108 | date: $(date +%Y/%m/%d)
 | 
| 109 | css_file: blog-bundle-v6.css
 | 
| 110 | body_css_class: width35
 | 
| 111 | default_highlighter: oil-sh
 | 
| 112 | tags: oil-release
 | 
| 113 | comments_url: TODO
 | 
| 114 | published: no
 | 
| 115 | ---
 | 
| 116 | 
 | 
| 117 | This is the latest version of Oils, a Unix shell that's our upgrade path from
 | 
| 118 | [bash][]:
 | 
| 119 | 
 | 
| 120 | [bash]: \$xref
 | 
| 121 | 
 | 
| 122 | <div class="attention">
 | 
| 123 | 
 | 
| 124 | [Oils version $OILS_VERSION][release-index] - Source tarballs and documentation.
 | 
| 125 | 
 | 
| 126 | </div>
 | 
| 127 | 
 | 
| 128 | To build and run it, follow the instructions in [INSTALL.txt][].  The wiki has
 | 
| 129 | tips on [How To Test OSH](\$wiki).
 | 
| 130 | 
 | 
| 131 | If you're new to the project, see [Why Create a New Shell?][why-oil] and posts
 | 
| 132 | tagged #[FAQ](\$blog-tag).
 | 
| 133 | 
 | 
| 134 | [INSTALL.txt]: /release/$OILS_VERSION/doc/INSTALL.html
 | 
| 135 | [github-bugs]: https://github.com/oilshell/oil/issues
 | 
| 136 | [why-oil]: ../../2021/01/why-a-new-shell.html
 | 
| 137 | [release-index]: /release/$OILS_VERSION/
 | 
| 138 | 
 | 
| 139 | [oilshell.zulipchat.com]: http://oilshell.zulipchat.com/
 | 
| 140 | 
 | 
| 141 | <div id="toc">
 | 
| 142 | </div> 
 | 
| 143 | 
 | 
| 144 | I'm trying something different this release.  These release notes are
 | 
| 145 | semi-automated with a shell script!  See the [last
 | 
| 146 | post](../02/good-parts-sketch.html) in #[shell-the-good-parts](\$blog-tag).
 | 
| 147 | 
 | 
| 148 | ## Closed Issues
 | 
| 149 | 
 | 
| 150 | <table>
 | 
| 151 | EOF
 | 
| 152 | 
 | 
| 153 |   issues-table 
 | 
| 154 | 
 | 
| 155 |   cat <<EOF
 | 
| 156 | </table>
 | 
| 157 | 
 | 
| 158 | ## Commit Log
 | 
| 159 | 
 | 
| 160 | Here are the commits from other contributors.  You can also view the [full
 | 
| 161 | changelog][changelog].
 | 
| 162 | 
 | 
| 163 | [changelog]: /release/$OILS_VERSION/changelog.html
 | 
| 164 | 
 | 
| 165 | <table>
 | 
| 166 | EOF
 | 
| 167 | 
 | 
| 168 |   contrib-commit-table
 | 
| 169 | 
 | 
| 170 |   cat <<EOF
 | 
| 171 | </table>
 | 
| 172 | 
 | 
| 173 | ## Documentation Updated
 | 
| 174 | 
 | 
| 175 | - [Known Differences](/release/$OILS_VERSION/doc/known-differences.html)
 | 
| 176 | - [Interpreter State](/release/$OILS_VERSION/doc/interpreter-state.html) - still
 | 
| 177 | 	a draft.
 | 
| 178 | 
 | 
| 179 | ### Wiki Pages
 | 
| 180 | 
 | 
| 181 | - [How Interactive Shells Work](https://github.com/oilshell/oil/wiki/How-Interactive-Shells-Work)
 | 
| 182 | 
 | 
| 183 | 
 | 
| 184 | ## What's Next?
 | 
| 185 | 
 | 
| 186 | Here are some notable Open Issues
 | 
| 187 | 
 | 
| 188 | - [Provide APIs to allow users to write their own line editor / interactive
 | 
| 189 | interface](\$issue:663)
 | 
| 190 | 
 | 
| 191 | ## Appendix: Metrics for the $OILS_VERSION Release
 | 
| 192 | 
 | 
| 193 | These metrics help me keep track of the project.  Let's compare this release
 | 
| 194 | with the previous one, version [$metric_prev](/release/$metric_prev).
 | 
| 195 | 
 | 
| 196 | [spec-test]: \$xref:spec-test
 | 
| 197 | 
 | 
| 198 | ### Spec Tests
 | 
| 199 | 
 | 
| 200 | The Python reference implementation foo foo
 | 
| 201 | 
 | 
| 202 | - [OSH spec tests for $metric_prev](https://www.oilshell.org/release/$metric_prev/test/spec.wwz/osh-py/index.html): **2023** tests, 
 | 
| 203 | **1789** passing, **91** failing
 | 
| 204 | - [OSH spec tests for $OILS_VERSION](https://www.oilshell.org/release/$OILS_VERSION/test/spec.wwz/osh-py/index.html): **2042** tests, **1814** passing, **89** failing
 | 
| 205 | 
 | 
| 206 | And the C++ translation foo foo
 | 
| 207 | 
 | 
| 208 | - [C++ spec tests for $metric_prev](https://www.oilshell.org/release/$metric_prev/test/spec.wwz/osh-cpp/compare.html) - **1684** of **1792** passing
 | 
| 209 | - [C++ spec tests for $OILS_VERSION](https://www.oilshell.org/release/$OILS_VERSION/test/spec.wwz/osh-cpp/compare.html) - **1801** of **1817** passing
 | 
| 210 | 
 | 
| 211 | YSH got a lot of new behavior:
 | 
| 212 | 
 | 
| 213 | - [YSH spec tests for $metric_prev](https://www.oilshell.org/release/$metric_prev/test/spec.wwz/ysh-py/index.html): **561** tests, **514** passing, **47** failing
 | 
| 214 | - [YSH spec tests for $OILS_VERSION](https://www.oilshell.org/release/$OILS_VERSION/test/spec.wwz/ysh-py/index.html): **630** tests, **571** passing, **59** failing
 | 
| 215 | 
 | 
| 216 | And the C++ tarball is catching up rapidly:
 | 
| 217 | 
 | 
| 218 | - [YSH C++ spec tests for $metric_prev](https://www.oilshell.org/release/$metric_prev/test/spec.wwz/ysh-cpp/compare.html): **357** of **514** passing, delta **157**
 | 
| 219 | - [YSH C++ spec tests for $OILS_VERSION](https://www.oilshell.org/release/$OILS_VERSION/test/spec.wwz/ysh-cpp/compare.html): **492** of **569** passing, delta **77**
 | 
| 220 | 
 | 
| 221 | 
 | 
| 222 | ### Benchmarks
 | 
| 223 | 
 | 
| 224 | Bar Bar
 | 
| 225 | 
 | 
| 226 | - [Parser Performance for $metric_prev](https://www.oilshell.org/release/$metric_prev/benchmarks.wwz/osh-parser/): **21.8**
 | 
| 227 |   thousand irefs per line
 | 
| 228 | - [Parser Performance for $OILS_VERSION](https://www.oilshell.org/release/$OILS_VERSION/benchmarks.wwz/osh-parser/): **26.0**
 | 
| 229 |   thousand irefs per line
 | 
| 230 | 
 | 
| 231 | G G
 | 
| 232 | 
 | 
| 233 | - [benchmarks/gc for $metric_prev](https://www.oilshell.org/release/$metric_prev/benchmarks.wwz/gc/): \`parse.configure-coreutils\`
 | 
| 234 |   **1.83 M** objects comprising **62.1 MB**, max RSS **68.9 MB**
 | 
| 235 | - [benchmarks/gc for $OILS_VERSION](https://www.oilshell.org/release/$OILS_VERSION/benchmarks.wwz/gc/): \`parse.configure-coreutils\` **1.83 M** objects comprising **65.0 MB**, max RSS **69.3 MB**
 | 
| 236 | 
 | 
| 237 | G G
 | 
| 238 | 
 | 
| 239 | - [benchmarks/gc-cachegrind for $metric_prev](https://www.oilshell.org/release/$metric_prev/benchmarks.wwz/gc-cachegrind/) - \`fib\` takes **61.6** million irefs, mut+alloc+free+gc
 | 
| 240 | - [benchmarks/gc-cachegrind for $OILS_VERSION](https://www.oilshell.org/release/$OILS_VERSION/benchmarks.wwz/gc-cachegrind/) - \`fib\` takes **65.4** million irefs, mut+alloc+free+gc
 | 
| 241 | 
 | 
| 242 | 
 | 
| 243 | 
 | 
| 244 | Foo Foo
 | 
| 245 | 
 | 
| 246 | - [Runtime Performance for $metric_prev](https://www.oilshell.org/release/$metric_prev/benchmarks.wwz/osh-runtime/): **68.7** and **56.9** seconds running CPython's \`configure\`
 | 
| 247 | - [Runtime Performance for $OILS_VERSION](https://www.oilshell.org/release/$OILS_VERSION/benchmarks.wwz/osh-runtime/):
 | 
| 248 |   **35.2** and **22.5** seconds running CPython's \`configure\`
 | 
| 249 | - [bash](\$xref): **26.8** and **16.2** seconds running CPython's \`configure\`
 | 
| 250 | 
 | 
| 251 | 
 | 
| 252 | ### Code Size
 | 
| 253 | 
 | 
| 254 | The executable spec foo foo 
 | 
| 255 | 
 | 
| 256 | Significant lines:
 | 
| 257 | 
 | 
| 258 | - [cloc for $metric_prev](https://www.oilshell.org/release/$metric_prev/pub/metrics.wwz/line-counts/cloc-report.txt):
 | 
| 259 |   **19,581** lines of Python and C, **355** lines of ASDL
 | 
| 260 | - [cloc for $OILS_VERSION](https://www.oilshell.org/release/$OILS_VERSION/pub/metrics.wwz/line-counts/cloc-report.txt):
 | 
| 261 |   **19,491** lines of Python and C, **363** lines of ASDL
 | 
| 262 |   
 | 
| 263 | Code in the \`oils-for-unix\` C++ tarball, much of which is generated:
 | 
| 264 | 
 | 
| 265 | - [oil-cpp for $metric_prev](https://www.oilshell.org/release/$metric_prev/pub/metrics.wwz/line-counts/oil-cpp.txt) - **86,985** lines
 | 
| 266 | - [oil-cpp for $OILS_VERSION](https://www.oilshell.org/release/$OILS_VERSION/pub/metrics.wwz/line-counts/oil-cpp.txt) - **90,682** lines
 | 
| 267 | 
 | 
| 268 | Compiled binary size:
 | 
| 269 | 
 | 
| 270 | - [ovm-build for $metric_prev](https://www.oilshell.org/release/$metric_prev/benchmarks.wwz/ovm-build/):
 | 
| 271 |   **1.18 MB** of native code (under GCC)
 | 
| 272 | - [ovm-build for $OILS_VERSION](https://www.oilshell.org/release/$OILS_VERSION/benchmarks.wwz/ovm-build/):
 | 
| 273 |   **1.23 MB** of native code (under GCC)
 | 
| 274 | 
 | 
| 275 |  
 | 
| 276 | 
 | 
| 277 | EOF
 | 
| 278 | }
 | 
| 279 | 
 | 
| 280 | "$@"
 |