The conflicts check historically treated packages from the same origin as generally non-conflicting.
The reason might have been that packages built from the same origin for different FLAVORs might have matching package names, but might be able to co-exist.
There have been 2 changes that cause this assumption to no longer be valid:
- FLAVORS lead to conflicting packages that can not co-exist, e.g. "git" and "git-lite".
- Package names have been made unique for each FLAVOR.
As a result, the same origin exception from the conflicts tests voids CONFLICTS definitions in a port's Makefile with conflicting FLAVORs.
E.g. devel/git has a CONFLICTS definition that excludes all other FLAVORS, but the conflict is not reported due to the same origin exception.
The patch replaces the exclusion of ports from the same origin by exclusion of ports with the same basename.
This is required, since there are ports that conflict with themselves, but this was not reported due to the same origin exclusion.
Excluding ports with the same basename instead of from the same origin has another advantage:
After the introduction of FLAVORs, many ports got FLAVOR dependent CONFLICT definitions, e.g. in devel/git:
FLAVORS= default gui lite svn tiny default_CONFLICTS_INSTALL= git-gui git-lite git-svn git-tiny gui_CONFLICTS_INSTALL= git git-lite git-svn git-tiny lite_CONFLICTS_INSTALL= git git-gui git-svn git-tiny svn_CONFLICTS_INSTALL= git git-gui git-lite git-tiny tiny_CONFLICTS_INSTALL= git git-gui git-svn git-lite
Each of these CONFLICTS definitions covers all FLAVORs except the one selected to be built, and this is a common schema found in many ports, e.g. here the one from editors/emacs, but there are ports that support more flavors and thus have longer lists of CONFLICTS definitions:
FLAVORS= full canna nox canna_CONFLICTS_INSTALL= emacs emacs-nox full_CONFLICTS_INSTALL= emacs-canna emacs-nox nox_CONFLICTS_INSTALL= emacs emacs-canna
The suggested patch simplifies the CONFLICTS definitions by allowing the ${PKGBASE} of the port being built to be specified in the list, but not excluded from the conflicts that are reported.
FLAVORS= default gui lite svn tiny CONFLICTS_INSTALL= git git-gui git-lite git-svn git-tiny
Or:
FLAVORS= full canna nox CONFLICTS_INSTALL= emacs emacs-canna emacs-nox
A conflict of a package with itself does not make sense and is caught in other parts of the ports system (e.g. when trying to install a new version of a package without prior de-installation of an old version). Insofar a package is always conflicting with (all versions) of itself, but due to the fact that it is generally de-installed before the new installation is performed, this is not an issue at port build time.
The proposed patch removes the "conflicts with itself" case from check-build-conflicts, too. It is possible to only apply the chunks that correspond to the install conflicts change, since most ports that I looked at actually use CONFLICTS_INSTALL, not CONFLICTS or CONFLICTS_BUILD in this way.
The change would not have any immediate effect, since ports already use these complex CONFLICTS definitions. It is a pre-requisite for a later simplification of the CONFLICTS definitions when a port is upgraded.