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)
Fri, Oct 17, 9:22 AM
Unknown Object (File)
Wed, Oct 15, 3:45 AM
Unknown Object (File)
Tue, Oct 14, 8:17 PM
Unknown Object (File)
Thu, Oct 9, 9:51 PM
Unknown Object (File)
Thu, Oct 2, 1:38 AM
Unknown Object (File)
Wed, Oct 1, 3:57 AM
Unknown Object (File)
Mon, Sep 29, 10:09 PM
Unknown Object (File)
Thu, Sep 25, 10:28 AM
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.