diff --git a/1002-Loongarch64-support-archLabel-for-loongson.patch b/1002-Loongarch64-support-archLabel-for-loongson.patch new file mode 100644 index 0000000000000000000000000000000000000000..ac7c932c6912bd9fd6dc3ac0620d4dd91caa1d6f --- /dev/null +++ b/1002-Loongarch64-support-archLabel-for-loongson.patch @@ -0,0 +1,49 @@ +From 3940d3a262b908b16d4fe16cc9459e0367a1a445 Mon Sep 17 00:00:00 2001 +From: xiezhongtian +Date: Thu, 25 Nov 2021 17:28:06 +0800 +Subject: [PATCH] Loongarch64: support archLabel for loongson + +--- + src/parted/__init__.py | 5 +++-- + tests/test_parted_parted.py | 1 + + 2 files changed, 4 insertions(+), 2 deletions(-) + +diff --git a/src/parted/__init__.py b/src/parted/__init__.py +index 706557b..0934f7e 100644 +--- a/src/parted/__init__.py ++++ b/src/parted/__init__.py +@@ -325,6 +325,7 @@ archLabels = {'i386': ['msdos', 'gpt'], + 'ppc64le': ['msdos', 'gpt'], + 'x86_64': ['msdos', 'gpt'], + 'aarch64': ['msdos', 'gpt'], ++ 'loongarch64': ['msdos', 'gpt'], + 'armv7l': ['msdos', 'gpt']} + + # Adapted from: +@@ -362,9 +363,9 @@ def Deprecated(mod, deprecated=None): + __archLabels = (('amiga', 'ppc(64)?$'), + ('bsd', 'alpha$'), + ('dasd', 's390x?$'), +- ('gpt', 'i[3-6]86$|x86_64$|ia64$|ppc(64|64le)?$|aarch64$|armv7l$'), ++ ('gpt', 'i[3-6]86$|x86_64$|ia64$|ppc(64|64le)?$|aarch64$|armv7l$|loongarch64$'), + ('mac', 'ppc(64)?$'), +- ('msdos', 'i[3-6]86$|x86_64$|s390x?$|alpha$|ia64$|ppc(64|64le)?$|aarch64$|armv7l$'), ++ ('msdos', 'i[3-6]86$|x86_64$|s390x?$|alpha$|ia64$|ppc(64|64le)?$|aarch64$|armv7l$|loongarch64$'), + ('sun', 'sparc(64)?$')) + + def getLabels(arch=None): +diff --git a/tests/test_parted_parted.py b/tests/test_parted_parted.py +index 44ebb37..ab32c77 100755 +--- a/tests/test_parted_parted.py ++++ b/tests/test_parted_parted.py +@@ -62,6 +62,7 @@ class GetLabelsTestCase(unittest.TestCase): + self.assertSetEqual(parted.getLabels('alpha'), {'bsd', 'msdos'}) + self.assertSetEqual(parted.getLabels('ia64'), {'gpt', 'msdos'}) + self.assertSetEqual(parted.getLabels('aarch64'), {'gpt', 'msdos'}) ++ self.assertSetEqual(parted.getLabels('loongarch64'), {'gpt', 'msdos'}) + self.assertSetEqual(parted.getLabels('armv7l'), {'gpt', 'msdos'}) + + class GetDeviceTestCase(RequiresDeviceNode): +-- +2.18.4 + diff --git a/pyparted.spec b/pyparted.spec index 02ebd987307846dd12b2f81d7f53a4a9c4265166..2a9b0e62a9bbf0445a99049821fa2c1ebe02b1ba 100644 --- a/pyparted.spec +++ b/pyparted.spec @@ -1,13 +1,13 @@ %define anolis_release .0.1 -%if 0%{?rhel} -%if %{rhel} <= 7 +%if 0%{?anolis} +%if %{anolis} <= 7 # disable python3 by default %bcond_with python3 %else %bcond_without python3 %endif -%if %{rhel} > 7 +%if %{anolis} > 7 # disable python2 by default %bcond_with python2 %else @@ -49,6 +49,8 @@ Patch0: pyparted-3.11.7-covscan.patch # Begin: Anolis customized patches # backport patch from upstream Patch1001: 1001-pyparted-gcc10.patch +# support loongarch64 +Patch1002: 1002-Loongarch64-support-archLabel-for-loongson.patch # End: Anolis customized patches BuildRequires: gcc @@ -101,6 +103,7 @@ partition tables. This package provides Python 3 bindings for parted. %setup -q %patch0 -p1 %patch1001 -p1 +%patch1002 -p1 %if %{with python2} rm -rf ../%{py2dir} @@ -159,6 +162,9 @@ popd %endif %changelog +* Tue Jan 25 2022 Liwei Ge - 1:3.11.7-4.0.2 +- Support loongarch64 platform + * Thu Jan 20 2022 Weitao Zhou - 1:3.11.7-4.0.1 - add missing header for compatible gcc10 build