Skip to content

Commit

Permalink
Merge pull request #3520 from OmkarPh/fix/rpm-epoch-error
Browse files Browse the repository at this point in the history
Fixed epoch parser failing for numeric values
  • Loading branch information
AyanSinhaMahapatra authored Oct 10, 2023
2 parents c157593 + 2405a89 commit c84c8e9
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/packagedcode/rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ def __new__(self, version, release=None, epoch=None):
note: the sort order of the named tuple is the sort order.
But for creation we put the rarely used epoch last with a default to None.
"""

epoch = str(epoch) if epoch else ""

if epoch and epoch.strip() and not epoch.isdigit():
raise ValueError('Invalid epoch: must be a number or empty.')
if not version:
Expand Down
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "apache-commons-io",
"epoch": "1",
"version": "2.4",
"release": "12.el7",
"arch": "noarch",
"os": "linux",
"summary": "Utilities to assist with developing IO functionality",
"description": null,
"distribution": null,
"vendor": "CentOS",
"license": "ASL 2.0",
"packager": "CentOS BuildSystem <http://bugs.centos.org>",
"group": "Unspecified",
"url": "http://commons.apache.org/io",
"source_rpm": "apache-commons-io-2.4-12.el7.src.rpm",
"dist_url": null,
"is_binary": true
}
4 changes: 4 additions & 0 deletions tests/packagedcode/test_rpm.py
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,7 @@ def test_rpm_tags_xsetup_0_28_b1_src_rpm(self):
def test_rpm_tags_zziplib_0_11_15_3sf_i586_rpm(self):
test_file = self.get_test_loc('rpm/header/zziplib-0.11.15-3sf.i586.rpm')
self.check_rpm_tags(test_file)

def test_rpm_tags_apache_commons_io_2_4_12_el7_noarch_rpm(self):
test_file = self.get_test_loc('rpm/header/apache-commons-io-2.4-12.el7.noarch.rpm')
self.check_rpm_tags(test_file)

0 comments on commit c84c8e9

Please sign in to comment.