1 |
Author: zmedico |
2 |
Date: 2008-05-03 03:49:45 +0000 (Sat, 03 May 2008) |
3 |
New Revision: 10125 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.2/bin/emerge |
7 |
Log: |
8 |
Move --resume options handling to the beginning of action_build() so |
9 |
that the current options are updated with the saved options as soon |
10 |
as possible. (trunk r10122:10124) |
11 |
|
12 |
|
13 |
Modified: main/branches/2.1.2/bin/emerge |
14 |
=================================================================== |
15 |
--- main/branches/2.1.2/bin/emerge 2008-05-03 03:47:21 UTC (rev 10124) |
16 |
+++ main/branches/2.1.2/bin/emerge 2008-05-03 03:49:45 UTC (rev 10125) |
17 |
@@ -7585,6 +7585,41 @@ |
18 |
|
19 |
def action_build(settings, trees, mtimedb, |
20 |
myopts, myaction, myfiles, spinner): |
21 |
+ |
22 |
+ # validate the state of the resume data |
23 |
+ # so that we can make assumptions later. |
24 |
+ for k in ("resume", "resume_backup"): |
25 |
+ if k in mtimedb: |
26 |
+ if "mergelist" in mtimedb[k]: |
27 |
+ if not mtimedb[k]["mergelist"]: |
28 |
+ del mtimedb[k] |
29 |
+ else: |
30 |
+ del mtimedb[k] |
31 |
+ |
32 |
+ resume = False |
33 |
+ if "--resume" in myopts and \ |
34 |
+ ("resume" in mtimedb or |
35 |
+ "resume_backup" in mtimedb): |
36 |
+ resume = True |
37 |
+ if "resume" not in mtimedb: |
38 |
+ mtimedb["resume"] = mtimedb["resume_backup"] |
39 |
+ del mtimedb["resume_backup"] |
40 |
+ mtimedb.commit() |
41 |
+ # "myopts" is a list for backward compatibility. |
42 |
+ resume_opts = mtimedb["resume"].get("myopts", []) |
43 |
+ if isinstance(resume_opts, list): |
44 |
+ resume_opts = dict((k,True) for k in resume_opts) |
45 |
+ for opt in ("--skipfirst", "--ask", "--tree"): |
46 |
+ resume_opts.pop(opt, None) |
47 |
+ myopts.update(resume_opts) |
48 |
+ # Adjust config according to options of the command being resumed. |
49 |
+ for myroot in trees: |
50 |
+ mysettings = trees[myroot]["vartree"].settings |
51 |
+ mysettings.unlock() |
52 |
+ adjust_config(myopts, mysettings) |
53 |
+ mysettings.lock() |
54 |
+ del myroot, mysettings |
55 |
+ |
56 |
ldpath_mtimes = mtimedb["ldpath"] |
57 |
favorites=[] |
58 |
merge_count = 0 |
59 |
@@ -7635,65 +7670,15 @@ |
60 |
print darkgreen("These are the packages that would be %s, in order:") % action |
61 |
print |
62 |
|
63 |
- # validate the state of the resume data |
64 |
- # so that we can make assumptions later. |
65 |
- for k in ("resume", "resume_backup"): |
66 |
- if k in mtimedb: |
67 |
- if "mergelist" in mtimedb[k]: |
68 |
- if not mtimedb[k]["mergelist"]: |
69 |
- del mtimedb[k] |
70 |
- else: |
71 |
- del mtimedb[k] |
72 |
- |
73 |
show_spinner = "--quiet" not in myopts and "--nodeps" not in myopts |
74 |
if not show_spinner: |
75 |
spinner.update = spinner.update_quiet |
76 |
|
77 |
- if "--resume" in myopts and \ |
78 |
- ("resume" in mtimedb or |
79 |
- "resume_backup" in mtimedb): |
80 |
- if "resume" not in mtimedb: |
81 |
- mtimedb["resume"] = mtimedb["resume_backup"] |
82 |
- del mtimedb["resume_backup"] |
83 |
- mtimedb.commit() |
84 |
- |
85 |
- # Adjust config according to options of the command being resumed. |
86 |
- for myroot in trees: |
87 |
- mysettings = trees[myroot]["vartree"].settings |
88 |
- mysettings.unlock() |
89 |
- adjust_config(myopts, mysettings) |
90 |
- mysettings.lock() |
91 |
- del myroot, mysettings |
92 |
- |
93 |
+ if resume: |
94 |
favorites = mtimedb["resume"].get("favorites") |
95 |
if not isinstance(favorites, list): |
96 |
favorites = [] |
97 |
|
98 |
- # "myopts" is a list for backward compatibility. |
99 |
- resume_opts = mtimedb["resume"].get("myopts", []) |
100 |
- if isinstance(resume_opts, list): |
101 |
- resume_opts = dict((k,True) for k in resume_opts) |
102 |
- for opt in ("--skipfirst", "--ask", "--tree"): |
103 |
- resume_opts.pop(opt, None) |
104 |
- myopts.update(resume_opts) |
105 |
- |
106 |
- buildpkgonly = "--buildpkgonly" in myopts |
107 |
- pretend = "--pretend" in myopts |
108 |
- fetchonly = "--fetchonly" in myopts or "--fetch-all-uri" in myopts |
109 |
- ask = "--ask" in myopts |
110 |
- nodeps = "--nodeps" in myopts |
111 |
- tree = "--tree" in myopts |
112 |
- if nodeps and tree: |
113 |
- tree = False |
114 |
- del myopts["--tree"] |
115 |
- portage.writemsg(colorize("WARN", " * ") + \ |
116 |
- "--tree is broken with --nodeps. Disabling...\n") |
117 |
- verbose = "--verbose" in myopts |
118 |
- quiet = "--quiet" in myopts |
119 |
- if pretend or fetchonly: |
120 |
- # make the mtimedb readonly |
121 |
- mtimedb.filename = None |
122 |
- |
123 |
if show_spinner: |
124 |
print "Calculating dependencies ", |
125 |
myparams = create_depgraph_params(myopts, myaction) |
126 |
|
127 |
-- |
128 |
gentoo-commits@l.g.o mailing list |