Implement a better way of getting the package name and version from
stdin. This doesn't involve going through a list of all packages in
such a tedious way it was before. Only thing this now requires is that
the version number of any package always starts with a digit. So a
version number like "-1.0" is totally fine, but a version number like
"-r1-1.0" is not. Hopefully the latter ones aren't that common.
if "[ebuild" in line:
full_name = line.partition('] ')[2].partition(' ')[0]
- for i in all_packages:
- if i in full_name:
- packages.append((i, full_name[len(i):]))
+ version = full_name.partition('/')[2].partition('-')[2]
+ while not version[0].isdigit():
+ version = version.partition('-')[2]
+
+ package_name = full_name[:-len(version)-1]
+
+ packages.append((package_name, '-' + version))
+
if len(packages) == 0:
return