From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by mx.groups.io with SMTP id smtpd.web11.20020.1674578072686155617 for ; Tue, 24 Jan 2023 08:34:33 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=mxaaRHWo; spf=pass (domain: kernel.org, ip: 145.40.68.75, mailfrom: ardb@kernel.org) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id BC285B8129F; Tue, 24 Jan 2023 16:34:30 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1872EC433EF; Tue, 24 Jan 2023 16:34:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1674578069; bh=jBCyXrl6wgfI7V2TpY1RrCvfAQANEBUhe/8dX9t39nQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mxaaRHWoHjNty5bN/7y8zNzODxjyk1w+EMXztRwVdXjAa1xRZ6VOfRKT7nCUVk3ZB yKo31ZbOO5IdOLnXfthwK6TF/0X9paR7vpJGqubecoo5P2qfhl4mpTx4hWFhPGiRu5 X3EOaXcj5myu9eAnNverncAet5rpe4f4vAO1C9RJykrKXOTaI4R3q1moZso4XNdHOG ppSxowoFVZLpMaZ+O9OafrGtBuMCRPXJqOq8HDJZDwZ4xHWvKFeV0EmHwyzzE5v11r PzKa9P062khks2t/J5PZ0OfTAa5VLBRxZbz9nEr/x0so7uqxWjE6FftbQYxrCVaXy3 k5aCg2SRmJmMg== From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Gerd Hoffmann , Michael Kubacki , Jiewen Yao , Oliver Steffen Subject: [PATCH v2 3/6] ArmVirtPkg/PlatformCI: factor out reusable PlatformBuildLib.py Date: Tue, 24 Jan 2023 17:34:14 +0100 Message-Id: <20230124163417.584727-4-ardb@kernel.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230124163417.584727-1-ardb@kernel.org> References: <20230124163417.584727-1-ardb@kernel.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable 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 Signed-off-by: Ard Biesheuvel --- ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml | 12 ++++-= --- ArmVirtPkg/PlatformCI/{PlatformBuild.py =3D> PlatformBuildLib.py} | 19 ++-= --------- ArmVirtPkg/PlatformCI/QemuBuild.py | 31 +++++= +++++++++++++++ 3 files changed, 39 insertions(+), 23 deletions(-) diff --git a/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml b/ArmVir= tPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml index 5fa7518d2c5e..b1526ae8e50b 100644 --- a/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml +++ b/ArmVirtPkg/PlatformCI/.azurepipelines/Ubuntu-GCC5.yml @@ -30,42 +30,42 @@ jobs: strategy:=0D matrix:=0D QEMU_AARCH64_DEBUG:=0D - Build.File: "$(package)/PlatformCI/PlatformBuild.py"=0D + Build.File: "$(package)/PlatformCI/QemuBuild.py"=0D Build.Arch: "AARCH64"=0D Build.Flags: ""=0D Build.Target: "DEBUG"=0D Run.Flags: $(run_flags)=0D Run: $(should_run)=0D QEMU_AARCH64_RELEASE:=0D - Build.File: "$(package)/PlatformCI/PlatformBuild.py"=0D + Build.File: "$(package)/PlatformCI/QemuBuild.py"=0D Build.Arch: "AARCH64"=0D Build.Flags: ""=0D Build.Target: "RELEASE"=0D Run.Flags: $(run_flags)=0D Run: $(should_run)=0D QEMU_AARCH64_NOOPT:=0D - Build.File: "$(package)/PlatformCI/PlatformBuild.py"=0D + Build.File: "$(package)/PlatformCI/QemuBuild.py"=0D Build.Arch: "AARCH64"=0D Build.Flags: ""=0D Build.Target: "NOOPT"=0D Run.Flags: $(run_flags)=0D Run: $(should_run)=0D QEMU_ARM_DEBUG:=0D - Build.File: "$(package)/PlatformCI/PlatformBuild.py"=0D + Build.File: "$(package)/PlatformCI/QemuBuild.py"=0D Build.Arch: "ARM"=0D Build.Flags: ""=0D Build.Target: "DEBUG"=0D Run.Flags: $(run_flags)=0D Run: $(should_run)=0D QEMU_ARM_RELEASE:=0D - Build.File: "$(package)/PlatformCI/PlatformBuild.py"=0D + Build.File: "$(package)/PlatformCI/QemuBuild.py"=0D Build.Arch: "ARM"=0D Build.Flags: ""=0D Build.Target: "RELEASE"=0D Run.Flags: $(run_flags)=0D Run: $(should_run)=0D QEMU_ARM_NOOPT:=0D - Build.File: "$(package)/PlatformCI/PlatformBuild.py"=0D + Build.File: "$(package)/PlatformCI/QemuBuild.py"=0D Build.Arch: "ARM"=0D Build.Flags: ""=0D Build.Target: "NOOPT"=0D diff --git a/ArmVirtPkg/PlatformCI/PlatformBuild.py b/ArmVirtPkg/PlatformCI= /PlatformBuildLib.py similarity index 90% rename from ArmVirtPkg/PlatformCI/PlatformBuild.py rename to ArmVirtPkg/PlatformCI/PlatformBuildLib.py index dff653e919eb..91aa9b31d3c5 100644 --- a/ArmVirtPkg/PlatformCI/PlatformBuild.py +++ b/ArmVirtPkg/PlatformCI/PlatformBuildLib.py @@ -17,21 +17,6 @@ from edk2toolext.invocables.edk2_pr_eval import PrEvalSe= ttingsManager from edk2toollib.utility_functions import RunCmd=0D from edk2toollib.utility_functions import GetHostInfo=0D =0D -# ########################################################################= ############### #=0D -# Common Configuration = #=0D -# ########################################################################= ############### #=0D -=0D -=0D -class CommonPlatform():=0D - ''' Common settings for this platform. Define static data here and us= e=0D - for the different parts of stuart=0D - '''=0D - PackagesSupported =3D ("ArmVirtPkg",)=0D - ArchSupported =3D ("AARCH64", "ARM")=0D - TargetsSupported =3D ("DEBUG", "RELEASE", "NOOPT")=0D - Scopes =3D ('armvirt', 'edk2-build')=0D - WorkspaceRoot =3D os.path.realpath(os.path.join(=0D - os.path.dirname(os.path.abspath(__file__)), "..", ".."))=0D =0D # ####################################################################= ################### #=0D # Configuration for Update & Setup = #=0D @@ -139,7 +124,7 @@ class SettingsManager(UpdateSettingsManager, SetupSetti= ngsManager, PrEvalSetting =0D The tuple should be (, )=0D '''=0D - return (os.path.join("ArmVirtPkg", "ArmVirtQemu.dsc"), {})=0D + return (CommonPlatform.DscName, {})=0D =0D =0D # ####################################################################= ################### #=0D @@ -163,7 +148,7 @@ class PlatformBuilder(UefiBuilder, BuildSettingsManager= ): "TARGET_ARCH", args.build_arch.upper(), "From CmdLine")=0D =0D shell_environment.GetBuildVars().SetValue(=0D - "ACTIVE_PLATFORM", "ArmVirtPkg/ArmVirtQemu.dsc", "From CmdLine= ")=0D + "ACTIVE_PLATFORM", CommonPlatform.DscName, "From CmdLine")=0D =0D def GetWorkspaceRoot(self):=0D ''' get WorkspacePath '''=0D diff --git a/ArmVirtPkg/PlatformCI/QemuBuild.py b/ArmVirtPkg/PlatformCI/Qem= uBuild.py new file mode 100644 index 000000000000..f4dcc1d1d245 --- /dev/null +++ b/ArmVirtPkg/PlatformCI/QemuBuild.py @@ -0,0 +1,31 @@ +# @file=0D +# Script to Build OVMF UEFI firmware=0D +#=0D +# Copyright (c) Microsoft Corporation.=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +##=0D +import os=0D +import sys=0D +=0D +sys.path.append(os.path.dirname(os.path.abspath(__file__)))=0D +from PlatformBuildLib import SettingsManager=0D +from PlatformBuildLib import PlatformBuilder=0D +=0D + # ####################################################################= ################### #=0D + # Common Configuration = #=0D + # ####################################################################= ################### #=0D +class CommonPlatform():=0D + ''' Common settings for this platform. Define static data here and us= e=0D + for the different parts of stuart=0D + '''=0D + PackagesSupported =3D ("ArmVirtPkg",)=0D + ArchSupported =3D ("AARCH64", "ARM")=0D + TargetsSupported =3D ("DEBUG", "RELEASE", "NOOPT")=0D + Scopes =3D ('armvirt', 'edk2-build')=0D + WorkspaceRoot =3D os.path.realpath(os.path.join(=0D + os.path.dirname(os.path.abspath(__file__)), "..", ".."))=0D +=0D + DscName =3D os.path.join("ArmVirtPkg", "ArmVirtQemu.dsc")=0D +=0D +import PlatformBuildLib=0D +PlatformBuildLib.CommonPlatform =3D CommonPlatform=0D --=20 2.39.0