HomeFreeBSD

Fix opt_VARS premature expansion.

Description

Fix opt_VARS premature expansion.

Due to the way .for loop work, opt_VARS was being expanded too early
evaluation, which made it impossible to use vars that are set/modifies
afterwards (such as PREFIX or PKGDIR)

Fix this by changing opt_VARS handling logic so that the right side is
not prematurely expanded:

  • 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 changes the way this opt_VARS line work, which behavior is between
invalid and undefined:

opt_VARS= FOO=bar FOO=baz

Before it would end up with "FOO=baz", now it ends up with "FOO=bar baz"

Submitted by: amdmi3
Reviewed by: antoine, mat
Approved by: my portmgr hat
Sponsored by: Absolight
Differential Revision: https://reviews.freebsd.org/D3729

Details

Provenance
matAuthored on
Reviewer
antoine
Differential Revision
D3729: Fix opt_VARS premature expansion
Parents
rP398257: Mark as deprecated: Obsoleted by optionsng
Branches
Unknown
Tags
Unknown