author | Mingrui Lyu <mingrui.lyu@oracle.com> |
Thu, 08 Dec 2016 11:57:19 -0800 | |
changeset 3476 | cc1b291b79d2 |
parent 3391 | ab089cdd0665 |
child 3529 | ec88266d269c |
permissions | -rw-r--r-- |
1516
8c950a3b4171
10485 move pkg(5) to Python 2.6
Rich Burridge <rich.burridge@sun.com>
parents:
1500
diff
changeset
|
1 |
#!/usr/bin/python |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
2 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
3 |
# CDDL HEADER START |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
4 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
5 |
# The contents of this file are subject to the terms of the |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
6 |
# Common Development and Distribution License (the "License"). |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
7 |
# You may not use this file except in compliance with the License. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
8 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
9 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
10 |
# or http://www.opensolaris.org/os/licensing. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
11 |
# See the License for the specific language governing permissions |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
12 |
# and limitations under the License. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
13 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
14 |
# When distributing Covered Code, include this CDDL HEADER in each |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
15 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
16 |
# If applicable, add the following below this CDDL HEADER, with the |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
17 |
# fields enclosed by brackets "[]" replaced with your own identifying |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
18 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
19 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
20 |
# CDDL HEADER END |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
21 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
22 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
23 |
# |
3339
c88573eb98ea
22642620 pkg should deliver python 3.4 versions of modules
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3265
diff
changeset
|
24 |
# Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved. |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
25 |
# |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
26 |
|
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
27 |
import copy |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
28 |
import itertools |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
29 |
import operator |
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 |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
31 |
import re |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3171
diff
changeset
|
32 |
import six |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
33 |
|
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
34 |
from collections import namedtuple |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3171
diff
changeset
|
35 |
from six.moves.urllib.parse import unquote |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
36 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
37 |
import pkg.actions as actions |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
38 |
import pkg.client.api as api |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
39 |
import pkg.client.api_errors as apx |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
40 |
import pkg.flavor.base as base |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
41 |
import pkg.flavor.elf as elf_dep |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
42 |
import pkg.flavor.hardlink as hardlink |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
43 |
import pkg.flavor.script as script |
1933
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
44 |
import pkg.flavor.smf_manifest as smf_manifest |
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 |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
46 |
import pkg.manifest as manifest |
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
47 |
import pkg.misc as misc |
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.portable as portable |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
49 |
import pkg.variant as variants |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
50 |
|
3366
9b60d67a2fa8
PSARC/2016/291 Image Packaging System group-any dependency type
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
3356
diff
changeset
|
51 |
from pkg.actions.depend import known_types as dep_types |
9b60d67a2fa8
PSARC/2016/291 Image Packaging System group-any dependency type
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
3356
diff
changeset
|
52 |
|
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
53 |
paths_prefix = "{0}.path".format(base.Dependency.DEPEND_DEBUG_PREFIX) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
54 |
files_prefix = "{0}.file".format(base.Dependency.DEPEND_DEBUG_PREFIX) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
55 |
reason_prefix = "{0}.reason".format(base.Dependency.DEPEND_DEBUG_PREFIX) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
56 |
type_prefix = "{0}.type".format(base.Dependency.DEPEND_DEBUG_PREFIX) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
57 |
target_prefix = "{0}.target".format(base.Dependency.DEPEND_DEBUG_PREFIX) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
58 |
bypassed_prefix = "{0}.bypassed".format(base.Dependency.DEPEND_DEBUG_PREFIX) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
59 |
via_links_prefix = "{0}.via-links".format(base.Dependency.DEPEND_DEBUG_PREFIX) |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
60 |
path_id_prefix = "{0}.path-id".format(base.Dependency.DEPEND_DEBUG_PREFIX) |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
61 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
62 |
# A tag used to hold the product of the paths_prefix and files_prefix |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
63 |
# contents, used when bypassing dependency generation |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
64 |
fullpaths_prefix = "{0}.fullpath".format(base.Dependency.DEPEND_DEBUG_PREFIX) |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
65 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
66 |
Entries = namedtuple("Entries", ["delivered", "installed"]) |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
67 |
# This namedtuple is used to hold two items. The first, delivered, is used to |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
68 |
# hold items which are part of packages being delivered. The second, installed, |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
69 |
# is used to hold items which are part of packages installed on the system. |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
70 |
|
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
71 |
LinkInfo = namedtuple("LinkInfo", ["path", "pfmri", "nearest_pfmri", |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
72 |
"variant_combination", "via_links"]) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
73 |
# This namedtuple is used to hold the information needed when resolving links. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
74 |
# The 'path' is the path of the file that ultimately resolved the link. The |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
75 |
# 'pfmri' is the package fmri that delivered 'path.' The 'nearest_pfmri' is the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
76 |
# package that delivered the next element in the link chain. The |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
77 |
# 'variant-combination' is the combination of variants under which the link is |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
78 |
# satisfied. 'via-links' contains the links used to reach 'path.' |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
79 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
80 |
class DependencyError(Exception): |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
81 |
"""The parent class for all dependency exceptions.""" |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
82 |
pass |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
83 |
|
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
84 |
class DropPackageWarning(DependencyError): |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
85 |
"""This exception is used when a package is dropped as it cannot |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
86 |
satisfy all dependencies.""" |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
87 |
|
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
88 |
def __init__(self, pkgs, dep): |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
89 |
self.pkgs = pkgs |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
90 |
self.dep = dep |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
91 |
|
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
92 |
def __str__(self): |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
93 |
pkg_str = ", ".join(f.get_pkg_stem() for f in self.pkgs) |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
94 |
return _("WARNING: package {0} was ignored as it cannot " |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
95 |
"satisfy all dependencies:\n{1}\n").format(pkg_str, |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
96 |
prune_debug_attrs(self.dep)) |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
97 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
98 |
class UnresolvedDependencyError(DependencyError): |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
99 |
"""This exception is used when no package delivers a file which is |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
100 |
depended upon.""" |
1845
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
101 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
102 |
def __init__(self, pth, file_dep, pvars): |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
103 |
self.path = pth |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
104 |
self.file_dep = file_dep |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
105 |
self.pvars = pvars |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
106 |
|
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
107 |
def __str__(self): |
2528
d8f40e4e0ed6
18856 resolve errors need readability help for file dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2502
diff
changeset
|
108 |
dep_str = "\n" + self.file_dep.pretty_print() |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
109 |
if self.pvars.not_sat_set: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
110 |
return _("{pth} has unresolved dependency '{dep}' " |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
111 |
"under the following combinations of " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
112 |
"variants:\n{combo}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
113 |
pth=self.path, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
114 |
dep=dep_str + "\n", |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
115 |
combo="\n".join([ |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
116 |
" ".join([ |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
117 |
("{0}:{1}".format(name, val)) |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
118 |
for name, val in sorted(grp) |
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
119 |
]) |
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
120 |
for grp in self.pvars.not_sat_set |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
121 |
])) |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
122 |
else: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
123 |
return _("{pth} has unresolved dependency " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
124 |
"'{dep}'.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
125 |
pth=self.path, dep=dep_str) |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
126 |
|
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
127 |
|
3476
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
128 |
class UndeclaredVariantWarning(DependencyError): |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
129 |
"""This exception is used when an action is tagged with a variant or |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
130 |
variant value which the package is not tagged with.""" |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
131 |
|
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
132 |
def __init__(self, act_vars, pkg_vars, pth): |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
133 |
self.act_vars = act_vars |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
134 |
self.pkg_vars = pkg_vars |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
135 |
self.path = pth |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
136 |
|
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
137 |
def __str__(self): |
3476
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
138 |
return _("WARNING: The action delivering {path} is tagged with " |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
139 |
"a variant type or value not declared for the package; use " |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
140 |
"pkglint for details.\n" |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
141 |
"The action's variants are: {act}\nThe package's " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
142 |
"variants are: {pkg}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
143 |
path=self.path, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
144 |
act=self.act_vars, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
145 |
pkg=self.pkg_vars |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
146 |
) |
1845
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
147 |
|
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
148 |
|
2428
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
149 |
class BadPackageFmri(DependencyError): |
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
150 |
"""This exception is used when a manifest's fmri isn't a valid fmri.""" |
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
151 |
|
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
152 |
def __init__(self, path, e): |
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
153 |
self.path = path |
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
154 |
self.exc = e |
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
155 |
|
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
156 |
def __str__(self): |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
157 |
return _("The manifest '{path}' has an invalid package " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
158 |
"FMRI:\n\t{exc}").format(path=self.path, exc=self.exc) |
2428
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
159 |
|
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
160 |
|
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
161 |
class ExtraVariantedDependency(DependencyError): |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
162 |
"""This exception is used when one or more dependency actions have a |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
163 |
variant set on them which is not in the package's set of variants.""" |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
164 |
|
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
165 |
def __init__(self, pkg, reason_variants, manual_dep): |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
166 |
self.pkg = pkg |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
167 |
assert len(reason_variants) > 0 |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
168 |
self.rvs = reason_variants |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
169 |
self.manual = manual_dep |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
170 |
|
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
171 |
def __str__(self): |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
172 |
s = "" |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3171
diff
changeset
|
173 |
for r, diff in sorted(six.iteritems(self.rvs)): |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
174 |
for kind in diff.type_diffs: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
175 |
s += _("\t{r:15} Variant '{kind}' is not " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
176 |
"declared.\n").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
177 |
r=r, kind=kind) |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
178 |
for k, v in diff.value_diffs: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
179 |
s += _("\t{r:15} Variant '{kind}' is not " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
180 |
"declared to have value '{val}'.\n").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
181 |
r=r, val=v, kind=k) |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
182 |
if not self.manual: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
183 |
return _("The package '{pkg}' contains actions with " |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
184 |
"the\npaths seen below which have variants set on " |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
185 |
"them which are not set on the\npackage. These " |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
186 |
"variants must be set on the package or removed " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
187 |
"from the actions.\n\n{rvs}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
188 |
pkg=self.pkg, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
189 |
rvs=s |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
190 |
) |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
191 |
else: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
192 |
return _("The package '{pkg}' contains manually " |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
193 |
"specified dependencies\nwhich have variants set " |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
194 |
"on them which are not set on the package. " |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
195 |
"These\nvariants must be set on the package or " |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
196 |
"removed from the actions.\n\n{rvs}").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
197 |
pkg=self.pkg, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
198 |
rvs=s |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
199 |
) |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
200 |
|
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
201 |
class NeedConditionalRequireAny(DependencyError): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
202 |
"""This exception is used when pkgdepend would need a dependency which |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
203 |
was both require-any and conditional to properly represent the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
204 |
dependency.""" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
205 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
206 |
def __init__(self, conditionals, pkg_vars): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
207 |
self.conditionals = conditionals |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
208 |
self.pkg_vct = pkg_vars |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
209 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
210 |
def __str__(self): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
211 |
s = _("""\ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
212 |
pkgdepend has inferred conditional dependencies with different targets but |
3356
66ab3cc4794b
22813943 move man pages to new directories and update references
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3339
diff
changeset
|
213 |
which share a predicate. pkg(7) can not represent these dependencies. This |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
214 |
issue can be resolved by changing the packaging of the links which generated the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
215 |
conditional dependencies so that they have different predicates or share the |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3171
diff
changeset
|
216 |
same FMRI. Each pair of problematic conditional dependencies follows: |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
217 |
""") |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
218 |
for i, (d1, d2, v) in enumerate(self.conditionals): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
219 |
i += 1 |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
220 |
v.simplify(self.pkg_vct) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
221 |
if v.is_empty() or not v.sat_set: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
222 |
s += _("Pair {0}\n").format(i) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
223 |
else: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
224 |
s += _("Pair {0} is only problematic in the " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
225 |
"listed variant combinations:").format(i) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
226 |
s += "\n\t\t" + "\n\t\t".join([ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
227 |
" ".join([ |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
228 |
("{0}:{1}".format(name, val)) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
229 |
for name, val in sorted(grp) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
230 |
]) for grp in v.sat_set |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
231 |
]) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
232 |
s += "\n" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
233 |
s += d1.pretty_print() + "\n" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
234 |
s += d2.pretty_print() + "\n" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
235 |
return s |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
236 |
|
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
237 |
class __NotSubset(DependencyError): |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
238 |
def __init__(self, diff): |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
239 |
self.diff = variants.VCTDifference(tuple(diff.type_diffs), |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
240 |
tuple(diff.value_diffs)) |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
241 |
|
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
242 |
|
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
243 |
def list_implicit_deps(file_path, proto_dirs, dyn_tok_conv, run_paths, |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
244 |
remove_internal_deps=True, convert=True, ignore_bypass=False): |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
245 |
"""Given the manifest provided in file_path, use the known dependency |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
246 |
generators to produce a list of dependencies the files delivered by |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
247 |
the manifest have. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
248 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
249 |
'file_path' is the path to the manifest for the package. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
250 |
|
1908
4bdaf0463bae
15843 pkgdepend can't handle more than one proto area
Brock Pytlik <bpytlik@sun.com>
parents:
1887
diff
changeset
|
251 |
'proto_dirs' is a list of paths to proto areas which hold the files that |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
252 |
will be delivered by the package. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
253 |
|
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
254 |
'dyn_tok_conv' is the dictionary which maps the dynamic tokens, like |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
255 |
$PLATFORM, to the values they should be expanded to. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
256 |
|
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
257 |
'run_paths' contains the run paths that are used to find modules. |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
258 |
|
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
259 |
'convert' determines whether PublishingDependencies will be transformed |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
260 |
to DependencyActions prior to being returned. This is primarily an |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
261 |
option to facilitate testing and debugging. |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
262 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
263 |
'ignore_bypass' determines whether to bypass generation of dependencies |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
264 |
against certain files or directories. This is primarily an option to |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
265 |
facilitate testing and debugging. |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
266 |
""" |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
267 |
|
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
268 |
m, manifest_errs = __make_manifest(file_path, proto_dirs) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
269 |
pkg_vars = m.get_all_variants() |
3476
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
270 |
deps, elist, warnings, missing, pkg_attrs = \ |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
271 |
list_implicit_deps_for_manifest(m, proto_dirs, pkg_vars, |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
272 |
dyn_tok_conv, run_paths, ignore_bypass=ignore_bypass) |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
273 |
rid_errs = [] |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
274 |
if remove_internal_deps: |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
275 |
deps, rid_errs = resolve_internal_deps(deps, m, proto_dirs, |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
276 |
pkg_vars) |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
277 |
if convert: |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
278 |
deps = convert_to_standard_dep_actions(deps) |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
279 |
|
3476
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
280 |
return deps, manifest_errs + elist + rid_errs, warnings, missing, pkg_attrs |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
281 |
|
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
282 |
def convert_to_standard_dep_actions(deps): |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
283 |
"""Convert pkg.base.Dependency objects to |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
284 |
pkg.actions.dependency.Dependency objects.""" |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
285 |
|
2639
06a370373267
7145683 explore general pkg performance improvements
Shawn Walker <shawn.walker@oracle.com>
parents:
2601
diff
changeset
|
286 |
def norm_attrs(a): |
06a370373267
7145683 explore general pkg performance improvements
Shawn Walker <shawn.walker@oracle.com>
parents:
2601
diff
changeset
|
287 |
"""Normalize attribute values as lists instead of sets; only |
06a370373267
7145683 explore general pkg performance improvements
Shawn Walker <shawn.walker@oracle.com>
parents:
2601
diff
changeset
|
288 |
lists are permitted for multi-value action attributes.""" |
06a370373267
7145683 explore general pkg performance improvements
Shawn Walker <shawn.walker@oracle.com>
parents:
2601
diff
changeset
|
289 |
for k, v in a.items(): |
06a370373267
7145683 explore general pkg performance improvements
Shawn Walker <shawn.walker@oracle.com>
parents:
2601
diff
changeset
|
290 |
if isinstance(v, set): |
06a370373267
7145683 explore general pkg performance improvements
Shawn Walker <shawn.walker@oracle.com>
parents:
2601
diff
changeset
|
291 |
a[k] = list(v) |
06a370373267
7145683 explore general pkg performance improvements
Shawn Walker <shawn.walker@oracle.com>
parents:
2601
diff
changeset
|
292 |
|
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
293 |
res = [] |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
294 |
for d in deps: |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
295 |
tmp = [] |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
296 |
for c in d.dep_vars.not_sat_set: |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
297 |
attrs = d.attrs.copy() |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
298 |
attrs.update(c) |
2639
06a370373267
7145683 explore general pkg performance improvements
Shawn Walker <shawn.walker@oracle.com>
parents:
2601
diff
changeset
|
299 |
norm_attrs(attrs) |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
300 |
tmp.append(actions.depend.DependencyAction(**attrs)) |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
301 |
if not tmp: |
2639
06a370373267
7145683 explore general pkg performance improvements
Shawn Walker <shawn.walker@oracle.com>
parents:
2601
diff
changeset
|
302 |
attrs = d.attrs.copy() |
06a370373267
7145683 explore general pkg performance improvements
Shawn Walker <shawn.walker@oracle.com>
parents:
2601
diff
changeset
|
303 |
norm_attrs(attrs) |
06a370373267
7145683 explore general pkg performance improvements
Shawn Walker <shawn.walker@oracle.com>
parents:
2601
diff
changeset
|
304 |
tmp.append(actions.depend.DependencyAction(**attrs)) |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
305 |
res.extend(tmp) |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
306 |
return res |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
307 |
|
1908
4bdaf0463bae
15843 pkgdepend can't handle more than one proto area
Brock Pytlik <bpytlik@sun.com>
parents:
1887
diff
changeset
|
308 |
def resolve_internal_deps(deps, mfst, proto_dirs, pkg_vars): |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
309 |
"""Given a list of dependencies, remove those which are satisfied by |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
310 |
others delivered by the same package. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
311 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
312 |
'deps' is a list of Dependency objects. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
313 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
314 |
'mfst' is the Manifest of the package that delivered the dependencies |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
315 |
found in deps. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
316 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
317 |
'proto_dir' is the path to the proto area which holds the files that |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
318 |
will be delivered by the package. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
319 |
|
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
320 |
'pkg_vars' are the variants that this package was published against.""" |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
321 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
322 |
res = [] |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
323 |
errs = [] |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
324 |
delivered = {} |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
325 |
delivered_bn = {} |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
326 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
327 |
files = Entries({}, {}) |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
328 |
links = {} |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
329 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
330 |
# A fake pkg name is used because there is no requirement that a package |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
331 |
# name itself to generate its dependencies. Also, the name is entirely |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
332 |
# a private construction which should not escape to the user. |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
333 |
add_fmri_path_mapping(files.delivered, links, |
2476
25342deb3749
3262 symlink loops can cause operation traceback
Shawn Walker <shawn.walker@oracle.com>
parents:
2462
diff
changeset
|
334 |
fmri.PkgFmri("INTERNAL@0-0", "0"), mfst) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
335 |
for a in mfst.gen_actions_by_type("file"): |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
336 |
pvars = a.get_variant_template() |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
337 |
if not pvars: |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
338 |
pvars = pkg_vars |
3476
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
339 |
assert pvars.issubset(pkg_vars) |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
340 |
pvc = variants.VariantCombinations(pvars, satisfied=True) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
341 |
p = a.attrs["path"] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
342 |
bn = os.path.basename(p) |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
343 |
delivered_bn.setdefault(bn, copy.copy(pvc)) |
1845
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
344 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
345 |
for d in deps: |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
346 |
etype, pvars = d.resolve_internal( |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
347 |
delivered_files=files.delivered, |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
348 |
delivered_base_names=delivered_bn, links=links, |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
349 |
resolve_links=resolve_links) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
350 |
if etype is None: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
351 |
continue |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
352 |
pvars.simplify(pkg_vars) |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
353 |
d.dep_vars = pvars |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
354 |
res.append(d) |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
355 |
return res, errs |
1231
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 no_such_file(action, **kwargs): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
358 |
"""Function to handle dispatch of files not found on the system.""" |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
359 |
|
1933
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
360 |
return [], [base.MissingFile(action.attrs["path"])], {} |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
361 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
362 |
# Dictionary which maps codes from portable.get_file_type to the functions which |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
363 |
# find dependencies for those types of files. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
364 |
dispatch_dict = { |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
365 |
portable.ELF: elf_dep.process_elf_dependencies, |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
366 |
portable.EXEC: script.process_script_deps, |
1933
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
367 |
portable.SMF_MANIFEST: smf_manifest.process_smf_manifest_deps, |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
368 |
portable.UNFOUND: no_such_file |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
369 |
} |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
370 |
|
1908
4bdaf0463bae
15843 pkgdepend can't handle more than one proto area
Brock Pytlik <bpytlik@sun.com>
parents:
1887
diff
changeset
|
371 |
def list_implicit_deps_for_manifest(mfst, proto_dirs, pkg_vars, dyn_tok_conv, |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
372 |
run_paths, ignore_bypass=False): |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
373 |
"""For a manifest, produce the list of dependencies generated by the |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
374 |
files it installs. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
375 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
376 |
'mfst' is the Manifest of the package that delivered the dependencies |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
377 |
found in deps. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
378 |
|
1933
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
379 |
'proto_dirs' are the paths to the proto areas which hold the files that |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
380 |
will be delivered by the package. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
381 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
382 |
'pkg_vars' are the variants that this package was published against. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
383 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
384 |
'dyn_tok_conv' is the dictionary which maps the dynamic tokens, like |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
385 |
$PLATFORM, to the values they should be expanded to. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
386 |
|
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
387 |
'run_paths' contains the run paths used to find modules, this is |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
388 |
overridden by any manifest or action attributes setting |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
389 |
'pkg.depend.runpath' (portable.PD_RUN_PATH) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
390 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
391 |
'ignore_bypass' set to True will prevent us from looking up any |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
392 |
pkg.depend.bypass-generate attributes - this is primarily to aid |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
393 |
debugging and testing. |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
394 |
|
3476
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
395 |
Returns a tuple of four lists. |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
396 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
397 |
'deps' is a list of dependencies found for the given Manifest. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
398 |
|
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
399 |
'elist' is a list of errors encountered while finding dependencies. |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
400 |
|
3476
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
401 |
'warnings' is a list of warnings encountered while finding dependencies. |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
402 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
403 |
'missing' is a dictionary mapping a file type that isn't recognized by |
1933
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
404 |
portable.get_file_type to a file which produced that filetype. |
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
405 |
|
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
406 |
'pkg_attrs' is a dictionary containing metadata that was gathered |
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
407 |
during dependency analysis. Typically these would get turned into |
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
408 |
AttributeActions for that package. """ |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
409 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
410 |
deps = [] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
411 |
elist = [] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
412 |
missing = {} |
3476
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
413 |
warnings = [] |
1933
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
414 |
pkg_attrs = {} |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
415 |
act_list = list(mfst.gen_actions_by_type("file")) |
1908
4bdaf0463bae
15843 pkgdepend can't handle more than one proto area
Brock Pytlik <bpytlik@sun.com>
parents:
1887
diff
changeset
|
416 |
file_types = portable.get_file_type(act_list) |
3476
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
417 |
var_dict = dict() |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
418 |
|
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
419 |
# Collect all variants that are used and not declared and emit a warning |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
420 |
# for each of them. |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
421 |
for a in mfst.gen_actions(): |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
422 |
pvars = a.get_variant_template() |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
423 |
for k, v in six.iteritems(pvars): |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
424 |
if k not in pkg_vars or not v.issubset(pkg_vars[k]): |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
425 |
warnings.append(UndeclaredVariantWarning( |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
426 |
pvars, pkg_vars.copy(), a.attrs["path"])) |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
427 |
var_dict.setdefault(k, set()).update(v) |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
428 |
pkg_vars.merge_unknown(var_dict) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
429 |
|
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
430 |
if portable.PD_RUN_PATH in mfst: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
431 |
# check for multiple values in a set attribute |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
432 |
run_path_str = mfst[portable.PD_RUN_PATH] |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
433 |
es = __verify_run_path(run_path_str) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
434 |
if es: |
3476
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
435 |
return deps, elist + es, warnings, missing, pkg_attrs |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
436 |
run_paths = run_path_str.split(":") |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
437 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
438 |
mf_bypass = [] |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
439 |
if portable.PD_BYPASS_GENERATE in mfst: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
440 |
mf_bypass = __makelist(mfst[portable.PD_BYPASS_GENERATE]) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
441 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
442 |
for i, file_type in enumerate(file_types): |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
443 |
a = act_list[i] |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
444 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
445 |
a_run_paths = run_paths |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
446 |
if portable.PD_RUN_PATH in a.attrs: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
447 |
a_run_path_str = a.attrs[portable.PD_RUN_PATH] |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
448 |
es = __verify_run_path(a_run_path_str) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
449 |
if es: |
3476
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
450 |
return (deps, elist + es, warnings, missing, |
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
451 |
pkg_attrs) |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
452 |
a_run_paths = a_run_path_str.split(":") |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
453 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
454 |
bypass = __makelist( |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
455 |
a.attrs.get(portable.PD_BYPASS_GENERATE, mf_bypass)) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
456 |
# If we're bypassing all depdendency generation, we can avoid |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
457 |
# calling our dispatch_dict function altogether. |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
458 |
if (".*" in bypass or "^.*$" in bypass) and not ignore_bypass: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
459 |
pkg_attrs[bypassed_prefix] = "{0}:.*".format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
460 |
a.attrs["path"]) |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
461 |
continue |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
462 |
try: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
463 |
func = dispatch_dict[file_type] |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
464 |
except KeyError: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
465 |
if file_type not in missing: |
1908
4bdaf0463bae
15843 pkgdepend can't handle more than one proto area
Brock Pytlik <bpytlik@sun.com>
parents:
1887
diff
changeset
|
466 |
missing[file_type] = \ |
4bdaf0463bae
15843 pkgdepend can't handle more than one proto area
Brock Pytlik <bpytlik@sun.com>
parents:
1887
diff
changeset
|
467 |
a.attrs[portable.PD_LOCAL_PATH] |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
468 |
else: |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
469 |
try: |
1933
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
470 |
ds, errs, attrs = func(action=a, |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
471 |
pkg_vars=pkg_vars, |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
472 |
dyn_tok_conv=dyn_tok_conv, |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
473 |
run_paths=a_run_paths) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
474 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
475 |
# prune out any dependencies on the files we've |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
476 |
# been asked to avoid creating dependencies on |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
477 |
if bypass and not ignore_bypass: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
478 |
ds = \ |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
479 |
__bypass_deps(ds, bypass, pkg_attrs) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
480 |
|
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
481 |
deps.extend(ds) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
482 |
elist.extend(errs) |
1933
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
483 |
__update_pkg_attrs(pkg_attrs, attrs) |
3171
525f5bdb3f62
20434301 change exception handling syntax for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3158
diff
changeset
|
484 |
except base.DependencyAnalysisError as e: |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
485 |
elist.append(e) |
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
486 |
for a in mfst.gen_actions_by_type("hardlink"): |
1908
4bdaf0463bae
15843 pkgdepend can't handle more than one proto area
Brock Pytlik <bpytlik@sun.com>
parents:
1887
diff
changeset
|
487 |
deps.extend(hardlink.process_hardlink_deps(a, pkg_vars)) |
3476
cc1b291b79d2
18640960 pkgdepend stacktrace with varianted dependencies
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3391
diff
changeset
|
488 |
return deps, elist, warnings, missing, pkg_attrs |
1933
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
489 |
|
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
490 |
def __update_pkg_attrs(pkg_attrs, new_attrs): |
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
491 |
"""Update the pkg_attrs dictionary with the contents of new_attrs.""" |
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
492 |
for key in new_attrs: |
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
493 |
pkg_attrs.setdefault(key, []).extend(new_attrs[key]) |
1231
f7b99e8118d2
9290 need a way to find the file dependencies of a package
Brock Pytlik <bpytlik@sun.com>
parents:
diff
changeset
|
494 |
|
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
495 |
def __verify_run_path(run_path_str): |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
496 |
"""Verify we've been passed a single item and ensure it contains |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
497 |
at least one non-null string.""" |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
498 |
if not isinstance(run_path_str, str): |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
499 |
# require a colon separated string to potentially enforce |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
500 |
# ordering in the future |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
501 |
return [base.DependencyAnalysisError( |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
502 |
_("Manifest specified multiple values for {0} rather " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
503 |
"than a single colon-separated string.").format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
504 |
portable.PD_RUN_PATH))] |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
505 |
if set(run_path_str.split(":")) == set([""]): |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
506 |
return [base.DependencyAnalysisError( |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
507 |
_("Manifest did not specify any entries for {0}, expecting " |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
508 |
"a colon-separated string.").format(portable.PD_RUN_PATH))] |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
509 |
return [] |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
510 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
511 |
def __makelist(value): |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
512 |
"""Given a value, return it if that value is a list, or if it's a |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
513 |
string, return a single-element list of just that string.""" |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
514 |
if isinstance(value, list): |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
515 |
return value |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
516 |
elif isinstance(value, str): |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
517 |
if value: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
518 |
return [value] |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
519 |
else: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
520 |
return [] |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
521 |
else: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
522 |
raise ValueError("Value was not a string or a list") |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
523 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
524 |
def __bypass_deps(ds, bypass, pkg_attrs): |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
525 |
"""Return a list of dependencies, excluding any of those that should be |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
526 |
bypassed. |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
527 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
528 |
ds the list of dependencies to operate on |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
529 |
bypass a list of paths on which we should not generate dependencies |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
530 |
pkg_attrs the set of package attributes for this manifest, produced as |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
531 |
a by-product of this dependency generation |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
532 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
533 |
We support regular expressions as entries in the bypass list, matching |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
534 |
one or more files. |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
535 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
536 |
If a bypass-list entry is provided that does not contain one of the |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
537 |
following characters: ["/", "*", "?"], it is assumed to be a filename, |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
538 |
and expanded to the regular expression ".*/<entry>" |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
539 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
540 |
All bypass-list entries are assumed to be regular expressions that are |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
541 |
rooted at ^ and $. |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
542 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
543 |
The special match-all wildcard ".*" is dealt with separately, |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
544 |
by list_implicit_deps_for_manifest(..) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
545 |
""" |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
546 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
547 |
new_ds = [] |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
548 |
for dep in ds: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
549 |
full_paths = set(make_paths(dep)) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
550 |
bypassed_files = set() |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
551 |
bypass_regexps = [] |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
552 |
try: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
553 |
for item in bypass: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
554 |
# try to determine if this is a regexp, |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
555 |
# rather than a filename |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
556 |
if "*" in item or "?" in item: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
557 |
pass |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
558 |
# if it appears to be a filename, make it match |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
559 |
# all paths to that filename. |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
560 |
elif "/" not in item: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
561 |
item = ".*{0}{1}".format(os.path.sep, |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
562 |
item) |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
563 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
564 |
# always anchor our regular expressions, |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
565 |
# otherwise, we get partial matches for files, |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
566 |
# eg. bypassing "foo.c" would otherwise also |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
567 |
# bypass "foo.cc" |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
568 |
if item: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
569 |
if not item.endswith("$"): |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
570 |
item = item + "$" |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
571 |
if not item.startswith("^"): |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
572 |
item = "^" + item |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
573 |
bypass_regexps.append(re.compile(item)) |
3171
525f5bdb3f62
20434301 change exception handling syntax for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3158
diff
changeset
|
574 |
except re.error as e: |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
575 |
raise base.InvalidDependBypassValue(item, e) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
576 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
577 |
for path in full_paths: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
578 |
if path in bypass: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
579 |
bypassed_files.add(path) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
580 |
continue |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
581 |
for regexp in bypass_regexps: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
582 |
if regexp.match(path): |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
583 |
bypassed_files.add(path) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
584 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
585 |
if bypassed_files: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
586 |
# remove the old runpath and basename entries from |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
587 |
# the dependency if they were present |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
588 |
dep.attrs.pop(files_prefix, None) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
589 |
dep.attrs.pop(paths_prefix, None) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
590 |
dep.base_names = [] |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
591 |
dep.run_paths = [] |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
592 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
593 |
# determine our new list of paths |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
594 |
full_paths = full_paths - bypassed_files |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
595 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
596 |
dep.full_paths = sorted(list(full_paths)) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
597 |
dep.attrs[fullpaths_prefix] = dep.full_paths |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
598 |
pkg_attrs[bypassed_prefix] = \ |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
599 |
sorted(list(bypassed_files)) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
600 |
|
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
601 |
# only include the dependency if it still contains data |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
602 |
if full_paths: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
603 |
new_ds.append(dep) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
604 |
else: |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
605 |
new_ds.append(dep) |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
606 |
return new_ds |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
607 |
|
1500
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
608 |
def __make_manifest(fp, basedirs=None, load_data=True): |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
609 |
"""Given the file path, 'fp', return a Manifest for that path.""" |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
610 |
|
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
611 |
m = manifest.Manifest() |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
612 |
try: |
3339
c88573eb98ea
22642620 pkg should deliver python 3.4 versions of modules
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3265
diff
changeset
|
613 |
fh = open(fp, "r") |
3171
525f5bdb3f62
20434301 change exception handling syntax for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3158
diff
changeset
|
614 |
except EnvironmentError as e: |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
615 |
raise apx._convert_error(e) |
1500
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
616 |
acts = [] |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
617 |
missing_files = [] |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
618 |
action_errs = [] |
1500
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
619 |
accumulate = "" |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
620 |
for l in fh: |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
621 |
l = l.strip() |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
622 |
if l.endswith("\\"): |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
623 |
accumulate += l[0:-1] |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
624 |
continue |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
625 |
elif accumulate: |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
626 |
l = accumulate + l |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
627 |
accumulate = "" |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
628 |
if not l or l[0] == '#': |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
629 |
continue |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
630 |
try: |
1908
4bdaf0463bae
15843 pkgdepend can't handle more than one proto area
Brock Pytlik <bpytlik@sun.com>
parents:
1887
diff
changeset
|
631 |
a, local_path, used_bd = actions.internalizestr(l, |
1500
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
632 |
basedirs=basedirs, |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
633 |
load_data=load_data) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
634 |
|
3366
9b60d67a2fa8
PSARC/2016/291 Image Packaging System group-any dependency type
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
3356
diff
changeset
|
635 |
# Ensure dependency is a type we understand; the |
9b60d67a2fa8
PSARC/2016/291 Image Packaging System group-any dependency type
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
3356
diff
changeset
|
636 |
# manifest could contain a future dependency type. |
9b60d67a2fa8
PSARC/2016/291 Image Packaging System group-any dependency type
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
3356
diff
changeset
|
637 |
if (a.name == "depend" and |
9b60d67a2fa8
PSARC/2016/291 Image Packaging System group-any dependency type
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
3356
diff
changeset
|
638 |
a.attrs.get("type") not in dep_types): |
9b60d67a2fa8
PSARC/2016/291 Image Packaging System group-any dependency type
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
3356
diff
changeset
|
639 |
raise actions.InvalidActionError(str(a), |
9b60d67a2fa8
PSARC/2016/291 Image Packaging System group-any dependency type
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
3356
diff
changeset
|
640 |
"Unknown dependency type '{0}'". |
9b60d67a2fa8
PSARC/2016/291 Image Packaging System group-any dependency type
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
3356
diff
changeset
|
641 |
format(a.attrs.get("type"))) |
9b60d67a2fa8
PSARC/2016/291 Image Packaging System group-any dependency type
Shawn Walker-Salas <shawn.walker@oracle.com>
parents:
3356
diff
changeset
|
642 |
|
3171
525f5bdb3f62
20434301 change exception handling syntax for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3158
diff
changeset
|
643 |
except actions.ActionDataError as e: |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
644 |
new_a, local_path, used_bd = actions.internalizestr( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
645 |
l, basedirs=basedirs, load_data=False) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
646 |
if new_a.name == "license": |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
647 |
local_path = None |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
648 |
a = new_a |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
649 |
else: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
650 |
missing_files.append(base.MissingFile( |
3391
ab089cdd0665
22992245 pkgdepend missing files error message wrong when hash attribute provided
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3366
diff
changeset
|
651 |
new_a.attrs["path"], dirs=basedirs, |
ab089cdd0665
22992245 pkgdepend missing files error message wrong when hash attribute provided
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3366
diff
changeset
|
652 |
hash=new_a.hash)) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
653 |
continue |
3171
525f5bdb3f62
20434301 change exception handling syntax for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3158
diff
changeset
|
654 |
except actions.ActionError as e: |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
655 |
action_errs.append(e) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
656 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
657 |
else: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
658 |
# If this action has a payload, add the information |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
659 |
# about where that payload file lives to the action. |
1500
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
660 |
if local_path: |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
661 |
assert portable.PD_LOCAL_PATH not in a.attrs |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
662 |
a.attrs[portable.PD_LOCAL_PATH] = local_path |
1908
4bdaf0463bae
15843 pkgdepend can't handle more than one proto area
Brock Pytlik <bpytlik@sun.com>
parents:
1887
diff
changeset
|
663 |
a.attrs[portable.PD_PROTO_DIR] = used_bd |
1933
5193ac03ad9f
15305 need to generate dependency information from SMF manifests
Tim Foster <tim.s.foster@oracle.com>
parents:
1908
diff
changeset
|
664 |
a.attrs[portable.PD_PROTO_DIR_LIST] = basedirs |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
665 |
try: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
666 |
a.validate() |
3171
525f5bdb3f62
20434301 change exception handling syntax for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3158
diff
changeset
|
667 |
except actions.ActionError as e: |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
668 |
action_errs.append(e) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
669 |
else: |
1500
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
670 |
acts.append(a) |
fb15a23b6915
11805 pkgdep generate doesn't respect the payload path for file actions
Brock Pytlik <bpytlik@sun.com>
parents:
1431
diff
changeset
|
671 |
fh.close() |
2073
9fcacc9e5eaa
16998 transport should support publisher-specific write and read caches
Shawn Walker <shawn.walker@oracle.com>
parents:
1934
diff
changeset
|
672 |
m.set_content(content=acts) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
673 |
return m, missing_files + action_errs |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
674 |
|
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
675 |
def choose_name(fp, mfst): |
2298
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
676 |
"""Find the package name for this manifest. If it's defined in a set |
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
677 |
action in the manifest, use that. Otherwise use the basename of the |
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
678 |
path to the manifest as the name. If a proper package fmri is found, |
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
679 |
then also return a PkgFmri object so that we can track which packages |
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
680 |
are being processed. |
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
681 |
|
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
682 |
'fp' is the path to the file for the manifest. |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
683 |
|
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
684 |
'mfst' is the Manifest object.""" |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
685 |
|
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
686 |
if mfst is None: |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3171
diff
changeset
|
687 |
return unquote(os.path.basename(fp)), None |
1431
62b6033670e4
10416 server catalog v1 support desired
Shawn Walker <srw@sun.com>
parents:
1337
diff
changeset
|
688 |
name = mfst.get("pkg.fmri", mfst.get("fmri", None)) |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
689 |
if name is not None: |
2298
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
690 |
try: |
2958
868e07939116
16851082 build_release (aka build version) should not be displayed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2753
diff
changeset
|
691 |
pfmri = fmri.PkgFmri(name) |
2298
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
692 |
except fmri.IllegalFmri: |
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
693 |
pfmri = None |
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
694 |
return name, pfmri |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3171
diff
changeset
|
695 |
return unquote(os.path.basename(fp)), None |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
696 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
697 |
def make_paths(file_dep): |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
698 |
"""Find all the possible paths which could satisfy the dependency |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
699 |
'file_dep'.""" |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
700 |
|
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
701 |
if file_dep.attrs.get(fullpaths_prefix, []): |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
702 |
return file_dep.attrs[fullpaths_prefix] |
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
703 |
|
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
704 |
rps = file_dep.attrs.get(paths_prefix, [""]) |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
705 |
files = file_dep.attrs[files_prefix] |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3171
diff
changeset
|
706 |
if isinstance(files, six.string_types): |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
707 |
files = [files] |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3171
diff
changeset
|
708 |
if isinstance(rps, six.string_types): |
1674
faf484754465
13059 pkgdep generate should analyze python modules using the version of python they use
Brock Pytlik <bpytlik@sun.com>
parents:
1581
diff
changeset
|
709 |
rps = [rps] |
1580
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
710 |
return [os.path.join(rp, f) for rp in rps for f in files] |
2763f36d0eda
13136 pkgdep test cases shouldn't reference installed image
Brock Pytlik <bpytlik@sun.com>
parents:
1544
diff
changeset
|
711 |
|
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
712 |
def resolve_links(path, files_dict, links, path_vars, file_dep_attrs, index=1): |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
713 |
"""This method maps a path to one or more real paths and the variants |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
714 |
under which each real path can exist. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
715 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
716 |
'path' is the original text of the path which is being resolved to a |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
717 |
real path. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
718 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
719 |
'files_dict' is a dictionary which maps package identity to the files |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
720 |
the package delivers and the variants under which each file is present. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
721 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
722 |
'links' is an Entries namedtuple which contains two dictionaries. One |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
723 |
dictionary maps package identity to the links that it delivers. The |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
724 |
other dictionary, contains the same information for links that are |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
725 |
installed on the system. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
726 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
727 |
'path_vars' is the set of variants under which 'path' exists. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
728 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
729 |
'file_dep_attrs' is the dictonary of attributes for the file dependency |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
730 |
for 'path'. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
731 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
732 |
'index' indicates how much of 'path' should be checked against the file |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
733 |
and link dictionaries.""" |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
734 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
735 |
res_paths = [] |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
736 |
res_links = [] |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
737 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
738 |
# If the current path is a known file, then we might be done resolving |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
739 |
# the path. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
740 |
if path in files_dict: |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
741 |
# Copy the variants so that marking the variants as satisified |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
742 |
# doesn't change the sate of 'path_vars.' |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
743 |
tmp_vars = copy.copy(path_vars) |
2191
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
744 |
# If tmp_vars has been satisfied, then this function should |
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
745 |
# never have been called. |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
746 |
assert(tmp_vars.is_empty() or not tmp_vars.is_satisfied()) |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
747 |
# Check each package which delivers a file with this path. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
748 |
for pfmri, p_vc in files_dict[path]: |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
749 |
# If the file is delivered under a set of variants which |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
750 |
# are irrelevant to the path being considered, skip it. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
751 |
if not path_vars.intersects(p_vc): |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
752 |
continue |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
753 |
# The intersection of the variants which apply to the |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
754 |
# current path and the variants for the delivered file |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
755 |
# is the combination of variants where the original |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
756 |
# path resolves to the delivered file. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
757 |
inter = path_vars.intersection(p_vc) |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
758 |
inter.mark_all_as_satisfied() |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
759 |
tmp_vars.mark_as_satisfied(p_vc) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
760 |
res_paths.append(LinkInfo(path, pfmri, pfmri, inter, |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
761 |
[])) |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
762 |
# If the path was resolved under all relevant variants, then |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
763 |
# we're done. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
764 |
if res_paths and tmp_vars.is_satisfied(): |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
765 |
return res_paths, res_links |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
766 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
767 |
lst = path.split(os.path.sep) |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
768 |
# If there aren't any more pieces of the path left to check, then |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
769 |
# there's nothing to do so return whatever has been found so far. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
770 |
if index > len(lst): |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
771 |
return res_paths, res_links |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
772 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
773 |
# Create the path to check for links. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
774 |
cur_path = os.path.join(*lst[0:index]) |
2298
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
775 |
# Find the links which match the path being checked. |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
776 |
rel_links = links.get(cur_path, False) |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
777 |
# If there weren't any relevant links, then add the next path component |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
778 |
# to the path being considered and try again. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
779 |
if not rel_links: |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
780 |
return resolve_links(path, files_dict, links, path_vars, |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
781 |
file_dep_attrs, index=index+1) |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
782 |
|
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
783 |
links_found = {} |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
784 |
for link_pfmri, link_vc, rel_target in rel_links: |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
785 |
# If the variants needed to reach the current path and the |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
786 |
# variants for the link don't intersect, then the link is |
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
787 |
# irrelevant. |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
788 |
if not path_vars.intersects(link_vc): |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
789 |
continue |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
790 |
vc_intersection = path_vars.intersection(link_vc) |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
791 |
# If the link only matters under variants that are satisfied, |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
792 |
# then it's not an interesting link for this purpose. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
793 |
if vc_intersection.is_satisfied() and \ |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
794 |
not vc_intersection.is_empty(): |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
795 |
continue |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
796 |
# Apply the link to the current path to get the new relevant |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
797 |
# path. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
798 |
next_path = os.path.normpath(os.path.join( |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
799 |
os.path.dirname(cur_path), rel_target, |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
800 |
*lst[index:])).lstrip(os.path.sep) |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
801 |
# Index is reset back to the default because an element in path |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
802 |
# the link provides could actually be a link. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
803 |
rec_paths, link_deps = resolve_links(next_path, files_dict, |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
804 |
links, vc_intersection, file_dep_attrs) |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
805 |
if not rec_paths: |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
806 |
continue |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
807 |
# The current path was able to be resolved to a real path, so |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
808 |
# add the paths and the dependencies from links found to the |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
809 |
# results. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
810 |
res_links.extend(link_deps) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
811 |
for rec_path, rec_pfmri, nearest_pfmri, rec_vc, via_links in \ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
812 |
rec_paths: |
2298
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
813 |
via_links.append(path) |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
814 |
assert vc_intersection.intersects(rec_vc), \ |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
815 |
"vc:{0}\nvc_intersection:{1}".format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
816 |
rec_vc, vc_intersection) |
2538
c7f52b443803
18884 pkgdepend resolve outputs ksh dependencies with variant.debug.osnet=false
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2528
diff
changeset
|
817 |
links_found.setdefault(next_path, []).append( |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
818 |
(link_pfmri, nearest_pfmri, rec_vc)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
819 |
res_paths.append(LinkInfo(rec_path, rec_pfmri, |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
820 |
link_pfmri, rec_vc, via_links)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
821 |
|
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
822 |
# Now add in the dependencies for the current link. |
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
823 |
for next_path in links_found.keys(): |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
824 |
cur_deps = group_by_variant_combinations(links_found[next_path]) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
825 |
for pfmri_pairs, vc in cur_deps: |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
826 |
# Make a copy of path_vars which is unsatisfied, then |
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
827 |
# mark the specific combinations which are satisfied by |
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
828 |
# this group of pfmris. |
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
829 |
dep_vc = path_vars.unsatisfied_copy() |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
830 |
dep_vc.mark_as_satisfied(vc) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
831 |
for l_pfmri, r_pfmri in pfmri_pairs: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
832 |
if l_pfmri == r_pfmri: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
833 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
834 |
dep_type = "conditional" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
835 |
attrs = file_dep_attrs.copy() |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
836 |
attrs.update({ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
837 |
"fmri": l_pfmri.get_short_fmri(), |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
838 |
"predicate": r_pfmri.get_short_fmri(), |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
839 |
type_prefix: "link", |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
840 |
files_prefix: [path], |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
841 |
"type": dep_type, |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
842 |
}) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
843 |
attrs.pop(paths_prefix, None) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
844 |
attrs.pop(fullpaths_prefix, None) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
845 |
# The dependency is created with the same |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
846 |
# variants as the path. This works because the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
847 |
# set of relevant variants is restricted as |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
848 |
# links are applied so the variants used for the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
849 |
# path are the intersection of the variants for |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
850 |
# each of the links used to reach the path and |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
851 |
# the variants under which the file is |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
852 |
# delivered. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
853 |
res_links.append(( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
854 |
actions.depend.DependencyAction(**attrs), |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
855 |
dep_vc)) |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
856 |
|
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
857 |
return res_paths, res_links |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
858 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
859 |
def find_package_using_delivered_files(files_dict, links, file_dep, dep_vars, |
1856
68eb900fbed5
14869 pkgdepend shouldn't include the timestamp in resolved dependencies
Richard Lowe <richlowe@richlowe.net>
parents:
1845
diff
changeset
|
860 |
orig_dep_vars): |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
861 |
"""Maps a dependency on a file to the packages which can satisfy that |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
862 |
dependency. |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
863 |
|
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
864 |
'files_dict' is a dictionary mapping paths to a list of fmri, variants |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
865 |
pairs. |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
866 |
|
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
867 |
'links' is an Entries namedtuple which contains two dictionaries. One |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
868 |
dictionary maps package identity to the links that it delivers. The |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
869 |
other dictionary, contains the same information for links that are |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
870 |
installed on the system. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
871 |
|
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
872 |
'file_dep' is the dependency that is being resolved. |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
873 |
|
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
874 |
'dep_vars' are the variants for which the dependency has not yet been |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
875 |
resolved. |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
876 |
|
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
877 |
'orig_dep_vars' is the original set of variants under which the |
1856
68eb900fbed5
14869 pkgdepend shouldn't include the timestamp in resolved dependencies
Richard Lowe <richlowe@richlowe.net>
parents:
1845
diff
changeset
|
878 |
dependency must be satisfied.""" |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
879 |
|
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
880 |
res = [] |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
881 |
errs = [] |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
882 |
link_deps = [] |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
883 |
cur_deps = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
884 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
885 |
pths = sorted(make_paths(file_dep)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
886 |
pth_id = ":".join(pths) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
887 |
for p in pths: |
2191
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
888 |
# If orig_dep_vars is satisfied, then this function should never |
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
889 |
# have been called. |
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
890 |
assert(orig_dep_vars.is_empty() or |
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
891 |
not orig_dep_vars.is_satisfied()) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
892 |
# Find the packages which satisfy this path of the file |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
893 |
# dependency and the links needed to reach the files which those |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
894 |
# packages provide. |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
895 |
paths_info, path_deps = resolve_links(os.path.normpath(p), |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
896 |
files_dict, links, orig_dep_vars, file_dep.attrs.copy()) |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
897 |
link_deps.extend(path_deps) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
898 |
cur_deps += paths_info |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
899 |
# Because all of the package dependencies are ultimately satisfying the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
900 |
# same file dependency, they should all be grouped together. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
901 |
cur_deps = group_by_variant_combinations([ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
902 |
(t.path, t.pfmri, t.via_links, t.variant_combination) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
903 |
for t in cur_deps |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
904 |
]) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
905 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
906 |
for l, vc in cur_deps: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
907 |
dep_vars.mark_as_satisfied(vc) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
908 |
attrs = file_dep.attrs.copy() |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
909 |
dep_type = "require-any" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
910 |
# Find the packages which satisify this file dependency. Using |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
911 |
# the short fmri is appropriate for these purposes because |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
912 |
# dependencies can never be inferred on different versions of |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
913 |
# the same package during a single run of resolve. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
914 |
pfmri_names = sorted(set([ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
915 |
pfmri.get_short_fmri() |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
916 |
for path, pfmri, vl in l |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
917 |
])) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
918 |
paths = sorted(set([ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
919 |
path for path, pfmri, vl in l |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
920 |
])) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
921 |
via_links = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
922 |
# If only a single package satisfies this dependency, then a |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
923 |
# require dependency should be created, otherwise a require-any |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
924 |
# is needed. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
925 |
if len(pfmri_names) == 1: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
926 |
dep_type = "require" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
927 |
pfmri_names = pfmri_names[0] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
928 |
via_links = l[0][2] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
929 |
via_links.reverse() |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
930 |
via_links = ":".join(via_links) |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
931 |
else: |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
932 |
for path, pfmri, vl in l: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
933 |
vl.reverse() |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
934 |
via_links.append(":".join(vl)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
935 |
attrs.pop(paths_prefix, None) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
936 |
attrs.pop(fullpaths_prefix, None) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
937 |
attrs.update({ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
938 |
"type": dep_type, |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
939 |
"fmri": pfmri_names, |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
940 |
files_prefix: paths, |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
941 |
}) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
942 |
if via_links: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
943 |
attrs[via_links_prefix] = via_links |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
944 |
res.append((actions.depend.DependencyAction(**attrs), vc)) |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
945 |
|
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
946 |
res.extend(link_deps) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
947 |
# Add the path id so that these dependencies analyzed for simplification |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
948 |
# as a group. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
949 |
for d, v in res: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
950 |
d.attrs[path_id_prefix] = pth_id |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
951 |
return res, dep_vars, errs |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
952 |
|
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
953 |
def find_package(files, links, file_dep, orig_dep_vars, pkg_vars, use_system): |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
954 |
"""Find the packages which resolve the dependency. It returns a list of |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
955 |
dependency actions with the fmri tag resolved. |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
956 |
|
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
957 |
'files' is an Entries namedtuple which contains two dictionaries. One |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
958 |
dictionary maps package identity to the files that it delivers. The |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
959 |
other dictionary, contains the same information for files that are |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
960 |
installed on the system. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
961 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
962 |
'links' is an Entries namedtuple which contains two dictionaries. One |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
963 |
dictionary maps package identity to the links that it delivers. The |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
964 |
other dictionary, contains the same information for links that are |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
965 |
installed on the system. |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
966 |
|
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
967 |
'file_dep' is the dependency being resolved. |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
968 |
|
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
969 |
'orig_dep_vars' is the original set of variants under which the |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
970 |
dependency must be satisfied. |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
971 |
|
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
972 |
'pkg_vars' is the variants against which the package was published.""" |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
973 |
|
2191
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
974 |
# If the file dependency has already satisfied all its variants, then |
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
975 |
# this function should never have been called. |
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
976 |
assert(orig_dep_vars.is_empty() or not orig_dep_vars.is_satisfied()) |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
977 |
dep_vars = copy.copy(orig_dep_vars) |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
978 |
# First try to resolve the dependency against the delivered files. |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
979 |
res, dep_vars, errs = find_package_using_delivered_files( |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
980 |
files.delivered, links, file_dep, dep_vars, orig_dep_vars) |
2191
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
981 |
# If dep_vars is satisfied then we found at least one solution. It's |
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
982 |
# possible that more than one solution was found, causing an error. |
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
983 |
assert(not dep_vars.is_satisfied() or |
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
984 |
(res or errs or dep_vars.is_empty())) |
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
985 |
if ((res or errs) and dep_vars.is_satisfied()) or not use_system: |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
986 |
return res, dep_vars, errs |
1934
4afdb552a5ec
15647 pkgdepend generates duplicate dependencies if dependency can't be satisfied for all variant values
Richard Lowe <richlowe@richlowe.net>
parents:
1933
diff
changeset
|
987 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
988 |
# If the dependency isn't fully satisfied, resolve it against the |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
989 |
# files installed in the current image. |
1934
4afdb552a5ec
15647 pkgdepend generates duplicate dependencies if dependency can't be satisfied for all variant values
Richard Lowe <richlowe@richlowe.net>
parents:
1933
diff
changeset
|
990 |
# |
4afdb552a5ec
15647 pkgdepend generates duplicate dependencies if dependency can't be satisfied for all variant values
Richard Lowe <richlowe@richlowe.net>
parents:
1933
diff
changeset
|
991 |
# We only need to resolve for the variants not already satisfied |
4afdb552a5ec
15647 pkgdepend generates duplicate dependencies if dependency can't be satisfied for all variant values
Richard Lowe <richlowe@richlowe.net>
parents:
1933
diff
changeset
|
992 |
# above. |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
993 |
const_dep_vars = copy.copy(dep_vars) |
2191
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
994 |
# If dep_vars has been satisfied, then we should have exited the |
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
995 |
# function above. |
da5a579210cc
17700 pkgdep can trace back when two packages deliver paths which satisfy a dependency
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2159
diff
changeset
|
996 |
assert(const_dep_vars.is_empty() or not const_dep_vars.is_satisfied()) |
1581
37d9bf54ee23
13058 search makes resolve go slow
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
997 |
inst_res, dep_vars, inst_errs = find_package_using_delivered_files( |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
998 |
files.installed, links, file_dep, dep_vars, const_dep_vars) |
1581
37d9bf54ee23
13058 search makes resolve go slow
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
999 |
res.extend(inst_res) |
37d9bf54ee23
13058 search makes resolve go slow
Brock Pytlik <bpytlik@sun.com>
parents:
1580
diff
changeset
|
1000 |
errs.extend(inst_errs) |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1001 |
return res, dep_vars, errs |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1002 |
|
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1003 |
def is_file_dependency(act): |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1004 |
return act.name == "depend" and \ |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1005 |
act.attrs.get("fmri", None) == base.Dependency.DUMMY_FMRI and \ |
2236
7b074b5316ec
16015 pkgdepend needs python runpath hints
Tim Foster <tim.s.foster@oracle.com>
parents:
2191
diff
changeset
|
1006 |
(files_prefix in act.attrs or fullpaths_prefix in act.attrs) |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1007 |
|
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1008 |
def group_by_variant_combinations(lst): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1009 |
"""The goal of this function is to produce the smallest list of (info |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1010 |
list, VariantCombinations) tuples which has the following properties: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1011 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1012 |
1. The intersection between any two satisfied sets of the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1013 |
VariantCombinations must be empty. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1014 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1015 |
2. If a piece of information was satisfied under a particular |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1016 |
combination of variants, that information must be paired with the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1017 |
VariantCombination which has that combination in its satisfied set. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1018 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1019 |
Note: A piece of information can appear more than once in the result. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1020 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1021 |
The 'lst' parameter is a list of tuples. The last item in each tuple |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1022 |
must be a VariantCombination. The rest of each tuple is the "piece of |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1023 |
information" discussed above.""" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1024 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1025 |
seed = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1026 |
for item in lst: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1027 |
# Separate the VariantCombination out from the info to be |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1028 |
# grouped. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1029 |
i_vc = item[-1] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1030 |
info = item[:-1] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1031 |
# If there's only a single piece of information, then take it |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1032 |
# out of a list. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1033 |
if len(info) == 1: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1034 |
info = info[0] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1035 |
new_res = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1036 |
for old_info, old_vc in seed: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1037 |
# If i_vc is None, then variant combinations under which |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1038 |
# 'info' is satisfied have been covered by previous |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1039 |
# old_vc's and info has already been merged in, so just |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1040 |
# finish extending the list with the existing |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1041 |
# information. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1042 |
if i_vc is None: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1043 |
new_res.append((old_info, old_vc)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1044 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1045 |
# Check to see how i_vc and old_vc's satisfied sets |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1046 |
# overlap. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1047 |
only_i, intersect, only_old = \ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1048 |
i_vc.separate_satisfied(old_vc) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1049 |
assert only_i or intersect or only_old |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1050 |
assert only_i or i_vc.issubset(old_vc, True) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1051 |
assert only_old or old_vc.issubset(i_vc, True) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1052 |
assert intersect or (only_i and only_old) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1053 |
# If there are any variant combinations where old_vc is |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1054 |
# satisfied but i_vc is not, add the VariantCombination |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1055 |
# for those combinations to the list along with the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1056 |
# old_info. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1057 |
if only_old: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1058 |
new_res.append((old_info, only_old)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1059 |
# If i_vc and old_vc are both satisfied under some |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1060 |
# variant combinations, then add info into the old_info |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1061 |
# under those variant combinations. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1062 |
if intersect: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1063 |
tmp = old_info[:] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1064 |
tmp.append(info) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1065 |
new_res.append((tmp, intersect)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1066 |
# The relevant variant combinations to consider now are |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1067 |
# those that didn't overlap with old_vc. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1068 |
i_vc = only_i |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1069 |
# If i_vc is not None, then i_vc was satisfied under some |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1070 |
# variant combinations which no other VariantCombination was, so |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1071 |
# add it to the list. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1072 |
if i_vc is not None: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1073 |
new_res.append(([info], i_vc)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1074 |
seed = new_res |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1075 |
return seed |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1076 |
|
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1077 |
def merge_deps(dest, src): |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1078 |
"""Add the information contained in src's attrs to dest.""" |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1079 |
|
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1080 |
for k, v in src.attrs.items(): |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1081 |
# If any of these dependencies already have a variant set, |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1082 |
# then something's gone horribly wrong. |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1083 |
assert(not k.startswith("variant.")) |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1084 |
if k not in dest.attrs: |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1085 |
dest.attrs[k] = v |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1086 |
elif v != dest.attrs[k]: |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1087 |
# For now, just merge the values. Duplicate values |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1088 |
# will be removed in a later step. |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3171
diff
changeset
|
1089 |
if isinstance(v, six.string_types): |
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1090 |
v = [v] |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1091 |
if isinstance(dest.attrs[k], list): |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1092 |
dest.attrs[k].extend(v) |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1093 |
else: |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1094 |
t = [dest.attrs[k]] |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1095 |
t.extend(v) |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1096 |
dest.attrs[k] = t |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1097 |
|
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1098 |
def __predicate_path_id_attrget(d): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1099 |
# d is a tuple containing two items. d[0] is the action. d[1] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1100 |
# is the VariantCombination for this action. The |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1101 |
# VariantCombination isn't useful for our grouping needs. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1102 |
try: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1103 |
return d[0].attrs["predicate"], \ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1104 |
d[0].attrs.get(path_id_prefix, None) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1105 |
except KeyError: |
3158
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
1106 |
raise RuntimeError("Expected this to have a predicate:{0}".format( |
58c9c2c21e67
20177033 change string formatting for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2958
diff
changeset
|
1107 |
d[0])) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1108 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1109 |
def __collapse_conditionals(deps): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1110 |
"""Under certain conditions, conditional dependencies can be transformed |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1111 |
into require-any or require dependencies. This function is responsible |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1112 |
for performing the transformation. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1113 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1114 |
The 'deps' parameter is a list of dependency action and |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1115 |
VariantCombination tuples.""" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1116 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1117 |
# Construct a dictionary which maps a package name to a list of |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1118 |
# dependencies which require that package. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1119 |
req_dict = {} |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1120 |
for d, v in deps: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1121 |
if d.attrs["type"] != "require": |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1122 |
continue |
2958
868e07939116
16851082 build_release (aka build version) should not be displayed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2753
diff
changeset
|
1123 |
t_pfmri = fmri.PkgFmri(d.attrs["fmri"]) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1124 |
req_dict.setdefault(t_pfmri.get_pkg_stem(include_scheme=False), |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1125 |
[]).append((t_pfmri, d, v)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1126 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1127 |
cond_deps = {} |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1128 |
preds_to_process = set() |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1129 |
for (predicate, path_id), group in itertools.groupby(sorted( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1130 |
[(d, v) for d, v in deps if d.attrs["type"] == "conditional"], |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1131 |
key=__predicate_path_id_attrget), __predicate_path_id_attrget): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1132 |
group = list(group) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1133 |
cond_deps.setdefault(predicate, []).append((path_id, group)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1134 |
preds_to_process.add(predicate) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1135 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1136 |
new_req_deps = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1137 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1138 |
# While there are still require dependencies which might be used to |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1139 |
# transform a conditional dependency... |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1140 |
while preds_to_process: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1141 |
# Pick a fmri which might be the predicate of a conditional |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1142 |
# dependency that could be collapsed. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1143 |
predicate = preds_to_process.pop() |
2958
868e07939116
16851082 build_release (aka build version) should not be displayed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2753
diff
changeset
|
1144 |
t_pfmri = fmri.PkgFmri(predicate) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1145 |
t_name = t_pfmri.get_pkg_stem(include_scheme=False) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1146 |
# If there are no require dependencies with that package name as |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1147 |
# a target, then there's nothing to do. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1148 |
if t_name not in req_dict: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1149 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1150 |
rel_reqs = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1151 |
# Only require dependencies whose fmri is a successor to the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1152 |
# fmri under consideration are interesting. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1153 |
for req_fmri, d, v in req_dict[t_name]: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1154 |
if req_fmri.is_successor(t_pfmri): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1155 |
rel_reqs.append((d, v)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1156 |
if not rel_reqs: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1157 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1158 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1159 |
new_group = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1160 |
for path_id, group in cond_deps.get(predicate, []): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1161 |
tmp_deps = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1162 |
# Group all of the conditional dependencies inferred for |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1163 |
# path_id by the variant combinations under which |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1164 |
# they're valid. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1165 |
tmp_deps = group_by_variant_combinations(group) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1166 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1167 |
collapse_deps = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1168 |
no_collapse = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1169 |
# Separate the conditional dependencies into those that |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1170 |
# can be collapsed and those that can't. If a |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1171 |
# conditional dependency intersects with any of the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1172 |
# relevant required dependencies found earlier, it can |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1173 |
# be collapsed. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1174 |
for ds, v in tmp_deps: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1175 |
for req_d, req_v in rel_reqs: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1176 |
only_tmp, intersect, only_req = \ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1177 |
v.separate_satisfied(req_v) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1178 |
assert only_tmp or intersect or only_req |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1179 |
assert only_tmp or \ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1180 |
v.issubset(req_v, True) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1181 |
assert only_req or v.issubset(v, True) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1182 |
assert intersect or \ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1183 |
(only_tmp and only_req) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1184 |
if intersect: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1185 |
collapse_deps.append( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1186 |
(ds, intersect)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1187 |
v = only_tmp |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1188 |
if v is None: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1189 |
break |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1190 |
if v is not None: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1191 |
no_collapse.extend([(d, v) for d in ds]) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1192 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1193 |
if no_collapse: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1194 |
new_group.append((path_id, no_collapse)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1195 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1196 |
# If path_id is None, then these conditional |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1197 |
# dependencies were not inferred links needed to reach a |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1198 |
# file dependency. In that case, the conditional |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1199 |
# dependencies can be individually collapsed to require |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1200 |
# dependencies but cannot be collapsed together into a |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1201 |
# require-any dependency. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1202 |
if path_id is None: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1203 |
for ds, v in collapse_deps: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1204 |
for d in ds: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1205 |
res_dep = actions.depend.DependencyAction(**d.attrs) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1206 |
del res_dep.attrs["predicate"] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1207 |
res_dep.attrs["type"] = \ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1208 |
"require" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1209 |
new_req_deps.append( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1210 |
(res_dep, v)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1211 |
# Since a new require dependency |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1212 |
# has been created, its possible |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1213 |
# that conditional dependencies |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1214 |
# could be collapsed using that, |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1215 |
# so add the fmri to the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1216 |
# predicates to be processed. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1217 |
preds_to_process.add( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1218 |
res_dep.attrs["fmri"]) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1219 |
t_pfmri = fmri.PkgFmri( |
2958
868e07939116
16851082 build_release (aka build version) should not be displayed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2753
diff
changeset
|
1220 |
d.attrs["fmri"]) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1221 |
req_dict.setdefault( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1222 |
t_pfmri.get_pkg_stem( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1223 |
include_scheme=False), |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1224 |
[]).append( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1225 |
(t_pfmri, res_dep, v)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1226 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1227 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1228 |
# Since path_id is not None, these conditional |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1229 |
# dependencies were all inferred while trying to satisfy |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1230 |
# a dependency on the same "file." Since they all have |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1231 |
# the same predicate, they must be collapsed into a |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1232 |
# require-any dependency because each represents a valid |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1233 |
# step through the link path to reach the dependened |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1234 |
# upon file. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1235 |
for ds, v in collapse_deps: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1236 |
res_dep = actions.depend.DependencyAction( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1237 |
**ds[0].attrs) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1238 |
for d in ds[1:]: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1239 |
merge_deps(res_dep, d) |
3339
c88573eb98ea
22642620 pkg should deliver python 3.4 versions of modules
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3265
diff
changeset
|
1240 |
d = ds[-1] |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1241 |
res_dep.attrs["fmri"] = list(set( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1242 |
res_dep.attrlist("fmri"))) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1243 |
if len(res_dep.attrlist("fmri")) > 1: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1244 |
res_dep.attrs["type"] = "require-any" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1245 |
else: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1246 |
res_dep.attrs["type"] = "require" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1247 |
res_dep.attrs["fmri"] = \ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1248 |
res_dep.attrs["fmri"][0] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1249 |
# Since a new require dependency has |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1250 |
# been created, its possible that |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1251 |
# conditional dependencies could be |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1252 |
# collapsed using that, so add the fmri |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1253 |
# to the predicates to be processed. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1254 |
preds_to_process.add( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1255 |
res_dep.attrs["fmri"]) |
2958
868e07939116
16851082 build_release (aka build version) should not be displayed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2753
diff
changeset
|
1256 |
t_pfmri = fmri.PkgFmri(d.attrs["fmri"]) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1257 |
req_dict.setdefault( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1258 |
t_pfmri.get_pkg_stem( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1259 |
include_scheme=False), |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1260 |
[]).append((t_pfmri, res_dep, v)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1261 |
del res_dep.attrs["predicate"] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1262 |
new_req_deps.append((res_dep, v)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1263 |
# Now that all the new require dependencies have been removed, |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1264 |
# update the remaining conditional dependencies for this |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1265 |
# predicate. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1266 |
if new_group: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1267 |
cond_deps[predicate] = new_group |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1268 |
elif predicate in cond_deps: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1269 |
del cond_deps[predicate] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1270 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1271 |
# The result is the original non-conditional dependencies ... |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1272 |
res = [(d, v) for d, v in deps if d.attrs["type"] != "conditional"] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1273 |
# plus the new require or require-any dependencies made by collapsing |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1274 |
# the conditional dependencies ... |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1275 |
res += new_req_deps |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1276 |
# plus the conditional dependencies that couldn't be collapsed. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1277 |
for l in cond_deps.values(): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1278 |
for path_id, dep_pairs in l: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1279 |
res.extend(dep_pairs) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1280 |
return res |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1281 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1282 |
def __remove_unneeded_require_and_require_any(deps, pkg_fmri): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1283 |
"""Drop any unneeded require or require any dependencies and record any |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1284 |
dropped require-any dependencies which were inferred.""" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1285 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1286 |
res = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1287 |
omitted_req_any = {} |
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1288 |
fmri_dict = {} |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1289 |
warnings = [] |
3391
ab089cdd0665
22992245 pkgdepend missing files error message wrong when hash attribute provided
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3366
diff
changeset
|
1290 |
# |
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1291 |
# We assume that the subsets are shorter than the supersets. |
3391
ab089cdd0665
22992245 pkgdepend missing files error message wrong when hash attribute provided
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3366
diff
changeset
|
1292 |
# |
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1293 |
# Example: |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1294 |
# #1 depend fmri=a, fmri=b, fmri=c, type=require-any |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1295 |
# #2 depend fmri=a, fmri=b, type=require=any |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1296 |
# #2 is treated as a subset of #1 |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1297 |
# |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1298 |
# Sort the dependencies by length to visit the subsets before the |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1299 |
# supersets. |
3391
ab089cdd0665
22992245 pkgdepend missing files error message wrong when hash attribute provided
Mingrui Lyu <mingrui.lyu@oracle.com>
parents:
3366
diff
changeset
|
1300 |
# |
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1301 |
for cur_dep, cur_vars in sorted(deps, key=lambda i: len(str(i))): |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1302 |
if cur_dep.attrs["type"] not in ("require", "require-any"): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1303 |
res.append((cur_dep, cur_vars)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1304 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1305 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1306 |
cur_fmris = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1307 |
for f in cur_dep.attrlist("fmri"): |
2958
868e07939116
16851082 build_release (aka build version) should not be displayed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2753
diff
changeset
|
1308 |
cur_fmris.append(fmri.PkgFmri(f)) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1309 |
skip = False |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1310 |
# If we're resolving a pkg with a known name ... |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1311 |
if pkg_fmri is not None: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1312 |
for pfmri in cur_fmris: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1313 |
# Then if this package is a successor to any of |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1314 |
# the packages the dependency requires, then we |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1315 |
# can omit the dependency. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1316 |
if pkg_fmri.is_successor(pfmri): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1317 |
skip = True |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1318 |
if skip: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1319 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1320 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1321 |
# If this dependency isn't a require-any dependency, then it |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1322 |
# should be included in the output. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1323 |
if cur_dep.attrs["type"] != "require-any": |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1324 |
res.append((cur_dep, cur_vars)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1325 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1326 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1327 |
marked = False |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1328 |
# Now the require-any dependency is going to be compared to all |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1329 |
# the known require dependencies to see if it can be omitted. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1330 |
# It can be omitted if one of the packages it requires is |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1331 |
# already required. Because a require-any dependency could be |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1332 |
# omitted under some, but not all, variant combinations, the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1333 |
# satisfied set of the variant combination of the require-any |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1334 |
# dependency is used for bookkeeping. Each require dependency |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1335 |
# which has a successor to one of the packages in the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1336 |
# require-any dependency marks the variant combinations under |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1337 |
# which it's valid as unsatisfied in the require-any dependency. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1338 |
# At the end, if the require-any dependency is still satisfied |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1339 |
# under any variant combinations, then it's included in the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1340 |
# result. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1341 |
successors = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1342 |
for comp_dep, comp_vars in deps: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1343 |
if comp_dep.attrs["type"] != "require": |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1344 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1345 |
successor = False |
2958
868e07939116
16851082 build_release (aka build version) should not be displayed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2753
diff
changeset
|
1346 |
comp_fmri = fmri.PkgFmri(comp_dep.attrs["fmri"]) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1347 |
# Check to see whether the package required by the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1348 |
# require dependency is a successor to any of the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1349 |
# packages required by the require-any dependency. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1350 |
for c in cur_fmris: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1351 |
if comp_fmri.is_successor(c): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1352 |
successor = True |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1353 |
break |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1354 |
if not successor: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1355 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1356 |
# If comp_vars is empty, then no variants have been |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1357 |
# declared for these packages, so having a matching |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1358 |
# require dependency is enough to omit this require-any |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1359 |
# dependency. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1360 |
only_cur, inter, only_comp = \ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1361 |
cur_vars.separate_satisfied(comp_vars) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1362 |
if cur_vars.mark_as_unsatisfied(comp_vars) or \ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1363 |
comp_vars.is_empty(): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1364 |
marked = True |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1365 |
successors.append((comp_fmri, inter)) |
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1366 |
|
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1367 |
# If one require-any dependency is the subset of the other |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1368 |
# require-any dependency, we should drop the superset because |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1369 |
# ultimately they should end up with the package dependency |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1370 |
# as the subset requires. |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1371 |
# |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1372 |
# Note that we only drop the deps we generate (with the |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1373 |
# pkgdepend.debug.depend.* prefix); we ignore the deps a |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1374 |
# developer added. |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1375 |
is_superset = False |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1376 |
if files_prefix in cur_dep.attrs or \ |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1377 |
fullpaths_prefix in cur_dep.attrs: |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1378 |
# convert to a set for set operation |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1379 |
cur_fmris_set = set(cur_fmris) |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1380 |
for (comp_dep, comp_vars), comp_fmris_set in \ |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1381 |
six.iteritems(fmri_dict): |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1382 |
if comp_fmris_set != cur_fmris_set and \ |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1383 |
comp_fmris_set.issubset(cur_fmris_set) and \ |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1384 |
cur_vars == comp_vars: |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1385 |
is_superset = True |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1386 |
drop_f = cur_fmris_set - comp_fmris_set |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1387 |
warnings.append(DropPackageWarning( |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1388 |
drop_f, comp_dep)) |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1389 |
break |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1390 |
if not is_superset: |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1391 |
fmri_dict.setdefault((cur_dep, cur_vars), |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1392 |
cur_fmris_set) |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1393 |
|
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1394 |
# If the require-any dependency was never changed or is not a |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1395 |
# superset of any other require-any dependency, then include |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1396 |
# it. If it was changed, check whether there are situations |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1397 |
# where the require-any dependency is needed. |
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1398 |
if not marked and not is_superset: |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1399 |
res.append((cur_dep, cur_vars)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1400 |
continue |
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1401 |
if cur_vars.sat_set and not is_superset: |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1402 |
res.append((cur_dep, cur_vars)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1403 |
path_id = cur_dep.attrs.get(path_id_prefix, None) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1404 |
if path_id: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1405 |
omitted_req_any[path_id] = successors |
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1406 |
|
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1407 |
return res, omitted_req_any, warnings |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1408 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1409 |
def __remove_extraneous_conditionals(deps, omitted_req_any): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1410 |
"""Remove conditional dependencies which other dependencies have made |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1411 |
unnecessary. If an inferred require-any dependency was collapsed to a |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1412 |
require dependency, then only the conditional dependencies needed to |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1413 |
reach the require dependency should be retained.""" |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1414 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1415 |
def fmri_attrget(d): |
2958
868e07939116
16851082 build_release (aka build version) should not be displayed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2753
diff
changeset
|
1416 |
return fmri.PkgFmri(d[0].attrs["fmri"]).get_pkg_stem( |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1417 |
include_scheme=False) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1418 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1419 |
def path_id_attrget(d): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1420 |
return d[0].attrs.get(path_id_prefix, None) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1421 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1422 |
req_dict = {} |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1423 |
for target, group in itertools.groupby(sorted( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1424 |
[(d, v) for d, v in deps if d.attrs["type"] == "require"], |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1425 |
key=fmri_attrget), fmri_attrget): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1426 |
req_dict[target] = list(group) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1427 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1428 |
needed_cond_deps = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1429 |
for path_id, group in itertools.groupby(sorted( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1430 |
[(d, v) for d, v in deps if d.attrs["type"] == "conditional"], |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1431 |
key=path_id_attrget), path_id_attrget): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1432 |
# Because of how the list was created, each dependency in |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1433 |
# successors is not satisfied under the same set of variant |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1434 |
# values as any other dependency in successors. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1435 |
successors = omitted_req_any.get(path_id, []) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1436 |
for d, v in group: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1437 |
# If this conditional dependency was part of a path to a |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1438 |
# require-any dependency which was reduced to a require |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1439 |
# dependency under some combinations of variants, then |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1440 |
# make sure this conditional doesn't apply under those |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1441 |
# combinations of variants. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1442 |
skip = False |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1443 |
for s_d, s_v in successors: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1444 |
# If s_v is empty, then s_d applies under all |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1445 |
# variant combinations. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1446 |
if s_v.is_empty(): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1447 |
skip = True |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1448 |
break |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1449 |
v.mark_as_unsatisfied(s_v) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1450 |
if skip or (not v.is_empty() and not v.sat_set): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1451 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1452 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1453 |
# If this conditional dependency's fmri is also the fmri |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1454 |
# of a require dependency, then it can be ignored under |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1455 |
# those combinations of variants under which the require |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1456 |
# dependency applies. |
2958
868e07939116
16851082 build_release (aka build version) should not be displayed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2753
diff
changeset
|
1457 |
d_fmri = fmri.PkgFmri(d.attrs["fmri"]) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1458 |
for r_d, r_v in req_dict.get(d_fmri.get_pkg_stem( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1459 |
include_scheme=False), []): |
2958
868e07939116
16851082 build_release (aka build version) should not be displayed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2753
diff
changeset
|
1460 |
r_fmri = fmri.PkgFmri(r_d.attrs["fmri"]) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1461 |
if not r_fmri.is_successor(d_fmri): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1462 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1463 |
if r_v.is_empty(): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1464 |
skip = True |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1465 |
break |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1466 |
v.mark_as_unsatisfied(r_v) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1467 |
if not skip and (v.is_empty() or v.sat_set): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1468 |
needed_cond_deps.append((d, v)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1469 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1470 |
return [(d, v) for d, v in deps if d.attrs["type"] != "conditional"] + \ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1471 |
needed_cond_deps |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1472 |
|
2411
936617650fa1
18150 MultiplePackagesPathError should include package
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2381
diff
changeset
|
1473 |
def combine(deps, pkg_vars, pkg_fmri, pkg_name): |
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1474 |
"""Combine duplicate dependency actions. |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1475 |
|
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1476 |
'deps' is a list of tuples. Each tuple contains a dependency action and |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1477 |
the variants associated with that dependency. |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1478 |
|
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1479 |
'pkg_vars' are the variants that the package for which dependencies are |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
1480 |
being generated was published against. |
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
1481 |
|
2411
936617650fa1
18150 MultiplePackagesPathError should include package
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2381
diff
changeset
|
1482 |
'pkg_fmri' is the name of the package being resolved. This can be None. |
936617650fa1
18150 MultiplePackagesPathError should include package
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2381
diff
changeset
|
1483 |
|
936617650fa1
18150 MultiplePackagesPathError should include package
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2381
diff
changeset
|
1484 |
'pkg_name' is either the same as 'pkg_fmri', if 'pkg_fmri' is not None, |
936617650fa1
18150 MultiplePackagesPathError should include package
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2381
diff
changeset
|
1485 |
or it's the basename of the path to the manifest being resolved.""" |
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1486 |
|
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1487 |
def action_group_key(d): |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1488 |
"""Return a key on which the tuples can be sorted and grouped |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1489 |
so that the groups match the duplicate actions that the code |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1490 |
in pkg.manifest notices.""" |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1491 |
|
2283
c368082b6a17
16499 pkgdepend resolve -mo includes manifest path in output stream
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2275
diff
changeset
|
1492 |
# d is a tuple containing two items. d[0] is the action. d[1] |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1493 |
|
2283
c368082b6a17
16499 pkgdepend resolve -mo includes manifest path in output stream
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2275
diff
changeset
|
1494 |
# is the VariantCombination for this action. The |
c368082b6a17
16499 pkgdepend resolve -mo includes manifest path in output stream
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2275
diff
changeset
|
1495 |
# VariantCombination isn't useful for our grouping needs. |
c368082b6a17
16499 pkgdepend resolve -mo includes manifest path in output stream
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2275
diff
changeset
|
1496 |
return d[0].name, d[0].attrs.get("type", None), \ |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1497 |
d[0].attrs.get("predicate", None), \ |
2283
c368082b6a17
16499 pkgdepend resolve -mo includes manifest path in output stream
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2275
diff
changeset
|
1498 |
d[0].attrs.get(d[0].key_attr, id(d[0])) |
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1499 |
|
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1500 |
def add_vars(d, d_vars, pkg_vars): |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1501 |
"""Add the variants 'd_vars' to the dependency 'd', after |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1502 |
removing the variants matching those defined in 'pkg_vars'.""" |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1503 |
|
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1504 |
d_vars.simplify(pkg_vars) |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1505 |
res = [] |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1506 |
for s in d_vars.sat_set: |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1507 |
attrs = d.attrs.copy() |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1508 |
attrs.update(s) |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1509 |
t = actions.depend.DependencyAction(**attrs) |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1510 |
t.consolidate_attrs() |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1511 |
res.append(t) |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1512 |
if not res: |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1513 |
d.consolidate_attrs() |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1514 |
res = [d] |
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1515 |
return res |
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1516 |
|
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1517 |
# Transform conditional dependencies into require or require-any |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1518 |
# dependencies where possible. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1519 |
res = __collapse_conditionals(deps) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1520 |
|
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
1521 |
errs = [] |
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
1522 |
|
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1523 |
# Remove require dependencies on this package and require-any |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1524 |
# dependencies which are unneeded. |
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1525 |
res, omitted_require_any, warnings = \ |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1526 |
__remove_unneeded_require_and_require_any(res, pkg_fmri) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1527 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1528 |
# Now remove all conditionals which are no longer needed. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1529 |
res = __remove_extraneous_conditionals(res, omitted_require_any) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1530 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1531 |
# There are certain dependency relationships between packages that the |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1532 |
# current dependency types can't properly represent. One is the case |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1533 |
# where if A is present then either B or C must be installed. In this |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1534 |
# situation, find_package_using_delivered_files will have inferred a |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1535 |
# conditional dependency on B if A is present and another one on C if A |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1536 |
# is present. The following code detects this situation and provides an |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1537 |
# error to the user. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1538 |
conflicts = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1539 |
for (predicate, path_id), group in itertools.groupby(sorted( |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1540 |
[(d, v) for d, v in res if d.attrs["type"] == "conditional"], |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1541 |
key=__predicate_path_id_attrget), __predicate_path_id_attrget): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1542 |
if not path_id: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1543 |
continue |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1544 |
group = list(group) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1545 |
for i, (d1, v1) in enumerate(group): |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1546 |
for d2, v2 in group[i + 1:]: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1547 |
only_v1, inter, only_v2 = \ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1548 |
v1.separate_satisfied(v2) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1549 |
if (inter.is_empty() or inter.sat_set) and \ |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1550 |
d1.attrs["fmri"] != d2.attrs["fmri"]: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1551 |
conflicts.append((d1, d2, inter)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1552 |
if conflicts: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1553 |
errs.append(NeedConditionalRequireAny(conflicts, pkg_vars)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1554 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1555 |
# For each group of dependencies (g) for a particular fmri (k) merge |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1556 |
# together depedencies on the same fmri with different variants. |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1557 |
new_res = [] |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1558 |
for k, group in itertools.groupby(sorted(res, key=action_group_key), |
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1559 |
action_group_key): |
2288
29c3afa79a1b
18130 pkgdepend doesn't simplify variants where it should
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2283
diff
changeset
|
1560 |
group = list(group) |
29c3afa79a1b
18130 pkgdepend doesn't simplify variants where it should
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2283
diff
changeset
|
1561 |
res_dep = group[0][0] |
29c3afa79a1b
18130 pkgdepend doesn't simplify variants where it should
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2283
diff
changeset
|
1562 |
res_vars = variants.VariantCombinations(pkg_vars, False) |
29c3afa79a1b
18130 pkgdepend doesn't simplify variants where it should
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2283
diff
changeset
|
1563 |
for cur_dep, cur_vars in group: |
29c3afa79a1b
18130 pkgdepend doesn't simplify variants where it should
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2283
diff
changeset
|
1564 |
merge_deps(res_dep, cur_dep) |
29c3afa79a1b
18130 pkgdepend doesn't simplify variants where it should
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2283
diff
changeset
|
1565 |
res_vars.mark_as_satisfied(cur_vars) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1566 |
new_res.append((res_dep, res_vars)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1567 |
res = new_res |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1568 |
|
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1569 |
# Merge the variant information into the depend action. |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
1570 |
new_res = [] |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1571 |
for d, vc in res: |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1572 |
new_res.extend(add_vars(d, vc, pkg_vars)) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1573 |
res = new_res |
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1574 |
|
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1575 |
return res, errs, warnings |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
1576 |
|
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
1577 |
def split_off_variants(dep, pkg_vars, satisfied=False): |
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1578 |
"""Take a dependency which may be tagged with variants and move those |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1579 |
tags into a VariantSet.""" |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1580 |
|
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1581 |
dep_vars = dep.get_variant_template() |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1582 |
if not dep_vars.issubset(pkg_vars): |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1583 |
raise __NotSubset(dep_vars.difference(pkg_vars)) |
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1584 |
dep_vars.merge_unknown(pkg_vars) |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1585 |
# Since all variant information is being kept in the above VariantSets, |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1586 |
# remove the variant information from the action. This prevents |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1587 |
# confusion about which is the authoritative source of information. |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1588 |
dep.strip_variants() |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
1589 |
return dep, variants.VariantCombinations(dep_vars, satisfied=satisfied) |
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1590 |
|
1845
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1591 |
def prune_debug_attrs(action): |
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1592 |
"""Given a dependency action with pkg.debug.depend attributes |
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1593 |
return a matching action with those attributes removed""" |
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1594 |
|
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3171
diff
changeset
|
1595 |
attrs = dict((k, v) for k, v in six.iteritems(action.attrs) |
1845
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1596 |
if not k.startswith(base.Dependency.DEPEND_DEBUG_PREFIX)) |
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1597 |
return actions.depend.DependencyAction(**attrs) |
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1598 |
|
2275
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1599 |
def add_fmri_path_mapping(files_dict, links_dict, pfmri, mfst, |
2502
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1600 |
distro_vars=None, use_template=False): |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1601 |
"""Add mappings from path names to FMRIs and variants. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1602 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1603 |
'files_dict' is a dictionary which maps package identity to the files |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1604 |
the package delivers and the variants under which each file is |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1605 |
present. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1606 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1607 |
'links_dict' is a dictionary which maps package identity to the links |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1608 |
the package delivers and the variants under which each link is |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1609 |
present. |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1610 |
|
2275
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1611 |
'pfmri' is the FMRI of the current manifest. |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1612 |
|
2275
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1613 |
'mfst' is the manifest to process. |
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1614 |
|
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1615 |
'distro_vars' is a VariantCombinationTemplate which contains all the |
2502
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1616 |
variant types and values known. |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1617 |
|
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1618 |
'use_template is a boolean which indicates whether to fill the |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1619 |
dictionaries with VariantCombinationTemplates instead of |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1620 |
VariantCombinations.""" |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1621 |
|
2502
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1622 |
assert not distro_vars or not use_template |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1623 |
if not use_template: |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1624 |
pvariants = mfst.get_all_variants() |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1625 |
if distro_vars: |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1626 |
pvariants.merge_unknown(distro_vars) |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1627 |
|
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1628 |
for f in mfst.gen_actions_by_type("file"): |
2502
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1629 |
vc = f.get_variant_template() |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1630 |
if not use_template: |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1631 |
vc.merge_unknown(pvariants) |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1632 |
vc = variants.VariantCombinations(vc, |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1633 |
satisfied=True) |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1634 |
files_dict.setdefault(f.attrs["path"], []).append( |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1635 |
(pfmri, vc)) |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1636 |
for f in itertools.chain(mfst.gen_actions_by_type("hardlink"), |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1637 |
mfst.gen_actions_by_type("link")): |
2502
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1638 |
vc = f.get_variant_template() |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1639 |
if not use_template: |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1640 |
vc.merge_unknown(pvariants) |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1641 |
vc = variants.VariantCombinations(vc, |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1642 |
satisfied=True) |
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1643 |
links_dict.setdefault(f.attrs["path"], []).append( |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1644 |
(pfmri, vc, f.attrs["target"])) |
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1645 |
|
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1646 |
def __safe_fmri_parse(txt): |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1647 |
dep_name = None |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1648 |
try: |
2958
868e07939116
16851082 build_release (aka build version) should not be displayed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2753
diff
changeset
|
1649 |
dep_name = fmri.PkgFmri(txt).pkg_name |
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1650 |
except fmri.IllegalFmri: |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1651 |
pass |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1652 |
return dep_name |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1653 |
|
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1654 |
def resolve_deps(manifest_paths, api_inst, system_patterns, prune_attrs=False): |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1655 |
"""For each manifest given, resolve the file dependencies to package |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1656 |
dependencies. It returns a mapping from manifest_path to a list of |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1657 |
dependencies and a list of unresolved dependencies. |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1658 |
|
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1659 |
'manifest_paths' is a list of paths to the manifests being resolved. |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1660 |
|
1845
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1661 |
'api_inst' is an ImageInterface which references the current image. |
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1662 |
|
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1663 |
'system_patterns' is a list of patterns which determines the system |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1664 |
packages that are resolved against. |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1665 |
|
1845
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1666 |
'prune_attrs' is a boolean indicating whether debugging |
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1667 |
attributes should be stripped from returned actions.""" |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1668 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1669 |
# The variable 'manifests' is a list of 5-tuples. The first element |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1670 |
# of the tuple is the path to the manifest. The second is the name of |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1671 |
# the package contained in the manifest. The third is the manifest |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1672 |
# object for the manifest in that location. The fourth is the list of |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1673 |
# variants the package was published against. The fifth is the list of |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1674 |
# files referenced in the manifest that couldn't be found. |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1675 |
manifests = [ |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1676 |
(mp, choose_name(mp, mfst), mfst, mfst.get_all_variants(), |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1677 |
manifest_errs) |
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1678 |
for mp, (mfst, manifest_errs) in |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1679 |
((mp, __make_manifest(mp, load_data=False)) |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1680 |
for mp in manifest_paths) |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1681 |
] |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1682 |
|
2159
be07d9cad5a7
16013 ON build noise from pkgdepend about perl's complicated symlinks
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2091
diff
changeset
|
1683 |
files = Entries({}, {}) |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
1684 |
links = {} |
1856
68eb900fbed5
14869 pkgdepend shouldn't include the timestamp in resolved dependencies
Richard Lowe <richlowe@richlowe.net>
parents:
1845
diff
changeset
|
1685 |
|
2275
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1686 |
# This records all the variants used in any package known. It is used |
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1687 |
# to ensure that all packages live in the same variant universe for |
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1688 |
# purposes of dependency resolution. |
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1689 |
distro_vars = variants.VariantCombinationTemplate() |
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1690 |
|
2298
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
1691 |
resolving_pkgs = set() |
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
1692 |
|
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
1693 |
for mp, (name, pfmri), mfst, pkg_vars, miss_files in manifests: |
2275
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1694 |
distro_vars.merge_values(pkg_vars) |
2298
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
1695 |
if pfmri: |
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
1696 |
resolving_pkgs.add(pfmri.pkg_name) |
2275
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1697 |
|
2502
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1698 |
def __merge_actvct_with_pkgvct(act_vct, pkg_vct): |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1699 |
act_vct.merge_unknown(pkg_vct) |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1700 |
return variants.VariantCombinations(act_vct, satisfied=True) |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1701 |
|
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1702 |
sys_fmris = set() |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1703 |
unmatched_patterns = set() |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1704 |
if system_patterns: |
2502
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1705 |
pkg_list = api_inst.get_pkg_list( |
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1706 |
api.ImageInterface.LIST_INSTALLED, |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1707 |
patterns=system_patterns, raise_unmatched=True) |
2502
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1708 |
tmp_files = {} |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1709 |
tmp_links = {} |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1710 |
package_vars = {} |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1711 |
pkg_cnt = 0 |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1712 |
# Gather information from installed packages |
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1713 |
# Because get_pkg_list returns a generator, the |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1714 |
# InventoryException raised when a pattern has no matches isn't |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1715 |
# raised until all the matching patterns have been iterated |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1716 |
# over. |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1717 |
try: |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1718 |
for (pub, stem, ver), summ, cats, states, attrs in \ |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1719 |
pkg_list: |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1720 |
# If this package is being resolved, then that's |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1721 |
# the information to use. |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1722 |
if stem in resolving_pkgs: |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1723 |
continue |
2753
4d4b2324d1c0
7139940 cached manifests persist for packages not currently installed even when copy in repository changes
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2639
diff
changeset
|
1724 |
# To get the manifest, we need an fmri with a |
4d4b2324d1c0
7139940 cached manifests persist for packages not currently installed even when copy in repository changes
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2639
diff
changeset
|
1725 |
# publisher because we need to be able to check |
4d4b2324d1c0
7139940 cached manifests persist for packages not currently installed even when copy in repository changes
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2639
diff
changeset
|
1726 |
# if the package is installed. |
4d4b2324d1c0
7139940 cached manifests persist for packages not currently installed even when copy in repository changes
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2639
diff
changeset
|
1727 |
pfmri = fmri.PkgFmri(publisher=pub, name=stem, |
4d4b2324d1c0
7139940 cached manifests persist for packages not currently installed even when copy in repository changes
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2639
diff
changeset
|
1728 |
version=ver) |
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1729 |
mfst = api_inst.get_manifest(pfmri, |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1730 |
all_variants=True) |
2753
4d4b2324d1c0
7139940 cached manifests persist for packages not currently installed even when copy in repository changes
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2639
diff
changeset
|
1731 |
# But we don't want fmris with publishers as |
4d4b2324d1c0
7139940 cached manifests persist for packages not currently installed even when copy in repository changes
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2639
diff
changeset
|
1732 |
# targets of dependencies, so remove the |
4d4b2324d1c0
7139940 cached manifests persist for packages not currently installed even when copy in repository changes
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2639
diff
changeset
|
1733 |
# publisher. |
4d4b2324d1c0
7139940 cached manifests persist for packages not currently installed even when copy in repository changes
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2639
diff
changeset
|
1734 |
pfmri.publisher = None |
4d4b2324d1c0
7139940 cached manifests persist for packages not currently installed even when copy in repository changes
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2639
diff
changeset
|
1735 |
sys_fmris.add(pfmri.pkg_name) |
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1736 |
distro_vars.merge_values( |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1737 |
mfst.get_all_variants()) |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1738 |
package_vars[stem] = mfst.get_all_variants() |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1739 |
add_fmri_path_mapping(tmp_files, tmp_links, |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1740 |
pfmri, mfst, use_template=True) |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1741 |
pkg_cnt += 1 |
3171
525f5bdb3f62
20434301 change exception handling syntax for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3158
diff
changeset
|
1742 |
except apx.InventoryException as e: |
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1743 |
# If "*" didn't match any packages, then the image was |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1744 |
# empty. |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1745 |
try: |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1746 |
e.notfound.remove("*") |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1747 |
except ValueError: |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1748 |
pass |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1749 |
unmatched_patterns.update(e.notfound) |
2502
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1750 |
del pkg_list |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1751 |
# Move all package variants into the same universe. |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1752 |
for pkg_vct in package_vars.values(): |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1753 |
pkg_vct.merge_unknown(distro_vars) |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1754 |
# Populate the installed files dictionary. |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3171
diff
changeset
|
1755 |
for pth, l in six.iteritems(tmp_files): |
2502
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1756 |
new_val = [ |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1757 |
(p, __merge_actvct_with_pkgvct(tmpl, |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1758 |
package_vars[p.pkg_name])) |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1759 |
for (p, tmpl) in l |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1760 |
] |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1761 |
files.installed[pth] = new_val |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1762 |
del tmp_files |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1763 |
# Populate the link dictionary using the installed packages' |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1764 |
# information. |
3234
3a90dc0b66c9
21188662 use six library for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3171
diff
changeset
|
1765 |
for pth, l in six.iteritems(tmp_links): |
2502
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1766 |
new_val = [ |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1767 |
(p, __merge_actvct_with_pkgvct(tmpl, |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1768 |
package_vars[p.pkg_name]), target) |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1769 |
for (p, tmpl, target) in l |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1770 |
] |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1771 |
links[pth] = new_val |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1772 |
del tmp_links |
aaeebfbd0446
18702 pkgdepend resolve can be faster
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2493
diff
changeset
|
1773 |
del package_vars |
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1774 |
|
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1775 |
res_fmris = set() |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1776 |
# Build a list of all files delivered in the manifests being resolved. |
2298
c15c3c1a5590
18172 p.d.d.file is misleading when links are involved
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2288
diff
changeset
|
1777 |
for mp, (name, pfmri), mfst, pkg_vars, miss_files in manifests: |
2428
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
1778 |
try: |
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
1779 |
if pfmri is None: |
2958
868e07939116
16851082 build_release (aka build version) should not be displayed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
2753
diff
changeset
|
1780 |
pfmri = fmri.PkgFmri(name) |
3171
525f5bdb3f62
20434301 change exception handling syntax for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3158
diff
changeset
|
1781 |
except fmri.IllegalFmri as e: |
2428
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
1782 |
raise BadPackageFmri(mp, e) |
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
1783 |
add_fmri_path_mapping(files.delivered, links, pfmri, mfst, |
25adeb0b7928
16849 pkgdepend doesn't handle invalid or incomplete package FMRIs gracefully
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2411
diff
changeset
|
1784 |
distro_vars) |
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1785 |
res_fmris.add(pfmri.pkg_name) |
1856
68eb900fbed5
14869 pkgdepend shouldn't include the timestamp in resolved dependencies
Richard Lowe <richlowe@richlowe.net>
parents:
1845
diff
changeset
|
1786 |
|
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1787 |
pkg_deps = {} |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1788 |
errs = [] |
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1789 |
warnings = [] |
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1790 |
external_deps = set() |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1791 |
for mp, (name, pfmri), mfst, pkg_vars, manifest_errs in manifests: |
2411
936617650fa1
18150 MultiplePackagesPathError should include package
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2381
diff
changeset
|
1792 |
name_to_use = pfmri or name |
2275
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1793 |
# The add_fmri_path_mapping function moved the actions it found |
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1794 |
# into the distro_vars universe of variants, so we need to move |
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1795 |
# pkg_vars (and by extension the variants on depend actions) |
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1796 |
# into that universe too. |
eed34df93728
18045 pkgdepend resolve fails to recognize unvarianted dependencies
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2236
diff
changeset
|
1797 |
pkg_vars.merge_unknown(distro_vars) |
2600
2e02df71b0be
19009 pkgdepend can't decide which gcc runtime version to output so errors out instead
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2538
diff
changeset
|
1798 |
errs.extend(manifest_errs) |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1799 |
if mfst is None: |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1800 |
pkg_deps[mp] = None |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1801 |
continue |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1802 |
ds = [] |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1803 |
bad_ds = {} |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1804 |
for d in mfst.gen_actions_by_type("depend"): |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1805 |
if not is_file_dependency(d): |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1806 |
continue |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1807 |
try: |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1808 |
r = split_off_variants(d, pkg_vars) |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1809 |
ds.append(r) |
3171
525f5bdb3f62
20434301 change exception handling syntax for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3158
diff
changeset
|
1810 |
except __NotSubset as e: |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1811 |
diff = bad_ds.setdefault(d.attrs[reason_prefix], |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1812 |
variants.VCTDifference(set(), set())) |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1813 |
diff.type_diffs.update(e.diff.type_diffs) |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1814 |
diff.value_diffs.update(e.diff.value_diffs) |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1815 |
if bad_ds: |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1816 |
errs.append(ExtraVariantedDependency(name_to_use, |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1817 |
bad_ds, False)) |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1818 |
|
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1819 |
pkg_res = [ |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1820 |
(d, find_package(files, links, d, d_vars, pkg_vars, |
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1821 |
bool(system_patterns))) |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1822 |
for d, d_vars in ds |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1823 |
] |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1824 |
|
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1825 |
# Seed the final results with those dependencies defined |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1826 |
# manually. |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1827 |
deps = [] |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1828 |
bad_deps = {} |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1829 |
for d in mfst.gen_actions_by_type("depend"): |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1830 |
if is_file_dependency(d): |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1831 |
continue |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1832 |
try: |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1833 |
r = split_off_variants(d, pkg_vars, |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1834 |
satisfied=True) |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1835 |
deps.append(r) |
3171
525f5bdb3f62
20434301 change exception handling syntax for python 3 migration
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3158
diff
changeset
|
1836 |
except __NotSubset as e: |
2462
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1837 |
diff = bad_deps.setdefault( |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1838 |
d.attrs.get("fmri", None), |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1839 |
variants.VCTDifference(set(), set())) |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1840 |
diff.type_diffs.update(e.diff.type_diffs) |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1841 |
diff.value_diffs.update(e.diff.value_diffs) |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1842 |
if bad_deps: |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1843 |
errs.append(ExtraVariantedDependency(name_to_use, |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1844 |
bad_deps, True)) |
d89a0da0a548
17756 action with more variants than its package raises assertion
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2428
diff
changeset
|
1845 |
|
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1846 |
for file_dep, (res, dep_vars, pkg_errs) in pkg_res: |
2411
936617650fa1
18150 MultiplePackagesPathError should include package
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2381
diff
changeset
|
1847 |
for e in pkg_errs: |
936617650fa1
18150 MultiplePackagesPathError should include package
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2381
diff
changeset
|
1848 |
if hasattr(e, "pkg_name"): |
936617650fa1
18150 MultiplePackagesPathError should include package
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2381
diff
changeset
|
1849 |
e.pkg_name = name_to_use |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1850 |
errs.extend(pkg_errs) |
2091
824491c11ff3
15958 generate gets partially satisfied internal dependencies wrong
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2073
diff
changeset
|
1851 |
dep_vars.simplify(pkg_vars) |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1852 |
if not res: |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1853 |
errs.append(UnresolvedDependencyError(mp, |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1854 |
file_dep, dep_vars)) |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1855 |
else: |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1856 |
deps.extend(res) |
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1857 |
if not dep_vars.is_satisfied(): |
1544
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1858 |
errs.append(UnresolvedDependencyError( |
e0ce5081236a
12697 pkgdep throws an exception for $PLATFORM or $ISALIST in runpath
Brock Pytlik <bpytlik@sun.com>
parents:
1516
diff
changeset
|
1859 |
mp, file_dep, dep_vars)) |
1756
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1860 |
# Add variant information to the dependency actions and combine |
0dd15313e977
14118 pkgdepend resolve results in repeated dependencies
Brock Pytlik <bpytlik@sun.com>
parents:
1674
diff
changeset
|
1861 |
# what would otherwise be duplicate dependencies. |
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1862 |
deps, combine_errs, combine_warnings = combine(deps, pkg_vars, |
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1863 |
pfmri, name_to_use) |
2381
45a20c3a277a
11307 pkgdep can traceback for unprivileged user
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2298
diff
changeset
|
1864 |
errs.extend(combine_errs) |
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1865 |
warnings.extend(combine_warnings) |
1845
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1866 |
|
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1867 |
ext_pfmris = [ |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1868 |
pkg_name |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1869 |
for pkg_name in ( |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1870 |
__safe_fmri_parse(pfmri) |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1871 |
for a in deps |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1872 |
for pfmri in a.attrlist("fmri") |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1873 |
if a.attrs["type"] in |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1874 |
("conditional", "require", "require-any") |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1875 |
) |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1876 |
if pkg_name is not None |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1877 |
if pkg_name not in res_fmris |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1878 |
] |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1879 |
external_deps.update(ext_pfmris) |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1880 |
sys_fmris.difference_update(ext_pfmris) |
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1881 |
|
1845
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1882 |
if prune_attrs: |
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1883 |
deps = [prune_debug_attrs(d) for d in deps] |
1337
52e101b7cc31
9293 there should be a way to automatically infer/audit package dependencies for a package
Brock Pytlik <bpytlik@sun.com>
parents:
1231
diff
changeset
|
1884 |
pkg_deps[mp] = deps |
1845
d9a33bd442b5
14870 pkgdep should strip dependency debugging information
Richard Lowe <richlowe@richlowe.net>
parents:
1756
diff
changeset
|
1885 |
|
2601
4143eb80c3ba
18975 resolve should be able to restrict which packages are used as fall back
Brock Pytlik <brock.pytlik@oracle.com>
parents:
2600
diff
changeset
|
1886 |
sys_fmris.update(unmatched_patterns) |
3265
c006f082699c
21329151 ON build fails with perl-520 installed
Yiteng Zhang <yiteng.zhang@oracle.com>
parents:
3234
diff
changeset
|
1887 |
return pkg_deps, errs, warnings, sys_fmris, external_deps |