Gentoo Archives: gentoo-commits

From: "Zac Medico (zmedico)" <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] portage r10483 - main/branches/2.1.2/bin
Date: Thu, 29 May 2008 21:19:54
Message-Id: E1K1pXJ-0001it-6Y@stork.gentoo.org
1 Author: zmedico
2 Date: 2008-05-29 21:19:48 +0000 (Thu, 29 May 2008)
3 New Revision: 10483
4
5 Modified:
6 main/branches/2.1.2/bin/emerge
7 Log:
8 Make --skipfirst handle missing dependencies by dropping the merge tasks
9 that have missing dependencies. This involves creating an entirely new
10 depgraph each time that a missing dependency is discovered. This isn't
11 the most efficient approach but it's simple and it works well.
12
13 This new behavior can server as a fix for bug #12768 by calling emerge
14 --resume --skipfirst each time that emerge exits unsuccessfully. This
15 was possible before, but now packages with unsatisfied dependencies
16 will be properly identified and dropped from the list.
17 (trunk r10477:10482)
18
19
20 Modified: main/branches/2.1.2/bin/emerge
21 ===================================================================
22 --- main/branches/2.1.2/bin/emerge 2008-05-29 21:00:16 UTC (rev 10482)
23 +++ main/branches/2.1.2/bin/emerge 2008-05-29 21:19:48 UTC (rev 10483)
24 @@ -5351,13 +5351,6 @@
25 if not isinstance(mergelist, list):
26 mergelist = []
27
28 - if mergelist and "--skipfirst" in self.myopts:
29 - for i, task in enumerate(mergelist):
30 - if isinstance(task, list) and \
31 - task and task[-1] == "merge":
32 - del mergelist[i]
33 - break
34 -
35 fakedb = self.mydbapi
36 trees = self.trees
37 serialized_tasks = []
38 @@ -8291,11 +8284,43 @@
39 if show_spinner:
40 print "Calculating dependencies ",
41 myparams = create_depgraph_params(myopts, myaction)
42 - mydepgraph = depgraph(settings, trees,
43 - myopts, myparams, spinner)
44 +
45 + resume_data = mtimedb["resume"]
46 + mergelist = resume_data["mergelist"]
47 + if mergelist and "--skipfirst" in myopts:
48 + for i, task in enumerate(mergelist):
49 + if isinstance(task, list) and \
50 + task and task[-1] == "merge":
51 + del mergelist[i]
52 + break
53 +
54 + dropped_tasks = set()
55 +
56 success = False
57 try:
58 - success = mydepgraph.loadResumeCommand(mtimedb["resume"])
59 + while True:
60 + mydepgraph = depgraph(settings, trees,
61 + myopts, myparams, spinner)
62 + try:
63 + success = mydepgraph.loadResumeCommand(mtimedb["resume"])
64 + except depgraph.UnsatisfiedResumeDep, e:
65 + if "--skipfirst" not in myopts:
66 + raise
67 + unsatisfied_parents = set(dep.parent for dep in e.value)
68 + pruned_mergelist = []
69 + for task in mergelist:
70 + if isinstance(task, list) and \
71 + tuple(task) in unsatisfied_parents:
72 + continue
73 + pruned_mergelist.append(task)
74 + if not pruned_mergelist:
75 + raise
76 + mergelist[:] = pruned_mergelist
77 + dropped_tasks.update(unsatisfied_parents)
78 + del e, unsatisfied_parents
79 + continue
80 + else:
81 + break
82 except (portage_exception.PackageNotFound,
83 mydepgraph.UnsatisfiedResumeDep), e:
84 if show_spinner:
85 @@ -8329,7 +8354,9 @@
86 msg = "The resume list contains packages " + \
87 "with dependencies that have not been " + \
88 "installed yet. Please restart/continue " + \
89 - "the operation manually."
90 + "the operation manually, or use --skipfirst " + \
91 + "to skip the first package in the list and " + \
92 + "any other packages that may have missing dependencies."
93 for line in wrap(msg, 72):
94 out.eerror(line)
95 elif isinstance(e, portage_exception.PackageNotFound):
96 @@ -8346,7 +8373,16 @@
97 if show_spinner:
98 print "\b\b... done!"
99
100 - if not success:
101 + if success:
102 + if dropped_tasks:
103 + portage.writemsg("!!! One or more packages have been " + \
104 + "dropped due to unsatisfied dependencies:\n\n",
105 + noiselevel=-1)
106 + for task in dropped_tasks:
107 + portage.writemsg(" " + str(task) + "\n", noiselevel=-1)
108 + portage.writemsg("\n", noiselevel=-1)
109 + del dropped_tasks
110 + else:
111 mydepgraph.display_problems()
112 if not (ask or pretend):
113 # delete the current list and also the backup
114
115 --
116 gentoo-commits@l.g.o mailing list