Closed furlongm closed 8 years ago
Thanks for the report, and sorry for the delayed response. We were in full crazy mode at the office last week, and I was camping over the weekend. I'll get on this tonight or tomorrow!
So this is an interesting one. Based on your output from python-rpm
, it seems like even it parses it as having no package name. When I wrote this initially, there weren't any cases in which we had to parse a package string with no package name. Is this a significant use case for you?
Hmm, there definitely should have been a package name. And I can't reproduce it now :(
I'll reopen the issue if it reoccurs.
Ah, I'm able to reproduce. Somehow I didn't copy and paste correctly in the initial report. Here's the full stacktrace:
Finding updates for Host test1
test1.internal.lan
Traceback (most recent call last):
File "sbin/patchman", line 582, in <module>
main()
File "sbin/patchman", line 577, in main
showhelp = process_args(args)
File "sbin/patchman", line 561, in process_args
host_updates_alt(args.host)
File "sbin/patchman", line 278, in host_updates_alt
host.find_updates()
File "/home/furlongm/src/patchman/patchman/hosts/models.py", line 194, in find_updates
repo_packages)
File "/home/furlongm/src/patchman/patchman/hosts/models.py", line 259, in find_osgroup_repo_updates
if highest_package.compare_version(potential_update) == -1 \
File "/home/furlongm/src/patchman/patchman/packages/models.py", line 140, in compare_version
other.get_version_string(), False)
File "/home/furlongm/src/patchman/lib/python2.7/site-packages/version_utils/rpm.py", line 71, in compare_packages
a_epoch, a_ver, a_rel = parse_package(rpm_str_a, arch_provided)['EVR']
File "/home/furlongm/src/patchman/lib/python2.7/site-packages/version_utils/rpm.py", line 212, in parse_package
'{0}'.format(package_string))
version_utils.errors.RpmError: Could not parse package string: aaa_base-13.2+git20140911.61c1681-10.1
Changing the regex in rpm.py to something like _rpm_re = compile('(\S+)-(?:(\d*):)?(.*)-(~?\w+[\w.]*)')
seems to fix it for me.
That is indeed a complicated package name! I'll add it to the test suite and update the regex to handle it properly.
Getting the following error:
For reference, python-rpm parses this as ('', '13.2+git20140911.61c1681', '10.1')