Bug 1935886

Summary: Python dist dep generator crashes silently when nonexisitng ghost .egg-info is passed to %python_extras_subpkg
Product: [Fedora] Fedora Reporter: Miro Hrončok <mhroncok>
Component: python-rpm-generatorsAssignee: Tomas Orsava <torsava>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 34CC: cstratak, lbalhar, m.cyprian, mhroncok, ngompa13, pviktori, shcherbina.iryna, torsava
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2021-06-08 09:24:28 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Miro Hrončok 2021-03-05 17:43:55 UTC
When I get the python-twisted package at https://src.fedoraproject.org/rpms/python-twisted/c/0c1cdc460ff7877bd07c0305a192aec9c59f3366 and re-intorduce this line:

%{?python_extras_subpkg:%python_extras_subpkg -n python3-%{pypi_name} -i %{python3_sitearch}/Twisted-%{version}-py%{python3_version}.egg-info tls}

The generator (silently) crashes:

Traceback (most recent call last):
  File "/usr/lib/rpm/pythondistdeps.py", line 328, in <module>
    dist = Distribution(f)
  File "/usr/lib/rpm/pythondistdeps.py", line 56, in __init__
    self.normalized_name = normalize_name(self.name)
  File "/usr/lib/rpm/pythondistdeps.py", line 38, in normalize_name
    return re.sub(r'[-_.]+', '-', name).lower()
  File "/usr/lib64/python3.9/re.py", line 210, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object
Traceback (most recent call last):
  File "/usr/lib/rpm/pythondistdeps.py", line 328, in <module>
    dist = Distribution(f)
  File "/usr/lib/rpm/pythondistdeps.py", line 56, in __init__
    self.normalized_name = normalize_name(self.name)
  File "/usr/lib/rpm/pythondistdeps.py", line 38, in normalize_name
    return re.sub(r'[-_.]+', '-', name).lower()
  File "/usr/lib64/python3.9/re.py", line 210, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or bytes-like object

Comment 1 Miro Hrončok 2021-03-05 17:47:56 UTC
Additional info.

With python3-rpm-generators-12-1.fc34, the build actually fails with:


Error: The package name contains an extras name `tls` that was not found in the metadata.
Check if the extras were removed from the project. If so, consider removing the subpackage and obsoleting it from another.

error: Dependency tokens must begin with alpha-numeric, '_' or '/': *** PYTHON_EXTRAS_NOT_FOUND_ERROR___SEE_STDERR ***




That is also wrong. The extra is in /usr/lib/python3.9/site-packages/Twisted-21.2.0-py3.9.egg-info/requires.txt specified as follows:

...

[tls]
pyopenssl>=16.0.0
service_identity>=18.1.0
idna>=2.4

...

Comment 2 Miro Hrončok 2021-03-05 17:59:11 UTC
So, I've panicked for no reason, this was my PEBKAC.

I've added:

%{?python_extras_subpkg:%python_extras_subpkg -n python3-%{pypi_name} -i %{python3_sitearch}/Twisted-%{version}-py%{python3_version}.egg-info tls}

But the metadata is in sitelib, not sitearch, so it doe snot exists.


We should anyway make sure that if this happens:

 - the error message says: /usr/lib64/python3.9/site-packages/Twisted-21.2.0-py3.9.egg-info does not exist
 - the build fails

Both this does not have high severity.

Comment 3 Tomas Orsava 2021-06-08 09:07:04 UTC
PR has been merged: https://src.fedoraproject.org/rpms/python-rpm-generators/pull-request/40

Comment 4 Tomas Orsava 2021-06-08 09:10:21 UTC
Fixed in rawhide.

Comment 5 Tomas Orsava 2021-07-01 10:20:26 UTC
Test, ignore this message.