Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: bin/
Date: Wed, 07 Sep 2011 18:03:01
Message-Id: 4b8614d99da3e4d5ce46c70c944cce5d5d1d9a1f.zmedico@gentoo
1 commit: 4b8614d99da3e4d5ce46c70c944cce5d5d1d9a1f
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Wed Sep 7 18:01:14 2011 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Wed Sep 7 18:01:14 2011 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4b8614d9
7
8 egencache: tweak cache dir write access check
9
10 ---
11 bin/egencache | 14 +++++++++-----
12 1 files changed, 9 insertions(+), 5 deletions(-)
13
14 diff --git a/bin/egencache b/bin/egencache
15 index 6229ed6..7766e78 100755
16 --- a/bin/egencache
17 +++ b/bin/egencache
18 @@ -818,21 +818,25 @@ def egencache_main(args):
19 if options.update and 'metadata-transfer' not in settings.features:
20 settings.features.add('metadata-transfer')
21
22 + settings.lock()
23 +
24 + portdb = portage.portdbapi(mysettings=settings)
25 +
26 if options.update:
27 if options.cache_dir is not None:
28 # already validated earlier
29 pass
30 else:
31 - if os.path.isdir(settings["PORTAGE_DEPCACHEDIR"]) and \
32 - not os.access(settings["PORTAGE_DEPCACHEDIR"], os.W_OK):
33 + # We check write access after the portdbapi constructor
34 + # has had an opportunity to create it. This ensures that
35 + # we don't use the cache in the "volatile" mode which is
36 + # undesirable for egencache.
37 + if not os.access(settings["PORTAGE_DEPCACHEDIR"], os.W_OK):
38 writemsg_level("ecachegen: error: " + \
39 "write access denied: %s\n" % (settings["PORTAGE_DEPCACHEDIR"],),
40 level=logging.ERROR, noiselevel=-1)
41 return 1
42
43 - settings.lock()
44 -
45 - portdb = portage.portdbapi(mysettings=settings)
46 if options.repo is not None:
47 repo_path = portdb.getRepositoryPath(options.repo)
48 if repo_path is None: