Bug 213890

Summary: Mk/bsd.port.mk: CONFLICTS_INSTALL also blocks targets other than "install"
Product: Ports & Packages Reporter: Jan Beich <jbeich>
Component: Ports FrameworkAssignee: Port Management Team <portmgr>
Status: Closed FIXED    
Severity: Affects Only Me CC: ports-bugs, swills
Priority: --- Keywords: needs-patch
Version: Latest   
Hardware: Any   
OS: Any   
Bug Depends on:    
Bug Blocks: 213889    

Description Jan Beich freebsd_committer freebsd_triage 2016-10-29 16:43:43 UTC
For DEPENDS_TARGET != install to work CONFLICTS_INSTALL should only block ports that call "install". Currently, it behaves the same as CONFLICTS:

  $ pkg install -qy libressl

  $ make build -C security/openssl
  ===>  openssl-1.0.2j_1,1 conflicts with installed package(s):
	libressl-2.4.3

	They install files into the same place.
	You may want to stop build with Ctrl + C.
  ^C

  $ fgrep CONFLICTS security/openssl/Makefile
  CONFLICTS_INSTALL=      libressl-[0-9]* \
Comment 1 Mathieu Arnold freebsd_committer freebsd_triage 2016-10-29 20:04:22 UTC
Don't hit control-C, it should build just fine.
Comment 2 Jan Beich freebsd_committer freebsd_triage 2016-10-29 20:21:09 UTC
Indeed but confusing. So, bug 213889 doesn't *require* (but would still benefit from) the fix here.
Comment 3 Mathieu Arnold freebsd_committer freebsd_triage 2016-10-29 23:26:59 UTC
CONFLICTS_INSTALL is informing the user, it says:

Hi, you are building foo, but you already have bar which it conflicts with, so you won't be able to install foo, if you don't want it, you may stop it now.

It is different from CONFLICTS which will stop the build just there.

The problem in the bug you are referencing looks like a bug in the port the user is trying to install, it should set IGNORE if !${SSL_DEFAULT:Mlibressl*} or something similar.
Comment 4 Jan Beich freebsd_committer freebsd_triage 2016-10-30 16:19:01 UTC
Is it possible to hide conflicts' banner to avoid confusing users of BUILD_DEPENDS=path:dir:target consumers where target != install ?
Comment 5 Baptiste Daroussin freebsd_committer freebsd_triage 2016-10-30 17:41:55 UTC
I agree with Jan, the CONFLICT_INSTALL should only appear imho if one is trying to install, not otherwise, there are plenty of valid thing one can do without installing. It adds a painful sleep 10 for those operations.
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-08-26 09:04:21 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=acf5d2725a4e221a2aceb44297e151dc3902735d

commit acf5d2725a4e221a2aceb44297e151dc3902735d
Author:     Baptiste Daroussin <bapt@FreeBSD.org>
AuthorDate: 2022-08-26 08:52:51 +0000
Commit:     Baptiste Daroussin <bapt@FreeBSD.org>
CommitDate: 2022-08-26 09:03:31 +0000

    CONFLICTS_INSTALL: check later for conflicts

    Until now, the check of the CONFLICTS_INSTALL was done during the sanity
    check, meaning very early in the package building process.

    this makes it painful in 2 cases:
    1. a port depend at build time on the extraction of this port, it will print
       its warning message along with the default timer, while we will never reach
       the said conflict at all.
    2. since the ports tree has been staged, one can even go up to create a valid
       package even if a locally conflicting package is locally installed.

    This change make the check and print of the conflicts only happen during the
    install phase, the same way the ports tree checks if a previous version is
    already installed.

    PR:     213890
    Discussed with: tcberner
    Reviewed by:    tcberner
    Differential Revision:  https://reviews.freebsd.org/D36355

 Mk/bsd.port.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)