getting PKGNAME from CONFLICTS
Dan Langille
dan at langille.org
Tue Aug 14 21:03:16 UTC 2018
> On Aug 14, 2018, at 3:15 PM, Adam Weinberger <adamw at adamw.org> wrote:
>
> On Tue, Aug 14, 2018 at 1:13 PM Adam Weinberger <adamw at adamw.org> wrote:
>>
>> On Tue, Aug 14, 2018 at 11:54 AM Dan Langille <dan at langille.org> 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]+$/
>
> On second thought, 'p' should be in there too. [-_\.,0-9abp].
I think we are trying to match the regex instead of noticing a regex and removing it.
Am I doing it wrong?
$ cat ~/tmp/pkg-name.php
<?php
$CONFLICTS = "p5-CGI.pm-[1-3]*";
#$pkgname = preg_match("/(.*)[-_\.,0-9,abp]*/", $CONFLICTS, $matches);
$pkgname = preg_match("/(.*)-[\[.*\]+]/", $CONFLICTS, $matches);
print_r($matches);
$ php ~/tmp/pkg-name.php
Array
(
[0] => p5-CGI.pm-[
[1] => p5-CGI.pm
)
It's close, but not quite.
Thank you.
--
Dan Langille - BSDCan / PGCon
dan at langille.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 658 bytes
Desc: Message signed with OpenPGP
URL: <http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20180814/73d07aa9/attachment.sig>
More information about the freebsd-ports
mailing list