neil / rpms / python-blivet

Forked from rpms/python-blivet a year ago
Clone
0b05ab
From 12a2bdf3fc5a7a4568ff56b244d3067b73f82681 Mon Sep 17 00:00:00 2001
0b05ab
From: Peter Robinson <pbrobinson@gmail.com>
0b05ab
Date: Tue, 7 Aug 2018 15:11:56 +0100
0b05ab
Subject: [PATCH 1/6] arch: arm: drop omap specifics for partitioning
0b05ab
0b05ab
We've long stopped supporting or using any specifics around OMAP
0b05ab
ARM machines and all ARM platforms support the extlinux means of
0b05ab
doing things one way or another.
0b05ab
0b05ab
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
0b05ab
---
0b05ab
 blivet/arch.py              | 4 ----
0b05ab
 blivet/devices/partition.py | 3 ---
0b05ab
 2 files changed, 7 deletions(-)
0b05ab
0b05ab
diff --git a/blivet/arch.py b/blivet/arch.py
0b05ab
index 20fe4f57..f30b2d8b 100644
0b05ab
--- a/blivet/arch.py
0b05ab
+++ b/blivet/arch.py
0b05ab
@@ -352,10 +352,6 @@ def is_ipseries():
0b05ab
     return is_ppc() and get_ppc_machine() in ("iSeries", "pSeries")
0b05ab
 
0b05ab
 
0b05ab
-def is_omap_arm():
0b05ab
-    return is_arm() and get_arm_machine() == "omap"
0b05ab
-
0b05ab
-
0b05ab
 def get_arch():
0b05ab
     """
0b05ab
     :return: The hardware architecture
0b05ab
diff --git a/blivet/devices/partition.py b/blivet/devices/partition.py
0b05ab
index 47ff547b..623e1c9d 100644
0b05ab
--- a/blivet/devices/partition.py
0b05ab
+++ b/blivet/devices/partition.py
0b05ab
@@ -421,9 +421,6 @@ def _get_weight(self):
0b05ab
             # On ARM images '/' must be the last partition.
0b05ab
             if self.format.mountpoint == "/":
0b05ab
                 weight = -100
0b05ab
-            elif (arch.is_omap_arm() and
0b05ab
-                  self.format.mountpoint == "/boot/uboot" and self.format.type == "vfat"):
0b05ab
-                weight = 5000
0b05ab
         elif arch.is_ppc():
0b05ab
             if arch.is_pmac() and self.format.type == "appleboot":
0b05ab
                 weight = 5000
0b05ab
0b05ab
From ec978c3c625c74c387a9c8074d2378c4ecbeac47 Mon Sep 17 00:00:00 2001
0b05ab
From: Peter Robinson <pbrobinson@gmail.com>
0b05ab
Date: Thu, 16 Aug 2018 14:32:19 +0100
0b05ab
Subject: [PATCH 2/6] arch: arm: drop get_arm_machine function
0b05ab
0b05ab
The get_arm_machine function was used when we had to have detection for which
0b05ab
arm specific kernel to install. The last userr of this was the omap check for
0b05ab
special partitioning which is no longer used due to extlinux support so we can
0b05ab
now drop this function too.
0b05ab
0b05ab
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
0b05ab
---
0b05ab
 blivet/arch.py  | 22 ----------------------
0b05ab
 blivet/flags.py |  2 --
0b05ab
 2 files changed, 24 deletions(-)
0b05ab
0b05ab
diff --git a/blivet/arch.py b/blivet/arch.py
0b05ab
index f30b2d8b..55ce8108 100644
0b05ab
--- a/blivet/arch.py
0b05ab
+++ b/blivet/arch.py
0b05ab
@@ -33,7 +33,6 @@
0b05ab
 
0b05ab
 import os
0b05ab
 
0b05ab
-from .flags import flags
0b05ab
 from .storage_log import log_exception_info
0b05ab
 
0b05ab
 import logging
0b05ab
@@ -182,27 +181,6 @@ def is_aarch64():
0b05ab
     return os.uname()[4] == 'aarch64'
0b05ab
 
0b05ab
 
0b05ab
-def get_arm_machine():
0b05ab
-    """
0b05ab
-    :return: The ARM processor variety type, or None if not ARM.
0b05ab
-    :rtype: string
0b05ab
-
0b05ab
-    """
0b05ab
-    if not is_arm():
0b05ab
-        return None
0b05ab
-
0b05ab
-    if flags.arm_platform:
0b05ab
-        return flags.arm_platform
0b05ab
-
0b05ab
-    arm_machine = os.uname()[2].rpartition('.')[2]
0b05ab
-
0b05ab
-    if arm_machine.startswith('arm'):
0b05ab
-        # @TBD - Huh? Don't you want the arm machine name here?
0b05ab
-        return None
0b05ab
-    else:
0b05ab
-        return arm_machine
0b05ab
-
0b05ab
-
0b05ab
 def is_cell():
0b05ab
     """
