Gentoo Archives: gentoo-portage-dev

From: Zac Medico <zmedico@g.o>
To: gentoo-portage-dev@l.g.o
Subject: Re: [gentoo-portage-dev] Re: [PATCH 3/3] package.bashrc: per profile, per-package bashrc mechanism
Date: Fri, 24 Oct 2014 20:57:24
Message-Id: 544ABD1D.6040805@gentoo.org
In Reply to: Re: [gentoo-portage-dev] Re: [PATCH 3/3] package.bashrc: per profile, per-package bashrc mechanism by Alexander Berntsen
1 On 10/24/2014 12:25 AM, Alexander Berntsen wrote:
2 > On 24/10/14 04:00, Zac Medico wrote:
3 >> Should we go ahead and merge this now that 2.2.14 is released?
4 > ACK from me.
5
6 Thanks, I've pushed them to git now:
7
8 https://github.com/gentoo/portage/commit/60ee4deefb701d532fdd279caa989e7a6f4b8400
9 https://github.com/gentoo/portage/commit/1d351a59a57e018e9c79a371f0cae21505c2249c
10 https://github.com/gentoo/portage/commit/803dafc462027d6015721f40513abb5f57dc1178
11
12 In the last patch, I made 2 trivial changes:
13
14 1) Replace self.configdict["BASHRC_FILES"] with self._pbashrc, since configdict is used
15 for other unrelated things. Also make it an immutable tuple instead of a list.
16 2) Test if profile.bashrc exists before adding it to the list, which typically shortens
17 the list drastically because most profile directories don't have a profile.bashrc.
18
19 diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
20 index 33b4753..2ceb122 100644
21 --- a/pym/portage/package/ebuild/config.py
22 +++ b/pym/portage/package/ebuild/config.py
23 @@ -254,6 +254,7 @@ class config(object):
24 self._iuse_implicit_match = clone._iuse_implicit_match
25 self._non_user_variables = clone._non_user_variables
26 self._env_d_blacklist = clone._env_d_blacklist
27 + self._pbashrc = clone._pbashrc
28 self._repo_make_defaults = clone._repo_make_defaults
29 self.usemask = clone.usemask
30 self.useforce = clone.useforce
31 @@ -663,6 +664,7 @@ class config(object):
32 self._paccept_restrict = portage.dep.ExtendedAtomDict(dict)
33 self._penvdict = portage.dep.ExtendedAtomDict(dict)
34 self._pbashrcdict = {}
35 + self._pbashrc = ()
36
37 self._repo_make_defaults = {}
38 for repo in self.repositories.repos_with_profiles():
39 @@ -1531,8 +1533,10 @@ class config(object):
40 bashrc_files = []
41
42 for profile in self._locations_manager.profiles_complex:
43 - bashrc_files.append(os.path.join(profile.location,
44 - 'profile.bashrc'))
45 + profile_bashrc = os.path.join(profile.location,
46 + 'profile.bashrc')
47 + if os.path.exists(profile_bashrc):
48 + bashrc_files.append(profile_bashrc)
49 if profile in self._pbashrcdict:
50 cpdict = self._pbashrcdict[profile].get(cp)
51 if cpdict:
52 @@ -1541,7 +1545,7 @@ class config(object):
53 for x in bashrc_matches:
54 bashrc_files.extend(x)
55
56 - self.configdict["BASHRC_FILES"] = bashrc_files
57 + self._pbashrc = tuple(bashrc_files)
58
59 protected_pkg_keys = set(pkg_configdict)
60 protected_pkg_keys.discard('USE')
61 diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
62 index 20b179e..544d193 100644
63 --- a/pym/portage/package/ebuild/doebuild.py
64 +++ b/pym/portage/package/ebuild/doebuild.py
65 @@ -337,8 +337,7 @@ def doebuild_environment(myebuild, mydo, myroot=None, settings=None,
66 mysettings["ECLASSDIR"] = mysettings["PORTDIR"]+"/eclass"
67 mysettings["SANDBOX_LOG"] = mycpv.replace("/", "_-_")
68
69 - mysettings["PORTAGE_BASHRC_FILES"] = \
70 - "\n".join(mysettings.configdict["BASHRC_FILES"])
71 + mysettings["PORTAGE_BASHRC_FILES"] = "\n".join(mysettings._pbashrc)
72
73 mysettings["P"] = mysplit[0]+"-"+mysplit[1]
74 mysettings["PN"] = mysplit[0]
75
76 --
77 Thanks,
78 Zac

Replies