Gentoo Archives: gentoo-portage-dev

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

Attachments

File name MIME type
signature.asc application/pgp-signature