0b05ab
     :return: True if the hardware is the Cell platform, False otherwise.
0b05ab
diff --git a/blivet/flags.py b/blivet/flags.py
0b05ab
index 18401218..4e26d82f 100644
0b05ab
--- a/blivet/flags.py
0b05ab
+++ b/blivet/flags.py
0b05ab
@@ -57,8 +57,6 @@ def __init__(self):
0b05ab
         self.jfs = True
0b05ab
         self.reiserfs = True
0b05ab
 
0b05ab
-        self.arm_platform = None
0b05ab
-
0b05ab
         self.gpt = False
0b05ab
 
0b05ab
         # for this flag to take effect,
0b05ab
0b05ab
From e75049e9e9edac9da789cee2add2b4190159805d Mon Sep 17 00:00:00 2001
0b05ab
From: Peter Robinson <pbrobinson@gmail.com>
0b05ab
Date: Thu, 16 Aug 2018 14:35:30 +0100
0b05ab
Subject: [PATCH 3/6] Aarch64 platforms: Fix gpt defaults for 64 bit arm
0b05ab
 platforms
0b05ab
0b05ab
The 46165f589d commit added support for msdos needed on some aarch64 devices
0b05ab
but it messed up the gpt defaults, this was fixed in 4908746c3a but this now
0b05ab
defaults back to msdos so we put in an aarch64 options to put gpt first again.
0b05ab
0b05ab
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
0b05ab
---
0b05ab
 blivet/formats/disklabel.py | 2 ++
0b05ab
 1 file changed, 2 insertions(+)
0b05ab
0b05ab
diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
0b05ab
index 44f9834c..e93a4c13 100644
0b05ab
--- a/blivet/formats/disklabel.py
0b05ab
+++ b/blivet/formats/disklabel.py
0b05ab
@@ -223,6 +223,8 @@ def get_platform_label_types(cls):
0b05ab
         label_types = ["msdos", "gpt"]
0b05ab
         if arch.is_pmac():
0b05ab
             label_types = ["mac"]
0b05ab
+        elif arch.is_aarch64():
0b05ab
+            label_types = ["gpt", "msdos"]
0b05ab
         elif arch.is_efi() and not arch.is_aarch64():
0b05ab
             label_types = ["gpt"]
0b05ab
         elif arch.is_s390():
0b05ab
0b05ab
From dda51536e902def437872fcdb3005efaff231703 Mon Sep 17 00:00:00 2001
0b05ab
From: Peter Robinson <pbrobinson@gmail.com>
0b05ab
Date: Thu, 16 Aug 2018 14:38:16 +0100
0b05ab
Subject: [PATCH 4/6] arm: add support for EFI on ARMv7
0b05ab
0b05ab
We now can support EFI for ARMv7 so add/enabled the checks for ARM too.
0b05ab
0b05ab
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
0b05ab
---
0b05ab
 blivet/formats/disklabel.py | 2 ++
