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 OIL_VERSION=$(head -n 1 oil-version.txt)
18 readonly PREV_VERSION='0.16.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/$OIL_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 write-template() {
69 ### New blog post
70
71 local date=$(date +%Y/%m)
72 local out=../oilshell.org/blog/$date/_release-$OIL_VERSION.md
73 print-template > $out
74 echo "Wrote $out"
75 }
76
77 preview-template() {
78 local out=_tmp/release-note.html
79
80 # This isn't right because it doesn't split the --- front matter
81 # But good enough for now
82
83 print-template | doctools/cmark.py > $out
84 log "Wrote $out"
85 }
86
87 print-template() {
88 local metric_prev=${1:-$PREV_VERSION}
89
90 cat <<EOF
91 ---
92 title: Oils $OIL_VERSION - Foo Foo
93 date: $(date +%Y/%m/%d)
94 css_file: blog-bundle-v6.css
95 body_css_class: width35
96 default_highlighter: oil-sh
97 tags: oil-release
98 comments_url: TODO
99 published: no
100 ---
101
102 This is the latest version of Oil, a Unix shell that's our upgrade path from
103 [bash][]:
104
105 [bash]: \$xref
106
107 <div class="attention">
108
109 [Oil version $OIL_VERSION][release-index] - Source tarballs and documentation.
110
111 </div>
112
113 To build and run it, follow the instructions in [INSTALL.txt][]. The wiki has
114 tips on [How To Test OSH](\$wiki).
115
116 If you're new to the project, see [Why Create a New Shell?][why-oil] and posts
117 tagged #[FAQ](\$blog-tag).
118
119 [INSTALL.txt]: /release/$OIL_VERSION/doc/INSTALL.html
120 [github-bugs]: https://github.com/oilshell/oil/issues
121 [why-oil]: ../../2021/01/why-a-new-shell.html
122 [release-index]: /release/$OIL_VERSION/
123
124 [oilshell.zulipchat.com]: http://oilshell.zulipchat.com/
125
126 <div id="toc">
127 </div>
128
129 I'm trying something different this release. These release notes are
130 semi-automated with a shell script! See the [last
131 post](../02/good-parts-sketch.html) in #[shell-the-good-parts](\$blog-tag).
132
133 ## Closed Issues
134
135 <table>
136 EOF
137
138 issues-table
139
140 cat <<EOF
141 </table>
142
143 ## Commit Log
144
145 Here are the commits from other contributors. You can also view the [full
146 changelog][changelog].
147
148 [changelog]: /release/$OIL_VERSION/changelog.html
149
150 <table>
151 EOF
152
153 contrib-commit-table
154
155 cat <<EOF
156 </table>
157
158 ## Documentation Updated
159
160 - [Known Differences](/release/$OIL_VERSION/doc/known-differences.html)
161 - [Interpreter State](/release/$OIL_VERSION/doc/interpreter-state.html) - still
162 a draft.
163
164 ### Wiki Pages
165
166 - [How Interactive Shells Work](https://github.com/oilshell/oil/wiki/How-Interactive-Shells-Work)
167
168
169 ## What's Next?
170
171 Here are some notable Open Issues
172
173 - [Provide APIs to allow users to write their own line editor / interactive
174 interface](\$issue:663)
175
176 ## Appendix: Metrics for the $OIL_VERSION Release
177
178 These metrics help me keep track of the project. Let's compare this release
179 with the previous one, version [$metric_prev](/release/$metric_prev).
180
181 [spec-test]: \$xref:spec-test
182
183 ### Spec Tests
184
185 The Python reference implementation foo foo
186
187 - [OSH spec tests for $metric_prev](https://www.oilshell.org/release/$metric_prev/test/spec.wwz/survey/osh.html): **2023** tests,
188 **1789** passing, **91** failing
189 - [OSH spec tests for $OIL_VERSION](https://www.oilshell.org/release/$OIL_VERSION/test/spec.wwz/survey/osh.html): **2042** tests, **1814** passing, **89** failing
190
191 And the C++ translation foo foo
192
193 - [C++ spec tests for $metric_prev](https://www.oilshell.org/release/$metric_prev/test/spec.wwz/cpp/osh-summary.html) - **1684** of **1792** passing
194 - [C++ spec tests for $OIL_VERSION](https://www.oilshell.org/release/$OIL_VERSION/test/spec.wwz/cpp/osh-summary.html) - **1801** of **1817** passing
195
196 ---
197
198 YSH / Oil foo foo
199
200 - [Oil spec tests for $metric_prev](https://www.oilshell.org/release/$metric_prev/test/spec.wwz/oil-language/oil.html): **502** tests, **464** passing, **38** failing
201 - [Oil spec tests for $OIL_VERSION](https://www.oilshell.org/release/$OIL_VERSION/test/spec.wwz/oil-language/oil.html): **506** tests, **466** passing, **40** failing
202
203
204 ### Benchmarks
205
206 Bar Bar
207
208 - [Parser Performance for $metric_prev](https://www.oilshell.org/release/$metric_prev/benchmarks.wwz/osh-parser/): **21.8**
209 thousand irefs per line
210 - [Parser Performance for $OIL_VERSION](https://www.oilshell.org/release/$OIL_VERSION/benchmarks.wwz/osh-parser/): **26.0**
211 thousand irefs per line
212
213 Foo Foo
214
215 - [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\`
216 - [Runtime Performance for $OIL_VERSION](https://www.oilshell.org/release/$OIL_VERSION/benchmarks.wwz/osh-runtime/):
217 **35.2** and **22.5** seconds running CPython's \`configure\`
218 - [bash](\$xref): **26.8** and **16.2** seconds running CPython's \`configure\`
219
220
221 ### Code Size
222
223 The executable spec foo foo
224
225 Significant lines:
226
227 - [cloc for $metric_prev](https://www.oilshell.org/release/$metric_prev/pub/metrics.wwz/line-counts/osh-cloc.txt):
228 **19,581** lines of Python and C, **355** lines of ASDL
229 - [cloc for $OIL_VERSION](https://www.oilshell.org/release/$OIL_VERSION/pub/metrics.wwz/line-counts/osh-cloc.txt):
230 **19,491** lines of Python and C, **363** lines of ASDL
231
232 Code in the \`oils-for-unix\` C++ tarball, much of which is generated:
233
234 - [oil-cpp for $metric_prev](https://www.oilshell.org/release/$metric_prev/pub/metrics.wwz/line-counts/oil-cpp.txt) - **86,985** lines
235 - [oil-cpp for $OIL_VERSION](https://www.oilshell.org/release/$OIL_VERSION/pub/metrics.wwz/line-counts/oil-cpp.txt) - **90,682** lines
236
237 Compiled binary size:
238
239 - [ovm-build for $metric_prev](https://www.oilshell.org/release/$metric_prev/benchmarks.wwz/ovm-build/):
240 **1.18 MB** of native code (under GCC)
241 - [ovm-build for $OIL_VERSION](https://www.oilshell.org/release/$OIL_VERSION/benchmarks.wwz/ovm-build/):
242 **1.23 MB** of native code (under GCC)
243
244 &nbsp;
245
246 EOF
247 }
248
249 "$@"