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.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 11, 5:47 AM
Unknown Object (File)
Mon, Mar 11, 5:47 AM
Unknown Object (File)
Mon, Mar 11, 5:47 AM
Unknown Object (File)
Mon, Mar 11, 5:47 AM
Unknown Object (File)
Mon, Mar 11, 5:47 AM
Unknown Object (File)
Mon, Mar 11, 5:47 AM
Unknown Object (File)
Mon, Mar 11, 5:47 AM
Unknown Object (File)
Thu, Mar 7, 10:14 PM
Subscribers

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

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 23570
Build 22562: arc lint + arc unit

Event Timeline

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.
bin/freebsd-version/Makefile
10–11

This likely should start eval $${

  • 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.

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

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

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

This is a nice cleanup, thank you.

This revision is now accepted and ready to land.May 23 2019, 4:43 PM
This revision was automatically updated to reflect the committed changes.
emaste added inline comments.
head/sys/conf/newvers.sh
109–113 ↗(On Diff #57784)

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

Reported by: @zeising