1 |
Author: zmedico |
2 |
Date: 2009-04-30 07:17:28 +0000 (Thu, 30 Apr 2009) |
3 |
New Revision: 13513 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.6/bin/repoman |
7 |
Log: |
8 |
Use a new ProfileDesc class to handle the data for each profile listed in |
9 |
profiles.desc. (trunk r13357) |
10 |
|
11 |
Modified: main/branches/2.1.6/bin/repoman |
12 |
=================================================================== |
13 |
--- main/branches/2.1.6/bin/repoman 2009-04-30 07:17:13 UTC (rev 13512) |
14 |
+++ main/branches/2.1.6/bin/repoman 2009-04-30 07:17:28 UTC (rev 13513) |
15 |
@@ -609,6 +609,14 @@ |
16 |
|
17 |
logging.debug("Found the following packages to scan:\n%s" % '\n'.join(scanlist)) |
18 |
|
19 |
+class ProfileDesc(object): |
20 |
+ __slots__ = ('abs_path', 'status', 'sub_path', 'tree_path',) |
21 |
+ def __init__(self, status, sub_path, tree_path): |
22 |
+ self.status = status |
23 |
+ self.sub_path = normalize_path(sub_path.lstrip(os.sep)) |
24 |
+ self.tree_path = tree_path |
25 |
+ self.abs_path = os.path.join(tree_path, 'profiles', self.sub_path) |
26 |
+ |
27 |
profiles={} |
28 |
valid_profile_types = frozenset(["dev", "exp", "stable"]) |
29 |
descfile=portdir+"/profiles/profiles.desc" |
30 |
@@ -628,13 +636,11 @@ |
31 |
elif arch[2] not in valid_profile_types: |
32 |
err("invalid profile type: \"" + bad(arch[2]) + "\" in " + \ |
33 |
descfile + " line %d" % (i+1, )) |
34 |
- if not os.path.isdir(portdir+"/profiles/"+arch[1]): |
35 |
+ profile_desc = ProfileDesc(arch[2], arch[1], portdir) |
36 |
+ if not os.path.isdir(profile_desc.abs_path): |
37 |
print "Invalid "+arch[2]+" profile ("+arch[1]+") for arch "+arch[0] |
38 |
continue |
39 |
- if arch[0] in profiles: |
40 |
- profiles[arch[0]]+= [[arch[1], arch[2]]] |
41 |
- else: |
42 |
- profiles[arch[0]] = [[arch[1], arch[2]]] |
43 |
+ profiles.setdefault(arch[0], []).append(profile_desc) |
44 |
|
45 |
for x in repoman_settings.archlist(): |
46 |
if x[0] == "~": |
47 |
@@ -659,11 +665,11 @@ |
48 |
""" |
49 |
type_arch_map = {} |
50 |
for arch, arch_profiles in profiles.iteritems(): |
51 |
- for profile_path, profile_type in arch_profiles: |
52 |
- arch_set = type_arch_map.get(profile_type) |
53 |
+ for prof in arch_profiles: |
54 |
+ arch_set = type_arch_map.get(prof.status) |
55 |
if arch_set is None: |
56 |
arch_set = set() |
57 |
- type_arch_map[profile_type] = arch_set |
58 |
+ type_arch_map[prof.status] = arch_set |
59 |
arch_set.add(arch) |
60 |
|
61 |
dev_keywords = type_arch_map.get('dev', set()) |
62 |
@@ -1524,23 +1530,20 @@ |
63 |
|
64 |
for prof in profiles[arch]: |
65 |
|
66 |
- if prof[1] not in ("stable", "dev") or \ |
67 |
- prof[1] == "dev" and not options.include_dev: |
68 |
+ if prof.status not in ("stable", "dev") or \ |
69 |
+ prof.status == "dev" and not options.include_dev: |
70 |
continue |
71 |
|
72 |
- profdir = portdir+"/profiles/"+prof[0] |
73 |
- |
74 |
- if prof[0] in arch_caches: |
75 |
- dep_settings = arch_caches[prof[0]] |
76 |
- else: |
77 |
+ dep_settings = arch_caches.get(prof.sub_path) |
78 |
+ if dep_settings is None: |
79 |
dep_settings = portage.config( |
80 |
- config_profile_path=profdir, |
81 |
+ config_profile_path=prof.abs_path, |
82 |
config_incrementals=portage.const.INCREMENTALS, |
83 |
local_config=False, |
84 |
env=env) |
85 |
if options.without_mask: |
86 |
dep_settings.pmaskdict.clear() |
87 |
- arch_caches[prof[0]] = dep_settings |
88 |
+ arch_caches[prof.sub_path] = dep_settings |
89 |
while True: |
90 |
try: |
91 |
# Protect ACCEPT_KEYWORDS from config.regenerate() |
92 |
@@ -1549,7 +1552,7 @@ |
93 |
except ValueError: |
94 |
break |
95 |
|
96 |
- xmatch_cache_key = (prof[0], tuple(groups)) |
97 |
+ xmatch_cache_key = (prof.sub_path, tuple(groups)) |
98 |
xcache = arch_xmatch_caches.get(xmatch_cache_key) |
99 |
if xcache is None: |
100 |
portdb.melt() |
101 |
@@ -1571,7 +1574,8 @@ |
102 |
prov_cp = portage.dep_getkey(myprovide) |
103 |
if prov_cp not in dep_settings.getvirtuals(): |
104 |
stats["virtual.unavailable"]+=1 |
105 |
- fails["virtual.unavailable"].append(x+"/"+y+".ebuild: "+keyword+"("+prof[0]+") "+prov_cp) |
106 |
+ fails["virtual.unavailable"].append("%s: %s(%s) %s" % \ |
107 |
+ (relative_path, keyword, prof.sub_path, prov_cp)) |
108 |
|
109 |
if not baddepsyntax: |
110 |
ismasked = os.path.join(catdir, y) not in \ |
111 |
@@ -1593,7 +1597,7 @@ |
112 |
have_dev_keywords = \ |
113 |
bool(dev_keywords.intersection(keywords)) |
114 |
|
115 |
- if prof[1] == "dev": |
116 |
+ if prof.status == "dev": |
117 |
suffix=suffix+"indev" |
118 |
|
119 |
for mytype,mypos in [["DEPEND",len(missingvars)],["RDEPEND",len(missingvars)+1],["PDEPEND",len(missingvars)+2]]: |
120 |
@@ -1602,33 +1606,28 @@ |
121 |
myvalue = myaux[mytype] |
122 |
if not myvalue: |
123 |
continue |
124 |
- try: |
125 |
- mydep = portage.dep_check(myvalue, portdb, |
126 |
- dep_settings, use="all", mode=matchmode, |
127 |
- trees=trees) |
128 |
- except KeyError, e: |
129 |
- stats[mykey]=stats[mykey]+1 |
130 |
- fails[mykey].append(x+"/"+y+".ebuild: "+keyword+"("+prof[0]+") "+repr(e[0])) |
131 |
- continue |
132 |
- |
133 |
- if mydep[0]==1: |
134 |
- if mydep[1]!=[]: |
135 |
+ |
136 |
+ success, atoms = portage.dep_check(myvalue, portdb, |
137 |
+ dep_settings, use="all", mode=matchmode, |
138 |
+ trees=trees) |
139 |
+ |
140 |
+ if success: |
141 |
+ if atoms: |
142 |
#we have some unsolvable deps |
143 |
#remove ! deps, which always show up as unsatisfiable |
144 |
- d=0 |
145 |
- while d<len(mydep[1]): |
146 |
- if mydep[1][d][0]=="!": |
147 |
- del mydep[1][d] |
148 |
- else: |
149 |
- d += 1 |
150 |
+ atoms = [str(atom) for atom in atoms if not atom.blocker] |
151 |
#if we emptied out our list, continue: |
152 |
- if not mydep[1]: |
153 |
+ if not atoms: |
154 |
continue |
155 |
stats[mykey]=stats[mykey]+1 |
156 |
- fails[mykey].append(x+"/"+y+".ebuild: "+keyword+"("+prof[0]+") "+repr(mydep[1])) |
157 |
+ fails[mykey].append("%s: %s(%s) %s" % \ |
158 |
+ (relative_path, keyword, |
159 |
+ prof.sub_path, repr(atoms))) |
160 |
else: |
161 |
stats[mykey]=stats[mykey]+1 |
162 |
- fails[mykey].append(x+"/"+y+".ebuild: "+keyword+"("+prof[0]+") "+repr(mydep[1])) |
163 |
+ fails[mykey].append("%s: %s(%s) %s" % \ |
164 |
+ (relative_path, keyword, |
165 |
+ prof.sub_path, repr(atoms))) |
166 |
|
167 |
# Check for 'all unstable' or 'all masked' -- ACCEPT_KEYWORDS is stripped |
168 |
# XXX -- Needs to be implemented in dep code. Can't determine ~arch nicely. |