From ca15a0975d746e45690682cf94ea59a8c9f72fad Mon Sep 17 00:00:00 2001 From: Dominik Rumian Date: Mar 15 2022 10:04:18 +0000 Subject: Fix: 'lint' subcommand should not invoke rpmlint on debuginfo packages 'lint' subcommand included debuginfo packages in list of packages to be checked by rpmlint. Those packages however, should not be included. This commit fixes this issue. Jira: RHELCMP-8537 Resolves: rhbz#2052451 Signed-off-by: Dominik Rumian --- diff --git a/pyrpkg/__init__.py b/pyrpkg/__init__.py index 7162c53..2a4b3fd 100644 --- a/pyrpkg/__init__.py +++ b/pyrpkg/__init__.py @@ -2688,7 +2688,9 @@ class Commands(object): rpms = set() for rpm_glob in rpm_globs: - rpms.update(glob.glob(rpm_glob)) + for path in glob.glob(rpm_glob): + if '-debuginfo' not in path and '-debugsource' not in path: + rpms.add(path) if not rpms: log.warning('No rpm found') diff --git a/tests/test_commands.py b/tests/test_commands.py index e984db0..2009c93 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -1032,6 +1032,10 @@ class TestLint(CommandTestCase): 'docpkg-1.2-2.fc26.src.rpm') bin_path = os.path.join(cmd.path, 'results', 'docpkg-1.2-2.fc26.x86_64.rpm') + debuginfo_path = os.path.join(cmd.path, 'results', + 'docpkg-debuginfo-1.2-2.fc26.src.rpm') + debugsource_path = os.path.join(cmd.path, 'results', + 'docpkg-debugsource-1.2-2.fc26.src.rpm') def _mock_exists(path): return path in [srpm_path, os.path.join(cmd.path, 'results')] @@ -1039,7 +1043,7 @@ class TestLint(CommandTestCase): def _mock_glob(g): return { os.path.join(cmd.path, 'results', '*.rpm'): [bin_path], - srpm_path: [srpm_path], + srpm_path: [srpm_path, debuginfo_path, debugsource_path], }[g] exists.side_effect = _mock_exists