author | Tim Foster <tim.s.foster@oracle.com> |
Tue, 08 Jun 2010 12:17:06 +1200 | |
changeset 1933 | 5193ac03ad9f |
parent 1908 | 4bdaf0463bae |
child 2091 | 824491c11ff3 |
permissions | -rw-r--r-- |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1500
diff
changeset
|
1 |
#!/usr/bin/python |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
2 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
4 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
8 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
13 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
19 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
21 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
22 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
23 |
# |
1908
4bdaf0463bae
15843 pkgdepend can't handle more than one proto area
Brock Pytlik <bpytlik@sun.com>
parents:
1715
diff
changeset
|
24 |
# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
25 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
26 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
27 |
import os |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
28 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
29 |
import pkg.elf as elf |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
30 |
import pkg.flavor.base as base |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
31 |
|
1908
4bdaf0463bae
15843 pkgdepend can't handle more than one proto area
Brock Pytlik <bpytlik@sun.com>
parents:
1715
diff
changeset
|
32 |
from pkg.portable import PD_LOCAL_PATH, PD_PROTO_DIR |
1500
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1384
diff
changeset
|
33 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
34 |
class BadElfFile(base.DependencyAnalysisError): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
35 |
"""Exception that is raised when the elf dependency checker is given |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
36 |
a file that errors when it tries to get the dynamic section from the |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
37 |
file.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
38 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
39 |
def __init__(self, fp, ex): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
40 |
base.DependencyAnalysisError.__init__(self) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
41 |
self.fp = fp |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
42 |
self.ex = ex |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
43 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
44 |
def __str__(self): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
45 |
return _("%s had this elf error:%s") % (self.fp, self.ex) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
46 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
47 |
class UnsupportedDynamicToken(base.DependencyAnalysisError): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
48 |
"""Exception that is used for elf dependencies which have a dynamic |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
49 |
token in their path that we're unable to decode.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
50 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
51 |
def __init__(self, proto_path, installed_path, run_path, token): |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
52 |
base.DependencyAnalysisError.__init__(self) |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
53 |
self.pp = proto_path |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
54 |
self.ip = installed_path |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
55 |
self.rp = run_path |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
56 |
self.tok = token |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
57 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
58 |
def __str__(self): |
1600
14668d09ca60
13436 several translatable messages should use mapping to enable swap of parameters (API part)
Danek Duvall <danek.duvall@sun.com>
parents:
1582
diff
changeset
|
59 |
return _("%(pp)s (which will be installed at %(ip)s) had this " |
14668d09ca60
13436 several translatable messages should use mapping to enable swap of parameters (API part)
Danek Duvall <danek.duvall@sun.com>
parents:
1582
diff
changeset
|
60 |
"token, %(tok)s, in its run path: %(rp)s. It is not " |
14668d09ca60
13436 several translatable messages should use mapping to enable swap of parameters (API part)
Danek Duvall <danek.duvall@sun.com>
parents:
1582
diff
changeset
|
61 |
"currently possible to automatically expand this token. " |
14668d09ca60
13436 several translatable messages should use mapping to enable swap of parameters (API part)
Danek Duvall <danek.duvall@sun.com>
parents:
1582
diff
changeset
|
62 |
"Please specify its value on the command line.") % \ |
14668d09ca60
13436 several translatable messages should use mapping to enable swap of parameters (API part)
Danek Duvall <danek.duvall@sun.com>
parents:
1582
diff
changeset
|
63 |
self.__dict__ |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
64 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
65 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
66 |
class ElfDependency(base.PublishingDependency): |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
67 |
"""Class representing a dependency from one file to another library |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
68 |
as determined by elf.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
69 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
70 |
def __init__(self, action, base_name, run_paths, pkg_vars, proto_dir): |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
71 |
self.err_type = self.ERROR |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
72 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
73 |
base.PublishingDependency.__init__(self, action, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
74 |
[base_name], run_paths, pkg_vars, proto_dir, "elf") |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
75 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
76 |
def is_error(self): |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
77 |
"""Because elf dependencies can be either warnings or errors, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
78 |
it's necessary to check whether this dependency is an error |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
79 |
or not.""" |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
80 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
81 |
return self.err_type == self.ERROR |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
82 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
83 |
def resolve_internal(self, delivered_base_names, **kwargs): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
84 |
"""Checks whether this dependency has been delivered. If the |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
85 |
full path has not been delivered, check whether the base name |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
86 |
has. If it has, it's likely that the run path is being set |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
87 |
externally. Report a warning, but not an error in this case.""" |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
88 |
err, vars = base.PublishingDependency.resolve_internal( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
89 |
self, delivered_base_names=delivered_base_names, **kwargs) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
90 |
# If the none of the paths pointed to a file with the desired |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
91 |
# basename, but a file with that basename was delivered by this |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
92 |
# package, then treat the dependency as a warning instead of |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
93 |
# an error. The failure to find the path to the right file |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
94 |
# may be due to the library search path being set outside the |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
95 |
# file that generates the dependency. |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
96 |
if err == self.ERROR and vars.is_satisfied() and \ |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
97 |
self.base_names[0] in delivered_base_names: |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
98 |
self.err_type = self.WARNING |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
99 |
self.attrs["%s.severity" % self.DEPEND_DEBUG_PREFIX] =\ |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
100 |
"warning" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
101 |
return self.WARNING, self.get_var_diff( |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
102 |
delivered_base_names[self.base_names[0]]) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
103 |
else: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
104 |
return err, vars |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
105 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
106 |
def __repr__(self): |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1600
diff
changeset
|
107 |
return "ElfDep(%s, %s, %s, %s)" % (self.action, |
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1600
diff
changeset
|
108 |
self.base_names[0], self.run_paths, self.pkg_vars) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
109 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
110 |
def expand_variables(paths, dyn_tok_conv): |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
111 |
"""Replace dynamic tokens, such as $PLATFORM, in the paths in the |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
112 |
paramter 'paths' with the values for that token provided in the |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
113 |
dictionary 'dyn_tok_conv.' |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
114 |
""" |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
115 |
|
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
116 |
res = [] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
117 |
elist = [] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
118 |
for p in paths: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
119 |
tok_start = p.find("$") |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
120 |
if tok_start > -1: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
121 |
tok = p[tok_start:] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
122 |
tok_end = tok.find("/") |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
123 |
if tok_end > -1: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
124 |
tok = tok[:tok_end] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
125 |
if tok not in dyn_tok_conv: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
126 |
elist.append((p, tok)) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
127 |
else: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
128 |
np = [ |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
129 |
p[:tok_start] + dc + \ |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
130 |
p[tok_start + len(tok):] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
131 |
for dc in dyn_tok_conv[tok] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
132 |
] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
133 |
# The first dynamic token has been replaced, but |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
134 |
# more may remain so process the path again. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
135 |
rec_res, rec_elist = expand_variables(np, |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
136 |
dyn_tok_conv) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
137 |
res.extend(rec_res) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
138 |
elist.extend(rec_elist) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
139 |
else: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
140 |
res.append(p) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
141 |
return res, elist |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
142 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
143 |
default_run_paths = ["/lib", "/usr/lib"] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
144 |
|
1908
4bdaf0463bae
15843 pkgdepend can't handle more than one proto area
Brock Pytlik <bpytlik@sun.com>
parents:
1715
diff
changeset
|
145 |
def process_elf_dependencies(action, pkg_vars, dyn_tok_conv, |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
146 |
kernel_paths, **kwargs): |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
147 |
"""Produce the elf dependencies for the file delivered in the action |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
148 |
provided. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
149 |
|
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
150 |
'action' is the file action to analyze. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
151 |
|
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
152 |
'pkg_vars' is the list of variants against which the package delivering |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
153 |
the action was published. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
154 |
|
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
155 |
'dyn_tok_conv' is the dictionary which maps the dynamic tokens, like |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
156 |
$PLATFORM, to the values they should be expanded to. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
157 |
|
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
158 |
'kernel_paths' contains the run paths which kernel modules should use. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
159 |
""" |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
160 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
161 |
if not action.name == "file": |
1933
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
162 |
return [], [], {} |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
163 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
164 |
installed_path = action.attrs[action.key_attr] |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
165 |
|
1500
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1384
diff
changeset
|
166 |
proto_file = action.attrs[PD_LOCAL_PATH] |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
167 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
168 |
if not os.path.exists(proto_file): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
169 |
raise base.MissingFile(proto_file) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
170 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
171 |
if not elf.is_elf_object(proto_file): |
1933
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
172 |
return [], [], {} |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
173 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
174 |
try: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
175 |
ei = elf.get_info(proto_file) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
176 |
ed = elf.get_dynamic(proto_file) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
177 |
except elf.ElfError, e: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
178 |
raise BadElfFile(proto_file, e) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
179 |
deps = [ |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
180 |
d[0] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
181 |
for d in ed.get("deps", []) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
182 |
] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
183 |
rp = ed.get("runpath", "").split(":") |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
184 |
if len(rp) == 1 and rp[0] == "": |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
185 |
rp = [] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
186 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
187 |
dyn_tok_conv["$ORIGIN"] = [os.path.join("/", |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
188 |
os.path.dirname(installed_path))] |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
189 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
190 |
kernel64 = None |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
191 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
192 |
# For kernel modules, default path resolution is /platform/<platform>, |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
193 |
# /kernel, /usr/kernel. But how do we know what <platform> would be for |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
194 |
# a given module? Does it do fallbacks to, say, sun4u? |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
195 |
if installed_path.startswith("kernel") or \ |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
196 |
installed_path.startswith("usr/kernel") or \ |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
197 |
(installed_path.startswith("platform") and \ |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
198 |
installed_path.split("/")[2] == "kernel"): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
199 |
if rp: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
200 |
raise RuntimeError("RUNPATH set for kernel module " |
1293
298de942442b
10517 pkgdep hurls while munching on kernel modules
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
201 |
"(%s): %s" % (installed_path, rp)) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
202 |
# Add this platform to the search path. |
1293
298de942442b
10517 pkgdep hurls while munching on kernel modules
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
203 |
if installed_path.startswith("platform"): |
298de942442b
10517 pkgdep hurls while munching on kernel modules
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
204 |
rp.append("/platform/%s/kernel" % |
1582
c7ef4ea4f2f6
13057 pkgdep should add platform args to kernel paths
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
205 |
installed_path.split("/")[1]) |
c7ef4ea4f2f6
13057 pkgdep should add platform args to kernel paths
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
206 |
else: |
c7ef4ea4f2f6
13057 pkgdep should add platform args to kernel paths
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
207 |
for p in dyn_tok_conv.get("$PLATFORM", []): |
c7ef4ea4f2f6
13057 pkgdep should add platform args to kernel paths
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
208 |
rp.append("/platform/%s/kernel" % p) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
209 |
# Default kernel search path |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
210 |
rp.extend(kernel_paths) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
211 |
# What subdirectory should we look in for 64-bit kernel modules? |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
212 |
if ei["bits"] == 64: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
213 |
if ei["arch"] == "i386": |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
214 |
kernel64 = "amd64" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
215 |
elif ei["arch"] == "sparc": |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
216 |
kernel64 = "sparcv9" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
217 |
else: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
218 |
raise RuntimeError("Unknown arch:%s" % |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
219 |
ei["arch"]) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
220 |
else: |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
221 |
for p in default_run_paths: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
222 |
if p not in rp: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
223 |
rp.append(p) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
224 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
225 |
rp, elist = expand_variables(rp, dyn_tok_conv) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
226 |
|
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
227 |
elist = [ |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
228 |
UnsupportedDynamicToken(proto_file, installed_path, p, tok) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
229 |
for p, tok in elist |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
230 |
] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
231 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
232 |
res = [] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
233 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
234 |
for d in deps: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
235 |
pn, fn = os.path.split(d) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
236 |
pathlist = [] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
237 |
for p in rp: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
238 |
if kernel64: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
239 |
# Find 64-bit modules the way krtld does. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
240 |
# XXX We don't resolve dependencies found in |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
241 |
# /platform, since we don't know where under |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
242 |
# /platform to look. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
243 |
deppath = os.path.join(p, pn, kernel64, fn)[1:] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
244 |
else: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
245 |
# This is a hack for when a runpath uses the 64 |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
246 |
# symlink to the actual 64-bit directory. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
247 |
# Better would be to see if the runpath was a |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
248 |
# link, and if so, use its resolution, but |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
249 |
# extracting that information from used list is |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
250 |
# a pain, especially because you potentially |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
251 |
# have to resolve symlinks at all levels of the |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
252 |
# path. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
253 |
if p.endswith("/64"): |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
254 |
if ei["arch"] == "i386": |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
255 |
p = p[:-2] + "amd64" |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
256 |
elif ei["arch"] == "sparc": |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
257 |
p = p[:-2] + "sparcv9" |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
258 |
deppath = os.path.join(p, d).lstrip(os.path.sep) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
259 |
# deppath includes filename; remove that. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
260 |
head, tail = os.path.split(deppath) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
261 |
if head: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
262 |
pathlist.append(head) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
263 |
res.append(ElfDependency(action, fn, pathlist, pkg_vars, |
1908
4bdaf0463bae
15843 pkgdepend can't handle more than one proto area
Brock Pytlik <bpytlik@sun.com>
parents:
1715
diff
changeset
|
264 |
action.attrs[PD_PROTO_DIR])) |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
265 |
del dyn_tok_conv["$ORIGIN"] |
1933
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
266 |
return res, elist, {} |