freebsd-ports/Tools/scripts
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
..
pkg-stash Cleanup executable bits, prompted by 9e1d7c39a1. 2021-04-08 11:36:35 +02:00
sunshar framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
addport framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
ardiff
bad-pkgdescrs.sh
BDB-upgrade-helper.sh
bump-revision.sh framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
bump_revision.pl Tools/scripts/bump_revision.pl: Minimal update 2022-01-17 23:19:14 +01:00
checkcats.py framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
checknewver.sh framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
checksize.sh
checksum.sh
chkorigin.sh framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
chkversion.pl all: Remove all other $FreeBSD keywords. 2021-04-06 16:31:13 +02:00
distclean.sh all: Remove all other $FreeBSD keywords. 2021-04-06 16:31:13 +02:00
domakedescribe
doportlint
getpatch Tools/scripts/getpatch: Add SPDX identifier 2021-05-28 12:25:52 +00:00
getpatch.sh framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
gnomedepends.py framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
indent_make_if.pl framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
mark_safe.pl framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
MOVEDlint.awk Tools/scripts/MOVEDlint.awk: remove svn compatibility 2021-04-06 12:39:46 +02:00
neededlibs.sh framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
notconnected framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
parse-kdump.tcl
patchtool.py framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
port_conflicts_check.lua Tools/scripts: Add port_conflicts_check.lua 2022-01-22 12:48:03 +01:00
portsearch
portsvar.sh framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
README Tools/scripts: Add port_conflicts_check.lua 2022-01-22 12:48:03 +01:00
README.getpatch
README.getpatch.sh
README.patchtool
README.portsearch
redundant-opt-files.sh
rmport rmport: first check if we are in a git checkout, then check for changes. 2021-09-08 21:57:45 +02:00
search_lib_depends_and_bump.sh Tools/scripts/search_lib_depends_and_bump.sh: remove svn in an echo 2021-04-06 12:39:46 +02:00
splitpatch.pl framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
sunshar.rb framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
tindex tindex: add new compression format for INDEX 2021-11-22 09:16:17 +01:00
top-size-offenders.sh
update-patches framework: Remove $FreeBSD$ 2021-04-06 16:27:10 +02:00
update_crates Tools/scripts: Add new script update_crates to replace CARGO_CRATES block 2021-11-14 23:45:25 +01:00

NOTE: These scripts need work and are *NOT* safe to use unless you know
      what they do.  Use at your own risk.  Patches would be great, but
      it is preferred they pass through the maintainer of each particular
      script.

MOVEDlint.awk - checks MOVED for common errors
ardiff	- compare two archives easily
addport	- replacement for easy-import
bad-pkgdescrs.sh - locate identical pkg descriptions
bump_revision.pl - Small script to bump the PORTREVISION variable of ports
                   which are depending on a port with a changed shared lib
                   version.
checkcats.py - verify that master categories in all ports are correct and
               report any problems. Beware that the full check takes quite
			   some time.
checknewvers - checks for availability for a newest version of distfiles on
               MASTER_SITES (ftp only).
checksum  - allows checking of ports to see if their checksums
			match, and if they don't, give a diff against the older version to
			help discover why the checksum didn't match.
chkorigin.sh - checks all ports in the tree for a wrong PKGORIGIN.
               Run this tool after every repocopy.
