tools/python/pkglint/userland.py
branchs11-update
changeset 2528 788328aeec2a
parent 623 15f87c23a86e
child 2723 138732f62341
equal deleted inserted replaced
2527:0935492f14d7 2528:788328aeec2a
    19 #
    19 #
    20 # CDDL HEADER END
    20 # CDDL HEADER END
    21 #
    21 #
    22 
    22 
    23 #
    23 #
    24 # Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
    24 # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
    25 #
    25 #
    26 
    26 
    27 # Some userland consolidation specific lint checks
    27 # Some userland consolidation specific lint checks
    28 
    28 
    29 import pkg.lint.base as base
    29 import pkg.lint.base as base
    43 		path = os.getenv('PROTO_PATH')
    43 		path = os.getenv('PROTO_PATH')
    44 		if path != None:
    44 		if path != None:
    45 			self.proto_path = path.split()
    45 			self.proto_path = path.split()
    46 		else:
    46 		else:
    47 			self.proto_path = None
    47 			self.proto_path = None
       
    48 		#
       
    49 		# These lists are used to check if a 32/64-bit binary
       
    50 		# is in a proper 32/64-bit directory.
       
    51 		#
       
    52 		self.pathlist32 = [
       
    53 			"i86",
       
    54 			"sparcv7",
       
    55 			"32",
       
    56 			"i86pc-solaris-64int",  # perl path
       
    57 			"sun4-solaris-64int"    # perl path
       
    58 		]
       
    59 		self.pathlist64 = [
       
    60 			"amd64",
       
    61 			"sparcv9",
       
    62 			"64",
       
    63 			"i86pc-solaris-64",     # perl path
       
    64 			"sun4-solaris-64"       # perl path
       
    65 		]
    48 		self.runpath_re = [
    66 		self.runpath_re = [
    49 			re.compile('^/lib(/.*)?$'),
    67 			re.compile('^/lib(/.*)?$'),
    50 			re.compile('^/usr/'),
    68 			re.compile('^/usr/'),
    51 			re.compile('^\$ORIGIN/')
    69 			re.compile('^\$ORIGIN/')
    52 		]
    70 		]
    53 		self.runpath_64_re = [
    71 		self.runpath_64_re = [
    54 			re.compile('^.*/64(/.*)?$'),
    72 			re.compile('^.*/64(/.*)?$'),
    55 			re.compile('^.*/amd64(/.*)?$'),
    73 			re.compile('^.*/amd64(/.*)?$'),
    56 			re.compile('^.*/sparcv9(/.*)?$')
    74 			re.compile('^.*/sparcv9(/.*)?$'),
       
    75 			re.compile('^.*/i86pc-solaris-64(/.*)?$'), # perl path
       
    76 			re.compile('^.*/sun4-solaris-64(/.*)?$')   # perl path
    57 		]
    77 		]
    58 		self.initscript_re = re.compile("^etc/(rc.|init)\.d")
    78 		self.initscript_re = re.compile("^etc/(rc.|init)\.d")
    59 
    79 
    60                 self.lint_paths = {}
    80                 self.lint_paths = {}
    61                 self.ref_paths = {}
    81                 self.ref_paths = {}
   248 		ei = elf.get_info(path)
   268 		ei = elf.get_info(path)
   249 		bits = ei.get("bits")
   269 		bits = ei.get("bits")
   250 		type = ei.get("type");
   270 		type = ei.get("type");
   251                 elems = os.path.dirname(path).split("/")
   271                 elems = os.path.dirname(path).split("/")
   252 
   272 
   253                 if ("amd64" in elems) or ("sparcv9" in elems) or ("64" in elems):
   273                 path64 = False
   254                     path64 = True
   274 		for p in self.pathlist64:
   255                 else:
   275 		    if (p in elems):
   256                     path64 = False
   276 			path64 = True
   257 
   277 
   258                 if ("i86" in elems) or ("sparcv7" in elems) or ("32" in elems):
   278                 path32 = False
   259                     path32 = True
   279 		for p in self.pathlist32:
   260                 else:
   280 		    if (p in elems):
   261                     path32 = False
   281 			path32 = True
   262 
   282 
   263 		# ignore 64-bit executables in normal (non-32-bit-specific)
   283 		# ignore 64-bit executables in normal (non-32-bit-specific)
   264 		# locations, that's ok now.
   284 		# locations, that's ok now.
   265 		if (type == "exe" and bits == 64 and path32 == False and path64 == False):
   285 		if (type == "exe" and bits == 64 and path32 == False and path64 == False):
   266 			return result
   286 			return result