Solved Create a poor mans linter on make.conf and options files.

In /etc/make.conf you can easily put :
Code:
OPTIONS_SET+=JOHN_WAYNE
OPTIONS_UNSET+=LORNE_GREENE

I want to create a list of all possible options and then check all options lines in make.conf which don't contain any valid option ?
This does not look too complicated ? With a few grep /awk / .etc ... lines .
Maybe use the output of "pkg roptions" ?

[ & The same for the OPTIONS_FILE_SET/UNSET in options files ]
 
If i'm correct the following line gives me all possible options line by line
Code:
pkg roptions | awk '{print $3}' | sort | uniq | sed s/':'//

Now somehow i must check if each line make.conf contains in word as result of previous script ?
 
It was easier than expected,
Code:
pkg roptions | awk '{print $3}' | sort | uniq | sed s/':'// > allportoptions
grep -Fwv -f allportoptions make.conf
 
Try this: Write a script that takes the makefile, and finds all the lines that set or unset options. Having found those, systematically modify or remove them one at a time. Like replace the first line from your example above with "OPTIONS_SET+=CLEAVON_LITTLE", or outright remove it (because we don't need a sheriff in town). Then rerun make. If the make still succeeds, even with that line removed or changed, then the line was not needed.
 
Back
Top