* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/package/ebuild/_config/, ...
@ 2012-05-11 23:17 Zac Medico
0 siblings, 0 replies; 2+ messages in thread
From: Zac Medico @ 2012-05-11 23:17 UTC (permalink / raw
To: gentoo-commits
commit: 912c564620f59d6e8d0752121c931095ba832ef2
Author: Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Fri May 11 23:17:32 2012 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Fri May 11 23:17:32 2012 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=912c5646
Avoid redundant layout.conf parsing.
By passing the RepoConfigLoader instance into LocationsManager, we can
re-use previously parsed layout.conf data. The RepoConfigLoader
instance will also be useful for bug #414961.
---
.../package/ebuild/_config/LocationsManager.py | 19 ++++++++++++++-----
pym/portage/package/ebuild/config.py | 2 +-
pym/portage/repository/config.py | 3 ++-
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/pym/portage/package/ebuild/_config/LocationsManager.py b/pym/portage/package/ebuild/_config/LocationsManager.py
index 9c73612..368c0dd 100644
--- a/pym/portage/package/ebuild/_config/LocationsManager.py
+++ b/pym/portage/package/ebuild/_config/LocationsManager.py
@@ -52,11 +52,20 @@ class LocationsManager(object):
self.abs_user_config = os.path.join(self.config_root, USER_CONFIG_PATH)
self.config_profile_path = config_profile_path
- def load_profiles(self, known_repository_paths):
- known_repos = set(os.path.realpath(x) for x in known_repository_paths)
- # force a trailing '/' for ease of doing startswith checks
- known_repos = tuple((x + '/', parse_layout_conf(x)[0])
- for x in known_repos)
+ def load_profiles(self, repositories, known_repository_paths):
+ known_repository_paths = set(os.path.realpath(x)
+ for x in known_repository_paths)
+
+ known_repos = []
+ for x in known_repository_paths:
+ try:
+ layout_data = {"profile-formats":
+ repositories.get_repo_for_location(x).profile_formats}
+ except KeyError:
+ layout_data = parse_layout_conf(x)[0]
+ # force a trailing '/' for ease of doing startswith checks
+ known_repos.append((x + '/', layout_data))
+ known_repos = tuple(known_repos)
if self.config_profile_path is None:
self.config_profile_path = \
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 45b048c..1a88250 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -427,7 +427,7 @@ class config(object):
self.lookuplist = [self.configdict["env"]]
self.repositories = load_repository_config(self)
- locations_manager.load_profiles(known_repos)
+ locations_manager.load_profiles(self.repositories, known_repos)
profiles_complex = locations_manager.profiles_complex
self.profiles = locations_manager.profiles
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index e544c57..3716569 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -49,7 +49,7 @@ class RepoConfig(object):
'cache_formats', 'create_manifest', 'disable_manifest', 'eapi',
'eclass_db', 'eclass_locations', 'eclass_overrides', 'format', 'location',
'main_repo', 'manifest_hashes', 'masters', 'missing_repo_name',
- 'name', 'priority', 'sign_commit', 'sign_manifest', 'sync', 'thin_manifest',
+ 'name', 'priority', 'profile_formats', 'sign_commit', 'sign_manifest', 'sync', 'thin_manifest',
'update_changelog', 'user_location', 'portage1_profiles',
'portage1_profiles_compat')
@@ -153,6 +153,7 @@ class RepoConfig(object):
for value in ('allow-missing-manifest',
'allow-provide-virtual', 'cache-formats',
'create-manifest', 'disable-manifest', 'manifest-hashes',
+ 'profile-formats',
'sign-commit', 'sign-manifest', 'thin-manifest', 'update-changelog'):
setattr(self, value.lower().replace("-", "_"), layout_data[value])
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/package/ebuild/_config/, ...
@ 2014-01-19 8:04 Arfrever Frehtes Taifersar Arahesis
0 siblings, 0 replies; 2+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2014-01-19 8:04 UTC (permalink / raw
To: gentoo-commits
commit: 06093629d346c31505e5b9d85b50b1a072560436
Author: Arfrever Frehtes Taifersar Arahesis <Arfrever <AT> Apache <DOT> Org>
AuthorDate: Sun Jan 19 08:04:06 2014 +0000
Commit: Arfrever Frehtes Taifersar Arahesis <arfrever <AT> apache <DOT> org>
CommitDate: Sun Jan 19 08:04:06 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=06093629
Rename portage._sync_disabled_warnings to portage._sync_mode.
---
pym/_emerge/actions.py | 4 ++--
pym/_emerge/main.py | 4 ++--
pym/portage/__init__.py | 5 ++---
pym/portage/package/ebuild/_config/LocationsManager.py | 4 ++--
pym/portage/package/ebuild/config.py | 6 +++---
pym/portage/repository/config.py | 14 +++++++-------
6 files changed, 18 insertions(+), 19 deletions(-)
diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py
index 9bb4774..c401d39 100644
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function, unicode_literals
@@ -2073,7 +2073,7 @@ def action_sync(emerge_config, trees=DeprecationWarning,
return returncode
# Reload the whole config from scratch.
- portage._sync_disabled_warnings = False
+ portage._sync_mode = False
load_emerge_config(emerge_config=emerge_config)
adjust_configs(emerge_config.opts, emerge_config.trees)
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 89413a9..da223a6 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import print_function
@@ -1011,7 +1011,7 @@ def emerge_main(args=None):
# Portage needs to ensure a sane umask for the files it creates.
os.umask(0o22)
if myaction == "sync":
- portage._sync_disabled_warnings = True
+ portage._sync_mode = True
emerge_config = load_emerge_config(
action=myaction, args=myfiles, opts=myopts)
rval = profile_check(emerge_config.trees, emerge_config.action)
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 75d0d64..4c0d9ca 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -1,5 +1,4 @@
-# portage.py -- core Portage functionality
-# Copyright 1998-2013 Gentoo Foundation
+# Copyright 1998-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
@@ -373,7 +372,7 @@ _working_copy = VERSION == "HEAD"
# Api consumers included in portage should set this to True.
_internal_caller = False
-_sync_disabled_warnings = False
+_sync_mode = False
def _get_stdin():
"""
diff --git a/pym/portage/package/ebuild/_config/LocationsManager.py b/pym/portage/package/ebuild/_config/LocationsManager.py
index 80b6a70..4427f1d 100644
--- a/pym/portage/package/ebuild/_config/LocationsManager.py
+++ b/pym/portage/package/ebuild/_config/LocationsManager.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2013 Gentoo Foundation
+# Copyright 2010-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
@@ -119,7 +119,7 @@ class LocationsManager(object):
self._addProfile(os.path.realpath(self.profile_path),
repositories, known_repos)
except ParseError as e:
- if not portage._sync_disabled_warnings:
+ if not portage._sync_mode:
writemsg(_("!!! Unable to parse profile: '%s'\n") % self.profile_path, noiselevel=-1)
writemsg("!!! ParseError: %s\n" % str(e), noiselevel=-1)
self.profiles = []
diff --git a/pym/portage/package/ebuild/config.py b/pym/portage/package/ebuild/config.py
index 92e6c3f..f5ef982 100644
--- a/pym/portage/package/ebuild/config.py
+++ b/pym/portage/package/ebuild/config.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2013 Gentoo Foundation
+# Copyright 2010-2014 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
from __future__ import unicode_literals
@@ -536,7 +536,7 @@ class config(object):
if portdir_overlay:
for ov in portdir_overlay:
ov = normalize_path(ov)
- if isdir_raise_eaccess(ov) or portage._sync_disabled_warnings:
+ if isdir_raise_eaccess(ov) or portage._sync_mode:
new_ov.append(portage._shell_quote(ov))
else:
writemsg(_("!!! Invalid PORTDIR_OVERLAY"
@@ -1040,7 +1040,7 @@ class config(object):
else:
profile_broken = True
- if profile_broken and not portage._sync_disabled_warnings:
+ if profile_broken and not portage._sync_mode:
abs_profile_path = None
for x in (PROFILE_PATH, 'etc/make.profile'):
x = os.path.join(self["PORTAGE_CONFIGROOT"], x)
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index b7ee34f..f89f098 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -169,7 +169,7 @@ class RepoConfig(object):
location = repo_opts.get('location')
self.user_location = location
if location is not None and location.strip():
- if os.path.isdir(location) or portage._sync_disabled_warnings:
+ if os.path.isdir(location) or portage._sync_mode:
location = os.path.realpath(location)
else:
location = None
@@ -187,7 +187,7 @@ class RepoConfig(object):
# is empty (bug #484950).
if name is not None:
self.name = name
- if portage._sync_disabled_warnings:
+ if portage._sync_mode:
missing = False
elif name == "DEFAULT":
@@ -493,7 +493,7 @@ class RepoConfigLoader(object):
prepos[repo.name] = repo
else:
- if not portage._sync_disabled_warnings:
+ if not portage._sync_mode:
writemsg(_("!!! Invalid PORTDIR_OVERLAY (not a dir): '%s'\n") % ov, noiselevel=-1)
return portdir
@@ -647,7 +647,7 @@ class RepoConfigLoader(object):
del prepos[repo_name]
continue
else:
- if not portage._sync_disabled_warnings:
+ if not portage._sync_mode:
if not isdir_raise_eaccess(repo.location):
writemsg_level("!!! %s\n" % _("Section '%s' in repos.conf has location attribute set "
"to nonexistent directory: '%s'") %
@@ -713,7 +713,7 @@ class RepoConfigLoader(object):
prepos['DEFAULT'].main_repo = main_repo
else:
prepos['DEFAULT'].main_repo = None
- if portdir and not portage._sync_disabled_warnings:
+ if portdir and not portage._sync_mode:
writemsg(_("!!! main-repo not set in DEFAULT and PORTDIR is empty.\n"), noiselevel=-1)
if main_repo is not None and prepos[main_repo].priority is None:
@@ -826,7 +826,7 @@ class RepoConfigLoader(object):
continue
if repo._masters_orig is None and self.mainRepo() and \
- repo.name != self.mainRepo().name and not portage._sync_disabled_warnings:
+ repo.name != self.mainRepo().name and not portage._sync_mode:
# TODO: Delete masters code in pym/portage/tests/resolver/ResolverPlayground.py when deleting this warning.
writemsg_level("!!! %s\n" % _("Repository '%s' is missing masters attribute in '%s'") %
(repo.name, os.path.join(repo.location, "metadata", "layout.conf")) +
@@ -880,7 +880,7 @@ class RepoConfigLoader(object):
if r.location is None:
writemsg(_("!!! Location not set for repository %s\n") % name, noiselevel=-1)
else:
- if not isdir_raise_eaccess(r.location) and not portage._sync_disabled_warnings:
+ if not isdir_raise_eaccess(r.location) and not portage._sync_mode:
self.prepos_order.remove(name)
writemsg(_("!!! Invalid Repository Location"
" (not a dir): '%s'\n") % r.location, noiselevel=-1)
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-01-19 8:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-19 8:04 [gentoo-commits] proj/portage:master commit in: pym/portage/package/ebuild/, pym/portage/package/ebuild/_config/, Arfrever Frehtes Taifersar Arahesis
-- strict thread matches above, loose matches on Subject: below --
2012-05-11 23:17 Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox