[PATCH cygport] Add 'vars' command to output arbitrary .cygport variables

Brian Inglis Brian.Inglis@SystematicSw.ab.ca
Mon May 31 23:46:47 GMT 2021


On 2021-05-31 10:14, Jon Turney wrote:
> On 28/05/2021 17:06, Brian Inglis wrote:
>> On 2021-05-26 13:06, Jon Turney wrote:
>>> Since variables in a .cygport file can be computed from arbitrary shell
>>> expressions, perhaps containing variables that cygport itself defines,
>>> other programs can't determine their value just by parsing the .cygport
>>> file.
>>> Add 'vars' command to output arbitrary variables defined by the .cygport
>>> file.
>>> The idea is that the output from this should be eval-able in a shell to
>>> be further used, but it probably needs some additional escaping (of
>>> newlines?) to be completely right in all cases.
>>> e.g

>>>> $ cygport libX11.cygport vars PVR BUILD_REQUIRES
>>>> PVR='1.7.1-1'
>>>> BUILD_REQUIRES='xtrans xorgproto libxcb-devel xmlto 
>>>> xorg-sgml-doctools docbook-xml43'
>>>> eval $(cygport libX11.cygport vars BUILD_REQUIRES) ; for r in 
>>>> ${BUILD_REQUIRES} ; do echo $r; done

>> bash "declare -p NAME..." seems to do what you want and produce 
>> .source-able output:
>> $ ( . mingw64-x86_64-nghttp2/mingw64-x86_64-nghttp2.cygport; declare 
>> -p BUILD_REQUIRES DESCRIPTION; echo echo \$BUILD_REQUIRES 
>> \$DESCRIPTION) | bash -svx

> Yeah, I should probably use 'declare -p'.
> But just sourcing the .cygport is not adequate, as this can't determine 
> variables which are generated by cygport itself (e.g. VR, 'inherit' for 
> some cygclasses sets ARCH=noarch, etc.)

I meant 'declare -p' solely as a means of getting properly escaped shell 
values (like other shell command -p option flags) out of cygport in 
statements which can be safely executed in other bash shell contexts.
The ./source was only a q&d means of setting the vars.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.
[Data in binary units and prefixes, physical quantities in SI.]


More information about the Cygwin-apps mailing list