Page MenuHomeFreeBSD

Simplify CONFLICTS checks based on a feature introduced with pkg-1.17.2
ClosedPublic

Authored by se on Oct 27 2021, 2:24 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Apr 20, 7:45 PM
Unknown Object (File)
Mon, Apr 15, 1:45 PM
Unknown Object (File)
Mon, Apr 15, 1:38 PM
Unknown Object (File)
Mon, Apr 15, 1:30 PM
Unknown Object (File)
Mon, Apr 15, 11:29 AM
Unknown Object (File)
Mon, Apr 15, 11:29 AM
Unknown Object (File)
Mon, Apr 15, 11:27 AM
Unknown Object (File)
Mon, Apr 15, 11:19 AM
Subscribers

Details

Summary

The functionality provided in this review is identical to that of https://reviews.freebsd.org/D31151, but using a pkg-1.17.2 feature to simplify the code.
As long as there are systems with pkg-1.17.1 or below, the lack of that feature would cause all ports to be reported as conflicting.
Therefore, I'd like to get this change reviewed, but I do expect that it will be only applied when it can be assumed that most systems used to build ports have a version of the pkg command >= 1,17.2.

The reminder of this text is a verbatim copy of the summary of D31151:

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.

The patch in this review includes the prior patch to remove the "same origin exception" from the conflicts check: https://reviews.freebsd.org/D30891

If this patch is only accepted in part (for check-install-conflicts, not check-build-conflicts), then at least the same origin exception patch shall be applied to the rest of these conditions.

Test Plan

Apply test and verify that with the patch:

  • git and git-lite are reported as conflicting with each other (without the patch suppressed by the "same origin exclusion")
  • git is not reported as conflicting with itself

See D30891 for further comments and details (but that patch was incomplete and did not exclude self-conflicting ports).

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

se requested review of this revision.Oct 27 2021, 2:24 PM
se created this revision.
This revision is now accepted and ready to land.Oct 28 2021, 1:59 PM

I had missed another typo in the previously uploaded patch ...

This revision now requires review to proceed.Jan 12 2022, 3:16 PM

Put back correct patch. I had mistakenly updated the patch for D31151 to this review and did not notice the mistake, since most of the reasoning for this patch is similar, it uses just a much simplified command to generate the list of conflicting files taking advantage of features introduced in pkg-1.17.2.

There have been several new releases of the pkg command since I initially uploaded this patch (and it had been accepted by bapt), but I'm not convinced that pkg-1.17.2 or newer can be assumed to exist on all systems.

OTOH, tools that rely on the CONFLICTS definitions like portmaster and portupgrade generally update the pkg command first, before working on the other ports, therefore a sufficiently recent pkg command can be expected to exist at least on systems were ports are built with one of these tools.

If this patch is accepted, then the functionally equivalent (but not depending on pkg>=1.17.2) review D31151 can be skipped.

Please also bump MINIMAL_PKG_VERSION

Update MINIMAL_PKG_VERSION to 1.17.2 as requested by bapt@.

This patch is otherwise unchanged relative to the one accepted by bapt@ on 2021-10-28 (except possibly for white-space changes).

I'd appreciate if this patch version was approved by portmgr (i.e. bapt@), since pkg-1.17.2 has been in the tree for about half a year.

A previous version (functionally identical, might have had white-space differences, though) has been accepted by bapt@ (see https://reviews.freebsd.org/D32694#738230). That version had been over-written by a different patch-set by accident, though.

The updated patch does also contain the update of MINIMAL_PKG_VERSION to 1.17.2 as requested by bapt@.

I do assume that the approval of the previous version is sufficient to permit a commit to bsd.port.mk, but I'd appreciate an approval of this latest version.

I had again erroneously uploaded the patch for review D31151 to this review - since both deal with the issue in different ways (and the text of the review is mostly the same ...)

This should be the final upload of the correct patch, identical to the one approved by bapt@ in October of 2021, except for a white-space change (and the requested update of the MINIMAL_PKG_VERSION to 1.17.2).

This revision was not accepted when it landed; it landed in state Needs Review.Apr 24 2022, 11:19 AM
This revision was automatically updated to reflect the committed changes.