0b05ab
 1 file changed, 2 insertions(+)
0b05ab
0b05ab
diff --git a/blivet/formats/disklabel.py b/blivet/formats/disklabel.py
0b05ab
index e93a4c13..e13ab2f8 100644
0b05ab
--- a/blivet/formats/disklabel.py
0b05ab
+++ b/blivet/formats/disklabel.py
0b05ab
@@ -225,6 +225,8 @@ def get_platform_label_types(cls):
0b05ab
             label_types = ["mac"]
0b05ab
         elif arch.is_aarch64():
0b05ab
             label_types = ["gpt", "msdos"]
0b05ab
+        elif arch.is_efi() and arch.is_arm():
0b05ab
+            label_types = ["msdos", "gpt"]
0b05ab
         elif arch.is_efi() and not arch.is_aarch64():
0b05ab
             label_types = ["gpt"]
0b05ab
         elif arch.is_s390():
0b05ab
0b05ab
From 1cdd509f2034f456402f39045425cbdfe62bde97 Mon Sep 17 00:00:00 2001
0b05ab
From: Peter Robinson <pbrobinson@gmail.com>
0b05ab
Date: Thu, 23 Aug 2018 14:23:38 +0100
0b05ab
Subject: [PATCH 5/6] Update disk label tests for ARM platforms
0b05ab
0b05ab
UEFI supports either gpt or msdos but different platforms have different
0b05ab
requirements. Update the disk label tests to test the following:
0b05ab
- aarch64: gpt default but msdos option also supported
0b05ab
- ARMv7 UEFI: msdos default but gpt option also supported
0b05ab
- ARMv7 extlinux: msdos default, also support gpt
0b05ab
0b05ab
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
0b05ab
---
0b05ab
 tests/formats_test/disklabel_test.py | 12 ++++++++++++
0b05ab
 1 file changed, 12 insertions(+)
0b05ab
0b05ab
diff --git a/tests/formats_test/disklabel_test.py b/tests/formats_test/disklabel_test.py
0b05ab
index 4b6608f5..3edbdb0b 100644
0b05ab
--- a/tests/formats_test/disklabel_test.py
0b05ab
+++ b/tests/formats_test/disklabel_test.py
0b05ab
@@ -71,6 +71,7 @@ def test_platform_label_types(self, arch):
0b05ab
         arch.is_s390.return_value = False
0b05ab
         arch.is_efi.return_value = False
0b05ab
         arch.is_aarch64.return_value = False
0b05ab
+        arch.is_arm.return_value = False
0b05ab
         arch.is_pmac.return_value = False
0b05ab
 
0b05ab
         self.assertEqual(disklabel_class.get_platform_label_types(), ["msdos", "gpt"])
0b05ab
@@ -81,8 +82,18 @@ def test_platform_label_types(self, arch):
0b05ab
 
0b05ab
         arch.is_efi.return_value = True
0b05ab
         self.assertEqual(disklabel_class.get_platform_label_types(), ["gpt"])
0b05ab
+        arch.is_aarch64.return_value = True
0b05ab
+        self.assertEqual(disklabel_class.get_platform_label_types(), ["gpt", "msdos"])
0b05ab
+        arch.is_aarch64.return_value = False
0b05ab
+        arch.is_arm.return_value = True
0b05ab
+        self.assertEqual(disklabel_class.get_platform_label_types(), ["msdos", "gpt"])
0b05ab
+        arch.is_arm.return_value = False
0b05ab
         arch.is_efi.return_value = False
0b05ab
 
0b05ab
+        arch.is_arm.return_value = True
0b05ab
+        self.assertEqual(disklabel_class.get_platform_label_types(), ["msdos", "gpt"])
0b05ab
+        arch.is_arm.return_value = False
0b05ab
+
0b05ab
         arch.is_s390.return_value = True
