Re: git: cc9c37d73947 - main - */*: Always use WRK_ENV with SETENVI

From: Tijl Coosemans <tijl_at_FreeBSD.org>
Date: Tue, 09 Apr 2024 22:06:02 UTC
On Tue, 9 Apr 2024 05:15:22 +0800 Po-Chuan Hsieh wrote:
> Hello Tijl,
> 
> On Sun, Mar 24, 2024 at 1:47 AM Tijl Coosemans <tijl@freebsd.org> wrote:
> 
>> The branch main has been updated by tijl:
>>
>> URL:
>> https://cgit.FreeBSD.org/ports/commit/?id=cc9c37d73947e0184f66f0b5fa3fc021f7fdf51c
>>
>> commit cc9c37d73947e0184f66f0b5fa3fc021f7fdf51c
>> Author:     Tijl Coosemans <tijl@FreeBSD.org>
>> AuthorDate: 2024-03-23 17:35:13 +0000
>> Commit:     Tijl Coosemans <tijl@FreeBSD.org>
>> CommitDate: 2024-03-23 17:45:45 +0000
>>
>>     */*: Always use WRK_ENV with SETENVI
>>
>>     WRK_ENV contains environment variables like OSVERSION and UNAME_* that
>>     are needed when cross-building packages using Poudriere for a different
>>     version of FreeBSD or a different architecture than that of the host
>>     system.  
> 
> 
> It's just my 2 cents.
> 
> If SETENVI and WRK_ENV always come together, it would be better to have a
> new knob for it (e.g. SET_BASIC_ENV, SET_COMMON_ENV or SET_MIN_ENV).
> Therefore we won't use only part of them. The side benefit is it's
> shorter.

Sure, no objection.  Maybe make it even shorter, e.g. DO_WRK.

SETENVI and WRK_ENV don't always go together.  There are a few existing
cases of ${SETENV} -i in the tree that could be replaced with ${SETENVI}
without ${WRK_ENV}.

> Since WRK_ENV contains a minimal set of common environment variables,
> could we rename it to a more intuitive name such as COMMON_ENV or
> something like that?

It's called WRK_ENV because it's tied to WRKDIR.  It should be used
to run upstream commands/scripts in WRKDIR and only for that purpose.
Also, it won't necessarily stay minimal.  There's quite a bit of
duplication between CONFIGURE_ENV and MAKE_ENV much of which could be
moved to WRK_ENV.