From owner-freebsd-ports@freebsd.org Sat Apr 6 18:59:38 2019 Return-Path: Delivered-To: freebsd-ports@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9EB281569467 for ; Sat, 6 Apr 2019 18:59:38 +0000 (UTC) (envelope-from adamw@adamw.org) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 43FE08D365 for ; Sat, 6 Apr 2019 18:59:37 +0000 (UTC) (envelope-from adamw@adamw.org) Received: by mail-wr1-x435.google.com with SMTP id s15so11661668wra.12 for ; Sat, 06 Apr 2019 11:59:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamw-org.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=etWLL9uqq2vsx7jBSIptEzn3H7MIPLwjZQG3ToG4WrQ=; b=Z8CZIdgDKoMOFl4mBZefV4cVe8FXX8DbS6FknHluLa/53pjuMPknGu1H/PHJPvcpzr A0Mn53Yx3OGE0K7bf4feyCtkEfDdUk2CbM6zL/uO/tfLMK+cOZg5BvInH07RMHurpx45 zFb4L2ZVkB5VEL5bEJdGDHBunZmYLlkYe2okCCVyMtoCLNQiIHO4PemwpLYmFLKMGYbD XCpBzWUig7JND5otfDwULQyG57VY8pM5qlJF40kPZUt4Ir63s3VF52eDt93T03VX+36d deHGnddk+VOfkDwbZv5Wg331+tHDVBDiegJyG5tfgK0aKaemm8fDXXJNYj/dd69QH5ut VApQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=etWLL9uqq2vsx7jBSIptEzn3H7MIPLwjZQG3ToG4WrQ=; b=HLLBz8nDq3obAnOegePg+WwPhgGlG+K8Duo84Z7WY7de5hIwxqJuJhY+5BpStPYtrA TJSw+d3Jk+J2l8MSvVrkLX0RKtLAd3iolfyRrwwX2jS41WnTiZjV1RbNnQUIIhITeh/7 XNfg+kWk/vbejJqQ6f3eDarIaZ35vS6LdGH9v5FVteATumQjhQcJVPqLPanTvJxoBkxp ZVBKv6zCaEKo2UqbA18cA4LciigKF5ISbX8lazkYy1XLcvU45pJCELlejeOZAJK8xnGr JxeLndok3XDqRF6x38Z26P/M2a+hRFkE35H1CeakkESML47IFwcG5W+DVHCjOJkdxKkF WvdA== X-Gm-Message-State: APjAAAX15v4SWNPMF2pgUTACAjZHeeNxr2ICgri8H0EG5sH/pLKKoHBv KEpcsHe4rI8p8pZXyimeENjqOjqzci+anq1bAFw7YsPytHY= X-Google-Smtp-Source: APXvYqznInnPpC2OsCo4qFkCVEwZPEFAdzKARZyZnJ3GcODIwNkLtMe3pbKm3pXin7hQd9k2T8PG3ylLISsuSOeNnHE= X-Received: by 2002:a5d:4d42:: with SMTP id a2mr13015863wru.130.1554577175878; Sat, 06 Apr 2019 11:59:35 -0700 (PDT) MIME-Version: 1.0 References: <16553fab-03af-9942-93e2-7ebb116487a9@fechner.net> <94efa3ed-ec50-f29a-b0a3-d174ba2d496c@FreeBSD.org> In-Reply-To: From: Adam Weinberger Date: Sat, 6 Apr 2019 12:59:19 -0600 Message-ID: Subject: Re: How to use @preexec to test for installed packages To: Miroslav Lachman <000.fbsd@quip.cz> Cc: Matthew Seaman , FreeBSD Ports Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 43FE08D365 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; dkim=pass header.d=adamw-org.20150623.gappssmtp.com header.s=20150623 header.b=Z8CZIdgD; spf=pass (mx1.freebsd.org: domain of adamw@adamw.org designates 2a00:1450:4864:20::435 as permitted sender) smtp.mailfrom=adamw@adamw.org X-Spamd-Result: default: False [-6.25 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[adamw-org.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-ports@freebsd.org]; DMARC_NA(0.00)[adamw.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[adamw-org.20150623.gappssmtp.com:+]; MX_GOOD(-0.01)[cached: alt1.aspmx.l.google.com]; RCVD_IN_DNSWL_NONE(0.00)[5.3.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.5.4.1.0.0.a.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_SHORT(-0.98)[-0.976,0]; IP_SCORE(-2.77)[ip: (-9.21), ipnet: 2a00:1450::/32(-2.37), asn: 15169(-2.17), country: US(-0.06)]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; RCVD_TLS_LAST(0.00)[]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 06 Apr 2019 18:59:38 -0000 On Sat, Apr 6, 2019 at 12:49 PM Miroslav Lachman <000.fbsd@quip.cz> wrote: > > Matthew Seaman wrote on 2019/04/06 19:00: > > 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. > >> > >> The command should check if a package is installed and stop the > >> installation or continue if the package is not installed. > >> > >> 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 > >> > >> 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. > >> > >> 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. > > Then you can add some fake (empty) file to the plist of package A which > will conflict with package B and then pkg conflict will work as expected. > But I am not sure we should prevent installation of some package just > because it uses authorized_keys too. Especially since www/gitea does the same thing (and probably a number of others as well). # Adam -- Adam Weinberger adamw@adamw.org https://www.adamw.org