Gentoo Archives: gentoo-portage-dev

From: Brian <dol-sen@×××××.net>
To: gentoo-portage-dev <gentoo-portage-dev@l.g.o>
Cc: Porthole-Developers <porthole-devel@×××××××××××××××××.net>
Subject: [gentoo-portage-dev] Possible bug in portdbapi.xmatch()
Date: Sun, 24 Dec 2006 13:52:02
Message-Id: 1166968107.11565.41.camel@localhost
1 Sorry, this is a long one :(
2
3 A user on the forums has been having problems with porthole-0.5.0 only
4 on his desktop, his laptop has been working fine. It has been the
5 dev-util/ecletex package causing porthole to stall when building the
6 descrition database for searches.
7
8 Testing on my machine has similar results. Porthole is unable to get
9 the description and other data because it cannot get an ebuild. It is
10 difficult to explain in short terms. Anyway porthole makes frequent
11 calls to portage for info rather than cache the info again, since the
12 xmatch() is a caching function. Porthole's portagelib.py (expanded for
13 added debug print statements):
14
15 def get_versions(full_name, include_masked = True):
16 """Returns all available ebuilds for the package"""
17 # Note: this is slow, especially when include_masked is false
18 criterion = include_masked and 'match-all' or 'match-visible'
19 v = portage.portdb.xmatch(criterion, str(full_name))
20 utils.debug.dprint("PORTAGELIB: get_versions(); criterion = %s, package = %s, v = %s" %(str(criterion),full_name,str(v)))
21 return v #portage.portdb.xmatch(criterion, str(full_name))
22
23 Data returned in portholes debug terminal with the print filter set:
24
25 big_squirt trunk # ./porthole -l -d ecletex
26 PORTHOLE: importing MainWindow
27 PORTAGE setting = backends.portagelib
28 PORTAGELIB: portage version = 2.1.2_rc4
29 import complete : <module 'backends.portagelib' from '/home/brian/trunk/backends/portagelib.pyc'>
30 opt, arg -l <type 'str'>
31 opt, arg -d ecletex <type 'str'>
32 Debug printing is enabled
33 ('Debug print filter set to ', 'ecletex')
34 PACKAGE: get_versions(); criterion = match-all, package = dev-util/ecletex
35 PORTAGELIB: get_versions(); criterion = match-all, package = dev-util/ecletex, v = ['dev-util/ecletex-0.0.3']
36 PACKAGE: get_versions(); v = ['dev-util/ecletex-0.0.3']
37 PACKAGE: get_latest_ebuild(); checking hard masked vers = ['dev-util/ecletex-0.0.3']
38 PACKAGE: get_versions(); criterion = match-all, package = dev-util/ecletex
39 PORTAGELIB: get_versions(); criterion = match-all, package = dev-util/ecletex, v = []
40 PACKAGE: get_versions(); criterion = match-all, package = dev-util/ecletex
41 PORTAGELIB: get_versions(); criterion = match-all, package = dev-util/ecletex, v = []
42 PACKAGE: get_versions(); criterion = match-all, package = dev-util/ecletex
43 PORTAGELIB: get_versions(); criterion = match-all, package = dev-util/ecletex, v = []
44 PACKAGE: get_versions(); criterion = match-all, package = dev-util/ecletex
45 PORTAGELIB: get_versions(); criterion = match-all, package = dev-util/ecletex, v = []
46 PACKAGE; get_properties(): No ebuild found for dev-util/ecletex!
47 PACKAGE: get_versions(); criterion = match-all, package = dev-util/ecletex
48 PORTAGELIB: get_versions(); criterion = match-all, package = dev-util/ecletex, v = []
49 PACKAGE: get_versions(); criterion = match-all, package = dev-util/ecletex
50 PORTAGELIB: get_versions(); criterion = match-all, package = dev-util/ecletex, v = []
51 READERS: DescriptionReader(); No description for ecletex
52
53
54 This is consistent behaviour for this package as well as
55 dev-util/eclipse-cdt. I have browsed around the tree in porthole and
56 found numerous other packages that do work for masked, hard-masked, or
57 stable, single ebuild packages, multiple ebuild packages, etc.. It was
58 happening on portage-2.1.2_rc3-r2. I synced, upgraded to -2.1.2_rc4 ,
59 restarted everything and have the same results.
60
61
62 So for another test I opened a new terminal entered python, imported
63 portage and tried repeated calls to xmatch(). It worked correctly!
64
65 >>> portage.portdb.xmatch('match-all', str('dev-util/ecletex'))
66 ['dev-util/ecletex-0.0.3']
67 >>> portage.portdb.xmatch('match-all', str('dev-util/ecletex'))
68 ['dev-util/ecletex-0.0.3']
69 >>> portage.portdb.xmatch('match-all', str('dev-util/ecletex'))
70 ['dev-util/ecletex-0.0.3']
71 >>> portage.portdb.xmatch('match-all', str('dev-util/ecletex'))
72 ['dev-util/ecletex-0.0.3']
73 >>> portage.portdb.xmatch('match-all', str('dev-util/ecletex'))
74 ['dev-util/ecletex-0.0.3']
75 >>> portage.portdb.xmatch('match-all', str('dev-util/ecletex'))
76 ['dev-util/ecletex-0.0.3']
77 >>> portage.portdb.xmatch('match-visible', str('dev-util/ecletex'))
78 []
79 >>> portage.portdb.xmatch('match-all', str('dev-util/ecletex'))
80 ['dev-util/ecletex-0.0.3']
81 >>>
82
83
84 Anyway following porthole's program flow to the
85 package.get_latest_ebuild():
86
87 def get_latest_ebuild(self, include_masked = False):
88 """Return latest ebuild of a package"""
89 # Note: this is slow, see get_versions()
90 # Note: doesn't return hard-masked packages by default, unless in package.unmask
91 # unstable packages however ARE returned. To return the best version for a system,
92 # taking into account keywords and masking, use get_best_ebuild().
93 if self.full_name == "None":
94 return ''
95 vers = self.get_versions()
96 utils.debug.dprint("PACKAGE: get_latest_ebuild(); versions: " + str(vers))
97 if include_masked:
98 utils.debug.dprint("PACKAGE: get_latest_ebuild(); trying portage_lib.best() of versions: " + str(vers))
99 return portage_lib.best(vers)
100 if self.latest_ebuild == None:
101 utils.debug.dprint("PACKAGE: get_latest_ebuild(); checking hard masked vers = " + str(vers))
102 for m in self.get_hard_masked(check_unmask = True):
103 while m in vers:
104 vers.remove(m)
105 self.latest_ebuild = portage_lib.best(vers)
106 return self.latest_ebuild
107
108 I discovered that portage.portdbapi.xmatch() returned a pointer to
109 myval. It seems porthole while removing the hard masked packages from
110 the list it was actually removing them from portages cache.
111
112 Changing: vers = self.get_versions()
113 To: vers = self.get_versions()[:] # make a copy
114
115 solved the problem. The part I do not understand is why was it only
116 screwing up for those packages (there may be more, I did not search all
117 of them out) and not other similar masked packages.
118
119 --
120 Brian <dol-sen@×××××.net>
121
122 --
123 gentoo-portage-dev@g.o mailing list

Replies

Subject Author
Re: [gentoo-portage-dev] Possible bug in portdbapi.xmatch() Zac Medico <zmedico@g.o>