author | saurabh.vyas@oracle.com |
Thu, 08 Dec 2016 03:40:55 +0530 | |
branch | s11u3-sru |
changeset 3483 | 99004fc8ada4 |
parent 2966 | 6a97d8a803d3 |
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 |
# |
3483
99004fc8ada4
21164880 pkg(5) elf file content hash should use gelf_sign_range(3ELF)
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
24 |
# Copyright (c) 2009, 2016, 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 |
|
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
32 |
from pkg.portable import PD_LOCAL_PATH, PD_PROTO_DIR, PD_DEFAULT_RUNPATH |
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): |
2826
cae308eb6426
7185135 i18n messages should use parameterized values
Tim Foster <tim.s.foster@oracle.com>
parents:
2406
diff
changeset
|
45 |
return _("%(file)s had this elf error:%(err)s") % \ |
cae308eb6426
7185135 i18n messages should use parameterized values
Tim Foster <tim.s.foster@oracle.com>
parents:
2406
diff
changeset
|
46 |
{"file": "self.fp", "err": self.ex} |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
47 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
48 |
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
|
49 |
"""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
|
50 |
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
|
51 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
52 |
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
|
53 |
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
|
54 |
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
|
55 |
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
|
56 |
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
|
57 |
self.tok = token |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
58 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
59 |
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
|
60 |
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
|
61 |
"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
|
62 |
"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
|
63 |
"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
|
64 |
self.__dict__ |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
65 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
66 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
67 |
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
|
68 |
"""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
|
69 |
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
|
70 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
71 |
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
|
72 |
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
|
73 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
74 |
base.PublishingDependency.__init__(self, action, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
75 |
[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
|
76 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
77 |
def is_error(self): |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
78 |
"""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
|
79 |
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
|
80 |
or not.""" |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
81 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
82 |
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
|
83 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
84 |
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
|
85 |
"""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
|
86 |
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
|
87 |
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
|
88 |
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
|
89 |
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
|
90 |
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
|
91 |
# 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
|
92 |
# 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
|
93 |
# 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
|
94 |
# 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
|
95 |
# 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
|
96 |
# 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
|
97 |
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
|
98 |
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
|
99 |
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
|
100 |
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
|
101 |
"warning" |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
1933
diff
changeset
|
102 |
missing_vars = self.get_variant_combinations() |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
1933
diff
changeset
|
103 |
missing_vars.mark_as_satisfied( |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
104 |
delivered_base_names[self.base_names[0]]) |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
1933
diff
changeset
|
105 |
return self.WARNING, missing_vars |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
106 |
else: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
107 |
return err, vars |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
108 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
109 |
def __repr__(self): |
1715
8f305f0a6864
8265 EINVAL on rmdir running "make test"
Dan Price <dp@eng.sun.com>
parents:
1600
diff
changeset
|
110 |
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
|
111 |
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
|
112 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
113 |
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
|
114 |
"""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
|
115 |
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
|
116 |
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
|
117 |
""" |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
118 |
|
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
119 |
res = [] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
120 |
elist = [] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
121 |
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
|
122 |
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
|
123 |
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
|
124 |
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
|
125 |
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
|
126 |
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
|
127 |
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
|
128 |
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
|
129 |
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
|
130 |
else: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
131 |
np = [ |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
132 |
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
|
133 |
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
|
134 |
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
|
135 |
] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
136 |
# 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
|
137 |
# 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
|
138 |
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
|
139 |
dyn_tok_conv) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
140 |
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
|
141 |
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
|
142 |
else: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
143 |
res.append(p) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
144 |
return res, elist |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
145 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
146 |
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
|
147 |
|
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
148 |
def process_elf_dependencies(action, pkg_vars, dyn_tok_conv, run_paths, |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
149 |
**kwargs): |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
150 |
"""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
|
151 |
provided. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
152 |
|
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
153 |
'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
|
154 |
|
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
155 |
'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
|
156 |
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
|
157 |
|
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
158 |
'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
|
159 |
$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
|
160 |
|
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
161 |
'run_paths' contains the run paths which elf binaries should use. |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
162 |
""" |
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 |
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
|
165 |
return [], [], {} |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
166 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
167 |
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
|
168 |
|
1500
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1384
diff
changeset
|
169 |
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
|
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 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
|
172 |
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
|
173 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
174 |
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
|
175 |
return [], [], {} |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
176 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
177 |
try: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
178 |
ei = elf.get_info(proto_file) |
3483
99004fc8ada4
21164880 pkg(5) elf file content hash should use gelf_sign_range(3ELF)
saurabh.vyas@oracle.com
parents:
2966
diff
changeset
|
179 |
ed = elf.get_dynamic(proto_file) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
180 |
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
|
181 |
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
|
182 |
deps = [ |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
183 |
d[0] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
184 |
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
|
185 |
] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
186 |
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
|
187 |
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
|
188 |
rp = [] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
189 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
190 |
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
|
191 |
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
|
192 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
193 |
kernel64 = None |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
194 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
195 |
# 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
|
196 |
# /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
|
197 |
# 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
|
198 |
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
|
199 |
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
|
200 |
(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
|
201 |
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
|
202 |
if rp: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
203 |
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
|
204 |
"(%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
|
205 |
# 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
|
206 |
if installed_path.startswith("platform"): |
298de942442b
10517 pkgdep hurls while munching on kernel modules
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
207 |
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
|
208 |
installed_path.split("/")[1]) |
c7ef4ea4f2f6
13057 pkgdep should add platform args to kernel paths
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
209 |
else: |
c7ef4ea4f2f6
13057 pkgdep should add platform args to kernel paths
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
210 |
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
|
211 |
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
|
212 |
# Default kernel search path |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
213 |
rp.extend(["/kernel", "/usr/kernel"]) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
214 |
# 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
|
215 |
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
|
216 |
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
|
217 |
kernel64 = "amd64" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
218 |
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
|
219 |
kernel64 = "sparcv9" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
220 |
else: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
221 |
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
|
222 |
ei["arch"]) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
223 |
else: |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
224 |
for p in default_run_paths: |
2406
011c37aa39da
17808 pkgdepend generate should deal with 32 vs. 64-bit userland
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
225 |
if ei["bits"] == 64: |
011c37aa39da
17808 pkgdepend generate should deal with 32 vs. 64-bit userland
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
226 |
p += "/64" |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
227 |
if p not in rp: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
228 |
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
|
229 |
|
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
230 |
elist = [] |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
231 |
if run_paths: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
232 |
# add our detected runpaths into the user-supplied one (if any) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
233 |
rp = base.insert_default_runpath(rp, run_paths) |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
234 |
|
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
235 |
rp, errs = expand_variables(rp, dyn_tok_conv) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
236 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
237 |
elist.extend([ |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
238 |
UnsupportedDynamicToken(proto_file, installed_path, p, tok) |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
239 |
for p, tok in errs |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
240 |
]) |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
241 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
242 |
res = [] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
243 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
244 |
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
|
245 |
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
|
246 |
pathlist = [] |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
247 |
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
|
248 |
if kernel64: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
249 |
# 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
|
250 |
# 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
|
251 |
# /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
|
252 |
# /platform to look. |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
253 |
deppath = \ |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
254 |
os.path.join(p, pn, kernel64, fn).lstrip( |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2091
diff
changeset
|
255 |
os.path.sep) |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
256 |
else: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
257 |
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
|
258 |
# 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
|
259 |
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
|
260 |
if head: |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
261 |
pathlist.append(head) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
262 |
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
|
263 |
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
|
264 |
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
|
265 |
return res, elist, {} |