Page MenuHomeFreeBSD

[draft] mfc-candidates: convert to Lua
ClosedPublic

Authored by emaste on Nov 3 2024, 5:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Dec 4 2024, 6:33 AM
Unknown Object (File)
Nov 25 2024, 1:41 AM
Unknown Object (File)
Nov 15 2024, 8:12 PM
Unknown Object (File)
Nov 7 2024, 12:27 PM
Subscribers

Details

Reviewers
imp
Group Reviewers
srcmgr
Commits
rG48f3fcabea80: mfc-candidates: Convert to Lua
Summary
d51c59002367 added a Lua script to process the lists of candidate and
completed MFC commits to address sorting issues in the original shell
implementation.

Instead of having a mix of shell and Lua, implement the entire tool
in Lua.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

emaste requested review of this revision.Nov 3 2024, 5:04 PM
emaste created this revision.
tools/tools/git/mfc-candidates.lua
11
54

I semi-mechanically converted this from shell. Should switch this to be done in Lua instead of invoking sed.

119

$(basename $0) needs updating

Luaify $(basename $0) and avoid invoking sed

kevans added inline comments.
tools/tools/git/mfc-candidates.lua
14

I'd probably wrap all of these io ops in assert()

20

Inconsistent style

37

assert

For reference, wall time listing my outstanding main>stable/14 candidates:

x main
+ D47416
+------------------------------------------------------------------------------+
|     +                                                     x                  |
|+   ++   +                                                 x     x        x  x|
| |___A__|                                                  |_____M_A_______|  |
+------------------------------------------------------------------------------+
    N           Min           Max        Median           Avg        Stddev
x   5          0.99          1.09          1.02         1.032   0.046043458
+   5          0.65           0.7          0.68         0.676   0.018165902
Difference at 95.0% confidence
        -0.356 +/- 0.0510455
        -34.4961% +/- 3.51838%
        (Student's t, pooled s = 0.035)
jhb added inline comments.
tools/tools/git/mfc-candidates.lua
8

Should the license comment be the first comment?

imp added inline comments.
tools/tools/git/mfc-candidates.lua
8

The current style that we've been promoting is to have the license stuff first and to have it in the order copyright, SPDX identifier, though I've not published that policy. that order is the most standard order in the rest of open source, though I know when we have big boiler plate files we list SPDX above the copyright.

rearrange SPDX, copyright header

This looks ready enough. I just had a quick question, one minor tweak that's optional and a general grump about command line parsing in Lua

tools/tools/git/mfc-candidates.lua
78

why 40?

130

maybe this should be 'os.getenv("FREEBSD_USER") or os.getenv("USER") or ""'

160

Option parsing is a big reason I've done things in python :)
or rather :(.

This revision is now accepted and ready to land.Nov 15 2024, 7:55 PM
tools/tools/git/mfc-candidates.lua
78

a git sha-1 hash is 40 characters

130

We don't have any existing use of FREEBSD_USER, right? This is to accommodate the case where someone's @freebsd.org user id does not match their local user, I presume? Yeah, I agree we should do something like that, but I'm not sure exactly what so would like to revisit this in a subsequent look.

160

yeah it's a bit janky

This revision was automatically updated to reflect the committed changes.