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