openSUSE / obs-service-replace_using_package_version

An OBS service to replace a regex with some package version available in the build time repositories
GNU General Public License v3.0
4 stars 12 forks source link

pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: '' #45

Closed DimStar77 closed 1 year ago

DimStar77 commented 1 year ago

Staging projects received an update for python-setuptools to version 67.6.0

This service fails to parse version strings in a few builds:

e.g. https://build.opensuse.org/package/live_build_log/openSUSE:Factory:Staging:L/kubic-pause-image/images/x86_64

[    9s] Running build time source services...
[   10s] Traceback (most recent call last):
[   10s]   File "/usr/lib/obs/service/replace_using_package_version", line 251, in <module>
[   10s]     init(__name__)
[   10s]   File "/usr/lib/obs/service/replace_using_package_version", line 248, in init
[   10s]     main()
[   10s]   File "/usr/lib/obs/service/replace_using_package_version", line 133, in main
[   10s]     version = find_package_version(command_args['--package'], rpm_dir)
[   10s]   File "/usr/lib/obs/service/replace_using_package_version", line 164, in find_package_version
[   10s]     version = parse_version('')
[   10s]   File "/usr/lib/python3.10/site-packages/pkg_resources/_vendor/packaging/version.py", line 197, in __init__
[   10s]     raise InvalidVersion(f"Invalid version: '{version}'")
[   10s] pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: ''
[   10s] service run failed for service 'replace_using_package_version'

The 'replacing empty string' could very well hint at an error in the build where we try to find a version number of a package that does not exist? If so, this error might be a very nice addition to catch those things; otherwise the error should be fixed

s-t-e-v-e-n-k commented 1 year ago

Nope, it's in the code directly: https://github.com/openSUSE/obs-service-replace_using_package_version/blob/master/replace_using_package_version/replace_using_package_version.py#L164

Almost all of them look unneeded, but I'm going to defer to someone who knows the code better.

davidcassany commented 1 year ago

@DimStar77 @s-t-e-v-e-n-k Thanks for the notice I am having a look