Page MenuHomeFreeBSD

Reorg newvers.sh to eliminate VARS_ONLY and do things more directly
ClosedPublic

Authored by imp on Apr 8 2019, 6:26 PM.

Details

Summary

This reduces the namespace pollution when used in this mode.

Convert amd newvers to VARS_ONLY mode

Rather than the tedious and error-prone grep of sys/conf/newvers.sh,
use the new VARS_ONLY mode to dig out the data that's desired.

Note: I've left the comment in newversh.sh for now. We'll revisit that
once I'm sure things have been sorted.

Convert freebsd-version to using VARS_ONLY

newvers.sh has supported a variable setting only mode, use that in
preference to grep to future proof this script from changes there.

Implement a better "VARS_ONLY" mode.

Add -v to print TYPE REVISION BRANCH RELEASE VERSION RELDATE variables
Add -V var to print var's value
Both of these in ${var}="${val}" format
Add -c to print the copyright text only.
Add -o to set VARS_ONLY=t, but this is viewed as a transient thing since
I'd like to eliminate that mode entirely.

A bunch of other changes to transition to VARS_ONLY

Test Plan
NOTE: This is a bunch of commits that I need to curate. I'm looking for a notion of where we're at at the end.

Diff Detail

Repository
rS FreeBSD src repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

imp created this revision.Apr 8 2019, 6:26 PM
imp updated this revision to Diff 55958.Apr 8 2019, 6:39 PM

Finish the transition

  • Implement a better "VARS_ONLY" mode.
  • Move to newvers.sh -v
  • Implement using -v
  • Move to using newvers -c instead of VARS_ONLY=1
  • Delete VARS_ONLY mode.
  • Add docs for -c, -v and -V. Remove obsolete comment.
imp retitled this revision from Move function definitions to after the VARS_ONLY exit to Reorg newvers.sh to eliminate VARS_ONLY and do things more directly.Apr 8 2019, 6:42 PM
imp edited the summary of this revision. (Show Details)
imp edited the test plan for this revision. (Show Details)
imp added reviewers: emaste, bcran, allanjude.
imp added inline comments.Apr 8 2019, 7:21 PM
bin/freebsd-version/Makefile
10 ↗(On Diff #55958)

This likely should start eval $${

imp updated this revision to Diff 57693.May 22 2019, 3:43 PM
  • Convert amd newvers to using newvers.sh -v.
  • Convert freebsd-version to using -v
  • Move to using newvers -c instead of VARS_ONLY=1
  • Delete VARS_ONLY mode.
imp updated this revision to Diff 57768.May 23 2019, 2:29 PM

rebase, and remove the removal of VARS_ONLY. it's likely used outside of the tree.

imp updated this revision to Diff 57783.May 23 2019, 4:39 PM

guard against newvers.sh not being executable when invoking it.

imp added a comment.May 23 2019, 4:40 PM

The kernel invokes newvers.sh with sh, so do the same for all these instances. It has no 'x' bit in my tree.

allanjude accepted this revision.May 23 2019, 4:43 PM

This is a nice cleanup, thank you.

This revision is now accepted and ready to land.May 23 2019, 4:43 PM
kevans accepted this revision.May 23 2019, 5:18 PM
This revision was automatically updated to reflect the committed changes.
emaste added a subscriber: zeising.May 31 2019, 1:56 PM
emaste added inline comments.
head/sys/conf/newvers.sh
109–113

Moving this breaks the default -R mode because ${modified} is not set at the time this is evaluated.

Reported by: @zeising

imp added inline comments.May 31 2019, 3:09 PM