Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parse_match() stopped returning distinct results for 'foo' and 'foo:*' #270

Open
mgorny opened this issue Aug 24, 2019 · 1 comment
Open

Comments

@mgorny
Copy link
Contributor

mgorny commented Aug 24, 2019

In [1]: from pkgcore.util.parserestrict import parse_match                                                                                         

In [2]: parse_match('bar:*')                                                                                                                       
Out[2]: <PackageDep attr='package' restriction=<StrExactMatch 'bar' @0x7fdf61cae890> @0x7fdf614009b0>

In [3]: parse_match('bar')                                                                                                                         
Out[3]: <PackageDep attr='package' restriction=<StrExactMatch 'bar' @0x7fdf61cae890> @0x7fdf614009b0>

In [4]: parse_match('bar:=')                                                                                                                       
Out[4]: <AndRestriction negate=False type='package' finalized=True restrictions=(<SlotDep attr='slot' restriction=<StrExactMatch '=' @0x7fdf624a55f0> @0x7fdf61ca20b0>, <PackageDep attr='package' restriction=<StrExactMatch 'bar' @0x7fdf61cae890> @0x7fdf614009b0>) @0x7fdf624a5650>

In the past, bar:* used to return AndRestriction with SlotDep as well. I'm using this to construct 'unqualified atoms' in gentoopm, and losing this ability means I'm no longer able to accurately represent user input.

@ferringb
Copy link
Contributor

Offhand, I'm not entirely in agreement that ':=' should be optimize out. Admittedly it makes fuck-all sense for pquery, but that's an explicit slot operator; the atom object shouldn't drop that.

As to parse_match giving different atoms based upon invocation- it's supposed to; your ask is better phrased as "should parse_match rewrite input" (things like dropping slot operators) based on context, which phrased that way: it's not a simple 'yes'.

My personal inclination here is that 'no' is the correct answer for parse_match, but we should find a solution that address your base need.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants