author | Brock Pytlik <bpytlik@sun.com> |
Fri, 15 Jan 2010 13:54:49 -0800 | |
changeset 1662 | f0ba72befa72 |
parent 1580 | 2763f36d0eda |
child 1674 | faf484754465 |
permissions | -rw-r--r-- |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1231
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 |
|
1662
f0ba72befa72
13791 NameError when compile fails
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
23 |
# Copyright 2010 Sun Microsystems, Inc. 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
|
24 |
# Use is subject to license terms. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
25 |
|
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1231
diff
changeset
|
26 |
import cli.testutils as testutils |
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1231
diff
changeset
|
27 |
if __name__ == "__main__": |
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1231
diff
changeset
|
28 |
testutils.setup_environment("../../../proto") |
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1231
diff
changeset
|
29 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
30 |
import os |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
31 |
import shutil |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
32 |
import subprocess |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
33 |
import sys |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
34 |
import tempfile |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
35 |
import unittest |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
36 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
37 |
# Set the path so that modules above can be found |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
38 |
path_to_parent = os.path.join(os.path.dirname(__file__), "..") |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
39 |
sys.path.insert(0, path_to_parent) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
40 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
41 |
import pkg5unittest |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
42 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
43 |
import pkg.catalog as catalog |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
44 |
import pkg.flavor.elf as elf |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
45 |
import pkg.fmri as fmri |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
46 |
import pkg.portable as portable |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
47 |
import pkg.publish.dependencies as dependencies |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
48 |
import pkg.updatelog as updatelog |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
49 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
50 |
class TestDependencyAnalyzer(pkg5unittest.Pkg5TestCase): |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
51 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
52 |
paths = { |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
53 |
"authlog_path": "var/log/authlog", |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
54 |
"curses_path": "usr/xpg4/lib/libcurses.so.1", |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
55 |
"indexer_path": |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
56 |
"usr/lib/python2.6/vendor-packages/pkg_test/client/indexer.py", |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
57 |
"ksh_path": "usr/bin/ksh", |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
58 |
"libc_path": "lib/libc.so.1", |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
59 |
"pkg_path": |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
60 |
"usr/lib/python2.6/vendor-packages/pkg_test/client/__init__.py", |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
61 |
"script_path": "lib/svc/method/svc-pkg-depot", |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
62 |
"syslog_path": "var/log/syslog" |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
63 |
} |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
64 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
65 |
ext_hardlink_manf = """ \ |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
66 |
hardlink path=usr/foo target=../%(syslog_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
67 |
hardlink path=usr/bar target=../%(syslog_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
68 |
hardlink path=baz target=%(authlog_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
69 |
""" % paths |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
70 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
71 |
int_hardlink_manf = """ \ |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
72 |
hardlink path=usr/foo target=../%(syslog_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
73 |
file NOHASH group=sys mode=0644 owner=root path=%(syslog_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
74 |
""" % paths |
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 |
int_hardlink_manf_test_symlink = """ \ |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
77 |
hardlink path=usr/foo target=../%(syslog_path)s |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
78 |
file NOHASH group=sys mode=0644 owner=root path=bar/syslog |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
79 |
""" % paths |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
80 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
81 |
ext_script_manf = """ \ |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
82 |
file NOHASH group=bin mode=0755 owner=root path=%(script_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
83 |
""" % paths |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
84 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
85 |
int_script_manf = """ \ |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
86 |
file NOHASH group=bin mode=0755 owner=root path=%(script_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
87 |
file NOHASH group=bin mode=0755 owner=root path=%(ksh_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
88 |
""" % paths |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
89 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
90 |
ext_elf_manf = """ \ |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
91 |
file NOHASH group=bin mode=0755 owner=root path=%(curses_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
92 |
""" % paths |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
93 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
94 |
int_elf_manf = """ \ |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
95 |
file NOHASH group=bin mode=0755 owner=root path=%(libc_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
96 |
file NOHASH group=bin mode=0755 owner=root path=%(curses_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
97 |
""" % paths |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
98 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
99 |
ext_python_manf = """ \ |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
100 |
file NOHASH group=bin mode=0755 owner=root path=%(indexer_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
101 |
""" % paths |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
102 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
103 |
ext_python_pkg_manf = """ \ |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
104 |
file NOHASH group=bin mode=0755 owner=root path=%(pkg_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
105 |
""" % paths |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
106 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
107 |
variant_manf_1 = """ \ |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
108 |
set name=variant.arch value=foo value=bar value=baz |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
109 |
file NOHASH group=bin mode=0755 owner=root path=%(script_path)s |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
110 |
file NOHASH group=bin mode=0755 owner=root path=%(ksh_path)s variant.arch=foo |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
111 |
""" % paths |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
112 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
113 |
variant_manf_2 = """ \ |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
114 |
set name=variant.arch value=foo value=bar value=baz |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
115 |
file NOHASH group=bin mode=0755 owner=root path=%(script_path)s variant.arch=foo |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
116 |
file NOHASH group=bin mode=0755 owner=root path=%(ksh_path)s variant.arch=foo |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
117 |
""" % paths |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
118 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
119 |
variant_manf_3 = """ \ |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
120 |
set name=variant.arch value=foo value=bar value=baz |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
121 |
file NOHASH group=bin mode=0755 owner=root path=%(script_path)s variant.arch=bar |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
122 |
file NOHASH group=bin mode=0755 owner=root path=%(ksh_path)s variant.arch=foo |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
123 |
""" % paths |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
124 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
125 |
python_abs_text = """\ |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
126 |
#!/usr/bin/python |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
127 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
128 |
from __future__ import absolute_import |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
129 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
130 |
import os |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
131 |
import sys |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
132 |
import pkg_test.indexer_test.foobar as indexer |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
133 |
import pkg.search_storage as ss |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
134 |
from ..misc_test import EmptyI |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
135 |
""" |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
136 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
137 |
python_text = """\ |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
138 |
#!/usr/bin/python |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
139 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
140 |
import os |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
141 |
import sys |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
142 |
import pkg_test.indexer_test.foobar as indexer |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
143 |
import pkg.search_storage as ss |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
144 |
from pkg_test.misc_test import EmptyI |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
145 |
""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
146 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
147 |
script_text = "#!/usr/bin/ksh -p\n" |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
148 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
149 |
def setUp(self): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
150 |
pkg5unittest.Pkg5TestCase.setUp(self) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
151 |
self.image_dir = None |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
152 |
self.pid = os.getpid() |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
153 |
self.pwd = os.getcwd() |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
154 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
155 |
self.__test_prefix = os.path.join(tempfile.gettempdir(), |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
156 |
"ips.test.%d" % self.pid) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
157 |
self.proto_dir = os.path.join(self.__test_prefix, "proto") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
158 |
self.manf_dir = os.path.join(self.__test_prefix, "manfs") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
159 |
os.makedirs(self.proto_dir) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
160 |
os.makedirs(self.manf_dir) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
161 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
162 |
def tearDown(self): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
163 |
pkg5unittest.Pkg5TestCase.tearDown(self) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
164 |
shutil.rmtree(self.__test_prefix) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
165 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
166 |
def make_python_test_files(self, py_version): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
167 |
pdir = "usr/lib/python%s/vendor-packages" % py_version |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
168 |
for p in ["pkg_test/indexer_test/foobar", |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
169 |
"pkg_test/search_storage_test", "pkg_test/misc_test"]: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
170 |
self.make_text_file("%s/%s.py" % (pdir, p)) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
171 |
self.make_text_file("%s/pkg_test/__init__.py" % pdir, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
172 |
"#!/usr/bin/python\n") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
173 |
self.make_text_file("%s/pkg_test/indexer_test/__init__.py" % |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
174 |
pdir, "#!/usr/bin/python") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
175 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
176 |
def make_manifest(self, str): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
177 |
t_fd, t_path = tempfile.mkstemp(dir=self.manf_dir) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
178 |
t_fh = os.fdopen(t_fd, "w") |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
179 |
t_fh.write(str) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
180 |
t_fh.close() |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
181 |
return t_path |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
182 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
183 |
def make_text_file(self, o_path, o_text=""): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
184 |
f_path = os.path.join(self.proto_dir, o_path) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
185 |
f_dir = os.path.dirname(f_path) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
186 |
if not os.path.exists(f_dir): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
187 |
os.makedirs(f_dir) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
188 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
189 |
fh = open(f_path, "w") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
190 |
fh.write(o_text) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
191 |
fh.close() |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
192 |
return f_path |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
193 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
194 |
def make_elf(self, final_path, static=False): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
195 |
t_fd, t_path = tempfile.mkstemp(suffix=".c", dir=self.proto_dir) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
196 |
out_file = os.path.join(self.proto_dir, final_path) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
197 |
out_dir = os.path.dirname(out_file) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
198 |
if not os.path.exists(out_dir): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
199 |
os.makedirs(out_dir) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
200 |
t_fh = os.fdopen(t_fd, "w") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
201 |
t_fh.write("int main(){}\n") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
202 |
t_fh.close() |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
203 |
cmd = ["/usr/bin/cc", "-o", out_file] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
204 |
if static: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
205 |
cmd.append("-static") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
206 |
cmd.append(t_path) |
1662
f0ba72befa72
13791 NameError when compile fails
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
207 |
s = subprocess.Popen(cmd, stderr=subprocess.PIPE) |
f0ba72befa72
13791 NameError when compile fails
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
208 |
out, err = s.communicate() |
f0ba72befa72
13791 NameError when compile fails
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
209 |
rc = s.returncode |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
210 |
if rc != 0: |
1662
f0ba72befa72
13791 NameError when compile fails
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
211 |
raise RuntimeError("Compile of %s failed.\nCommand " |
f0ba72befa72
13791 NameError when compile fails
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
212 |
"was:\n%s\nError was:\n%s" % |
f0ba72befa72
13791 NameError when compile fails
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
213 |
(t_path, " ".join(cmd), err)) |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
214 |
return out_file |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
215 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
216 |
def __path_to_key(self, path): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
217 |
if path == self.paths["libc_path"]: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
218 |
return ((os.path.basename(path),), tuple([ |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
219 |
p.lstrip("/") for p in elf.default_run_paths |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
220 |
])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
221 |
return ((os.path.basename(path),), (os.path.dirname(path),)) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
222 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
223 |
def test_ext_hardlink(self): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
224 |
"""Check that a hardlink with a target outside the package is |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
225 |
reported as a dependency.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
226 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
227 |
def _check_results(res): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
228 |
ds, es, ms = res |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
229 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
230 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
231 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
232 |
self.assertEqual(ms, {}) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
233 |
self.assert_(len(ds) == 3) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
234 |
ans = set(["usr/foo", "usr/bar"]) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
235 |
for d in ds: |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
236 |
self.assert_(d.dep_vars.is_satisfied()) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
237 |
self.assert_(d.is_error()) |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
238 |
if d.dep_key() == self.__path_to_key( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
239 |
self.paths["syslog_path"]): |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
240 |
self.assert_( |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
241 |
d.action.attrs["path"] in ans) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
242 |
ans.remove(d.action.attrs["path"]) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
243 |
else: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
244 |
self.assertEqual(d.dep_key(), |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
245 |
self.__path_to_key( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
246 |
self.paths["authlog_path"])) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
247 |
self.assertEqual( |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
248 |
d.action.attrs["path"], "baz") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
249 |
t_path = self.make_manifest(self.ext_hardlink_manf) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
250 |
_check_results(dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
251 |
self.proto_dir, {}, [])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
252 |
_check_results(dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
253 |
self.proto_dir, {}, [], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
254 |
remove_internal_deps=False)) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
255 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
256 |
def test_int_hardlink(self): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
257 |
"""Check that a hardlink with a target inside the package is |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
258 |
not reported as a dependency, unless the flag to show internal |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
259 |
dependencies is set.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
260 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
261 |
t_path = self.make_manifest(self.int_hardlink_manf) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
262 |
self.make_text_file(self.paths["syslog_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
263 |
ds, es, ms = \ |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
264 |
dependencies.list_implicit_deps(t_path, self.proto_dir, {}, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
265 |
[]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
266 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
267 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
268 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
269 |
self.assert_(len(ms) == 1) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
270 |
self.assert_(len(ds) == 0) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
271 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
272 |
# Check that internal dependencies are as expected. |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
273 |
ds, es, ms = dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
274 |
self.proto_dir, {}, [], remove_internal_deps=False) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
275 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
276 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
277 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
278 |
self.assertEqual(len(ms), 1) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
279 |
self.assertEqual(len(ds), 1) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
280 |
d = ds[0] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
281 |
self.assert_(d.dep_vars.is_satisfied()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
282 |
self.assert_(d.is_error()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
283 |
self.assertEqual(d.dep_key(), self.__path_to_key( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
284 |
self.paths["syslog_path"])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
285 |
self.assertEqual(d.action.attrs["path"], "usr/foo") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
286 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
287 |
def test_ext_script(self): |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
288 |
"""Check that a file that starts with #! and references a file |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
289 |
outside its package is reported as a dependency.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
290 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
291 |
def _check_res(res): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
292 |
ds, es, ms = res |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
293 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
294 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
295 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
296 |
self.assertEqual(ms, {}) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
297 |
self.assert_(len(ds) == 1) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
298 |
d = ds[0] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
299 |
self.assert_(d.is_error()) |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
300 |
self.assert_(d.dep_vars.is_satisfied()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
301 |
self.assertEqual(d.dep_key(), |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
302 |
self.__path_to_key(self.paths["ksh_path"])) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
303 |
self.assertEqual(d.action.attrs["path"], |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
304 |
self.paths["script_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
305 |
t_path = self.make_manifest(self.ext_script_manf) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
306 |
self.make_text_file(self.paths["script_path"], self.script_text) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
307 |
_check_res(dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
308 |
self.proto_dir, {}, [])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
309 |
_check_res(dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
310 |
self.proto_dir, {}, [], remove_internal_deps=False)) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
311 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
312 |
def test_int_script(self): |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
313 |
"""Check that a file that starts with #! and references a file |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
314 |
inside its package is not reported as a dependency unless |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
315 |
the flag to show internal dependencies is set.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
316 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
317 |
t_path = self.make_manifest(self.int_script_manf) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
318 |
self.make_elf(self.paths["ksh_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
319 |
self.make_text_file(self.paths["script_path"], self.script_text) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
320 |
ds, es, ms = dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
321 |
self.proto_dir, {}, []) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
322 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
323 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
324 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
325 |
self.assertEqual(ms, {}) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
326 |
self.assert_(len(ds) == 1) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
327 |
d = ds[0] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
328 |
self.assert_(d.is_error()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
329 |
self.assert_(d.dep_vars.is_satisfied()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
330 |
self.assertEqual(d.base_names[0], "libc.so.1") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
331 |
self.assertEqual(set(d.run_paths), set(["lib", |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
332 |
"usr/lib"])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
333 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
334 |
# Check that internal dependencies are as expected. |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
335 |
ds, es, ms = dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
336 |
self.proto_dir, {}, [], remove_internal_deps=False) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
337 |
self.assertEqual(len(ds), 2) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
338 |
for d in ds: |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
339 |
self.assert_(d.is_error()) |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
340 |
self.assert_(d.dep_vars.is_satisfied()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
341 |
if d.dep_key() == self.__path_to_key( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
342 |
self.paths["ksh_path"]): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
343 |
self.assertEqual(d.action.attrs["path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
344 |
self.paths["script_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
345 |
elif d.dep_key() == self.__path_to_key( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
346 |
self.paths["libc_path"]): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
347 |
self.assertEqual(d.action.attrs["path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
348 |
self.paths["ksh_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
349 |
else: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
350 |
raise RuntimeError("Unexpected " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
351 |
"dependency path:%s" % d) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
352 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
353 |
def test_ext_elf(self): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
354 |
"""Check that an elf file that requires a library outside its |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
355 |
package is reported as a dependency.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
356 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
357 |
def _check_res(res): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
358 |
ds, es, ms = res |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
359 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
360 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
361 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
362 |
self.assertEqual(ms, {}) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
363 |
self.assert_(len(ds) == 1) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
364 |
d = ds[0] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
365 |
self.assert_(d.is_error()) |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
366 |
self.assert_(d.dep_vars.is_satisfied()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
367 |
self.assertEqual(d.base_names[0], "libc.so.1") |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
368 |
self.assertEqual(set(d.run_paths), |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
369 |
set(["lib", "usr/lib"])) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
370 |
self.assertEqual(d.dep_key(), |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
371 |
self.__path_to_key(self.paths["libc_path"])) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
372 |
self.assertEqual( |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
373 |
d.action.attrs["path"], |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
374 |
self.paths["curses_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
375 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
376 |
t_path = self.make_manifest(self.ext_elf_manf) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
377 |
self.make_elf(self.paths["curses_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
378 |
_check_res(dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
379 |
self.proto_dir, {}, [])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
380 |
_check_res(dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
381 |
self.proto_dir, {}, [], remove_internal_deps=False)) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
382 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
383 |
def test_int_elf(self): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
384 |
"""Check that an elf file that requires a library inside its |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
385 |
package is not reported as a dependency unless the flag to show |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
386 |
internal dependencies is set.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
387 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
388 |
def _check_all_res(res): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
389 |
ds, es, ms = res |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
390 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
391 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
392 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
393 |
self.assertEqual(ms, {}) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
394 |
self.assert_(len(ds) == 1) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
395 |
d = ds[0] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
396 |
self.assert_(d.is_error()) |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
397 |
self.assert_(d.dep_vars.is_satisfied()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
398 |
self.assertEqual(d.base_names[0], "libc.so.1") |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
399 |
self.assertEqual(set(d.run_paths), |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
400 |
set(["lib", "usr/lib"])) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
401 |
self.assertEqual(d.dep_key(), |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
402 |
self.__path_to_key(self.paths["libc_path"])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
403 |
self.assertEqual(d.action.attrs["path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
404 |
self.paths["curses_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
405 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
406 |
t_path = self.make_manifest(self.int_elf_manf) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
407 |
self.make_elf(self.paths["curses_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
408 |
self.make_elf(self.paths["libc_path"], static=True) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
409 |
d_map, es, ms = dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
410 |
self.proto_dir, {}, []) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
411 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
412 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
413 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
414 |
self.assertEqual(ms, {}) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
415 |
self.assert_(len(d_map) == 0) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
416 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
417 |
# Check that internal dependencies are as expected. |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
418 |
_check_all_res(dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
419 |
self.proto_dir, {}, [], remove_internal_deps=False)) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
420 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
421 |
def test_ext_python_dep(self): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
422 |
"""Check that a python file that imports a module outside its |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
423 |
package is reported as a dependency.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
424 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
425 |
def _check_all_res(res): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
426 |
ds, es, ms = res |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
427 |
mod_suffs = ["/__init__.py", ".py", ".pyc", ".pyo"] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
428 |
mod_names = ["foobar", "misc_test", "os", |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
429 |
"search_storage"] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
430 |
pkg_names = ["indexer_test", "pkg", "pkg_test"] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
431 |
expected_deps = set([("python",)] + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
432 |
[tuple(sorted([ |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
433 |
"%s%s" % (n,s) for s in mod_suffs |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
434 |
])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
435 |
for n in mod_names] + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
436 |
[("%s/__init__.py" % n,) for n in pkg_names]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
437 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
438 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
439 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
440 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
441 |
self.assertEqual(ms, {}) |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
442 |
for d in ds: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
443 |
self.assert_(d.is_error()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
444 |
if d.dep_vars is None: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
445 |
raise RuntimeError("This dep had " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
446 |
"depvars of None:%s" % d) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
447 |
self.assert_(d.dep_vars.is_satisfied()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
448 |
if not d.dep_key()[0] in expected_deps: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
449 |
raise RuntimeError("Got this " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
450 |
"unexpected dep:%s\n\nd:%s" % |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
451 |
(d.dep_key()[0], d)) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
452 |
expected_deps.remove(d.dep_key()[0]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
453 |
self.assertEqual(d.action.attrs["path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
454 |
self.paths["indexer_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
455 |
if expected_deps: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
456 |
raise RuntimeError("Couldn't find these " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
457 |
"dependencies:\n" + "\n".join( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
458 |
[str(s) for s in sorted(expected_deps)])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
459 |
self.__debug = True |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
460 |
t_path = self.make_manifest(self.ext_python_manf) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
461 |
self.make_python_test_files(2.6) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
462 |
self.make_text_file(self.paths["indexer_path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
463 |
self.python_text) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
464 |
_check_all_res(dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
465 |
self.proto_dir, {}, [])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
466 |
_check_all_res(dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
467 |
self.proto_dir, {}, [], remove_internal_deps=False)) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
468 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
469 |
def test_ext_python_abs_import_dep(self): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
470 |
"""Check that a python file that uses absolute imports a module |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
471 |
is handled correctly.""" |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
472 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
473 |
def _check_all_res(res): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
474 |
ds, es, ms = res |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
475 |
mod_suffs = ["/__init__.py", ".py", ".pyc", ".pyo"] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
476 |
mod_names = ["foobar", "os", "search_storage"] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
477 |
pkg_names = ["indexer_test", "pkg", "pkg_test"] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
478 |
expected_deps = set([("python",)] + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
479 |
[tuple(sorted([ |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
480 |
"%s%s" % (n,s) for s in mod_suffs |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
481 |
])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
482 |
for n in mod_names] + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
483 |
[("%s/__init__.py" % n,) for n in pkg_names]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
484 |
if len(es) != 1: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
485 |
raise RuntimeError("Expected exactly 1 error, " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
486 |
"got:%\n" + "\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
487 |
if es[0].name != "misc_test": |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
488 |
raise RuntimeError("Didn't get the expected " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
489 |
"error. Error found was:%s" % es[0]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
490 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
491 |
self.assertEqual(ms, {}) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
492 |
for d in ds: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
493 |
self.assert_(d.is_error()) |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
494 |
if d.dep_vars is None: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
495 |
raise RuntimeError("This dep had " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
496 |
"depvars of None:%s" % d) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
497 |
self.assert_(d.dep_vars.is_satisfied()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
498 |
if not d.dep_key()[0] in expected_deps: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
499 |
raise RuntimeError("Got this " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
500 |
"unexpected dep:%s\n\nd:%s" % |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
501 |
(d.dep_key()[0], d)) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
502 |
expected_deps.remove(d.dep_key()[0]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
503 |
self.assertEqual(d.action.attrs["path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
504 |
self.paths["indexer_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
505 |
if expected_deps: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
506 |
raise RuntimeError("Couldn't find these " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
507 |
"dependencies:\n" + "\n".join( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
508 |
[str(s) for s in sorted(expected_deps)])) |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1231
diff
changeset
|
509 |
self.__debug = True |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
510 |
t_path = self.make_manifest(self.ext_python_manf) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
511 |
self.make_python_test_files(2.6) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
512 |
# Check that absolute imports still work. |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
513 |
self.make_text_file(self.paths["indexer_path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
514 |
self.python_abs_text) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
515 |
_check_all_res(dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
516 |
self.proto_dir, {}, [])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
517 |
_check_all_res(dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
518 |
self.proto_dir, {}, [], remove_internal_deps=False)) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
519 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
520 |
def test_ext_python_pkg_dep(self): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
521 |
"""Check that a python file that is the __init__.py file for a |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
522 |
package is handled correctly.""" |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
523 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
524 |
def _check_all_res(res): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
525 |
ds, es, ms = res |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
526 |
mod_suffs = ["/__init__.py", ".py", ".pyc", ".pyo"] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
527 |
mod_names = ["foobar", "misc_test", "os", |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
528 |
"search_storage"] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
529 |
pkg_names = ["indexer_test", "pkg", "pkg_test"] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
530 |
expected_deps = set([("python",)] + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
531 |
[tuple(sorted([ |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
532 |
"%s%s" % (n,s) for s in mod_suffs |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
533 |
])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
534 |
for n in mod_names] + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
535 |
[("%s/__init__.py" % n,) for n in pkg_names]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
536 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
537 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
538 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
539 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
540 |
self.assertEqual(ms, {}) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
541 |
for d in ds: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
542 |
self.assert_(d.is_error()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
543 |
if d.dep_vars is None: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
544 |
raise RuntimeError("This dep had " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
545 |
"depvars of None:%s" % d) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
546 |
self.assert_(d.dep_vars.is_satisfied()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
547 |
if not d.dep_key()[0] in expected_deps: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
548 |
raise RuntimeError("Got this " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
549 |
"unexpected dep:%s\n\nd:%s" % |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
550 |
(d.dep_key()[0], d)) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
551 |
expected_deps.remove(d.dep_key()[0]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
552 |
self.assertEqual(d.action.attrs["path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
553 |
self.paths["pkg_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
554 |
if expected_deps: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
555 |
raise RuntimeError("Couldn't find these " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
556 |
"dependencies:\n" + "\n".join( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
557 |
[str(s) for s in sorted(expected_deps)])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
558 |
self.__debug = True |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
559 |
t_path = self.make_manifest(self.ext_python_pkg_manf) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
560 |
self.make_python_test_files(2.6) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
561 |
self.make_text_file(self.paths["pkg_path"], self.python_text) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
562 |
_check_all_res(dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
563 |
self.proto_dir, {}, [])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
564 |
_check_all_res(dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
565 |
self.proto_dir, {}, [], remove_internal_deps=False)) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
566 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
567 |
def test_variants_1(self): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
568 |
"""Test that a file which satisfies a dependency only under a |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
569 |
certain set of variants results in the dependency being reported |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
570 |
for the other set of variants.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
571 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
572 |
t_path = self.make_manifest(self.variant_manf_1) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
573 |
self.make_text_file(self.paths["script_path"], self.script_text) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
574 |
self.make_elf(self.paths["ksh_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
575 |
ds, es, ms = dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
576 |
self.proto_dir, {}, []) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
577 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
578 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
579 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
580 |
self.assertEqual(ms, {}) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
581 |
self.assert_(len(ds) == 2) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
582 |
for d in ds: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
583 |
self.assert_(d.is_error()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
584 |
if d.dep_key() == self.__path_to_key( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
585 |
self.paths["ksh_path"]): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
586 |
self.assertEqual(d.action.attrs["path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
587 |
self.paths["script_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
588 |
self.assertEqual(len(d.dep_vars), 1) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
589 |
self.assert_("variant.arch" in d.dep_vars) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
590 |
expected_vars = set([("bar",), ("baz",)]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
591 |
for v in d.dep_vars.not_sat_set: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
592 |
if v not in expected_vars: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
593 |
raise RuntimeError("Variant %s " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
594 |
"was not in %s" % |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
595 |
(v, expected_vars)) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
596 |
expected_vars.remove(v) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
597 |
self.assertEqual(expected_vars, set()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
598 |
elif d.dep_key() == self.__path_to_key( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
599 |
self.paths["libc_path"]): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
600 |
self.assertEqual( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
601 |
d.action.attrs["path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
602 |
self.paths["ksh_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
603 |
self.assertEqual( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
604 |
set(d.dep_vars["variant.arch"]), |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
605 |
set(["foo"])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
606 |
else: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
607 |
raise RuntimeError("Unexpected " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
608 |
"dependency path:%s" % (d.dep_key(),)) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
609 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
610 |
def test_variants_2(self): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
611 |
"""Test that when the variants of the action with the dependency |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
612 |
and the action satisfying the dependency share the same |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
613 |
dependency, an external dependency is not reported.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
614 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
615 |
t_path = self.make_manifest(self.variant_manf_2) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
616 |
self.make_text_file(self.paths["script_path"], self.script_text) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
617 |
self.make_elf(self.paths["ksh_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
618 |
ds, es, ms = dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
619 |
self.proto_dir, {}, []) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
620 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
621 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
622 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
623 |
self.assertEqual(ms, {}) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
624 |
self.assert_(len(ds) == 1) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
625 |
d = ds[0] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
626 |
self.assert_(d.is_error()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
627 |
self.assertEqual(set(d.dep_vars.keys()), set(["variant.arch"])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
628 |
self.assertEqual(set(d.dep_vars["variant.arch"]), set(["foo"])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
629 |
self.assertEqual(d.base_names[0], "libc.so.1") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
630 |
self.assertEqual(set(d.run_paths), set(["lib", "usr/lib"])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
631 |
|
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
632 |
# Check that internal dependencies are as expected. |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
633 |
ds, es, ms = dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
634 |
self.proto_dir, {}, [], remove_internal_deps=False) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
635 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
636 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
637 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
638 |
self.assertEqual(ms, {}) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
639 |
self.assert_(len(ds) == 2) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
640 |
for d in ds: |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
641 |
self.assert_(d.is_error()) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
642 |
self.assertEqual(set(d.dep_vars.keys()), |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
643 |
set(["variant.arch"])) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
644 |
self.assertEqual(set(d.dep_vars["variant.arch"]), |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
645 |
set(["foo"])) |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
646 |
if d.dep_key() == self.__path_to_key( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
647 |
self.paths["ksh_path"]): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
648 |
self.assertEqual(d.action.attrs["path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
649 |
self.paths["script_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
650 |
elif d.dep_key() == self.__path_to_key( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
651 |
self.paths["libc_path"]): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
652 |
self.assertEqual(d.action.attrs["path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
653 |
self.paths["ksh_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
654 |
else: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
655 |
raise RuntimeError( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
656 |
"Unexpected dependency path:%s" % |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
657 |
(d.dep_key(),)) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
658 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
659 |
def test_variants_3(self): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
660 |
"""Test that when the action with the dependency is tagged with |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
661 |
a different variant than the action which could satisfy it, it's |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
662 |
reported as an external dependency.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
663 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
664 |
t_path = self.make_manifest(self.variant_manf_3) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
665 |
self.make_text_file(self.paths["script_path"], self.script_text) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
666 |
self.make_elf(self.paths["ksh_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
667 |
ds, es, ms = dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
668 |
self.proto_dir, {}, []) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
669 |
if es != []: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
670 |
raise RuntimeError("Got errors in results:" + |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
671 |
"\n".join([str(s) for s in es])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
672 |
self.assertEqual(ms, {}) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
673 |
self.assert_(len(ds) == 2) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
674 |
for d in ds: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
675 |
self.assert_(d.is_error()) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
676 |
if d.dep_key() == self.__path_to_key( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
677 |
self.paths["ksh_path"]): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
678 |
self.assertEqual(d.action.attrs["path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
679 |
self.paths["script_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
680 |
self.assertEqual(set(d.dep_vars.keys()), |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
681 |
set(["variant.arch"])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
682 |
self.assertEqual( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
683 |
set(d.dep_vars["variant.arch"]), |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
684 |
set(["bar"])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
685 |
elif d.dep_key() == self.__path_to_key( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
686 |
self.paths["libc_path"]): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
687 |
self.assertEqual(d.action.attrs["path"], |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
688 |
self.paths["ksh_path"]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
689 |
self.assertEqual(set(d.dep_vars.keys()), |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
690 |
set(["variant.arch"])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
691 |
self.assertEqual( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
692 |
set(d.dep_vars["variant.arch"]), |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
693 |
set(["foo"])) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
694 |
else: |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
695 |
raise RuntimeError("Unexpected " |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
696 |
"dependency path:%s" % (d.dep_key(),)) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
697 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
698 |
def test_symlinks(self): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
699 |
"""Test that a file is recognized as delivered when a symlink |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
700 |
is involved.""" |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
701 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
702 |
usr_path = os.path.join(self.proto_dir, "usr") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
703 |
hardlink_path = os.path.join(usr_path, "foo") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
704 |
bar_path = os.path.join(self.proto_dir, "bar") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
705 |
file_path = os.path.join(bar_path, "syslog") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
706 |
var_path = os.path.join(self.proto_dir, "var") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
707 |
symlink_loc = os.path.join(var_path, "log") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
708 |
hardlink_target = os.path.join(usr_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
709 |
"../var/log/syslog") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
710 |
os.mkdir(usr_path) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
711 |
os.mkdir(bar_path) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
712 |
os.mkdir(var_path) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
713 |
fh = open(file_path, "w") |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
714 |
fh.close() |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
715 |
os.symlink(bar_path, symlink_loc) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
716 |
os.link(hardlink_target, hardlink_path) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
717 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
718 |
t_path = self.make_manifest( |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
719 |
self.int_hardlink_manf_test_symlink) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
720 |
ds, es, ms = dependencies.list_implicit_deps(t_path, |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
721 |
self.proto_dir, {}, []) |