Changed getFlatPackageInfo so it looks for a PackageInfo file at the top level of the expanded xar archive. Failing that, it looks for PackageInfo files in embedded sub-packages at the top level of the the expanded xar archive. If that still comes up empty, it tries to get info from the Distribution file at the top level of the expanded xar archive.

git-svn-id: http://munki.googlecode.com/svn/trunk@212 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2009-09-15 03:52:01 +00:00
parent 97afbb6e5e
commit 681a05e5db
+14 -1
View File
@@ -481,10 +481,23 @@ def getFlatPackageInfo(pkgpath):
packageinfofile = os.path.join(currentdir, "PackageInfo")
if os.path.exists(packageinfofile):
infoarray = parsePkgRefs(packageinfofile)
else:
if not infoarray:
# didn't get any packageid info.
# look for subpackages at the top level
for item in os.listdir(currentdir):
itempath = os.path.join(currentdir, item)
if itempath.endswith(".pkg") and os.path.isdir(itempath):
packageinfofile = os.path.join(itempath, "PackageInfo")
if os.path.exists(packageinfofile):
infoarray.extend(parsePkgRefs(packageinfofile))
if not infoarray:
# found no PackageInfo files, so let's look at the Distribution file
distributionfile = os.path.join(currentdir, "Distribution")
if os.path.exists(distributionfile):
infoarray = parsePkgRefs(distributionfile)
os.chdir("/")
shutil.rmtree(pkgtmp)
return infoarray