0b05ab
         self.assertEqual(disklabel_class.get_platform_label_types(), ["msdos", "dasd"])
0b05ab
         arch.is_s390.return_value = False
0b05ab
@@ -123,6 +134,7 @@ def test_best_label_type(self, arch):
0b05ab
         arch.is_s390.return_value = False
0b05ab
         arch.is_efi.return_value = False
0b05ab
         arch.is_aarch64.return_value = False
0b05ab
+        arch.is_arm.return_value = False
0b05ab
         arch.is_pmac.return_value = False
0b05ab
 
0b05ab
         with mock.patch.object(dl, '_label_type_size_check') as size_check:
0b05ab
0b05ab
From e0e6ac41cea805c3bf56852bfe2cd67d4bfe0b83 Mon Sep 17 00:00:00 2001
0b05ab
From: Peter Robinson <pbrobinson@gmail.com>
0b05ab
Date: Thu, 23 Aug 2018 15:54:51 +0100
0b05ab
Subject: [PATCH 6/6] Drop omap partition table tests on ARM platforms
0b05ab
0b05ab
We no longer need to test the /boot/uboot tests for omap platforms so
0b05ab
drop them as they're obsolete.
0b05ab
0b05ab
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
0b05ab
---
0b05ab
 tests/devices_test/partition_test.py | 14 ++------------
0b05ab
 1 file changed, 2 insertions(+), 12 deletions(-)
0b05ab
0b05ab
diff --git a/tests/devices_test/partition_test.py b/tests/devices_test/partition_test.py
0b05ab
index 394ffc27..08c0447d 100644
0b05ab
--- a/tests/devices_test/partition_test.py
0b05ab
+++ b/tests/devices_test/partition_test.py
0b05ab
@@ -26,11 +26,9 @@
0b05ab
             Weighted(fstype="efi", mountpoint="/boot/efi", true_funcs=['is_efi'], weight=5000),
0b05ab
             Weighted(fstype="prepboot", mountpoint=None, true_funcs=['is_ppc', 'is_ipseries'], weight=5000),
0b05ab
             Weighted(fstype="appleboot", mountpoint=None, true_funcs=['is_ppc', 'is_pmac'], weight=5000),
0b05ab
-            Weighted(fstype="vfat", mountpoint="/boot/uboot", true_funcs=['is_arm', 'is_omap_arm'], weight=5000),
0b05ab
-            Weighted(fstype=None, mountpoint="/", true_funcs=['is_arm'], weight=-100),
0b05ab
-            Weighted(fstype=None, mountpoint="/", true_funcs=['is_arm', 'is_omap_arm'], weight=-100)]
0b05ab
+            Weighted(fstype=None, mountpoint="/", true_funcs=['is_arm'], weight=-100)]
0b05ab
 
0b05ab
-arch_funcs = ['is_arm', 'is_efi', 'is_ipseries', 'is_omap_arm', 'is_pmac', 'is_ppc', 'is_x86']
0b05ab
+arch_funcs = ['is_arm', 'is_efi', 'is_ipseries', 'is_pmac', 'is_ppc', 'is_x86']
0b05ab
 
0b05ab
 
0b05ab
 class PartitionDeviceTestCase(unittest.TestCase):
0b05ab
@@ -309,14 +307,6 @@ def test_weight_1(self, *patches):
0b05ab
             fmt.mountpoint = "/"
0b05ab
             self.assertEqual(dev.weight, -100)
0b05ab
 
0b05ab
-            arch.is_omap_arm.return_value = False
0b05ab
-            fmt.mountpoint = "/boot/uboot"
0b05ab
-            fmt.type = "vfat"
0b05ab
-            self.assertEqual(dev.weight, 0)
0b05ab
-
0b05ab
-            arch.is_omap_arm.return_value = True
0b05ab
-            self.assertEqual(dev.weight, 5000)
0b05ab
-
0b05ab
             #
0b05ab
             # ppc
0b05ab
             #