From b83947891acd46020ba74ab88dfcd8c15ee605ee Mon Sep 17 00:00:00 2001 From: wangxiyuan Date: Tue, 15 Jun 2021 09:15:15 +0000 Subject: [PATCH] Fix qemu 4.1 size check error --- 0001-Fix-qemu-4.1-size-check-error.patch | 37 ++++++++++ python-oslo-utils.spec | 94 ++---------------------- 2 files changed, 42 insertions(+), 89 deletions(-) create mode 100644 0001-Fix-qemu-4.1-size-check-error.patch diff --git a/0001-Fix-qemu-4.1-size-check-error.patch b/0001-Fix-qemu-4.1-size-check-error.patch new file mode 100644 index 0000000..019401c --- /dev/null +++ b/0001-Fix-qemu-4.1-size-check-error.patch @@ -0,0 +1,37 @@ +From dd7dd9edb79cb87651125b89656320a0e6d309d8 Mon Sep 17 00:00:00 2001 +From: wangxiyuan +Date: Tue, 15 Jun 2021 09:05:44 +0000 +Subject: [PATCH] Fix qemu 4.1 size check error + +--- + oslo_utils/imageutils.py | 7 +++++-- + 1 file changed, 5 insertions(+), 2 deletions(-) + +diff --git a/oslo_utils/imageutils.py b/oslo_utils/imageutils.py +index a9bb3bb..14d7b5c 100644 +--- a/oslo_utils/imageutils.py ++++ b/oslo_utils/imageutils.py +@@ -44,7 +44,7 @@ class QemuImgInfo(object): + BACKING_FILE_RE = re.compile((r"^(.*?)\s*\(actual\s+path\s*:" + r"\s+(.*?)\)\s*$"), re.I) + TOP_LEVEL_RE = re.compile(r"^([\w\d\s\_\-]+):(.*)$") +- SIZE_RE = re.compile(r"(\d*\.?\d+)(\w+)?(\s*\(\s*(\d+)\s+bytes\s*\))?", ++ SIZE_RE = re.compile(r"(\d*\.?\d+)\s*(\w+)?(\s*\(\s*(\d+)\s+bytes\s*\))?", + re.I) + + def __init__(self, cmd_output=None, format='human'): +@@ -106,7 +106,10 @@ class QemuImgInfo(object): + return int(real_size.group(4)) + elif not unit_of_measure: + return int(magnitude) +- return strutils.string_to_bytes('%s%sB' % (magnitude, unit_of_measure), ++ # Allow abbreviated unit such as K to mean KB for compatibility. ++ if len(unit_of_measure) == 1 and unit_of_measure != 'B': ++ unit_of_measure += 'B' ++ return strutils.string_to_bytes('%s%s' % (magnitude, unit_of_measure), + return_int=True) + + def _extract_details(self, root_cmd, root_details, lines_after): +-- +2.27.0 + diff --git a/python-oslo-utils.spec b/python-oslo-utils.spec index 6fb5bf1..dbfab02 100644 --- a/python-oslo-utils.spec +++ b/python-oslo-utils.spec @@ -1,45 +1,17 @@ %global _empty_manifest_terminate_build 0 Name: python-oslo-utils Version: 3.35.0 -Release: 2 +Release: 3 Summary: Oslo Utility library License: Apache-2.0 URL: https://docs.openstack.org/oslo.utils/latest/ Source0: https://files.pythonhosted.org/packages/0e/3e/60213972daddecba38b23e0455d5f031f256187001e8400555dd02b98724/oslo.utils-3.35.0.tar.gz +Patch0: 0001-Fix-qemu-4.1-size-check-error.patch BuildArch: noarch %description -======================== -Team and repository tags -======================== - -.. image:: http://governance.openstack.org/badges/oslo.utils.svg - :target: http://governance.openstack.org/reference/tags/index.html - -.. Change things from this point on - -========== -oslo.utils -========== - -.. image:: https://img.shields.io/pypi/v/oslo.utils.svg - :target: https://pypi.python.org/pypi/oslo.utils/ - :alt: Latest Version - -.. image:: https://img.shields.io/pypi/dm/oslo.utils.svg - :target: https://pypi.python.org/pypi/oslo.utils/ - :alt: Downloads - The oslo.utils library provides support for common utility type functions, such as encoding, exception handling, string manipulation, and time handling. -* Free software: Apache license -* Documentation: https://docs.openstack.org/oslo.utils/latest/ -* Source: https://git.openstack.org/cgit/openstack/oslo.utils -* Bugs: https://bugs.launchpad.net/oslo.utils - - - - %package -n python2-oslo-utils Summary: Oslo Utility library Provides: python2-oslo-utils @@ -58,76 +30,18 @@ Requires: python2-debtcollector Requires: python2-pyparsing Requires: python2-funcsigs %description -n python2-oslo-utils -======================== -Team and repository tags -======================== - -.. image:: http://governance.openstack.org/badges/oslo.utils.svg - :target: http://governance.openstack.org/reference/tags/index.html - -.. Change things from this point on - -========== -oslo.utils -========== - -.. image:: https://img.shields.io/pypi/v/oslo.utils.svg - :target: https://pypi.python.org/pypi/oslo.utils/ - :alt: Latest Version - -.. image:: https://img.shields.io/pypi/dm/oslo.utils.svg - :target: https://pypi.python.org/pypi/oslo.utils/ - :alt: Downloads - The oslo.utils library provides support for common utility type functions, such as encoding, exception handling, string manipulation, and time handling. -* Free software: Apache license -* Documentation: https://docs.openstack.org/oslo.utils/latest/ -* Source: https://git.openstack.org/cgit/openstack/oslo.utils -* Bugs: https://bugs.launchpad.net/oslo.utils - - - - %package help Summary: Development documents and examples for oslo.utils Provides: python2-oslo-utils-doc %description help -======================== -Team and repository tags -======================== - -.. image:: http://governance.openstack.org/badges/oslo.utils.svg - :target: http://governance.openstack.org/reference/tags/index.html - -.. Change things from this point on - -========== -oslo.utils -========== - -.. image:: https://img.shields.io/pypi/v/oslo.utils.svg - :target: https://pypi.python.org/pypi/oslo.utils/ - :alt: Latest Version - -.. image:: https://img.shields.io/pypi/dm/oslo.utils.svg - :target: https://pypi.python.org/pypi/oslo.utils/ - :alt: Downloads - The oslo.utils library provides support for common utility type functions, such as encoding, exception handling, string manipulation, and time handling. -* Free software: Apache license -* Documentation: https://docs.openstack.org/oslo.utils/latest/ -* Source: https://git.openstack.org/cgit/openstack/oslo.utils -* Bugs: https://bugs.launchpad.net/oslo.utils - - - - %prep -%autosetup -n oslo.utils-3.35.0 +%autosetup -n oslo.utils-3.35.0 -S git %build %py2_build @@ -167,6 +81,8 @@ mv %{buildroot}/doclist.lst . %{_docdir}/* %changelog +* Tue Jun 15 2021 wangxiyuan +- Fix Qemu 4.1 image size check error * Sat May 29 2021 huangtianhua - Adds BuildRequires python2-pbr to make obs success * Fri May 07 2021 OpenStack_SIG -- Gitee