File return-the-expected-powerpc-os-arch-bsc-1117995.patch of Package salt
From 9365531537f2b80e0a0d1481edfa60de8331d07d Mon Sep 17 00:00:00 2001
From: Mihai Dinca <mdinca@suse.de>
Date: Thu, 13 Dec 2018 12:17:35 +0100
Subject: [PATCH] Return the expected powerpc os arch (bsc#1117995)
---
salt/utils/pkg/rpm.py | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/salt/utils/pkg/rpm.py b/salt/utils/pkg/rpm.py
index 2ee2bac4e5..d1b149ea0b 100644
--- a/salt/utils/pkg/rpm.py
+++ b/salt/utils/pkg/rpm.py
@@ -1,10 +1,7 @@
-# -*- coding: utf-8 -*-
"""
Common functions for working with RPM packages
"""
-# Import python libs
-from __future__ import absolute_import, print_function, unicode_literals
import collections
import datetime
@@ -14,8 +11,6 @@ import subprocess
import salt.utils.path
import salt.utils.stringutils
-
-# Import 3rd-party libs
from salt.ext import six
log = logging.getLogger(__name__)
@@ -68,9 +63,10 @@ def get_osarch():
stderr=subprocess.PIPE,
).communicate()[0]
else:
- ret = "".join([x for x in platform.uname()[-2:] if x][-1:])
-
- return salt.utils.stringutils.to_str(ret).strip() or "unknown"
+ ret = "".join(list(filter(None, platform.uname()[-2:]))[-1:])
+ ret = salt.utils.stringutils.to_str(ret).strip() or "unknown"
+ ARCH_FIXES_MAPPING = {"powerpc64le": "ppc64le"}
+ return ARCH_FIXES_MAPPING.get(ret, ret)
def check_32(arch, osarch=None):
@@ -102,7 +98,7 @@ def resolve_name(name, arch, osarch=None):
osarch = get_osarch()
if not check_32(arch, osarch) and arch not in (osarch, "noarch"):
- name += ".{0}".format(arch)
+ name += ".{}".format(arch)
return name
@@ -120,7 +116,7 @@ def parse_pkginfo(line, osarch=None):
name = resolve_name(name, arch, osarch)
if release:
- version += "-{0}".format(release)
+ version += "-{}".format(release)
if epoch not in ("(none)", "0"):
version = ":".join((epoch, version))
@@ -146,10 +142,10 @@ def combine_comments(comments):
comments = [comments]
ret = []
for comment in comments:
- if not isinstance(comment, six.string_types):
+ if not isinstance(comment, str):
comment = str(comment)
# Normalize for any spaces (or lack thereof) after the #
- ret.append("# {0}\n".format(comment.lstrip("#").lstrip()))
+ ret.append("# {}\n".format(comment.lstrip("#").lstrip()))
return "".join(ret)
@@ -171,7 +167,7 @@ def version_to_evr(verstring):
idx_e = verstring.find(":")
if idx_e != -1:
try:
- epoch = six.text_type(int(verstring[:idx_e]))
+ epoch = str(int(verstring[:idx_e]))
except ValueError:
# look, garbage in the epoch field, how fun, kill it
epoch = "0" # this is our fallback, deal
--
2.29.2