Merge pull request #458 from nmcspadden/master

Added uninstaller_item_location check to makecatalogs
This commit is contained in:
Greg Neagle
2015-04-13 14:19:42 -07:00

View File

@@ -234,6 +234,7 @@ def makecatalogs(repopath, options):
do_pkg_check = False
if pkginfo.get('PackageURL'):
do_pkg_check = False
if do_pkg_check:
if not 'installer_item_location' in pkginfo:
@@ -268,6 +269,42 @@ def makecatalogs(repopath, options):
exit_code = -1
continue
#uninstaller sanity checking
uninstaller_type = pkginfo.get('uninstall_method')
if uninstaller_type in ['AdobeCCPUninstaller']:
# uninstaller_item_location is required
if not 'uninstaller_item_location' in pkginfo:
errors.append(
"WARNING: file %s is missing uninstaller_item_location"
% filepath[len(pkgsinfopath)+1:])
# Skip this pkginfo unless we're running with force flag
if not options.force:
exit_code = -1
continue
# if an uninstaller_item_location is specified, sanity-check it
if 'uninstaller_item_location' in pkginfo:
try:
uninstalleritempath = os.path.join(
repopath, "pkgs", pkginfo['uninstaller_item_location'])
except TypeError:
errors.append("WARNING: invalid uninstaller_item_location "
"in info file %s"
% filepath[len(pkgsinfopath)+1:])
exit_code = -1
continue
# Check if the uninstaller item actually exists
if not os.path.exists(uninstalleritempath):
errors.append("WARNING: Info file %s refers to "
"missing uninstaller item: %s" %
(filepath[len(pkgsinfopath)+1:],
pkginfo['uninstaller_item_location']))
# Skip this pkginfo unless we're running with force flag
if not options.force:
exit_code = -1
continue
catalogs['all'].append(pkginfo)
for catalogname in pkginfo.get("catalogs", []):
infofilename = filepath[len(pkgsinfopath)+1:]