Skip to content

Commit 3d5f7ec

Browse files
committed
Fixed epoch parser failing for numeric values
Signed-off-by: Omkar Phansopkar <omkarphansopkar@gmail.com>
1 parent 9e4d706 commit 3d5f7ec

File tree

4 files changed

+26
-0
lines changed

4 files changed

+26
-0
lines changed

src/packagedcode/rpm.py

+3
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,9 @@ def __new__(self, version, release=None, epoch=None):
9696
note: the sort order of the named tuple is the sort order.
9797
But for creation we put the rarely used epoch last with a default to None.
9898
"""
99+
100+
epoch = str(epoch) if epoch else ""
101+
99102
if epoch and epoch.strip() and not epoch.isdigit():
100103
raise ValueError('Invalid epoch: must be a number or empty.')
101104
if not version:
Binary file not shown.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"name": "apache-commons-io",
3+
"epoch": "1",
4+
"version": "2.4",
5+
"release": "12.el7",
6+
"arch": "noarch",
7+
"os": "linux",
8+
"summary": "Utilities to assist with developing IO functionality",
9+
"description": null,
10+
"distribution": null,
11+
"vendor": "CentOS",
12+
"license": "ASL 2.0",
13+
"packager": "CentOS BuildSystem <http://bugs.centos.org>",
14+
"group": "Unspecified",
15+
"url": "http://commons.apache.org/io",
16+
"source_rpm": "apache-commons-io-2.4-12.el7.src.rpm",
17+
"dist_url": null,
18+
"is_binary": true
19+
}

tests/packagedcode/test_rpm.py

+4
Original file line numberDiff line numberDiff line change
@@ -391,3 +391,7 @@ def test_rpm_tags_xsetup_0_28_b1_src_rpm(self):
391391
def test_rpm_tags_zziplib_0_11_15_3sf_i586_rpm(self):
392392
test_file = self.get_test_loc('rpm/header/zziplib-0.11.15-3sf.i586.rpm')
393393
self.check_rpm_tags(test_file)
394+
395+
def test_rpm_tags_apache_commons_io_2_4_12_el7_noarch_rpm(self):
396+
test_file = self.get_test_loc('rpm/header/apache-commons-io-2.4-12.el7.noarch.rpm')
397+
self.check_rpm_tags(test_file)

0 commit comments

Comments
 (0)