elf.py revision 1908
70N/A# The contents of this file are subject to the terms of the 70N/A# Common Development and Distribution License (the "License"). 70N/A# You may not use this file except in compliance with the License. 70N/A# See the License for the specific language governing permissions 70N/A# and limitations under the License. 70N/A# When distributing Covered Code, include this CDDL HEADER in each 70N/A# If applicable, add the following below this CDDL HEADER, with the 70N/A# fields enclosed by brackets "[]" replaced with your own identifying 70N/A# information: Portions Copyright [yyyy] [name of copyright owner] 70N/A# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. 98N/A """Exception that is raised when the elf dependency checker is given 98N/A a file that errors when it tries to get the dynamic section from the 98N/A """Exception that is used for elf dependencies which have a dynamic 98N/A token in their path that we're unable to decode.""" 70N/A return _(
"%(pp)s (which will be installed at %(ip)s) had this " 70N/A "token, %(tok)s, in its run path: %(rp)s. It is not " 70N/A "currently possible to automatically expand this token. " 70N/A "Please specify its value on the command line.") % \
70N/A """Class representing a dependency from one file to another library 70N/A as determined by elf.""" """Because elf dependencies can be either warnings or errors, it's necessary to check whether this dependency is an error """Checks whether this dependency has been delivered. If the full path has not been delivered, check whether the base name has. If it has, it's likely that the run path is being set externally. Report a warning, but not an error in this case.""" # If the none of the paths pointed to a file with the desired # basename, but a file with that basename was delivered by this # package, then treat the dependency as a warning instead of # an error. The failure to find the path to the right file # may be due to the library search path being set outside the # file that generates the dependency. """Replace dynamic tokens, such as $PLATFORM, in the paths in the paramter 'paths' with the values for that token provided in the dictionary 'dyn_tok_conv.' # The first dynamic token has been replaced, but # more may remain so process the path again. """Produce the elf dependencies for the file delivered in the action 'action' is the file action to analyze. 'pkg_vars' is the list of variants against which the package delivering the action was published. 'dyn_tok_conv' is the dictionary which maps the dynamic tokens, like $PLATFORM, to the values they should be expanded to. 'kernel_paths' contains the run paths which kernel modules should use. for d
in ed.
get(
"deps", [])
# For kernel modules, default path resolution is /platform/<platform>, # /kernel, /usr/kernel. But how do we know what <platform> would be for # a given module? Does it do fallbacks to, say, sun4u? # Add this platform to the search path. # Default kernel search path # What subdirectory should we look in for 64-bit kernel modules? elif ei[
"arch"] ==
"sparc":
# Find 64-bit modules the way krtld does. # XXX We don't resolve dependencies found in # /platform, since we don't know where under # This is a hack for when a runpath uses the 64 # symlink to the actual 64-bit directory. # Better would be to see if the runpath was a # link, and if so, use its resolution, but # extracting that information from used list is # a pain, especially because you potentially # have to resolve symlinks at all levels of the elif ei[
"arch"] ==
"sparc":
# deppath includes filename; remove that.