Gentoo Archives: gentoo-commits

From: Zac Medico <zmedico@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/
Date: Sun, 15 Jul 2018 21:54:14
Message-Id: 1531691253.2de6ba26fd45fe942329ac928029e4edf603e125.zmedico@gentoo
1 commit: 2de6ba26fd45fe942329ac928029e4edf603e125
2 Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
3 AuthorDate: Sun Jul 15 04:54:45 2018 +0000
4 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
5 CommitDate: Sun Jul 15 21:47:33 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=2de6ba26
7
8 config: cache profile.bashrc stat results (bug 649806)
9
10 Optimize config to stat profile.bashrc files once in the constructor,
11 in order to avoid repeated stat calls in the setcpv method.
12
13 Bug: https://bugs.gentoo.org/649806
14 Reviewed-by: Brian Dolbec <dolsen <AT> gentoo.org>
15
16 pym/portage/package/ebuild/config.py | 13 ++++++++-----
17 1 file changed, 8 insertions(+), 5 deletions(-)
18
19 diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
20 index 88acac5cc..320d9f6c0 100644
21 --- a/pym/portage/package/ebuild/config.py
22 +++ b/pym/portage/package/ebuild/config.py
23 @@ -274,6 +274,7 @@ class config(object):
24 self.mycpv = clone.mycpv
25 self._setcpv_args_hash = clone._setcpv_args_hash
26 self._soname_provided = clone._soname_provided
27 + self._profile_bashrc = clone._profile_bashrc
28
29 # immutable attributes (internal policy ensures lack of mutation)
30 self._locations_manager = clone._locations_manager
31 @@ -725,6 +726,10 @@ class config(object):
32 self._license_manager.extract_global_changes( \
33 self.configdict["conf"].get("ACCEPT_LICENSE", ""))
34
35 + # profile.bashrc
36 + self._profile_bashrc = tuple(os.path.isfile(os.path.join(profile.location, 'profile.bashrc'))
37 + for profile in profiles_complex)
38 +
39 if local_config:
40 #package.properties
41 propdict = grabdict_package(os.path.join(
42 @@ -1596,11 +1601,9 @@ class config(object):
43
44 bashrc_files = []
45
46 - for profile in self._locations_manager.profiles_complex:
47 - profile_bashrc = os.path.join(profile.location,
48 - 'profile.bashrc')
49 - if os.path.exists(profile_bashrc):
50 - bashrc_files.append(profile_bashrc)
51 + for profile, profile_bashrc in zip(self._locations_manager.profiles_complex, self._profile_bashrc):
52 + if profile_bashrc:
53 + bashrc_files.append(os.path.join(profile.location, 'profile.bashrc'))
54 if profile in self._pbashrcdict:
55 cpdict = self._pbashrcdict[profile].get(cp)
56 if cpdict: