From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from sa-prd-fep-041.btinternet.com (mailomta6-sa.btinternet.com [213.120.69.12]) by sourceware.org (Postfix) with ESMTPS id EA9CD3846401 for ; Wed, 26 May 2021 19:06:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org EA9CD3846401 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dronecode.org.uk Authentication-Results: sourceware.org; spf=none smtp.mailfrom=jon.turney@dronecode.org.uk Received: from sa-prd-rgout-001.btmx-prd.synchronoss.net ([10.2.38.4]) by sa-prd-fep-041.btinternet.com with ESMTP id <20210526190657.GHLW27312.sa-prd-fep-041.btinternet.com@sa-prd-rgout-001.btmx-prd.synchronoss.net>; Wed, 26 May 2021 20:06:57 +0100 Authentication-Results: btinternet.com; auth=pass (LOGIN) smtp.auth=jonturney@btinternet.com X-SNCR-Rigid: 6038717E0CA83C12 X-Originating-IP: [86.140.69.112] X-OWM-Source-IP: 86.140.69.112 (GB) X-OWM-Env-Sender: jonturney@btinternet.com X-VadeSecure-score: verdict=clean score=0/300, class=clean X-RazorGate-Vade: gggruggvucftvghtrhhoucdtuddrgeduledrvdekfedgudefgecutefuodetggdotefrodftvfcurfhrohhfihhlvgemuceutffkvffkuffjvffgnffgvefqofdpqfgfvfenuceurghilhhouhhtmecufedtudenucenucfjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomheplfhonhcuvfhurhhnvgihuceojhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukheqnecuggftrfgrthhtvghrnhepteetieejuedutdeihffhhfelhfffueevkeehvdfhfedugeehtdehgeevfefhieefnecuffhomhgrihhnpegthihgfihinhdrtghomhenucfkphepkeeirddugedtrdeiledrudduvdenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopehlohgtrghlhhhoshhtrdhlohgtrghlughomhgrihhnpdhinhgvthepkeeirddugedtrdeiledrudduvddpmhgrihhlfhhrohhmpeeojhhonhdrthhurhhnvgihsegurhhonhgvtghouggvrdhorhhgrdhukheqpdhrtghpthhtohepoegthihgfihinhdqrghpphhssegthihgfihinhdrtghomheqpdhrtghpthhtohepoehjohhnrdhtuhhrnhgvhiesughrohhnvggtohguvgdrohhrghdruhhkqe X-RazorGate-Vade-Verdict: clean 0 X-RazorGate-Vade-Classification: clean Received: from localhost.localdomain (86.140.69.112) by sa-prd-rgout-001.btmx-prd.synchronoss.net (5.8.340) (authenticated as jonturney@btinternet.com) id 6038717E0CA83C12; Wed, 26 May 2021 20:06:57 +0100 From: Jon Turney To: cygwin-apps@cygwin.com Cc: Jon Turney Subject: [PATCH cygport] Add 'vars' command to output arbitrary .cygport variables Date: Wed, 26 May 2021 20:06:37 +0100 Message-Id: <20210526190637.30456-1-jon.turney@dronecode.org.uk> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1198.9 required=5.0 tests=BAYES_00, FORGED_SPF_HELO, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, SPF_NONE, TXREP autolearn=ham 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: Wed, 26 May 2021 19:07:04 -0000 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 > xtrans > xorgproto > libxcb-devel > xmlto > xorg-sgml-doctools > docbook-xml43 --- Notes: This is a generalization of the idea in [1], for querying the build-depends of a package. https://cygwin.com/pipermail/cygwin-apps/2021-January/041006.html bin/cygport.in | 5 +++++ data/cygport-bash-completion | 2 +- lib/pkg_info.cygpart | 10 +++++++++- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/bin/cygport.in b/bin/cygport.in index afc6f7e..e9295be 100755 --- a/bin/cygport.in +++ b/bin/cygport.in @@ -623,6 +623,11 @@ do __show_info; _status=$?; ;; + vars) + __show_vars ${argv[@]:$((++arg_n))}; + _status=$?; + arg_n=$argc; # consumed all remaining args + ;; homepage|web*|www*) __show_web; _status=$?; diff --git a/data/cygport-bash-completion b/data/cygport-bash-completion index 86df238..9085e19 100644 --- a/data/cygport-bash-completion +++ b/data/cygport-bash-completion @@ -12,7 +12,7 @@ _cygport() check test inst install list dep depends \ package pkg package-test pkg-test diff mkdiff mkpatch \ upload stage announce almostall all all-test clean finish \ - help info version homepage website' + help info version homepage website vars' if [[ $COMP_CWORD -eq 1 ]] ; then # first arg: source file completion diff --git a/lib/pkg_info.cygpart b/lib/pkg_info.cygpart index 4b18993..a5475cc 100644 --- a/lib/pkg_info.cygpart +++ b/lib/pkg_info.cygpart @@ -658,5 +658,13 @@ __show_web() { ${mybrowser} ${mywww} &>/dev/null & } +__show_vars() { + for v in "$@" + do + echo "${v}='${!v}'" + done +} + readonly -f __list_files __list_debug_files __list_deps \ - __show_deps __show_info __show_web __pager + __show_deps __show_info __show_web __pager \ + __show_vars -- 2.31.1