freebsd-ports/Tools
Stefan Eßer 59c30220dc Tools/scripts: Add port_conflicts_check.lua
Add a script to check the CONFLICTS and CONFLICTS_INSTALL parameters
of ports for completeness and correctness.

This script uses the "hidden" LUA interpreter in the FreeBSD base
system and the pkg-provides extension of the pkg command to check
for conflicting files in all packages available for the architecture
and version of the base system this command is run on.

It generates output in the following format:

portedit merge -ie 'CONFLICTS_INSTALL=kicad-library-footprints-devel \
    # share/kicad/template/fp-lib-table' \
    /usr/ports/cad/kicad-library-footprints

(The last line is shown wrapped for the text of this commit message.)

The portedit command is provided by the port-fmt package. It takes
care of placing the CONFLICTS_ENTRY into the correct position of the
port's Makefile (and removes prior definitions).

The files listed with each result are examples of files that are in
conflict between the port and the packages in the list after ">".
The main purpose of the files list is to help distinguish between
conflicts that affect all flavors or versions of a port, or whether
the files are placed in version specific sub-directories or use other
mechanisms to allow e.g. multiple Python versions to co-exist.
(In the latter case ${PYTHON_PKGNAMEPREFIX} can be used to limit
the CONFLICTS_INSTALL entry to conflicting packages using the same
Python interpreter version, for example, else a prefix like py*- might
be required for a version independent pattern).

Users of this feature are highly advised to check each Makefile by
comparing it with pre-edit version before the changes are committed!

There are several limitations that can cause incorrect or undesirable
changes:

- The list of files installed by each port is only available for the
  officially built packages (and the flavors selected from the set of
  available flavors). It does not include ports that may not be
  packaged or that are broken or ignored due to a dependency on a
  broken port (or for other reasons). As a result, there may be
  undected conflicts with ports for which no official package is
  available.

- The CONFLICTS_INSTALL line is not always inserted into the correct
  position in the Makefile, typically due to out-of-order entries used
  by portedit to locate the desired position.

- Complex ports may have conditional CONFLICTS_INSTALL entries,
  depending on port options or flavors that are in effect. It is not
  possible to deal with that kind of Makefiles in an automated way.

- The union of all CONFLICTS and CONFLICTS_INSTALL entries is used as
  the list of install conflicts of a port. But only CONFLICTS_INSTALL
  entries are generated by this tool. Quite a lot of ports have
  CONFLICTS entries where CONFLICTS_INSTALL would suffice (i.e. there
  is no build conflict, actually), but there are ports that need to
  keep the conflicts listed as CONFLICTS. Such issues can be found by
  comparing the before and after versions of the edited Makefiles.

- Conflicting ports that have been removed from the ports system will
  only be found as long as their official package files are still
  available. (There is a recommendation that conflicts with removed
  ports are kept for a few months.)

- If all packages conflicting with a given port have been removed
  from the ports system and the official packages repository, the
  now superfluous CONFLICTS_INSTALL definition will not be detected.
  This is due to only Makefiles of ports being parsed that install
  files in the same place as some other port. Parsing all Makefiles
  instead would increase the run-time of this script by more than a
  factor of 10.
2022-01-22 12:48:03 +01:00
..
scripts Tools/scripts: Add port_conflicts_check.lua 2022-01-22 12:48:03 +01:00
make_index
make_readmes