Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 2186223

Summary: repo2module fails when source RPMs are present in the repository
Product: Red Hat Enterprise Linux 8 Reporter: Stepan Broz <sbroz>
Component: modulemd-toolsAssignee: Jakub Kadlčík <jkadlcik>
Status: CLOSED ERRATA QA Contact: Tomáš Bajer <tbajer>
Severity: medium Docs Contact:
Priority: medium    
Version: 8.7CC: ovasik, tbajer
Target Milestone: rcKeywords: Triaged
Target Release: ---Flags: pm-rhel: mirror+
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: modulemd-tools-0.7-8.el8 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 2227436 (view as bug list) Environment:
Last Closed: 2023-11-14 15:35:59 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:
Bug Depends On:    
Bug Blocks: 2227436    

Description Stepan Broz 2023-04-12 13:08:17 UTC
Description of problem:
The "repo2module" utility fails everytime a (modular) .src.rpm is present in the repository.

Version-Release number of selected component (if applicable):
libmodulemd-2.13.0-1.el8.x86_64
modulemd-tools-0.7-6.el8.noarch
python3-libmodulemd-2.13.0-1.el8.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Create a test directory for the repo:
    # mkdir /root/repotest; cd /root/repotest

2. Download any modular .src.rpm, e.g. from brew or the Customer Portal.
    # curl "https://access.cdn.redhat.com/content/origin/rpms/aardvark-dns/1.1.0/5.module+el8.7.0+17824+66a0202b/fd431d51/aardvark-dns-1.1.0-5.module+el8.7.0+17824+66a0202b.src.rpm?user=90e4f6b5af3546dc2d63e878c977a13c&_auth_=1681318997_fcd05a5aa4cf0b47ae935f1995ed379e" -o aardvark-dns-1.1.0-5.module+el8.7.0+17824+66a0202b.src.rpm
   
3. Create non-modular repo:
    # createrepo /root/repotest

4. Run repo2module:
    # repo2module . --module-name foo --module-stream devel --module-version 123 --module-context f00d

Actual results:
Traceback (most recent call last):
  File "/usr/bin/repo2module", line 11, in <module>
    load_entry_point('repo2module==0.1', 'console_scripts', 'repo2module')()
  File "/usr/lib/python3.6/site-packages/repo2module/cli.py", line 122, in cli
    source_packages = get_source_packages(packages)
  File "/usr/lib/python3.6/site-packages/repo2module/cli.py", line 65, in get_source_packages
    subject = Subject(pkg.rpm_sourcerpm[:-4])
TypeError: 'NoneType' object is not subscriptable

Expected results:
Modular repo created or a self-explanatory error presented to the user.

Additional info:

Comment 1 Jakub Kadlčík 2023-04-26 14:45:13 UTC
Hello Stepan,
thank you for the report.

Unfortunately, the link from step 2 doesn't work anymore - "Download links are dynamic and available for 240 minutes before they expire". But I tried to download some modular package from brew and it seems to work for me with the upstream version of modulemd-version:

    $ cp ~/Downloads/aardvark-dns-1.5.0-2.module+el8.8.0+18060+3f21f2cc.x86_64.rpm .

    $ createrepo .
    Directory walk started
    Directory walk done - 1 packages
    Temporary output repo path: ./.repodata/
    Preparing sqlite DBs
    Pool started (with 5 workers)
    Pool finished

    $ repo2module . --module-name foo --module-stream devel --module-version 123 --module-context f00d

    $ cat modules.yaml |grep artifacts: -A2
      artifacts:
        rpms:
        - aardvark-dns-2:1.5.0-2.module+el8.8.0+18060+3f21f2cc.x86_64

There is an unnecessarily old version of modulemd-tools in RHEL8. Maybe we can update it to modulemd-tools-0.13 which is in Fedora?

Comment 2 Stepan Broz 2023-04-26 15:25:11 UTC
The link is irrelevant, any modular SRC RPM can be used to trigger the error -- note the SRC RPM (SRPM). It works fine with binary RPMs (e.g. "aardvark-dns-1.5.0-2.module+el8.8.0+18060+3f21f2cc.x86_64.rpm").

I am not sure what you meant by the old version of modulemd-tools in RHEL-8. That's what's shipped and what we have reported the issue on.

Do you believe the issue itself is not manifesting itself with modulemd-tools-0.13? If so, do you plan a rebase in the next RHEL-8 minor?

Comment 3 Jakub Kadlčík 2023-05-01 22:11:37 UTC
Hello Stepan,

> note the SRC RPM (SRPM)

Sorry about that, I missed this important part when reproducing the issue.
It turns out that this issue happens even with the latest upstream version of modulemd-tools, so I am currently working on a fix.

Comment 4 Jakub Kadlčík 2023-05-01 22:21:51 UTC
I am proposing the following patch
https://github.com/rpm-software-management/modulemd-tools/pull/66

Comment 14 errata-xmlrpc 2023-11-14 15:35:59 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (modulemd-tools bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2023:7037