From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) by mx.groups.io with SMTP id smtpd.web12.647.1666030021957661476 for ; Mon, 17 Oct 2022 11:07:02 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20210112 header.b=J/KSna9W; spf=pass (domain: gmail.com, ip: 209.85.214.172, mailfrom: joey.vagedes@gmail.com) Received: by mail-pl1-f172.google.com with SMTP id c24so11492124pls.9 for ; Mon, 17 Oct 2022 11:07:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=/Qc+GE7PzTQgMIJSqLYwrdBPjh6AaNu57Luy3UGz5Po=; b=J/KSna9WtyIsemnVR5tH530a7psE8DBleany/HpA3zzkQYep5W0C2Uk+bTb7j4QwIv xQvrdaC0UKJCxUiWqY8r30OiIv2pu1oJpk0mb2ccpAZXE4oF1ZvmBMasFuh6y5KJ9RnP 9ixAzC/Y6xAW/6EjaTiodAPh1HF2GRYZYLH+HJDXjeiQ9YFrNkGtKteLhHB0riU1oXke JZRSZ7osolc3ENZL8w5XI8bkEBNaRTBgO/E5T0Zqo4dQlvWXm+97VNFXe5PApw+y0Cpz 85OjV7FR7tkjKAorR9geNTkDIn+7l5n026t7q5eN92Mc1ZX+EWhVYu7qZSI43+8yt2X6 4ilg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/Qc+GE7PzTQgMIJSqLYwrdBPjh6AaNu57Luy3UGz5Po=; b=E+GkDjk5DAZYbif03PVSfankXH2QmBM20aUtSfc7cINHIRRpwlsj+rHns5ESl5bkTV VehyWre12HgDf1rw3gsvYaFN5aXETnsdNT9/FRC0XHTw53Q9kQSWMUom5vDkMdUUJFoL 1ikfC0+4i317wnM+I2xLH/whufw0ohAmfXL+eFi1/nivkVFrqsZJUiqaecYmiKeiw3Yi Gmjp9lB//Cg40krXvCtwZj7H+kzoYEDIg42iZ80QsoYpTnSncB5NnpaAQzdt1S+sMhe8 To2gsQ7oa+wvHnlqhUV4b1YjEQxce57Z17osaXVK34DH7RMZzuOep91scirc8htvh1TJ FaKg== X-Gm-Message-State: ACrzQf0AANAh/bqVIhQd5BKPmw7tmZrll8kIwlJs9wuqxEd/Tpi9PVCx 7FAq2YA+qbeJovOddPy3I1qSLwTo8hJxcw== X-Google-Smtp-Source: AMsMyM6pyY3Wwtb+e3EGHG9ckVN5Zj8oPv+PlK0dheqB4EJw30TGAqfGeNMzX46+sV7E7PIpT0O8xQ== X-Received: by 2002:a17:90b:4b0e:b0:20d:213b:1083 with SMTP id lx14-20020a17090b4b0e00b0020d213b1083mr15428875pjb.208.1666030021105; Mon, 17 Oct 2022 11:07:01 -0700 (PDT) Return-Path: Received: from localhost.localdomain (c-24-22-143-11.hsd1.wa.comcast.net. [24.22.143.11]) by smtp.gmail.com with ESMTPSA id e17-20020a17090301d100b001782398648dsm7011233plh.8.2022.10.17.11.07.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Oct 2022 11:07:00 -0700 (PDT) From: Joey Vagedes To: devel@edk2.groups.io Cc: Ard Biesheuvel , Jiewen Yao , Jordan Justen , Gerd Hoffmann Subject: [PATCH v1 2/3] OvmfPkg/PlatformCI: Dyn BaseTools Selection Date: Mon, 17 Oct 2022 11:06:34 -0700 Message-Id: <20221017180635.488-3-joey.vagedes@gmail.com> X-Mailer: git-send-email 2.38.0.windows.1 In-Reply-To: <20221017180635.488-1-joey.vagedes@gmail.com> References: <20221017180635.488-1-joey.vagedes@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable When using pytools to build OvmfPkg, add the ability to dynamically=0D determine which BaseTools to build with. The Pypi BaseTools will be used=0D if present, otherwise defaulting to the in-tree Basetools.=0D =0D Reference: https://bugzilla.tianocore.org/show_bug.cgi?id=3D4085=0D =0D Cc: Ard Biesheuvel =0D Cc: Jiewen Yao =0D Cc: Jordan Justen =0D Cc: Gerd Hoffmann =0D =0D Signed-off-by: Joey Vagedes =0D ---=0D OvmfPkg/PlatformCI/PlatformBuildLib.py | 37 ++++++++++++++++++--=0D 1 file changed, 34 insertions(+), 3 deletions(-)=0D =0D diff --git a/OvmfPkg/PlatformCI/PlatformBuildLib.py b/OvmfPkg/PlatformCI/Pl= atformBuildLib.py=0D index bfef9849c7..d030216dff 100644=0D --- a/OvmfPkg/PlatformCI/PlatformBuildLib.py=0D +++ b/OvmfPkg/PlatformCI/PlatformBuildLib.py=0D @@ -7,6 +7,7 @@=0D import os=0D import logging=0D import io=0D +import importlib=0D =0D from edk2toolext.environment import shell_environment=0D from edk2toolext.environment.uefi_build import UefiBuilder=0D @@ -14,7 +15,7 @@ from edk2toolext.invocables.edk2_platform_build import Bu= ildSettingsManager=0D from edk2toolext.invocables.edk2_setup import SetupSettingsManager, Requir= edSubmodule=0D from edk2toolext.invocables.edk2_update import UpdateSettingsManager=0D from edk2toolext.invocables.edk2_pr_eval import PrEvalSettingsManager=0D -from edk2toollib.utility_functions import RunCmd=0D +from edk2toollib.utility_functions import RunCmd, GetHostInfo=0D =0D =0D # ####################################################################= ################### #=0D @@ -22,6 +23,9 @@ from edk2toollib.utility_functions import RunCmd=0D # ####################################################################= ################### #=0D class SettingsManager(UpdateSettingsManager, SetupSettingsManager, PrEvalS= ettingsManager):=0D =0D + def __init__(self):=0D + self.UseBuiltInBaseTools =3D None=0D +=0D def GetPackagesSupported(self):=0D ''' return iterable of edk2 packages supported by this build.=0D These should be edk2 workspace relative paths '''=0D @@ -81,7 +85,19 @@ class SettingsManager(UpdateSettingsManager, SetupSettin= gsManager, PrEvalSetting=0D =0D def GetActiveScopes(self):=0D ''' return tuple containing scopes that should be active for this = process '''=0D - return CommonPlatform.Scopes=0D +=0D + scopes =3D CommonPlatform.Scopes=0D + is_linux =3D GetHostInfo().os.upper() =3D=3D "LINUX"=0D + if self.UseBuiltInBaseTools is None:=0D + if importlib.util.find_spec('edk2basetools') is not None:=0D + self.UseBuiltInBaseTools =3D True=0D + else:=0D + self.UseBuiltInBaseTools =3D False=0D +=0D + if self.UseBuiltInBaseTools is True:=0D + scopes +=3D ('pipbuild-unix',) if is_linux else ('pipbuild-win= ',)=0D +=0D + return scopes=0D =0D def FilterPackagesToTest(self, changedFilesList: list, potentialPackag= esList: list) -> list:=0D ''' Filter other cases that this package should be built=0D @@ -118,6 +134,7 @@ class SettingsManager(UpdateSettingsManager, SetupSetti= ngsManager, PrEvalSetting=0D # ####################################################################= ################### #=0D class PlatformBuilder( UefiBuilder, BuildSettingsManager):=0D def __init__(self):=0D + self.UseBuiltInBaseTools =3D None=0D UefiBuilder.__init__(self)=0D =0D def AddCommandLineOptions(self, parserObj):=0D @@ -144,7 +161,21 @@ class PlatformBuilder( UefiBuilder, BuildSettingsManag= er):=0D =0D def GetActiveScopes(self):=0D ''' return tuple containing scopes that should be active for this = process '''=0D - return CommonPlatform.Scopes=0D +=0D + scopes =3D CommonPlatform.Scopes=0D + is_linux =3D GetHostInfo().os.upper() =3D=3D "LINUX"=0D + if self.UseBuiltInBaseTools is None:=0D + if importlib.util.find_spec('edk2basetools') is not None:=0D + self.UseBuiltInBaseTools =3D True=0D + logging.warning("Using Pip Tools based BaseTools")=0D + else:=0D + self.UseBuiltInBaseTools =3D False=0D + logging.warning("Falling back to using in-tree BaseTools")= =0D +=0D + if self.UseBuiltInBaseTools is True:=0D + scopes +=3D ('pipbuild-unix',) if is_linux else ('pipbuild-win= ',)=0D +=0D + return scopes=0D =0D def GetName(self):=0D ''' Get the name of the repo, platform, or product being build '''= =0D -- =0D 2.38.0.windows.1=0D =0D