X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;ds=sidebyside;f=Tools%2FPython%2FInstallFar.py;h=7bc03aa0ca9ecf1a15ea1bf33668f72584bce08a;hb=c2b08e15a4711106fd95c13c583d2010ce1722b5;hp=6e28998cff1c5771d3beedcafa8a4eaccc656189;hpb=312ffece7b3b699b301bc10333ee0868e1f124b9;p=mirror_edk2.git diff --git a/Tools/Python/InstallFar.py b/Tools/Python/InstallFar.py index 6e28998cff..7bc03aa0ca 100755 --- a/Tools/Python/InstallFar.py +++ b/Tools/Python/InstallFar.py @@ -13,6 +13,7 @@ class Flags: self.verbose = False self.force = False self.reinstall = False + self.dir = '' class Database: @@ -52,7 +53,7 @@ class Database: XmlElement(fpd, "/PlatformHeader/PlatformName") for farfile in XmlList(self.dom, "/FrameworkDatabase/FarList/Filename"): - farGuid = farfile.getAttribute("FarGuid") + farGuid = Guid(farfile.getAttribute("FarGuid")) self.installedFars[farGuid] = XmlElementData(farfile) self.packageList = XmlNode(self.dom, "/FrameworkDatabase/PackageList") @@ -131,8 +132,8 @@ def GetFpdGuidVersion(Dom, strip=0): gpath = ["PlatformSurfaceArea", "PlatformHeader", "GuidValue"] vpath = ["PlatformSurfaceArea", "PlatformHeader", "Version"] - return string.lower(XmlElement(Dom, "/".join(gpath[strip:]))), \ - XmlElement(Dom, "/".join(vpath[strip:])) + return Guid(XmlElement(Dom, "/".join(gpath[strip:]))), \ + XmlElement(Dom, "/".join(vpath[strip:])) def GetSpdGuidVersion(Dom, strip=0): @@ -141,8 +142,8 @@ def GetSpdGuidVersion(Dom, strip=0): gpath = ["PackageSurfaceArea", "SpdHeader", "GuidValue"] vpath = ["PackageSurfaceArea", "SpdHeader", "Version"] - return string.lower(XmlElement(Dom, "/".join(gpath[strip:]))), \ - XmlElement(Dom, "/".join(vpath[strip:])) + return Guid(XmlElement(Dom, "/".join(gpath[strip:]))), \ + XmlElement(Dom, "/".join(vpath[strip:])) def InstallFar(farfile, workspaceLocation=""): @@ -189,7 +190,7 @@ def InstallFar(farfile, workspaceLocation=""): msa = XmlParseString(far.read(msafilePath)) for package in XmlList(msa, "/ModuleSurfaceArea/PackageDependencies/Package"): - guid = package.getAttribute("PackageGuid") + guid = Guid(package.getAttribute("PackageGuid")) version = package.getAttribute("PackageVersion") # Does anyone provide this package? @@ -215,8 +216,8 @@ def InstallFar(farfile, workspaceLocation=""): # Go through the dependencies for dependency in XmlList(fpd, "/PlatformSurfaceArea/FrameworkModules/ModuleSA") + \ XmlList(fpd, "/PlatformSurfaceArea/FrameworkModules/ModuleSA/Libraries/Instance"): - packagesNeeded.add((string.lower(dependency.getAttribute("PackageGuid")), - dependency.getAttribute("PackageVersion"))) + packagesNeeded.add((Guid(dependency.getAttribute("PackageGuid")), + dependency.getAttribute("PackageVersion"))) # Let's see if all the packages are in the workspace for guid, version in packagesNeeded: @@ -228,7 +229,7 @@ def InstallFar(farfile, workspaceLocation=""): installError = True # Check the fars - thisFarGuid = string.lower(XmlElement(manifest, "/FrameworkArchiveManifest/FarHeader/GuidValue")) + thisFarGuid = Guid(XmlElement(manifest, "/FrameworkArchiveManifest/FarHeader/GuidValue")) if fdb.HasFar(thisFarGuid): if not flags.reinstall: print "Error: There is a far with this guid already installed." @@ -301,7 +302,7 @@ if __name__ == '__main__': flags = Flags() # Process the command line args. - optlist, args = getopt.getopt(sys.argv[1:], '?hvf', ['help', 'verbose', 'force', 'reinstall']) + optlist, args = getopt.getopt(sys.argv[1:], '?hvfd:', ['directory=', 'help', 'verbose', 'force', 'reinstall']) # First pass through the options list. for o, a in optlist: @@ -314,6 +315,8 @@ if __name__ == '__main__': optlist.remove((o,a)) if o in ["-v", "--verbose"]: flags.verbose = True + if o in ["-d", "--directory"]: + flags.dir = a if o in ["-f", "--force"]: flags.force = True if o in ["--reinstall"]: