Argument passed to 'getChoiceChangesXML' now matches the argument used in preceding calls to 'getPackageMetaData'

Minor usage note changed for '--installer_choices_xml' as well as
proper os_version comparison as to NOT exclude Mac OS X 10.6.6.

Modified 'munkicommon.getChoiceChangesXML' to return 'choices' even if
empty.
This commit is contained in:
Heig Gregorian
2012-05-01 08:49:46 -07:00
parent 9c5ade47d3
commit 1e0d0842c7
2 changed files with 6 additions and 5 deletions
+4 -4
View File
@@ -63,7 +63,7 @@ def getCatalogInfoFromDmg(dmgpath, options):
if os.path.exists(pkgpath):
cataloginfo = munkicommon.getPackageMetaData(pkgpath)
if options.installer_choices_xml:
installer_choices_xml = munkicommon.getChoiceChangesXML(item)
installer_choices_xml = munkicommon.getChoiceChangesXML(pkgpath)
if installer_choices_xml:
cataloginfo['installer_choices_xml'] = installer_choices_xml
if cataloginfo:
@@ -75,7 +75,7 @@ def getCatalogInfoFromDmg(dmgpath, options):
if itempath.endswith('.pkg') or itempath.endswith('.mpkg'):
cataloginfo = munkicommon.getPackageMetaData(itempath)
if options.installer_choices_xml:
installer_choices_xml = munkicommon.getChoiceChangesXML(item)
installer_choices_xml = munkicommon.getChoiceChangesXML(itempath)
if installer_choices_xml:
cataloginfo['installer_choices_xml'] = installer_choices_xml
# get out of fsitem loop
@@ -337,7 +337,7 @@ def main():
help='''Optional flag
Specify that installer choices should be generated.
Note: Used with OS X 10.6.6 or later.''')
Note: Requires Mac OS X 10.6.6 or later.''')
p.add_option('--destinationpath', '-d',
help='''Optional flag.
@@ -454,7 +454,7 @@ def main():
if options.installer_choices_xml:
os_version = munkicommon.getOsVersion(only_major_minor=False,as_tuple=True)
if os_version <= (10, 6, 6):
if os_version < (10, 6, 6):
options.installer_choices_xml = False
catinfo = {}
+2 -1
View File
@@ -1506,6 +1506,7 @@ def isInstallerItem(path):
def getChoiceChangesXML(pkgitem):
"""Queries package for 'ChoiceChangesXML'"""
choices = []
try:
proc = subprocess.Popen(['/usr/sbin/installer', '-showChoiceChangesXML', '-pkg', pkgitem],
bufsize=1, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
@@ -1518,7 +1519,7 @@ def getChoiceChangesXML(pkgitem):
choices = [item for item in plist if 'selected' in item['choiceAttribute']]
except:
# No choices found or something went wrong
return False
pass
return choices