tools/userland-mangler
branchs11u2-sru
changeset 3545 bcd36758306e
parent 2855 576d5a7857b7
child 7682 8e5bb71809b9
equal deleted inserted replaced
3544:bcc54fcde38a 3545:bcd36758306e
    17 # fields enclosed by brackets "[]" replaced with your own identifying
    17 # fields enclosed by brackets "[]" replaced with your own identifying
    18 # information: Portions Copyright [yyyy] [name of copyright owner]
    18 # information: Portions Copyright [yyyy] [name of copyright owner]
    19 #
    19 #
    20 # CDDL HEADER END
    20 # CDDL HEADER END
    21 #
    21 #
    22 # Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
    22 # Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
    23 #
    23 #
    24 #
    24 #
    25 # userland-mangler - a file mangling utility
    25 # userland-mangler - a file mangling utility
    26 #
    26 #
    27 #  A simple program to mangle files to conform to Solaris WOS or Consoldation
    27 #  A simple program to mangle files to conform to Solaris WOS or Consoldation
   255 				src = os.path.join(directory, path)
   255 				src = os.path.join(directory, path)
   256 				if os.path.isfile(src):
   256 				if os.path.isfile(src):
   257 					mangle_path(manifest, action, src, dest)
   257 					mangle_path(manifest, action, src, dest)
   258 					break
   258 					break
   259 
   259 
       
   260 def mangle_manifest(manifest):
       
   261 	# Check for file content and remove tpno data and license actions if
       
   262 	# there is no content in the package that can be licensed.
       
   263 	manifest_has_file_content = False
       
   264 
       
   265 	for action in manifest.gen_actions_by_type("file"):
       
   266 		manifest_has_file_content = True
       
   267 		break
       
   268 
       
   269 	if not manifest_has_file_content:
       
   270 		# search for and remove 'set name=com.oracle.info.tpno ...'
       
   271 		for action in manifest.gen_actions_by_type("set"):
       
   272 			if (action.attrs["name"] == "com.oracle.info.tpno"):
       
   273 				manifest.actions.remove(action)
       
   274 		for action in manifest.gen_actions_by_type("license"):
       
   275 			manifest.actions.remove(action)
       
   276 
   260 def load_manifest(manifest_file):
   277 def load_manifest(manifest_file):
   261 	manifest = pkg.manifest.Manifest()
   278 	manifest = pkg.manifest.Manifest()
   262 	manifest.set_content(pathname=manifest_file)
   279 	manifest.set_content(pathname=manifest_file)
   263 
   280 
   264 	return manifest
   281 	return manifest
   303 	if destination == None:
   320 	if destination == None:
   304 		usage()
   321 		usage()
   305 
   322 
   306 	for manifest in manifests:
   323 	for manifest in manifests:
   307 		mangle_paths(manifest, search_paths, destination)
   324 		mangle_paths(manifest, search_paths, destination)
       
   325 		mangle_manifest(manifest)
   308 		print manifest
   326 		print manifest
   309 
   327 
   310 	sys.exit(0)
   328 	sys.exit(0)
   311 
   329 
   312 if __name__ == "__main__":
   330 if __name__ == "__main__":