bass-o-matic revision 3770
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# CDDL HEADER START
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# The contents of this file are subject to the terms of the
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# Common Development and Distribution License (the "License").
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# You may not use this file except in compliance with the License.
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# See the License for the specific language governing permissions
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# and limitations under the License.
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# When distributing Covered Code, include this CDDL HEADER in each
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# If applicable, add the following below this CDDL HEADER, with the
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# fields enclosed by brackets "[]" replaced with your own identifying
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# information: Portions Copyright [yyyy] [name of copyright owner]
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# CDDL HEADER END
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# A simple program to enumerate components in the userland gate and report
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# on dependency related information.
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# Locate SCM directories containing Userland components by searching from
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# from a supplied top of tree for .p5m files. Once a .p5m file is located,
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg# that directory is added to the list and no children are searched.
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg print >>debug, "searching %s for component directories" % path
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg for dirpath, dirnames, filenames in os.walk(path + '/components'):
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg # get supplied packages (cd path ; gmake print-package-names)
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg self.supplied_packages = self.run_make(path, 'print-package-names')
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg # get supplied paths (cd path ; gmake print-package-paths)
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg self.supplied_paths = self.run_make(path, 'print-package-paths')
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg # get required paths (cd path ; gmake print-required-paths)
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg self.required_paths = self.run_make(path, 'print-required-paths')
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg print >>self.debug, "Executing 'gmake %s' in %s" % (targets, path)
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg proc = subprocess.Popen(['gmake', targets], cwd=path,
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg print >>self.debug, "exit: %d, %s" % (proc.returncode, proc.stderr.read())
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg result = result + "\tProvides Package(s):\n\t\t%s\n" % '\t\t'.join(self.supplied_packages)
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg result = result + "\tProvides Path(s):\n\t\t%s\n" % '\t\t'.join(self.supplied_paths)
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg result = result + "\tRequired Path(s):\n\t\t%s\n" % '\t\t'.join(self.required_paths)
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg print "Usage: %s [-c|--components=(path|depend)] [-z|--zone (zone)]" % (sys.argv[0].split('/')[-1])
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg # FLUSH STDOUT
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg component_paths = FindComponentPaths(workspace, debug)
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg print "using template zone %s to create a build environment for %s to run '%s'" % (template_zone, component_arg, ['gmake'] + args)
ff7e89a077d93c243bd8261cf3c72b13732ab5b4fuankg if components_arg in [ 'path', 'paths', 'dir', 'dirs', 'directories' ]: