Re: git: ddd0e820c8eb - main - Mk/bsd.ports.mk: Add suppport for WWW in Makefiles

From: Stefan_Eßer <se_at_freebsd.org>
Date: Thu, 08 Sep 2022 14:03:00 UTC
Am 08.09.22 um 14:05 schrieb Antoine Brodin:
> On Wed, Sep 7, 2022 at 7:41 PM Stefan Eßer <se@freebsd.org> wrote:
>>
>> The branch main has been updated by se:
>>
>> URL: https://cgit.FreeBSD.org/ports/commit/?id=ddd0e820c8eb73acef94c72434c382982d0fa329
>>
>> commit ddd0e820c8eb73acef94c72434c382982d0fa329
>> Author:     Stefan Eßer <se@FreeBSD.org>
>> AuthorDate: 2022-09-07 19:32:54 +0000
>> Commit:     Stefan Eßer <se@FreeBSD.org>
>> CommitDate: 2022-09-07 19:32:54 +0000
>>
>>      Mk/bsd.ports.mk: Add suppport for WWW in Makefiles
>>
>>      Expect the project website or other relevant URL of a port to be
>>      specified in a WWW macro in its Makefile.
>>
>>      This information used to be available in WWW: lines at the end of
>>      each port's pkg-descr file. By moving it into the Makefile, this
>>      value is easier to access, verify, and maintain.
>>
>>      A WWW: line is added to the "desc" element of package manifests
>>      based on the WWW macro value by the create-manifest.sh script.
>>      This restores the previous contents of this line in the manifest
>>      (as e.g. expected by the Freshports website).
>>
>>      The ports-mgmt/portlint port has been updated in commit 9800743f0
>>      (version 2.19.13) to support the planned introduction of WWW in
>>      port Makefiles.
>>
>>      Approved by:            portmgr (tcberner)
>>      Differential Revision:  https://reviews.freebsd.org/D36434
>> ---
>>   Mk/Scripts/create-manifest.sh |  4 ++++
>>   Mk/bsd.port.mk                | 43 +++++++++++++++----------------------------
>>   2 files changed, 19 insertions(+), 28 deletions(-)
> ...
>> -       @(${ECHO_CMD} -n "${PKGNAME}|${.CURDIR}|${PREFIX}|"; \
>> -       ${ECHO_CMD} -n ${COMMENT:Q}; \
>> -       ${ECHO_CMD} -n "|${_DESCR}|${MAINTAINER}|${CATEGORIES}|${_EXTRACT_DEPENDS}|${_PATCH_DEPENDS}|${_FETCH_DEPENDS}|${_BUILD_DEPENDS:O:u}|${_RUN_DEPENDS:O:u}|"; \
>> -       while read one two discard; do \
>> -               case "$$one" in \
>> -               WWW:)   case "$$two" in \
>> -                       https://*|http://*|ftp://*) ${ECHO_CMD} -n "$$two" ;; \
>> -                       *) ${ECHO_CMD} -n "http://$$two" ;; \
>> -                       esac; \
>> -                       break; \
>> -                       ;; \
>> -               esac; \
>> -       done < ${DESCR}; ${ECHO_CMD}) >>${INDEX_OUT}
>> +       @(${ECHO_CMD} "${PKGNAME}|${.CURDIR}|${PREFIX}|${COMMENT:Q}|${_DESCR}|${MAINTAINER}|${CATEGORIES}|${_EXTRACT_DEPENDS}|${_PATCH_DEPENDS}|${_FETCH_DEPENDS}|${_BUILD_DEPENDS:O:u}|${_RUN_DEPENDS:O:u}|${_WWW}" >> ${INDEX_OUT})
> 
> Hi,
> 
> The regression is here,  ${ECHO_CMD} -n ${COMMENT:Q}; is not the same
> as ${ECHO_CMD} "...${COMMENT:Q}.."
> You can see in INDEX that there are now a lot of backslashes to escape
> spaces,  they weren't here before.

A, sorry, that's a bad effect that I had not seen during testing.

I'm just testing a patch that restores the old behavior:

${ECHO_CMD} "...|${COMMENT:Q}|..." --> ${ECHO_CMD} "...|"${COMMENT:Q}"|..."

By ending the quoted string before and restarting it after ${COMMENT:Q}
the issue should be fixed.

Thank you for pointing out this subtile bug!

Best regards, STefan