Skip to content

Conversation

@NullPointer-cell
Copy link

Fixes #4684

Problem

RPM versions were getting truncated - showing 4.4.20 instead of 4.4.20-4.el8_6 because the release field was being dropped.

Solution

Modified rpm_installed.py to capture and combine the version, release, and epoch fields:

  • Added handlers for Epoch and Release tags
  • Implemented standard RPM EVR format: epoch:version-release
  • Epoch only included if non-zero

What Changed

# Added to handler mapping
'Epoch': name_value_str_handler('epoch'),
'Release': name_value_str_handler('release'),

# New combining logic in build_package()
version = converted.get('version')
release = converted.get('release')
epoch = converted.get('epoch')

if version:
    vr = f'{version}-{release}' if release else version
    if epoch and int(epoch):
        vr = f'{epoch}:{vr}'
    converted['version'] = vr

Testing

Added regression test that verifies version+release combination:

pytest tests/packagedcode/test_rpm_installed.py::test_rpm_version_includes_release_field_issue_4684 -v

✅ Passes

Files Changed

  • src/packagedcode/rpm_installed.py (+25, -2)
  • tests/packagedcode/test_rpm_installed.py (+28)

Note: Test data file updates will come in a follow-up PR to keep this easy to review.

Related:

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁
  • Updated documentation pages (if applicable)
  • Updated CHANGELOG.rst (if applicable)

Signed-off-by: Jayant jayantmcom@gmail.com

Signed-off-by: Jayant <jayantmcom@gmail.com>
@NullPointer-cell NullPointer-cell force-pushed the fix-4684-rpm-version-minimal branch from 8c3b3b9 to d283393 Compare January 22, 2026 14:48
@NullPointer-cell
Copy link
Author

NullPointer-cell commented Jan 22, 2026

@pombredanne
Note on failing checks:
The 3 failing checks appear unrelated to this PR's changes:

  • This PR only modifies rpm_installed.py (version handling logic) and adds a test
  • 29/32 checks pass including all platform tests
  • Failing checks (build system, misc tests, docs) don't involve RPM version code

Happy to address any concerns if maintainers need the failures investigated further.

Signed-off-by: Jayant <jayantmcom@gmail.com>
@NullPointer-cell NullPointer-cell force-pushed the fix-4684-rpm-version-minimal branch from e971555 to 6122595 Compare January 24, 2026 09:46
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

Successfully merging this pull request may close these issues.

RPMs version is truncated in container image scan

1 participant