Better support for older package formats that are missing Info.plist files.

git-svn-id: http://munki.googlecode.com/svn/trunk@545 a4e17f2e-e282-11dd-95e1-755cbddbdd66
This commit is contained in:
Greg Neagle
2010-06-02 23:44:38 +00:00
parent afc0f5b6a8
commit 2ab043af4e
+24 -2
View File
@@ -773,8 +773,30 @@ def getOnePackageInfo(pkgpath):
pkginfo['packageid'] = "BAD PLIST in %s" % \
os.path.basename(pkgpath)
pkginfo['version'] = "0.0.0.0.0"
else:
# look for old-style .info files!
infopath = os.path.join(pkgpath, "Contents", "Resources",
"English.lproj")
for item in os.listdir(infopath):
if os.path.join(infopath, item).endswith(".info"):
pkginfo['filename'] = os.path.basename(pkgpath)
pkginfo['packageid'] = os.path.basename(pkgpath)
infofile = os.path.join(infopath, item)
f = open(infofile, mode='r')
info = f.read()
f.close()
infolines = info.splitlines()
for line in infolines:
parts = line.split(None, 1)
if parts:
label = parts[0]
if label == "Version":
pkginfo['version'] = padVersionString(parts[1],5)
if label == "Title":
pkginfo["name"] = parts[1]
break
return pkginfo
def getText(nodelist):
'''Helper function to get text from XML child nodes'''
@@ -826,7 +848,7 @@ def getBundlePackageInfo(pkgpath):
dirsToSearch.append(componentdir)
if dirsToSearch == []:
dirsToSearch = ['Contents', 'Contents/Installers',
dirsToSearch = ['', 'Contents', 'Contents/Installers',
'Contents/Packages', 'Contents/Resources',
'Contents/Resources/Packages']
for subdir in dirsToSearch: