Date: Wed, 15 Aug 2018 11:56:10 -0400 From: Dan Langille <dan@langille.org> To: Rodrigo Osorio <ros@bebik.net> Cc: freebsd-ports@freebsd.org Subject: Re: getting PKGNAME from CONFLICTS Message-ID: <45804981-C102-4DC5-B35F-1DFA45215964@langille.org> In-Reply-To: <106c6045-c2b3-7da6-5ceb-daa778e52286@bebik.net> References: <286CAC11-E9C6-42C4-8D41-97F51EFF1596@yahoo.com> <9823D065-3FCC-4D69-9EB4-9C4CD01C7778@langille.org> <16f81513-5324-001f-d1c7-45536835ef15@FreeBSD.org> <106c6045-c2b3-7da6-5ceb-daa778e52286@bebik.net>
next in thread | previous in thread | raw e-mail | index | archive | help
--Apple-Mail=_36DF765A-226F-4648-B215-2F67935E1963 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii > On Aug 15, 2018, at 9:17 AM, Rodrigo Osorio <ros@bebik.net> wrote: >=20 > On 08/15/18 14:46, Matthew Seaman wrote: >> On 15/08/2018 00:35, Dan Langille wrote: >>>> On Aug 14, 2018, at 2:55 PM, Mark Millard via freebsd-ports = <freebsd-ports@freebsd.org> wrote: >>>>=20 >>>>=20 >>>> Dan Langille dan at langille.org wrote on >>>> Tue Aug 14 17:54:01 UTC 2018 : >>>>=20 >>>>> . . . >>>>> At https://dev.freshports.org/www/p5-CGI/ you can see: >>>>>=20 >>>>> CONFLICTS: p5-CGI.pm-[1-3]* >>>>> . . . >>>>> To extract the PKGNAME values from the CONFLICTS I will need to = remove everything after the trailing dash. >>>>> . . . >>>> p5- >>>> vs. >>>> p5-CGI.pm- >>>> vs. >>>> p5-CGI.pm-[1- >>>>=20 >>>> It looks to me like "trailing dash" probably has a >>>> complicated definition where some "-"(s) may exist >>>> that are to be ignored after the one of interest. >>>> In the example I'm guessing that the middle >>>> "-" is intended (so "p5-CGI.pm-"). >>> Agreed. The hard part is identifying the regex and deleting it from = consideration. >>>=20 >> If you don't mind spawning a new process, you can just do: >>=20 >> % pkg search -qg 'p5-CGI.pm-[1-3]*' >> p5-CGI.pm-3.63_1,1 >>=20 >> This does assume your pkg(8) is configured to use a repository with = all >> possible packages available. The default FreeBSD repositories are a >> good choice in that regard. >>=20 >> Or if you already have a database table with all of the package names >> and versions, then you'll presumably want to change the glob = expression >> into a regex match (in this case something like = '^p5-CGI\.pm-[1-3].*') >> Unless there's a PG extension that allows using glob(3) to match >> strings? I can't see one after a pretty cursory search. (sqlite has >> glob(3) support, which is what the pkg(8) command above is using = under >> the hood.) >>=20 >> Cheers, >>=20 >> Matthew >>=20 > Hi, >=20 > Why do you uses regexp instead of evaluating them with fnmatch ? > The function is available (at least) in php, python and ruby. I want to extract PKGNAME from CONFLICTS. I was not trying to match anything with the raw CONFLICTS field. With PKGNAME, the application can then search the database. -- Dan Langille - BSDCan / PGCon dan@langille.org --Apple-Mail=_36DF765A-226F-4648-B215-2F67935E1963 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Comment: GPGTools - http://gpgtools.org iQGTBAEBCgB9FiEEzqcJ4oeyf8sgTIEBIU09XU2nXtMFAlt0TRpfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldENF QTcwOUUyODdCMjdGQ0IyMDRDODEwMTIxNEQzRDVENERBNzVFRDMACgkQIU09XU2n XtMpiAf/RhViFeivNIK/LaXGDWEjnJYqpTCnL/WbndzOC1zekOK0Hw4ANkPQfxAc 37GlVVgR5EI3Fhk/avlRIJEVscA50iV6InRYYax8iu6Y7znnlAbydXWsOvYK0/UR JC5/wFSIXtm/nrDy8wfJ7TvX50zPvjUsYZAVtrVhqVjc8ad4Su8yDlECcz/dtM/Y Cen1QBwAaFnL+8hkm2NNEYKPmA/zDG1ay6S2kWhBjDOsuMxe2TaZJ+13fkLbpEhG FbsDTZQcaQ7aoSSCxrlRRVq2L0teKEmTnlUbSBhHonkVVDdvzTB1D7Vc132df2o9 Jl3ANTZzVe9EVE7kMY3vUONZvwgFAw== =5pmD -----END PGP SIGNATURE----- --Apple-Mail=_36DF765A-226F-4648-B215-2F67935E1963--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?45804981-C102-4DC5-B35F-1DFA45215964>