summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2023-01-24 15:34:24 +0000
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2023-01-26 18:54:58 +0000
commit01a06884a173a40bde00d2bdbf9d89224a4b00f4 (patch)
tree82c3fd926cefe650c1f3d2cffa0d2d3e346e3561
parent619f077252226be45eb8c357f43c93ed88101228 (diff)
downloadedk2-01a06884a173a40bde00d2bdbf9d89224a4b00f4.tar.gz
edk2-01a06884a173a40bde00d2bdbf9d89224a4b00f4.tar.bz2
edk2-01a06884a173a40bde00d2bdbf9d89224a4b00f4.zip
ArmVirtPkg/PlatformCI: factor out reusable PlatformBuildLib.py
In order to reduce the amount of code duplication, refactor the PlatformBuild.py script that builds ArmVirtQemu.dsc into a reusable PlatformBuildLib.py containing most of the bits and pieces, and a small QemuBuild.py which is specific to the DSC in question. Suggested-by: Gerd Hoffmann <kraxel@redhat.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Acked-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
-rw-r--r--ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml12
-rw-r--r--ArmVirtPkg/PlatformCI/PlatformBuildLib.py (renamed from ArmVirtPkg/PlatformCI/PlatformBuild.py)19
-rw-r--r--ArmVirtPkg/PlatformCI/QemuBuild.py31
3 files changed, 39 insertions, 23 deletions
diff --git a/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml b/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml
index 5fa7518d2c..b1526ae8e5 100644
--- a/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml
+++ b/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml
@@ -30,42 +30,42 @@ jobs:
strategy:
matrix:
QEMU_AARCH64_DEBUG:
- Build.File: "$(package)/PlatformCI/PlatformBuild.py"
+ Build.File: "$(package)/PlatformCI/QemuBuild.py"
Build.Arch: "AARCH64"
Build.Flags: ""
Build.Target: "DEBUG"
Run.Flags: $(run_flags)
Run: $(should_run)
QEMU_AARCH64_RELEASE:
- Build.File: "$(package)/PlatformCI/PlatformBuild.py"
+ Build.File: "$(package)/PlatformCI/QemuBuild.py"
Build.Arch: "AARCH64"
Build.Flags: ""
Build.Target: "RELEASE"
Run.Flags: $(run_flags)
Run: $(should_run)
QEMU_AARCH64_NOOPT:
- Build.File: "$(package)/PlatformCI/PlatformBuild.py"
+ Build.File: "$(package)/PlatformCI/QemuBuild.py"
Build.Arch: "AARCH64"
Build.Flags: ""
Build.Target: "NOOPT"
Run.Flags: $(run_flags)
Run: $(should_run)
QEMU_ARM_DEBUG:
- Build.File: "$(package)/PlatformCI/PlatformBuild.py"
+ Build.File: "$(package)/PlatformCI/QemuBuild.py"
Build.Arch: "ARM"
Build.Flags: ""
Build.Target: "DEBUG"
Run.Flags: $(run_flags)
Run: $(should_run)
QEMU_ARM_RELEASE:
- Build.File: "$(package)/PlatformCI/PlatformBuild.py"
+ Build.File: "$(package)/PlatformCI/QemuBuild.py"
Build.Arch: "ARM"
Build.Flags: ""
Build.Target: "RELEASE"
Run.Flags: $(run_flags)
Run: $(should_run)
QEMU_ARM_NOOPT:
- Build.File: "$(package)/PlatformCI/PlatformBuild.py"
+ Build.File: "$(package)/PlatformCI/QemuBuild.py"
Build.Arch: "ARM"
Build.Flags: ""
Build.Target: "NOOPT"
diff --git a/ArmVirtPkg/PlatformCI/PlatformBuild.py b/ArmVirtPkg/PlatformCI/PlatformBuildLib.py
index dff653e919..91aa9b31d3 100644
--- a/ArmVirtPkg/PlatformCI/PlatformBuild.py
+++ b/ArmVirtPkg/PlatformCI/PlatformBuildLib.py
@@ -17,21 +17,6 @@ from edk2toolext.invocables.edk2_pr_eval import PrEvalSettingsManager
from edk2toollib.utility_functions import RunCmd
from edk2toollib.utility_functions import GetHostInfo
-# ####################################################################################### #
-# Common Configuration #
-# ####################################################################################### #
-
-
-class CommonPlatform():
- ''' Common settings for this platform. Define static data here and use
- for the different parts of stuart
- '''
- PackagesSupported = ("ArmVirtPkg",)
- ArchSupported = ("AARCH64", "ARM")
- TargetsSupported = ("DEBUG", "RELEASE", "NOOPT")
- Scopes = ('armvirt', 'edk2-build')
- WorkspaceRoot = os.path.realpath(os.path.join(
- os.path.dirname(os.path.abspath(__file__)), "..", ".."))
# ####################################################################################### #
# Configuration for Update & Setup #
@@ -139,7 +124,7 @@ class SettingsManager(UpdateSettingsManager, SetupSettingsManager, PrEvalSetting
The tuple should be (<workspace relative path to dsc file>, <input dictionary of dsc key value pairs>)
'''
- return (os.path.join("ArmVirtPkg", "ArmVirtQemu.dsc"), {})
+ return (CommonPlatform.DscName, {})
# ####################################################################################### #
@@ -163,7 +148,7 @@ class PlatformBuilder(UefiBuilder, BuildSettingsManager):
"TARGET_ARCH", args.build_arch.upper(), "From CmdLine")
shell_environment.GetBuildVars().SetValue(
- "ACTIVE_PLATFORM", "ArmVirtPkg/ArmVirtQemu.dsc", "From CmdLine")
+ "ACTIVE_PLATFORM", CommonPlatform.DscName, "From CmdLine")
def GetWorkspaceRoot(self):
''' get WorkspacePath '''
diff --git a/ArmVirtPkg/PlatformCI/QemuBuild.py b/ArmVirtPkg/PlatformCI/QemuBuild.py
new file mode 100644
index 0000000000..f4dcc1d1d2
--- /dev/null
+++ b/ArmVirtPkg/PlatformCI/QemuBuild.py
@@ -0,0 +1,31 @@
+# @file
+# Script to Build OVMF UEFI firmware
+#
+# Copyright (c) Microsoft Corporation.
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+import os
+import sys
+
+sys.path.append(os.path.dirname(os.path.abspath(__file__)))
+from PlatformBuildLib import SettingsManager
+from PlatformBuildLib import PlatformBuilder
+
+ # ####################################################################################### #
+ # Common Configuration #
+ # ####################################################################################### #
+class CommonPlatform():
+ ''' Common settings for this platform. Define static data here and use
+ for the different parts of stuart
+ '''
+ PackagesSupported = ("ArmVirtPkg",)
+ ArchSupported = ("AARCH64", "ARM")
+ TargetsSupported = ("DEBUG", "RELEASE", "NOOPT")
+ Scopes = ('armvirt', 'edk2-build')
+ WorkspaceRoot = os.path.realpath(os.path.join(
+ os.path.dirname(os.path.abspath(__file__)), "..", ".."))
+
+ DscName = os.path.join("ArmVirtPkg", "ArmVirtQemu.dsc")
+
+import PlatformBuildLib
+PlatformBuildLib.CommonPlatform = CommonPlatform