Page MenuHomeFreeBSD

Fix opt_VARS premature expansion
ClosedPublic

Authored by AMDmi3 on Sep 24 2015, 1:13 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 28, 11:17 AM
Unknown Object (File)
Sun, Nov 24, 11:19 PM
Unknown Object (File)
Fri, Nov 22, 12:23 PM
Unknown Object (File)
Fri, Nov 22, 11:32 AM
Unknown Object (File)
Wed, Nov 20, 1:32 PM
Unknown Object (File)
Wed, Nov 20, 12:12 AM
Unknown Object (File)
Mon, Nov 18, 4:07 PM
Unknown Object (File)
Nov 14 2024, 3:26 PM
Subscribers

Details

Reviewers
None
Group Reviewers
portmgr
Commits
rP398258: Fix opt_VARS premature expansion.
Summary

Due to .for loop, opt_VARS are expanded early during bsd.options.mk evaluation, which makes it impossible to use some vars which are set/modifies afterwards (such as PREFIX or PKGDIR)

Fix this by changing opt_VARS handling logic:

  • Loop not by words (each word here is single VAR=val / VAR+=val tuple) but by unique left sides of assignments (VAR, VAR+ here)
  • Using the left side, extract all corresponding right sides and append/assign them to a variable

This way right sides are not expanded preliminary and opt_VARS work as expected.

This also allows either logic for duplicated assignments:

opt_VAR= FOO=one FOO=two

currently leads to FOO=two, however if :[-1] is removed from the patch, this will lead to FOO=one two.
The current approach seems more consistent though, and there is still a way to assign multiple values with FOO="one two"

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

AMDmi3 retitled this revision from to Fix opt_VARS premature expansion.
AMDmi3 updated this object.
AMDmi3 edited the test plan for this revision. (Show Details)
antoine added inline comments.
Mk/bsd.options.mk
482 ↗(On Diff #8920)

Does this syntax work with fmake?

AMDmi3 edited edge metadata.

Fix fmake compatibility

  • _u workaround as apparently var can't be used directly
  • no [-1], fmake doesn't support it; FOO=foo FOO=bar now results in FOO="foo bar"
AMDmi3 added inline comments.
Mk/bsd.options.mk
483 ↗(On Diff #8921)

No. Another workaround was also needed.

Also, don't forget the off case.

AMDmi3 marked an inline comment as done.
AMDmi3 edited edge metadata.

Don't forget opt_VARS_OFF

This revision was automatically updated to reflect the committed changes.