From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mailout06.t-online.de (mailout06.t-online.de [194.25.134.19]) by sourceware.org (Postfix) with ESMTPS id 06E103858294 for ; Tue, 30 Apr 2024 10:27:58 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 06E103858294 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=t-online.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=t-online.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 06E103858294 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=194.25.134.19 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714472879; cv=none; b=DzQ+rnFoJ8cJTOjwqIUmGU0G2O2Q7Js3LkLMfslQF69W0UW8vMW+x7fxu2BnUrsPjdHSWEDu1h5Eix+GmCfghgRwEnGyf5H/KzBwkqOsfSpWJLJKg9a47LCAq3M8UDIqqxV6VDew8b7qxrLRVt7zoVR2ahEFrR3xjsKJ5OxT+MQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1714472879; c=relaxed/simple; bh=7zAwHlnxZokme9Vqg9cp3L85rx0vyopIz+7lSm+UE7o=; h=Subject:To:From:Message-ID:Date:MIME-Version; b=reJbnU0FnubXhPgJB2wnnBUiGz3K+rpzdFzHnbXBHjUWRrBN6Tl2RRwvxrSfO9APC1JY22H6UdQb1XU5Qgb3GxzrhArTcAsOm6pxI4Klz1FzQyhNVcTV6OyClfdv9leaODtqWBaSSwBPsRukGgFzyJ7t0GATVyxOkDLRKFtckJ0= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from fwd76.aul.t-online.de (fwd76.aul.t-online.de [10.223.144.102]) by mailout06.t-online.de (Postfix) with SMTP id DA6C073BE for ; Tue, 30 Apr 2024 12:27:36 +0200 (CEST) Received: from [192.168.2.101] ([87.187.33.121]) by fwd76.t-online.de with (TLSv1.3:TLS_AES_256_GCM_SHA384 encrypted) esmtp id 1s1ki0-4P3Z200; Tue, 30 Apr 2024 12:27:36 +0200 Subject: Re: [PATCH cygport] Add customization support for announce command To: cygwin-apps@cygwin.com References: <2c21353b-f249-d03f-a9fa-68f0e56b9dcb@t-online.de> <20d64930-9c17-4fb0-861e-3145b5d67601@dronecode.org.uk> Reply-To: cygwin-apps@cygwin.com From: Christian Franke Message-ID: <83629cb5-9807-f20c-c8e5-0deff7d8236c@t-online.de> Date: Tue, 30 Apr 2024 12:27:35 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 SeaMonkey/2.53.16 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-TOI-EXPURGATEID: 150726::1714472856-957F9ED6-1297D50E/0/0 CLEAN NORMAL X-TOI-MSGID: 8987aa48-873c-435d-b0b3-7c0e1824c66b X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,BODY_8BITS,FREEMAIL_FROM,KAM_DMARC_STATUS,NICE_REPLY_A,RCVD_IN_BARRACUDACENTRAL,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Jon Turney wrote: > On 10/03/2024 16:33, Christian Franke via Cygwin-apps wrote: >> Jon Turney wrote: >>> On 23/02/2024 11:23, Christian Franke via Cygwin-apps wrote: >>>> Christian Franke wrote: >>>>> The email generated by the cygport announce command is useful, but >>>>> actual use cases are somewhat limited due to the hard-coded email >>>>> submission. >>>>> >>>>> The attached patch adds more flexibility. The patch is on top of >>>>> the "Use correct wording if only one package is announced" patch. >>>> >>>> Slightly changed patch attached. Also adjusted to new version of >>>> "Use correct wording if only one package is announced" patch. >>>> >>>> >>> [...] >>> >>> Thanks for this. >>> >>>> Possible (better?) alternative names for the new settings: >>>> ANNOUNCEMENT_EDITOR >>>> ANNOUNCEMENT_MAILER >>> >>> Hmmm... I think "ANNOUNCE_EDITOR" and "ANNOUNCE_MAILER" would be >>> the best for clarity and conciseness. >> >> New patch attached. Is still on top of "Use correct wording ..." patch. >> >> I also added HOMEPAGE to the propagated variables as this should be >> included in an announcement. > > Thanks. > >> +    /bin/bash -c "cd ${top} || exit 1 >> +${HOMEPAGE+HOMEPAGE=${HOMEPAGE@Q}} >> +P=${P@Q}; PF=${PF@Q}; PN=${PN@Q}; PR=${PR@Q}; PV=(${PV[*]@Q}) >> +${SMTP_SENDER+SMTP_SENDER=${SMTP_SENDER@Q}} >> +${SMTP_SERVER+SMTP_SERVER=${SMTP_SERVER@Q}} >> +${SMTP_SERVER_PORT+SMTP_SERVER_PORT=${SMTP_SERVER_PORT@Q}} >> +${SMTP_ENCRYPTION+SMTP_ENCRYPTION=${SMTP_ENCRYPTION@Q}} >> +${SMTP_USER+SMTP_USER=${SMTP_USER@Q}} >> +${SMTP_PASS+SMTP_PASS=${SMTP_PASS@Q}} >> +${cmd} >> +"         $0 ${msg} || error "Command '\${${cmdvar}} ${msg}' >> (cwd=${top}) failed" >> +} > > Sorry I didn't notice this before, and I am terrible at writing shell, > but perhaps you could share the reasoning behind writing this as > above, and not as, e.g. > > (cd ${top} && env BLAH ${cmd}) > > avoiding all the verbiage in the description of ANNOUNCE_EDITOR about > it being fed into 'bash -c' (and hence getting evaluated twice??) > rather than just run? > > None of the mentioned variables are exported to the environment by cygport. I wanted to keep this fact in the subshell. Therefore the assignments are added to the script instead of passing via env(ironment). The latter won't even work with the PV variable because arrays could not be exported. Variables would not be evaluated twice. For example in the rare case that someone uses something like SMTP_SERVER="smtp.$(hostname -d)" in cygport.conf, this would immediately expand to SMTP_SERVER="smtp.some.domain". The above ${SMTP_SERVER+SMTP_SERVER=${SMTP_SERVER@Q}} would expand to SMTP_SERVER=${SMTP_SERVER@Q} and then to SMTP_SERVER='smtp.some.domain' (The @Q bash extension ensures proper quoting).