[PATCH] Fix package manager version handling for CentOS

Ihar Hrachyshka ihrachys at redhat.com
Sun Nov 15 09:59:40 UTC 2015


If dnf is used, the code crashes on CentoOS version strings like
'7.1.1503'. Instead of assuming there are only two components in the
string, split it on dots and use the major component.

Signed-off-by: Ihar Hrachyshka <ihrachys at redhat.com>
---
 py/mockbuild/package_manager.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/py/mockbuild/package_manager.py b/py/mockbuild/package_manager.py
index d10af4a..18b4294 100644
--- a/py/mockbuild/package_manager.py
+++ b/py/mockbuild/package_manager.py
@@ -17,7 +17,7 @@ def PackageManager(config_opts, chroot, plugins):
     elif pm == 'dnf':
         (distribution, version) = platform.dist()[0:2]
         if distribution in ['redhat', 'centos']:
-            version = float(version)
+            version = int(version.split('.')[0])
             if version < 8:
                 if  'dnf_warning' in config_opts and config_opts['dnf_warning']:
                     print("""WARNING! WARNING! WARNING!
-- 
1.8.3.1



More information about the buildsys mailing list