From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out-so.shaw.ca (smtp-out-so.shaw.ca [64.59.136.139]) by sourceware.org (Postfix) with ESMTPS id 3C1DF3858004 for ; Mon, 31 May 2021 23:46:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 3C1DF3858004 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSw.ab.ca Authentication-Results: sourceware.org; spf=none smtp.mailfrom=brian.inglis@systematicsw.ab.ca Received: from [192.168.1.104] ([68.147.0.90]) by shaw.ca with ESMTP id nrcOlQ1hiiLmnnrcPlhfem; Mon, 31 May 2021 17:46:49 -0600 X-Authority-Analysis: v=2.4 cv=W+Nb6Tak c=1 sm=1 tr=0 ts=60b57569 a=T+ovY1NZ+FAi/xYICV7Bgg==:117 a=T+ovY1NZ+FAi/xYICV7Bgg==:17 a=IkcTkHD0fZMA:10 a=94nOnFI1EgyDtX4ev68A:9 a=QEXdDO2ut3YA:10 Reply-To: cygwin-apps@cygwin.com Subject: Re: [PATCH cygport] Add 'vars' command to output arbitrary .cygport variables To: cygwin-apps@cygwin.com References: <20210526190637.30456-1-jon.turney@dronecode.org.uk> <3647e3d7-e04e-598c-4e62-c8098ac5a8a9@SystematicSw.ab.ca> <330598a2-0c68-44bf-f95d-bc7bd627ebcc@dronecode.org.uk> From: Brian Inglis Organization: Systematic Software Message-ID: <563a380c-ed26-78de-ef22-784c7fae320d@SystematicSw.ab.ca> Date: Mon, 31 May 2021 17:46:47 -0600 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.10.2 MIME-Version: 1.0 In-Reply-To: <330598a2-0c68-44bf-f95d-bc7bd627ebcc@dronecode.org.uk> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4xfLwxp+jvirCTQg7+6YC6beOjV4CB5MoAsoG697tLok0gO2zZQMeFN02llExIxLjlj+apZOE9kPn6+xws3y6XaUwGURopbSy5FVtN68GtHyCmMPM/DkJ9 Rf9gDd3Z3c35wWxI/YjgDAZLFG40fApGzvqqrWr/GR49nXez7Nv7f+jte+ZbWApwIRN0mZeTyBILK2FnwDFrAaJCRYfqjrpDiNM= X-Spam-Status: No, score=-3488.3 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin-apps@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Cygwin package maintainer discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 31 May 2021 23:46:51 -0000 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.]