doportlint - run portlint on every port and return the results
distclean - compare md5 sums of distfiles in ports/distfiles with currently
            installed ports collection in ports/* and prompt to remove
            unmatched entries
getpatch - downloads patch attachments from a Bug Tracking Systems
getpatch.sh - downloads patch attachments from a Bug Tracking Systems (plain shell script)
gnomedepends - Analyse pkg/PLIST and give an advice as to which GNOME ports
               should be listes in {RUN,LIB}_DEPENDS for this port
mark_safe.pl - utility to set subsets of ports to MAKE_JOBS_(UN)SAFE=yes
neededlibs.sh - Extract direct library dependencies from binaries.
port_conflicts_check.lua - Verify that files installed by more than 1 port are covered
               in CONFLICTS or CONFLICTS_INSTALL entries (and generate portedit commands
	       to fix those issues)x
portsearch - A utility for searching the ports tree. It allows more detailed
             search criteria than ``make search key=<string>'' and accepts
             all perl(1) regular expressions.
search_lib_depends_and_bump.sh - Give it a port that has changed and it will bump
				 all ports having a LIB_DEPENDS on this port
splitpatch.pl - A small script to convert multi-file patches to several
                appropriately named single-file patches.
tindex - script used to build INDEXes for supported FreeBSD branches, which
         are the source of the 'make fetchindex' INDEXes, and the build
         failure reports on ports@FreeBSD.org
update-patches - generates updated patches.

update_crates - script used to generate an updated Makefile using make cargo-crates
                output

----------------------------------------------------------------------

gnomedepends is a script, which analyses pkg/PLIST and gives an advice as to
which GNOME ports should be listes in {RUN,LIB}_DEPENDS for the port to ensure
correct removal of GNOME shared directories. Usage is simple:
	% cd /usr/ports/CATEGORY/PORT
	% gnomedepends.py
	According to the contents of PLIST the port depends on the following GNOME
	port(s):

	/usr/ports/audio/gnomeaudio, for directories:
        	share/gnome/sounds

	/usr/ports/sysutils/gnomecontrolcenter, for directories:
        	share/gnome/apps

	/usr/ports/x11/gnomecore, for directories:
        	share/gnome/apps/Games

	/usr/ports/x11/gnomelibs, for directories:
        	etc/sound/events
        	etc/sound
        	share/gnome/games
        	share/gnome/pixmaps
        	share/gnome

The example above means that you need to have ${PORTSDIR}/audio/gnomeaudio,
${PORTSDIR}/sysutils/gnomecontrolcenter, ${PORTSDIR}/x11/gnomecore and
${PORTSDIR}/x11/gnomelibs listed in {RUN,LIB}_DEPENDS for this port.
Please be warned, that the this only means that the ports listed by the script
required for correct removal of GNOME shared directories, not for the port
functionality, so actual {RUN,LIB}_DEPENDS may have more entries.

----------------------------------------------------------------------
portsearch - A utility for searching the ports tree.

     portsearch is a utility to for searching of the ports tree. It permits
     much more detailed searches to be performed than ``make search
     key=<string>'' by allowing you to specify which field(s) to search. It
     also supports all valid perl(1) regular expressions for pattern matching.

     portsearch displays matching ports in the same format as ``make search''
     and also displays the number of matching ports found.

     The following command line options are supported:

	   -h	      Prints a multi-line help message and exits

	   -n name    Search for name in the name field

	   -p path    Search for path in the path field

	   -i info    Search for info in the comments field

	   -m maint   Search for maint in the Maintainer field

	   -x index   Search for index in the category field

	   -b b_deps  Search for b_deps in the build-depends field

	   -r r_deps  Search for r_deps in the run-depends field

	   -d deps    Search for deps in the both the build and run dependency
		      fields. This option behaves differently to the other op-
		      tions, see the EXAMPLES section

	   -f file    Use the index file instead of /usr/ports/INDEX

     All searches are case-insensitive

See the file README.portsearch for further information.

----------------------------------------------------------------------

The update-patches script looks for files in $WRKSRC (if unset, this defaults
to the work/ subdirectory of the current directory) which have a matching .orig
file.  It also looks in $PATCHDIR (if unset, this defaults to the files/
subdirectory of the current directory) for patches that correspond to the first
set.  If the changes in an existing patch do not reflect the changes in the
files in $WRKSRC, the script renames the existing patch by adding the suffix
.orig and generates a new patch in its place.  If no patch existed, the new one
is created with a name that contains the path and filename of the file being
patched, except that "/" separators and "." characters are replaced by
underscores:  for example, a new patch to $WRKSRC/foo/bar.c would be created as
$PATCHDIR/patch-foo_bar_c.  If you save a .orig backup of a file, but don't
change the file, update-patches will generate an empty patch.