Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r9643 - main/trunk/pym/_emerge
Date: Mon, 31 Mar 2008 07:22:04
Message-Id: E1JgEL8-0004VC-M4@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-03-31 07:21:57 +0000 (Mon, 31 Mar 2008)
3 New Revision: 9643
4
5 Modified:
6 main/trunk/pym/_emerge/__init__.py
7 Log:
8 Pass Package instances into visible() so that the package instance can
9 be used to cache relevant visibility information such as whether or not
10 the package is corrupt or otherwise invalid.
11
12
13 Modified: main/trunk/pym/_emerge/__init__.py
14 ===================================================================
15 --- main/trunk/pym/_emerge/__init__.py 2008-03-30 23:51:26 UTC (rev 9642)
16 +++ main/trunk/pym/_emerge/__init__.py 2008-03-31 07:21:57 UTC (rev 9643)
17 @@ -472,8 +472,14 @@
18 def _visible(self, db, cpv, metadata):
19 installed = db is self.vartree.dbapi
20 built = installed or db is not self._portdb
21 - return visible(self.settings, cpv, metadata,
22 - built=built, installed=installed)
23 + pkg_type = "ebuild"
24 + if installed:
25 + pkg_type = "installed"
26 + elif built:
27 + pkg_type = "binary"
28 + return visible(self.settings,
29 + Package(type_name=pkg_type, root=self.settings["ROOT"],
30 + cpv=cpv, built=built, installed=installed, metadata=metadata))
31
32 def _xmatch(self, level, atom):
33 """
34 @@ -1052,7 +1058,7 @@
35 if updates:
36 mydb.aux_update(mycpv, updates)
37
38 -def visible(pkgsettings, cpv, metadata, built=False, installed=False):
39 +def visible(pkgsettings, pkg):
40 """
41 Check if a package is visible. This can raise an InvalidDependString
42 exception if LICENSE is invalid.
43 @@ -1060,20 +1066,24 @@
44 @rtype: Boolean
45 @returns: True if the package is visible, False otherwise.
46 """
47 - if not metadata["SLOT"]:
48 + if not pkg.metadata["SLOT"]:
49 return False
50 - if built and not installed and \
51 - metadata["CHOST"] != pkgsettings["CHOST"]:
52 + if pkg.built and not pkg.installed and \
53 + pkg.metadata["CHOST"] != pkgsettings["CHOST"]:
54 return False
55 - if not portage.eapi_is_supported(metadata["EAPI"]):
56 + if not portage.eapi_is_supported(pkg.metadata["EAPI"]):
57 return False
58 - if not installed and pkgsettings.getMissingKeywords(cpv, metadata):
59 + if not pkg.installed and \
60 + pkgsettings.getMissingKeywords(pkg.cpv, pkg.metadata):
61 return False
62 - if pkgsettings.getMaskAtom(cpv, metadata):
63 + if pkgsettings.getMaskAtom(pkg.cpv, pkg.metadata):
64 return False
65 - if pkgsettings.getProfileMaskAtom(cpv, metadata):
66 + if pkgsettings.getProfileMaskAtom(pkg.cpv, pkg.metadata):
67 return False
68 - if pkgsettings.getMissingLicenses(cpv, metadata):
69 + try:
70 + if pkgsettings.getMissingLicenses(pkg.cpv, pkg.metadata):
71 + return False
72 + except portage.exception.InvalidDependString:
73 return False
74 return True
75
76 @@ -1840,8 +1850,7 @@
77 if all_ebuilds_masked and not selective:
78 self._missing_args.append((arg, atom))
79
80 - if not visible(pkgsettings, pkg.cpv, pkg.metadata,
81 - built=pkg.built, installed=pkg.installed):
82 + if not visible(pkgsettings, pkg):
83 self._masked_installed.append((pkg, pkgsettings))
84
85 if args:
86 @@ -2422,12 +2431,9 @@
87 else:
88 metadata["USE"] = ""
89
90 - try:
91 - if not visible(pkgsettings, cpv, metadata,
92 - built=built, installed=installed):
93 - continue
94 - except portage.exception.InvalidDependString:
95 - # masked by corruption
96 + if not visible(pkgsettings, Package(built=built,
97 + cpv=cpv, root=myroot, type_name=pkg_type,
98 + installed=installed, metadata=metadata)):
99 continue
100
101 filtered_db.cpv_inject(cpv, metadata=metadata)
102 @@ -2631,12 +2637,9 @@
103 if not installed:
104 if myarg:
105 found_available_arg = True
106 - try:
107 - if not visible(pkgsettings, cpv, metadata,
108 - built=built, installed=installed):
109 - continue
110 - except portage.exception.InvalidDependString:
111 - # masked by corruption
112 + if not visible(pkgsettings, Package(built=built,
113 + cpv=cpv, installed=installed, metadata=metadata,
114 + type_name=pkg_type)):
115 continue
116 # At this point, we've found the highest visible
117 # match from the current repo. Any lower versions
118 @@ -6558,8 +6561,8 @@
119 for cpv in reversed(pkgs):
120 metadata = dict(izip(metadata_keys,
121 vardb.aux_get(cpv, metadata_keys)))
122 - if visible(settings, cpv, metadata,
123 - built=True, installed=True):
124 + if visible(settings, Package(built=True, cpv=cpv,
125 + installed=True, metadata=metadata, type_name="installed")):
126 pkgs = [cpv]
127 break
128 if len(pkgs) > 1:
129
130 --
131 gentoo-commits@l.g.o mailing list