From owner-freebsd-ports@freebsd.org Tue Aug 14 19:13:28 2018 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 D21A110550F4 for ; Tue, 14 Aug 2018 19:13:28 +0000 (UTC) (envelope-from adamw@adamw.org) Received: from mail-yw1-xc2a.google.com (mail-yw1-xc2a.google.com [IPv6:2607:f8b0:4864:20::c2a]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 75F8183250 for ; Tue, 14 Aug 2018 19:13:28 +0000 (UTC) (envelope-from adamw@adamw.org) Received: by mail-yw1-xc2a.google.com with SMTP id y203-v6so17025680ywd.9 for ; Tue, 14 Aug 2018 12:13:28 -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=TRlJprCAyDDwJ3JJXHD8TfOpk/qj4vi45URDxlkQD9U=; b=oet76dHZYl5sFJLxZ8CDo0/gYpdXpF0NLqWn0hr9AhDpNpk9JfNjYH6Ns2BL2oEqAm zf8KeJjLOKXR3UZk9bXzvuElf0N07ApBqwrdSlO1QEmoZnjYFI5pdJErzCeyHJN17qIp WhoAHtROQvSTjH2619lKxSAUX/i558a360z5+5KI0zwL1tC6BrO9Pm2hyNdnuvh5cK/t 1DwbWkgHCkyU4ExfK5W4t4UFeqCn58SCVI+VgYo+bSzk3ZhXprTxfqIv3TrXxPWSiwdH UhXhVQzIDGszADGRP6CVjZBGmA6d1dR74rlJYunMozHoSAJH02QNTOG0jDcxQWfOrFfY jdsQ== 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=TRlJprCAyDDwJ3JJXHD8TfOpk/qj4vi45URDxlkQD9U=; b=XrS8Foo8p5B52mjL6jmF+EeNdNzRJlqIuCqTIfzTHeGo3qgD9UBb6dk7rEMS6Pb4YC 1xJe6rR0eyfGw75mDLJioj56RlM/c9H6oZMgcCQtxseETg+F3z9j2vYcMc3EYhMYYDyg EpPJs+MALFNUemrlNidHnuUXLkgm7goz16RrTlHrxt0NDn62jHfv8Knrl2MVH+irrjBG eecyskTcFHskDFQ5TT9FmKxub/+K8KJGzxNdeR6TD3xM2bm7xtBtlKeQX2VjLyvqueQI BW8QhgsSVzty0sP23tHRbRD9mCPeBNc+TMOWh9ZidHgClmck3IIiiGt4fe2jvFaPwF8h tmhg== X-Gm-Message-State: AOUpUlFME1U94lUkBwBCHECbc2utkpShkBhgf+uSdHspFV1o3cKCxUrt e/NfYzBGJCKY9yGFexOZLA5OivGmElIqiojSSo+gRLugiII= X-Google-Smtp-Source: AA+uWPz6oXiSe8A1DyAdWYuhrBxgQvPTqHrFv2KooVFaQEzQ1rt8Fn5jiiSApLSMFTW151bggNFwAuGJos9OmRFRV5s= X-Received: by 2002:a25:61cd:: with SMTP id v196-v6mr12364441ybb.246.1534274007727; Tue, 14 Aug 2018 12:13:27 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Adam Weinberger Date: Tue, 14 Aug 2018 13:13:12 -0600 Message-ID: Subject: Re: getting PKGNAME from CONFLICTS To: dan@langille.org Cc: freebsd-ports@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: freebsd-ports@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Porting software to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Aug 2018 19:13:29 -0000 On Tue, Aug 14, 2018 at 11:54 AM Dan Langille wrote: > > I am in the process of adding FreshPorts support for CONFLICTS[1]. > > I reference www/p5-CGI only because it had a recent commit and it contains a CONFLICTS directive. > > At https://dev.freshports.org/www/p5-CGI/ you can see: > > CONFLICTS: p5-CGI.pm-[1-3]* > > My goal is to allow a link to the search page or to the page for that port. > > The CONFLICTS field is a 'A list of package name patterns'[2] > > I interpret this to mean the values returned by make -V PKGNAME and the documentation[3] indicates this is correct. > > Thus, the CONFLICTS matches https://dev.freshports.org/www/p5-CGI.pm [4] > > To extract the PKGNAME values from the CONFLICTS I will need to remove everything after the trailing dash. > > Can someone do me up a regex for that please? regex is a weak point for me. Or point me into the Mk infrastructure to locate an existing solution. Hi Dan, I suspect that the best you can get is to make some assumptions about what versions look like. This will catch most, but not all: /^(.*?)-[-_\.,0-9ab]+$/ That should put PKGNAME in $1. # Adam -- Adam Weinberger adamw@adamw.org https://www.adamw.org