1 |
commit: 912c564620f59d6e8d0752121c931095ba832ef2 |
2 |
Author: Zac Medico <zmedico <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri May 11 23:17:32 2012 +0000 |
4 |
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri May 11 23:17:32 2012 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=912c5646 |
7 |
|
8 |
Avoid redundant layout.conf parsing. |
9 |
|
10 |
By passing the RepoConfigLoader instance into LocationsManager, we can |
11 |
re-use previously parsed layout.conf data. The RepoConfigLoader |
12 |
instance will also be useful for bug #414961. |
13 |
|
14 |
--- |
15 |
.../package/ebuild/_config/LocationsManager.py | 19 ++++++++++++++----- |
16 |
pym/portage/package/ebuild/config.py | 2 +- |
17 |
pym/portage/repository/config.py | 3 ++- |
18 |
3 files changed, 17 insertions(+), 7 deletions(-) |
19 |
|
20 |
diff --git a/pym/portage/package/ebuild/_config/LocationsManager.py b/pym/portage/package/ebuild/_config/LocationsManager.py |
21 |
index 9c73612..368c0dd 100644 |
22 |
--- a/pym/portage/package/ebuild/_config/LocationsManager.py |
23 |
+++ b/pym/portage/package/ebuild/_config/LocationsManager.py |
24 |
@@ -52,11 +52,20 @@ class LocationsManager(object): |
25 |
self.abs_user_config = os.path.join(self.config_root, USER_CONFIG_PATH) |
26 |
self.config_profile_path = config_profile_path |
27 |
|
28 |
- def load_profiles(self, known_repository_paths): |
29 |
- known_repos = set(os.path.realpath(x) for x in known_repository_paths) |
30 |
- # force a trailing '/' for ease of doing startswith checks |
31 |
- known_repos = tuple((x + '/', parse_layout_conf(x)[0]) |
32 |
- for x in known_repos) |
33 |
+ def load_profiles(self, repositories, known_repository_paths): |
34 |
+ known_repository_paths = set(os.path.realpath(x) |
35 |
+ for x in known_repository_paths) |
36 |
+ |
37 |
+ known_repos = [] |
38 |
+ for x in known_repository_paths: |
39 |
+ try: |
40 |
+ layout_data = {"profile-formats": |
41 |
+ repositories.get_repo_for_location(x).profile_formats} |
42 |
+ except KeyError: |
43 |
+ layout_data = parse_layout_conf(x)[0] |
44 |
+ # force a trailing '/' for ease of doing startswith checks |
45 |
+ known_repos.append((x + '/', layout_data)) |
46 |
+ known_repos = tuple(known_repos) |
47 |
|
48 |
if self.config_profile_path is None: |
49 |
self.config_profile_path = \ |
50 |
|
51 |
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py |
52 |
index 45b048c..1a88250 100644 |
53 |
--- a/pym/portage/package/ebuild/config.py |
54 |
+++ b/pym/portage/package/ebuild/config.py |
55 |
@@ -427,7 +427,7 @@ class config(object): |
56 |
self.lookuplist = [self.configdict["env"]] |
57 |
self.repositories = load_repository_config(self) |
58 |
|
59 |
- locations_manager.load_profiles(known_repos) |
60 |
+ locations_manager.load_profiles(self.repositories, known_repos) |
61 |
|
62 |
profiles_complex = locations_manager.profiles_complex |
63 |
self.profiles = locations_manager.profiles |
64 |
|
65 |
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py |
66 |
index e544c57..3716569 100644 |
67 |
--- a/pym/portage/repository/config.py |
68 |
+++ b/pym/portage/repository/config.py |
69 |
@@ -49,7 +49,7 @@ class RepoConfig(object): |
70 |
'cache_formats', 'create_manifest', 'disable_manifest', 'eapi', |
71 |
'eclass_db', 'eclass_locations', 'eclass_overrides', 'format', 'location', |
72 |
'main_repo', 'manifest_hashes', 'masters', 'missing_repo_name', |
73 |
- 'name', 'priority', 'sign_commit', 'sign_manifest', 'sync', 'thin_manifest', |
74 |
+ 'name', 'priority', 'profile_formats', 'sign_commit', 'sign_manifest', 'sync', 'thin_manifest', |
75 |
'update_changelog', 'user_location', 'portage1_profiles', |
76 |
'portage1_profiles_compat') |
77 |
|
78 |
@@ -153,6 +153,7 @@ class RepoConfig(object): |
79 |
for value in ('allow-missing-manifest', |
80 |
'allow-provide-virtual', 'cache-formats', |
81 |
'create-manifest', 'disable-manifest', 'manifest-hashes', |
82 |
+ 'profile-formats', |
83 |
'sign-commit', 'sign-manifest', 'thin-manifest', 'update-changelog'): |
84 |
setattr(self, value.lower().replace("-", "_"), layout_data[value]) |