From nobody Sun Apr 24 11:18:54 2022 X-Original-To: dev-commits-ports-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 9BC141A87A2F; Sun, 24 Apr 2022 11:18:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4KmQdB3z62z4ZPl; Sun, 24 Apr 2022 11:18:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650799134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nqrikRsVdo2wqXyWwIprlpkkSddWz/AQQIaQgEklQqI=; b=d0SgExuHOEHyfH39N7cYSh9oWDmeBqv+yGboDSp52gNGTKdwwbX7oUsOs+8HcUh4LV31Aq mSmup71G6rnmlFiYdVNxKUG9n08oLB75vh87mfNVnO80P23itSsfPZTxGHqzNb7XNMkRfs fCxRthsvcsHPJyXUNMpEul+OFK8lnNFCeKwFf7Y3gZ4A3767o7rvEt5A5k1uDbOh4sBj0/ SiwJj80DAiNDva/zGGVHIEOioaVL9YsFGHotopUN5gfhhrw1/ubfBWh+MMnRso1M1/Ve+k VKXLKZakk7/7jLv2+V8fIgz48mzod6PFUXnHU9MVy27jb4gyFLuAyaozML0tVg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6804824EDF; Sun, 24 Apr 2022 11:18:54 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 23OBIsYk034485; Sun, 24 Apr 2022 11:18:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23OBIsGJ034484; Sun, 24 Apr 2022 11:18:54 GMT (envelope-from git) Date: Sun, 24 Apr 2022 11:18:54 GMT Message-Id: <202204241118.23OBIsGJ034484@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-main@FreeBSD.org From: =?utf-8?Q?Stefan E=C3=9Fer?= Subject: git: e03f85dbc9cc - main - Mk/bsd.port.mk: simplify conflicts checks logic List-Id: Commits to the main branch of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-ports-main@freebsd.org X-BeenThere: dev-commits-ports-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: se X-Git-Repository: ports X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: e03f85dbc9cc0a91636a7ce10202c70f6d7831f9 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650799134; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=nqrikRsVdo2wqXyWwIprlpkkSddWz/AQQIaQgEklQqI=; b=hNaVqOWcYU0ER8vN4hHcHtHPogAsAmv6oO/SJPz01Z2SfqbKHhwz0KdXvzIEuNwC5lX+pg ndTVnDCLZWAI3bJ+HvI5E+lfN33J5CAkkAL17lW0niWDGwww/z1ExaEQMN0xp/AV/MChHQ 5vF3dxO0OdA0hmczRzd+Ex86bNhurICb2U82H+BEyJ26YPPWEEQZeR5GMf62UcML4r7zHz AQPHAkR44rEqH9PMUThz+GkpnZXm7/LhGky3IO/ooeKrl7DyhboaENu9JV55mxr+xBpVMY nj7W7qoUMzpSkC25R6JcyGNjUT3O7aSubzAgJg2AaHvPg077tOmuZX2hXr66eA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650799134; a=rsa-sha256; cv=none; b=SltDs+wFb8qD9l0DzgPgC2JW+r319ykQiTkSADvJ5PF7WIB/Ai2mfHaUDoNiy1ZaLJ50+Q g4hAHCoiDzV9Pjxpj6NDhC4VNR5Rr/t+WitigPO07UXDrwJGLruOPoBhILBUEQM6hKNmq/ /1KcmaRhOeRPhMeBzqXgPQI8InjZrcUXdFL3HcXG/G0zxCOAANl4ThcUS1CNn1OHIhyDoc 34Ke3sHtqToy45Ozl21W93iskYcT+sccVvj4dwPVtoAiWzelhz0Aw52Ix9dMxH5am/BZ7Z hbe8/7Is3R4Gn57Cu/oaQ0yXvB0gZ+/ZifwEordAWSXONh67c8ZTLEVYqXPa6Q== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by se: URL: https://cgit.FreeBSD.org/ports/commit/?id=e03f85dbc9cc0a91636a7ce10202c70f6d7831f9 commit e03f85dbc9cc0a91636a7ce10202c70f6d7831f9 Author: Stefan Eßer AuthorDate: 2022-04-24 10:42:15 +0000 Commit: Stefan Eßer CommitDate: 2022-04-24 11:18:36 +0000 Mk/bsd.port.mk: simplify conflicts checks logic I had added support for the specification of a condition and package name patterns to Version 1.17.2 of the pkg command. This change allows to simplify the conflicts checks: instead of listing all packages that match a name pattern and then apply a filter to select the relevant values, the filter condition is now passed to the pkg command. This update includes a change to the semantics of the conflicts check which aligns the output with current package naming practices: After the introduction of flavors a "same origin exclusion" was introduced, which removed packages from the conflicts list when they shared the same origin (without considering the flavor). This was required to allow the installation of e.g. python modules for different interpreter versions (which typically use interpreter version specific sub-directories to store their files), at a time when there was no strict requirement to have non-colliding package base names. The "same origin exclusion" is wrong for ports with conflicting flavors, e.g. devel/git where only one flavor may be installed at any time - but the conflict is ignored due to the same origin of all the different git packages. Since all packages are now required to have a distinct base name (e.g. by using a prefix like "py38-" instead of the prior "py-"), a "same package base name exclusion" can be used to make the conflicts check stricter and to correctly report the conflict if for example some git flavor is installed and the installation of another one is attempted. An update of the documentation of the CONFLICTS* variables that describes the "same package base name exclusion" has been committed to the porter's handbook. The Makefiles of many flavored ports could be simplified as described in review D31303 (https://reviews.freebsd.org/D31303), since the complexity of those definitions results from the exclusion of the currently built package base name from the CONFLICTS definition, which was unneeded before (due to the "same origin exclusion", which made all these CONFLICTS definitions void, anyway) and is now correctly dealt with after this commit (due to the "same package base name exclusion"). This patch has been first put up for review in October of 2021, with a comment that it should not be applied before pkg-1.17.2 (or newer) can be assumed to be generally used. Bapt@ accepted the change but later requested the MINIMAL_PKG_VERSION to be adjusted to require pkg-1.17.2 (as included in this commit). Due to recent white-space changes in bsd.port.mk the latest patch uploaded for review does no longer cleanly apply. This commit contains an updated version that matches the white-space changes (indentation of .if / .else / .endif and other elements). Approved by: portmgr (bapt) Differential Revision: https://reviews.freebsd.org/D32694 --- Mk/bsd.port.mk | 35 +++++------------------------------ 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/Mk/bsd.port.mk b/Mk/bsd.port.mk index a7f4e7edf099..4ea0f73cc0c5 100644 --- a/Mk/bsd.port.mk +++ b/Mk/bsd.port.mk @@ -1047,7 +1047,7 @@ _FLAVOR:= ${FLAVOR} .if !defined(PORTS_FEATURES) && empty(${PORTS_FEATURES:MFLAVORS}) PORTS_FEATURES+= FLAVORS .endif -MINIMAL_PKG_VERSION= 1.15.9 +MINIMAL_PKG_VERSION= 1.17.2 _PORTS_DIRECTORIES+= ${PKG_DBDIR} ${PREFIX} ${WRKDIR} ${EXTRACT_WRKDIR} \ ${STAGEDIR}${PREFIX} ${WRKDIR}/pkg ${BINARY_LINKDIR} @@ -3294,13 +3294,7 @@ check-conflicts: check-build-conflicts check-install-conflicts . if !target(check-build-conflicts) check-build-conflicts: . if ( defined(CONFLICTS) || defined(CONFLICTS_BUILD) ) && !defined(DISABLE_CONFLICTS) && !defined(DEFER_CONFLICTS_CHECK) - @conflicts_with=$$( \ - { ${PKG_QUERY} -g "%n-%v %p %o" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_BUILD:C/.+/'&'/} 2>/dev/null || : ; } \ - | while read pkgname prfx orgn; do \ - if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \ - ${ECHO_CMD} -n " $${pkgname}"; \ - fi; \ - done); \ + @conflicts_with=$$(${PKG_QUERY} -ge "%n != ${PKGBASE}" "%n-%v" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_BUILD:C/.+/'&'/} 2>/dev/null || : ; ) ; \ if [ -n "$${conflicts_with}" ]; then \ ${ECHO_MSG}; \ ${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \ @@ -3319,13 +3313,7 @@ check-build-conflicts: CONFLICT_WARNING_WAIT?= 10 identify-install-conflicts: . if ( defined(CONFLICTS) || defined(CONFLICTS_INSTALL) ) && !defined(DISABLE_CONFLICTS) - @conflicts_with=$$( \ - { ${PKG_QUERY} -g "%n-%v %p %o" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_INSTALL:C/.+/'&'/} 2>/dev/null || : ; } \ - | while read pkgname prfx orgn; do \ - if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \ - ${ECHO_CMD} -n " $${pkgname}"; \ - fi; \ - done); \ + @conflicts_with=$$(${PKG_QUERY} -ge "%n != ${PKGBASE}" "%n-%v" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_INSTALL:C/.+/'&'/} 2>/dev/null || : ; ) ; \ if [ -n "$${conflicts_with}" ]; then \ ${ECHO_MSG}; \ ${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \ @@ -3343,14 +3331,7 @@ identify-install-conflicts: . if !target(check-install-conflicts) check-install-conflicts: . if ( defined(CONFLICTS) || defined(CONFLICTS_INSTALL) || ( defined(CONFLICTS_BUILD) && defined(DEFER_CONFLICTS_CHECK) ) ) && !defined(DISABLE_CONFLICTS) -. if defined(DEFER_CONFLICTS_CHECK) - @conflicts_with=$$( \ - { ${PKG_QUERY} -g "%n-%v %p %o" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_BUILD:C/.+/'&'/} ${CONFLICTS_INSTALL:C/.+/'&'/} 2>/dev/null || : ; } \ - | while read pkgname prfx orgn; do \ - if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \ - ${ECHO_CMD} -n " $${pkgname}"; \ - fi; \ - done); \ + @conflicts_with=$$(${PKG_QUERY} -ge "%n != ${PKGBASE}" "%n-%v" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_BUILD:C/.+/'&'/} ${CONFLICTS_INSTALL:C/.+/'&'/} 2>/dev/null || : ; ) ; \ if [ -n "$${conflicts_with}" ]; then \ ${ECHO_MSG}; \ ${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \ @@ -3362,13 +3343,7 @@ check-install-conflicts: exit 1; \ fi . else - @conflicts_with=$$( \ - { ${PKG_QUERY} -g "%n-%v %p %o" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_INSTALL:C/.+/'&'/} 2>/dev/null || : ; } \ - | while read pkgname prfx orgn; do \ - if [ "/${PREFIX}" = "/$${prfx}" -a "/${PKGORIGIN}" != "/$${orgn}" ]; then \ - ${ECHO_CMD} -n " $${pkgname}"; \ - fi; \ - done); \ + @conflicts_with=$$(${PKG_QUERY} -ge "%n != ${PKGBASE}" "%n-%v" ${CONFLICTS:C/.+/'&'/} ${CONFLICTS_INSTALL:C/.+/'&'/} 2>/dev/null || : ; ) ; \ if [ -n "$${conflicts_with}" ]; then \ ${ECHO_MSG}; \ ${ECHO_MSG} "===> ${PKGNAME} conflicts with installed package(s): "; \