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

could not parse package string #11

Closed
furlongm opened this issue Jun 16, 2016 · 6 comments
Closed

could not parse package string #11

furlongm opened this issue Jun 16, 2016 · 6 comments

Comments

@furlongm
Copy link
Contributor

furlongm commented Jun 16, 2016

Getting the following error:

version_utils.errors.RpmError: Could not parse package string: aaa_base-13.2+git20140911.61c1681-10.1

For reference, python-rpm parses this as ('', '13.2+git20140911.61c1681', '10.1')

@mplanchard
Copy link
Contributor

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!

@mplanchard
Copy link
Contributor

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?

@furlongm
Copy link
Contributor Author

Hmm, there definitely should have been a package name. And I can't reproduce it now :(

I'll reopen the issue if it reoccurs.

@furlongm furlongm reopened this Jun 27, 2016
@furlongm
Copy link
Contributor Author

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

@furlongm
Copy link
Contributor Author

Changing the regex in rpm.py to something like _rpm_re = compile('(\S+)-(?:(\d*):)?(.*)-(~?\w+[\w.]*)') seems to fix it for me.

@mplanchard
Copy link
Contributor

That is indeed a complicated package name! I'll add it to the test suite and update the regex to handle it properly.

mplanchard added a commit to mplanchard/version_utils that referenced this issue Jul 14, 2016
`version_utils` will now correctly parse version string such as
`aaa_base-13.2+git20140911.61c1681-10.1`. Thanks to
@furlongm for the find & the proposed fix.

* updated regex
* updated tests
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