neil / rpms / python-blivet

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