This bug was discovered while investigating bug #161622 comment #30.
$ depend-java-query --get-vm '>=virtual/jdk-1.4 >=dev-java/jdbc-mysql-3.1'
does not list a java 1.6 jm as required by dev-java/jdbc-mysql-5.1.11.
The reason is that the package_parser regular expression as added in http://overlays.gentoo.org/proj/java/changeset/7929 does parse that atom as "dev-java/jdbc-mysql-3". The digit 3 does match \w, but the . isn't matched.
Created attachment 250099 [details, diff]
Proposed quick fix
This is a quick fix for the issue. Nevertheless I suggest someone get together with the portage development team or EAPI group and figure out a reliable regexp to match Gentoo package atoms. Despite my expectations I couldn't find such a regexp in the portage source code, at least not as easily as I had hoped.
Created attachment 250115 [details, diff]
I meant PMS, not EAPI, in comment #1. For details about the PMS document I reference below, see http://www.gentoo.org/proj/en/qa/pms.xml
The regexp in the attached patch should resemble the PMS 3 specification more closely. It does, however, reject packages with a name ending in a hyphen, and doesn't model the relation between operators and the presence or absence of version numbers. Adding that would make the regexp even larger.
In the long run, it might be a good idea to stop silently ignoring any part of the atoms string we cannot parse. Instead it might be better to split atoms and ensure we parse each of them completely, issuing a warning if we fail for any of them. Parsing atoms completely would allow regexps to enable backtracking, which would allow us to accept hyphens at the end of a package name. Currently, allowing a hyphen at the end of the package name will greedily consume the version delimiter, ending the match at the first digit of the version number.
The regexp for package names resulted from the following interpretation based on section 3.1.2 (Package Names) of PMS 3:
* >= 2 characters, not ending in a digit (here's the ending hyphen)
* >= 3 characters, ending in a digit
* == 1 character
* == 2 characters, ending in a digit
Ping? This has been almost a year!
I saw something similar when trying to port an ebuild using java-pkg-opt-2.eclass to Prefix. Not sure where the root cause is.