1 |
Author: zmedico |
2 |
Date: 2009-04-30 06:53:50 +0000 (Thu, 30 Apr 2009) |
3 |
New Revision: 13445 |
4 |
|
5 |
Modified: |
6 |
main/branches/2.1.6/bin/egencache |
7 |
main/branches/2.1.6/pym/portage/__init__.py |
8 |
Log: |
9 |
Add support for a EGENCACHE_DEFAULT_OPTS variable in make.conf. (trunk r13266) |
10 |
|
11 |
Modified: main/branches/2.1.6/bin/egencache |
12 |
=================================================================== |
13 |
--- main/branches/2.1.6/bin/egencache 2009-04-30 06:53:38 UTC (rev 13444) |
14 |
+++ main/branches/2.1.6/bin/egencache 2009-04-30 06:53:50 UTC (rev 13445) |
15 |
@@ -50,12 +50,11 @@ |
16 |
action="store_true", |
17 |
help="enable rsync stat collision workaround " + \ |
18 |
"for bug 139134 (use with --update)") |
19 |
+ parser.add_option("--ignore-default-opts", |
20 |
+ action="store_true", |
21 |
+ help="do not use the EGENCACHE_DEFAULT_OPTS environment variable") |
22 |
options, args = parser.parse_args(args) |
23 |
|
24 |
- if not options.update: |
25 |
- parser.error('No action specified (--update ' + \ |
26 |
- 'is the only available action)') |
27 |
- |
28 |
if options.jobs: |
29 |
jobs = None |
30 |
try: |
31 |
@@ -105,7 +104,7 @@ |
32 |
if str(atom) != atom.cp: |
33 |
parser.error('Atom is too specific: %s' % (atom,)) |
34 |
|
35 |
- return options, args |
36 |
+ return parser, options, args |
37 |
|
38 |
class GenCache(object): |
39 |
def __init__(self, portdb, cp_iter=None, max_jobs=None, max_load=None, |
40 |
@@ -223,7 +222,7 @@ |
41 |
level=logging.ERROR, noiselevel=-1) |
42 |
|
43 |
def egencache_main(args): |
44 |
- options, args = parse_args(args) |
45 |
+ parser, options, atoms = parse_args(args) |
46 |
|
47 |
config_root = options.config_root |
48 |
if config_root is None: |
49 |
@@ -242,6 +241,27 @@ |
50 |
settings = portage.config(config_root=config_root, |
51 |
target_root='/', env=env) |
52 |
|
53 |
+ default_opts = None |
54 |
+ if not options.ignore_default_opts: |
55 |
+ default_opts = settings.get('EGENCACHE_DEFAULT_OPTS', '').split() |
56 |
+ |
57 |
+ if default_opts: |
58 |
+ parser, options, args = parse_args(default_opts + args) |
59 |
+ |
60 |
+ if options.config_root is not None: |
61 |
+ config_root = options.config_root |
62 |
+ |
63 |
+ if options.cache_dir is not None: |
64 |
+ env['PORTAGE_DEPCACHEDIR'] = options.cache_dir |
65 |
+ |
66 |
+ settings = portage.config(config_root=config_root, |
67 |
+ target_root='/', env=env) |
68 |
+ |
69 |
+ if not options.update: |
70 |
+ parser.error('No action specified (--update ' + \ |
71 |
+ 'is the only available action)') |
72 |
+ return 1 |
73 |
+ |
74 |
if 'metadata-transfer' not in settings.features: |
75 |
writemsg_level("ecachegen: warning: " + \ |
76 |
"automatically enabling FEATURES=metadata-transfer\n", |
77 |
@@ -255,8 +275,8 @@ |
78 |
portdb = portage.portdbapi(settings["PORTDIR"], mysettings=settings) |
79 |
|
80 |
cp_iter = None |
81 |
- if args: |
82 |
- cp_iter = iter(args) |
83 |
+ if atoms: |
84 |
+ cp_iter = iter(atoms) |
85 |
|
86 |
gen_cache = GenCache(portdb, cp_iter=cp_iter, |
87 |
max_jobs=options.jobs, |
88 |
|
89 |
Modified: main/branches/2.1.6/pym/portage/__init__.py |
90 |
=================================================================== |
91 |
--- main/branches/2.1.6/pym/portage/__init__.py 2009-04-30 06:53:38 UTC (rev 13444) |
92 |
+++ main/branches/2.1.6/pym/portage/__init__.py 2009-04-30 06:53:50 UTC (rev 13445) |
93 |
@@ -1091,7 +1091,7 @@ |
94 |
_environ_filter += [ |
95 |
"ACCEPT_KEYWORDS", "AUTOCLEAN", |
96 |
"CLEAN_DELAY", "COLLISION_IGNORE", "CONFIG_PROTECT", |
97 |
- "CONFIG_PROTECT_MASK", "EMERGE_DEFAULT_OPTS", |
98 |
+ "CONFIG_PROTECT_MASK", "EGENCACHE_DEFAULT_OPTS", "EMERGE_DEFAULT_OPTS", |
99 |
"EMERGE_WARNING_DELAY", "FETCHCOMMAND", "FETCHCOMMAND_FTP", |
100 |
"FETCHCOMMAND_HTTP", "FETCHCOMMAND_SFTP", |
101 |
"GENTOO_MIRRORS", "NOCONFMEM", "O", |