Date: Sat, 6 Apr 2019 18:00:55 +0100 From: Matthew Seaman <matthew@FreeBSD.org> To: freebsd-ports@freebsd.org Subject: Re: How to use @preexec to test for installed packages Message-ID: <94efa3ed-ec50-f29a-b0a3-d174ba2d496c@FreeBSD.org> In-Reply-To: <16553fab-03af-9942-93e2-7ebb116487a9@fechner.net> References: <16553fab-03af-9942-93e2-7ebb116487a9@fechner.net>
next in thread | previous in thread | raw e-mail | index | archive | help
This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --fRc7fjaTR1dvtxslpktFs1TmAfx0J7WY0 Content-Type: multipart/mixed; boundary="ZaMGabA0GTlT6bXct4EQ5pEWAl43qlLqS"; protected-headers="v1" From: Matthew Seaman <matthew@FreeBSD.org> To: freebsd-ports@freebsd.org Message-ID: <94efa3ed-ec50-f29a-b0a3-d174ba2d496c@FreeBSD.org> Subject: Re: How to use @preexec to test for installed packages References: <16553fab-03af-9942-93e2-7ebb116487a9@fechner.net> In-Reply-To: <16553fab-03af-9942-93e2-7ebb116487a9@fechner.net> --ZaMGabA0GTlT6bXct4EQ5pEWAl43qlLqS Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: quoted-printable On 06/04/2019 14:58, Matthias Fechner wrote: > as pkg cannot handle CONFLICTS_INSTALL I tried now to implement this as= > a preinstall command using @preexec in pkg-plist. >=20 > The command should check if a package is installed and stop the > installation or continue if the package is not installed. >=20 > I tried it with the following command: > @preexec `/usr/sbin/pkg -N info -e gogs`; if [ $? -eq 0 ]; then echo > "Gitlab cannot be installed together with gogs as both of them modify > .ssh/authorized_keys" && exit 1; else echo "Gogs not installed, > continue."; fi >=20 > But it does not work. > Now matter if gogs is installed or not. > If I execute the same line in a shell script, it works fine. >=20 > Anyone an idea? pkg(8) does handle the most common reason for packages conflicting at install time -- file name clashes. Indeed, it does this automatically with no need of input from porters or maintainers, although it is usual to add CONFLICTS_INSTALL lines to port Makefiles to document clashes discovered this way. However, where there are other reasons for packages to conflict at install time, then you are correct that pkg doesn't handle this. There's simply no mechanism to include information about package conflicts into pkg metadata. Now, it shouldn't be beyond the bounds of possibility to include this as input that the pkg solver could use, but it may require quite a deep dive into the bowels of pkg code. I doubt that using @preexec commands in the pkg-plist is going to be very satisfactory -- the end result is that pkg will end up trying to install conflicting packages and then abort in the middle of installation, which could well result in an inconsistent pkg database and user frustration. Cheers, Matthew --ZaMGabA0GTlT6bXct4EQ5pEWAl43qlLqS-- --fRc7fjaTR1dvtxslpktFs1TmAfx0J7WY0 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEEGfFU7L8RLlBUTj8wAFE/EOCp5OcFAlyo20hfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDE5 RjE1NEVDQkYxMTJFNTA1NDRFM0YzMDAwNTEzRjEwRTBBOUU0RTcACgkQAFE/EOCp 5OcnYA/7B2nU0hveQNcwje3EQjJqNOcmmR+0j3cn1eV/tmpbwHvYpXb7XHuri/WW ZrM4JJfvsqwwasfM7Ksf4EFymIPvDDOWYVFvKfdLRmfn7RezudnD8pqE4PbFADvu 7T5feAnStLlQkCHpSQOT2JZ7nMI4A9L6Cm4N6ceILiJDBzk2kP/IUV3wg7IujLt6 Fo8S78H7h1lRuNORa3QI4T/zKusufFVJ77AZRub1ELV3MElYwzaWfPpLRSJdEKTh +Wm4WLBUr/yZh629i2ySTaEOBHx7+tuWa+VvMOI2pimgFXNIsmUcEworqXydsRfT msQLevz3CPsMQRfKRQTGzkSxuHjEwCuMtQf+sFgmBDpJNwxAoDvbD/l4HzisA62D rg0sDJB9Hx7qLM5AGskD6VIIZafCZHYRGuzf3VLwYS4YEoCLTe6rHn3G3Nn8lMZq HFhg1Cj2fqc+dR62Sc8BxNyE7uADodTl2Z7hZM5lPDJsz94l0YMWOPzT4uASwrvk GIyYY4oRtsjzz7uiteFI0RBUFquK/ngdopew0lN/cmROI7yxMwIIzXHQeXN7+Ce6 lEmMnRgpYTzNxPvG5KtELHK2iYET+Ajg9ruyRojYXzE7s/kdEWfS2eCANyD5yZ6E DXqsJtxjgda0pkR9PMNhB9LMVm7yQBmZP4i+DoLA6djoSzaBGSQ= =NKTE -----END PGP SIGNATURE----- --fRc7fjaTR1dvtxslpktFs1TmAfx0J7WY0--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?94efa3ed-ec50-f29a-b0a3-d174ba2d496c>