Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r9647 - main/branches/2.1.2/bin
Date: Mon, 31 Mar 2008 18:45:15
Message-Id: E1JgP0L-0000Za-2e@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-03-31 18:45:12 +0000 (Mon, 31 Mar 2008)
3 New Revision: 9647
4
5 Modified:
6 main/branches/2.1.2/bin/emerge
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. (trunk r9643)
11
12
13 Modified: main/branches/2.1.2/bin/emerge
14 ===================================================================
15 --- main/branches/2.1.2/bin/emerge 2008-03-31 18:14:27 UTC (rev 9646)
16 +++ main/branches/2.1.2/bin/emerge 2008-03-31 18:45:12 UTC (rev 9647)
17 @@ -466,8 +466,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 @@ -1169,7 +1175,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 @@ -1177,18 +1183,19 @@
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 return True
69
70 @@ -1768,8 +1775,7 @@
71 # - multi-slot atoms listed in the world file
72 # to prevent depclean from removing them
73
74 - if not visible(pkgsettings, pkg.cpv, pkg.metadata,
75 - built=pkg.built, installed=pkg.installed):
76 + if not visible(pkgsettings, pkg):
77 self._masked_installed.append((pkg, pkgsettings))
78
79 if arg:
80 @@ -2268,12 +2274,9 @@
81 if not installed:
82 if myarg:
83 found_available_arg = True
84 - try:
85 - if not visible(pkgsettings, cpv, metadata,
86 - built=built, installed=installed):
87 - continue
88 - except portage_exception.InvalidDependString:
89 - # masked by corruption
90 + if not visible(pkgsettings, Package(built=built,
91 + cpv=cpv, installed=installed, metadata=metadata,
92 + type_name=pkg_type)):
93 continue
94 # At this point, we've found the highest visible
95 # match from the current repo. Any lower versions
96 @@ -6091,8 +6094,8 @@
97 for cpv in reversed(pkgs):
98 metadata = dict(izip(metadata_keys,
99 vardb.aux_get(cpv, metadata_keys)))
100 - if visible(settings, cpv, metadata,
101 - built=True, installed=True):
102 + if visible(settings, Package(built=True, cpv=cpv,
103 + installed=True, metadata=metadata, type_name="installed")):
104 pkgs = [cpv]
105 break
106 if len(pkgs) > 1:
107
108 --
109 gentoo-commits@l.g.o mailing list