1 |
Author: zmedico |
2 |
Date: 2008-03-28 11:59:23 +0000 (Fri, 28 Mar 2008) |
3 |
New Revision: 9553 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.2/bin/emerge |
7 |
main/branches/2.1.2/cnf/make.globals |
8 |
main/branches/2.1.2/pym/portage.py |
9 |
Log: |
10 |
* Optimize parallel-fetch to avoid redundant checksum verification. |
11 |
* Add parallel-fetch to the default FEATURES since it is more efficient now. |
12 |
(trunk r9462) |
13 |
|
14 |
|
15 |
Modified: main/branches/2.1.2/bin/emerge |
16 |
=================================================================== |
17 |
--- main/branches/2.1.2/bin/emerge 2008-03-28 11:56:50 UTC (rev 9552) |
18 |
+++ main/branches/2.1.2/bin/emerge 2008-03-28 11:59:23 UTC (rev 9553) |
19 |
@@ -4159,6 +4159,7 @@ |
20 |
fetch_env = os.environ.copy() |
21 |
fetch_env["FEATURES"] = fetch_env.get("FEATURES", "") + " -cvs" |
22 |
fetch_env["PORTAGE_NICENESS"] = "0" |
23 |
+ fetch_env["PORTAGE_PARALLEL_FETCHONLY"] = "1" |
24 |
fetch_args = [sys.argv[0], "--resume", "--fetchonly"] |
25 |
resume_opts = self.myopts.copy() |
26 |
# For automatic resume, we need to prevent |
27 |
@@ -6514,7 +6515,7 @@ |
28 |
if ("--resume" in myopts): |
29 |
favorites=mtimedb["resume"]["favorites"] |
30 |
mergetask = MergeTask(settings, trees, myopts) |
31 |
- if "--fetchonly" in myopts: |
32 |
+ if "PORTAGE_PARALLEL_FETCHONLY" in settings: |
33 |
""" parallel-fetch uses --resume --fetchonly and we don't want |
34 |
it to write the mtimedb""" |
35 |
mtimedb.filename = None |
36 |
|
37 |
Modified: main/branches/2.1.2/cnf/make.globals |
38 |
=================================================================== |
39 |
--- main/branches/2.1.2/cnf/make.globals 2008-03-28 11:56:50 UTC (rev 9552) |
40 |
+++ main/branches/2.1.2/cnf/make.globals 2008-03-28 11:59:23 UTC (rev 9553) |
41 |
@@ -33,7 +33,7 @@ |
42 |
RESUMECOMMAND="/usr/bin/wget -c -t 5 -T 60 --passive-ftp -O \"\${DISTDIR}/\${FILE}\" \"\${URI}\"" |
43 |
|
44 |
# Default user options |
45 |
-FEATURES="distlocks metadata-transfer sandbox sfperms strict unmerge-orphans userfetch" |
46 |
+FEATURES="distlocks parallel-fetch metadata-transfer sandbox sfperms strict unmerge-orphans userfetch" |
47 |
|
48 |
# Default chunksize for binhost comms |
49 |
PORTAGE_BINHOST_CHUNKSIZE="3000" |
50 |
|
51 |
Modified: main/branches/2.1.2/pym/portage.py |
52 |
=================================================================== |
53 |
--- main/branches/2.1.2/pym/portage.py 2008-03-28 11:56:50 UTC (rev 9552) |
54 |
+++ main/branches/2.1.2/pym/portage.py 2008-03-28 11:59:23 UTC (rev 9553) |
55 |
@@ -3008,6 +3008,14 @@ |
56 |
checksum_failure_primaryuri = 2 |
57 |
thirdpartymirrors = mysettings.thirdpartymirrors() |
58 |
|
59 |
+ # In the background parallel-fetch process, it's safe to skip checksum |
60 |
+ # verification of pre-existing files in $DISTDIR that have the correct |
61 |
+ # file size. The parent process will verify their checksums prior to |
62 |
+ # the unpack phase. |
63 |
+ |
64 |
+ parallel_fetchonly = fetchonly and \ |
65 |
+ "PORTAGE_PARALLEL_FETCHONLY" in mysettings |
66 |
+ |
67 |
check_config_instance(mysettings) |
68 |
|
69 |
custommirrors = grabdict(os.path.join(mysettings["PORTAGE_CONFIGROOT"], |
70 |
@@ -3203,7 +3211,7 @@ |
71 |
|
72 |
if use_locks and can_fetch: |
73 |
waiting_msg = None |
74 |
- if "parallel-fetch" in features: |
75 |
+ if not parallel_fetchonly and "parallel-fetch" in features: |
76 |
waiting_msg = ("Downloading '%s'... " + \ |
77 |
"see /var/log/emerge-fetch.log for details.") % myfile |
78 |
if locks_in_subdir: |
79 |
@@ -3262,6 +3270,15 @@ |
80 |
if mystat.st_size < mydigests[myfile]["size"] and \ |
81 |
not restrict_fetch: |
82 |
fetched = 1 # Try to resume this download. |
83 |
+ elif parallel_fetchonly and \ |
84 |
+ mystat.st_size == mydigests[myfile]["size"]: |
85 |
+ eout = portage.output.EOutput() |
86 |
+ eout.quiet = \ |
87 |
+ mysettings.get("PORTAGE_QUIET") == "1" |
88 |
+ eout.ebegin( |
89 |
+ "%s size ;-)" % (myfile, )) |
90 |
+ eout.eend(0) |
91 |
+ continue |
92 |
else: |
93 |
verified_ok, reason = portage_checksum.verify_all( |
94 |
myfile_path, mydigests[myfile]) |
95 |
@@ -4720,6 +4737,11 @@ |
96 |
fetchme = newuris[:] |
97 |
checkme = alist[:] |
98 |
|
99 |
+ if mydo == "fetch": |
100 |
+ # Files are already checked inside fetch(), |
101 |
+ # so do not check them again. |
102 |
+ checkme = [] |
103 |
+ |
104 |
# Only try and fetch the files if we are going to need them ... |
105 |
# otherwise, if user has FEATURES=noauto and they run `ebuild clean |
106 |
# unpack compile install`, we will try and fetch 4 times :/ |
107 |
|
108 |
-- |
109 |
gentoo-commits@l.g.o mailing list |