From: "Zac Medico" <zmedico@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] proj/portage:master commit in: pym/portage/repository/
Date: Tue, 25 Oct 2011 21:44:49 +0000 (UTC) [thread overview]
Message-ID: <0be173a54a5248cfd70a3543d7099d2dd3ee254b.zmedico@gentoo> (raw)
commit: 0be173a54a5248cfd70a3543d7099d2dd3ee254b
Author: Brian Harring <ferringb <AT> chromium <DOT> org>
AuthorDate: Tue Oct 25 00:38:33 2011 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Tue Oct 25 21:36:42 2011 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=0be173a5
split out layout.conf parsing so it's usable elsewhere
---
pym/portage/repository/config.py | 155 +++++++++++++++++++++-----------------
1 files changed, 86 insertions(+), 69 deletions(-)
diff --git a/pym/portage/repository/config.py b/pym/portage/repository/config.py
index fddba6c..fe2bd33 100644
--- a/pym/portage/repository/config.py
+++ b/pym/portage/repository/config.py
@@ -358,82 +358,27 @@ class RepoConfigLoader(object):
if not repo.location:
continue
layout_filename = os.path.join(repo.location, "metadata", "layout.conf")
- layout_file = KeyValuePairFileLoader(layout_filename, None, None)
- layout_data, layout_errors = layout_file.load()
-
- # Only set masters here if is None, so that repos.conf settings
- # will override those from layout.conf. This gives the
- # user control over inherited repositories and their settings
- # (the user must ensure that any required dependencies such as
- # eclasses are satisfied).
+ layout_data, layout_errors = parse_layout_conf(repo.location, repo.name)
+
if repo.masters is None:
- masters = layout_data.get('masters')
- if masters is not None:
- # We support empty masters settings here, in case a
- # repo wants to avoid implicit inheritance of PORTDIR
- # settings like package.mask.
- masters = tuple(masters.split())
- repo.masters = masters
+ repo.masters = layout_data['masters']
aliases = layout_data.get('aliases')
if aliases and aliases.strip():
aliases = aliases.split()
else:
aliases = None
- if aliases:
- if repo.aliases:
- aliases.extend(repo.aliases)
- repo.aliases = tuple(sorted(set(aliases)))
-
- if layout_data.get('sign-manifests', '').lower() == 'false':
- repo.sign_manifest = False
-
- if layout_data.get('thin-manifests', '').lower() == 'true':
- repo.thin_manifest = True
-
- manifest_policy = layout_data.get('use-manifests', 'strict').lower()
- repo.allow_missing_manifest = manifest_policy != 'strict'
- repo.create_manifest = manifest_policy != 'false'
- repo.disable_manifest = manifest_policy == 'false'
-
- # for compatibility w/ PMS, fallback to pms; but also check if the
- # cache exists or not.
- repo.cache_format = layout_data.get('cache-format', 'pms').lower()
- if repo.cache_format == 'pms' and not os.path.isdir(
- os.path.join(repo.location, 'metadata', 'cache')):
- repo.cache_format = None
-
- manifest_hashes = layout_data.get('manifest-hashes')
- if manifest_hashes is not None:
- manifest_hashes = frozenset(manifest_hashes.upper().split())
- if MANIFEST2_REQUIRED_HASH not in manifest_hashes:
- warnings.warn((_("Repository named '%(repo_name)s' has a "
- "'manifest-hashes' setting that does not contain "
- "the '%(hash)s' hash which is required by this "
- "portage version. You will have to upgrade portage "
- "if you want to generate valid manifests for this "
- "repository: %(layout_filename)s") %
- {"repo_name":repo.name,
- "hash":MANIFEST2_REQUIRED_HASH,
- "layout_filename":layout_filename}),
- DeprecationWarning)
- unsupported_hashes = manifest_hashes.difference(
- MANIFEST2_HASH_FUNCTIONS)
- if unsupported_hashes:
- warnings.warn((_("Repository named '%(repo_name)s' has a "
- "'manifest-hashes' setting that contains one "
- "or more hash types '%(hashes)s' which are not supported by "
- "this portage version. You will have to upgrade "
- "portage if you want to generate valid manifests for "
- "this repository: %(layout_filename)s") %
- {"repo_name":repo.name,
- "hashes":" ".join(sorted(unsupported_hashes)),
- "layout_filename":layout_filename}),
- DeprecationWarning)
- repo.manifest_hashes = manifest_hashes
-
- if layout_data.get('update-changelog', '').lower() == 'true':
- repo.update_changelog = True
+
+ if layout_data['aliases']:
+ aliases = repo.aliases
+ if aliases is None:
+ aliases = ()
+ repo.aliases = tuple(aliases) + layout_data['aliases']
+
+ for value in ('sign-manifest', 'thin-manifest', 'allow-missing-manifest',
+ 'create-manifest', 'disable-manifest', 'cache-format', 'manifest-hashes',
+ 'update-changelog'):
+ setattr(repo, value.lower().replace("-", "_"), layout_data[value])
#Take aliases into account.
new_prepos = {}
@@ -623,3 +568,75 @@ def load_repository_config(settings):
repoconfigpaths.append(os.path.join(settings["PORTAGE_CONFIGROOT"],
USER_CONFIG_PATH, "repos.conf"))
return RepoConfigLoader(repoconfigpaths, settings)
+
+
+def parse_layout_conf(repo_location, repo_name=None):
+ if repo_name is None:
+ repo_name = "unspecified"
+
+ layout_filename = os.path.join(repo_location, "metadata", "layout.conf")
+ layout_file = KeyValuePairFileLoader(layout_filename, None, None)
+ layout_data, layout_errors = layout_file.load()
+
+ data = {}
+
+ # allow None to slip through; later code spots that as an indication
+ # that an explicit nulling of the overlaying is desired.
+ masters = layout_data.get('masters')
+ if masters is not None:
+ masters = tuple(masters.split())
+ data['masters'] = masters
+ data['aliases'] = tuple(layout_data.get('aliases', '').split())
+
+ data['sign-manifest'] = layout_data.get('sign-manifests', 'true').lower() \
+ == 'true'
+
+ data['thin-manifest'] = layout_data.get('thin-manifests', 'false').lower() \
+ == 'true'
+
+ manifest_policy = layout_data.get('use-manifests', 'strict').lower()
+ data['allow-missing-manifest'] = manifest_policy != 'strict'
+ data['create-manifest'] = manifest_policy != 'false'
+ data['disable-manifest'] = manifest_policy == 'false'
+
+ # for compatibility w/ PMS, fallback to pms; but also check if the
+ # cache exists or not.
+ cache_format = layout_data.get('cache-format', 'pms').lower()
+ if cache_format == 'pms' and not os.path.isdir(
+ os.path.join(repo_location, 'metadata', 'cache')):
+ cache_format = None
+ data['cache-format'] = cache_format
+
+ manifest_hashes = layout_data.get('manifest-hashes')
+ if manifest_hashes is not None:
+ manifest_hashes = frozenset(manifest_hashes.upper().split())
+ if MANIFEST2_REQUIRED_HASH not in manifest_hashes:
+ warnings.warn((_("Repository named '%(repo_name)s' has a "
+ "'manifest-hashes' setting that does not contain "
+ "the '%(hash)s' hash which is required by this "
+ "portage version. You will have to upgrade portage "
+ "if you want to generate valid manifests for this "
+ "repository: %(layout_filename)s") %
+ {"repo_name":repo.name,
+ "hash":MANIFEST2_REQUIRED_HASH,
+ "layout_filename":layout_filename}),
+ DeprecationWarning)
+ unsupported_hashes = manifest_hashes.difference(
+ MANIFEST2_HASH_FUNCTIONS)
+ if unsupported_hashes:
+ warnings.warn((_("Repository named '%(repo_name)s' has a "
+ "'manifest-hashes' setting that contains one "
+ "or more hash types '%(hashes)s' which are not supported by "
+ "this portage version. You will have to upgrade "
+ "portage if you want to generate valid manifests for "
+ "this repository: %(layout_filename)s") %
+ {"repo_name":repo_name,
+ "hashes":" ".join(sorted(unsupported_hashes)),
+ "layout_filename":layout_filename}),
+ DeprecationWarning)
+ data['manifest-hashes'] = manifest_hashes
+
+ data['update-changelog'] = layout_data.get('update-changelog', 'false').lower() \
+ == 'false'
+
+ return data, layout_errors
next reply other threads:[~2011-10-25 21:45 UTC|newest]
Thread overview: 105+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-10-25 21:44 Zac Medico [this message]
-- strict thread matches above, loose matches on Subject: below --
2018-07-16 5:55 [gentoo-commits] proj/portage:master commit in: pym/portage/repository/ Zac Medico
2018-02-01 20:51 Michał Górny
2017-08-28 6:20 Zac Medico
2015-12-13 21:56 Zac Medico
2015-12-09 3:07 Zac Medico
2015-11-23 21:10 Arfrever Frehtes Taifersar Arahesis
2015-11-23 20:49 Arfrever Frehtes Taifersar Arahesis
2015-11-23 20:41 Arfrever Frehtes Taifersar Arahesis
2015-09-24 19:54 Brian Dolbec
2015-07-14 21:31 Brian Dolbec
2015-05-21 4:09 Mike Frysinger
2015-02-09 21:36 Brian Dolbec
2015-02-03 20:57 Brian Dolbec
2015-02-03 20:57 Brian Dolbec
2015-02-02 18:50 Brian Dolbec
2015-02-02 18:35 Brian Dolbec
2014-12-04 20:04 [gentoo-commits] proj/portage:plugin-sync " Brian Dolbec
2014-12-04 20:16 ` [gentoo-commits] proj/portage:master " Brian Dolbec
2014-02-09 7:27 Arfrever Frehtes Taifersar Arahesis
2013-09-23 20:59 Zac Medico
2013-09-23 20:44 Zac Medico
2013-09-23 20:43 Zac Medico
2013-09-15 14:10 Zac Medico
2013-09-15 10:58 Zac Medico
2013-09-13 9:14 Arfrever Frehtes Taifersar Arahesis
2013-08-22 16:22 Zac Medico
2013-08-08 16:04 Zac Medico
2013-07-29 17:23 Zac Medico
2013-07-25 21:41 Zac Medico
2013-07-25 19:55 Zac Medico
2013-07-25 18:46 Arfrever Frehtes Taifersar Arahesis
2013-07-25 18:25 Arfrever Frehtes Taifersar Arahesis
2013-07-24 20:42 Zac Medico
2013-07-23 21:53 Arfrever Frehtes Taifersar Arahesis
2013-07-23 5:56 Zac Medico
2013-07-23 4:45 Zac Medico
2013-07-23 4:42 Zac Medico
2013-07-14 7:57 Arfrever Frehtes Taifersar Arahesis
2013-07-14 7:49 Arfrever Frehtes Taifersar Arahesis
2013-06-28 1:54 Zac Medico
2013-06-26 3:32 Arfrever Frehtes Taifersar Arahesis
2013-06-24 23:42 Arfrever Frehtes Taifersar Arahesis
2013-06-24 22:03 Arfrever Frehtes Taifersar Arahesis
2013-06-24 21:47 Arfrever Frehtes Taifersar Arahesis
2013-06-24 19:45 Arfrever Frehtes Taifersar Arahesis
2013-06-24 19:40 Arfrever Frehtes Taifersar Arahesis
2013-06-24 19:24 Zac Medico
2013-06-24 18:57 Zac Medico
2013-06-24 17:04 Arfrever Frehtes Taifersar Arahesis
2013-06-19 19:22 Zac Medico
2013-06-19 19:11 Zac Medico
2013-06-19 18:02 Zac Medico
2013-06-19 5:55 Zac Medico
2013-06-19 4:49 Zac Medico
2013-06-19 3:58 Zac Medico
2013-06-19 3:42 Zac Medico
2013-06-19 2:19 Zac Medico
2013-06-19 1:58 Zac Medico
2013-06-18 21:20 Zac Medico
2013-06-18 17:47 Zac Medico
2013-06-18 16:14 Zac Medico
2013-03-29 21:43 Zac Medico
2013-03-20 18:38 Zac Medico
2013-03-10 8:31 Zac Medico
2013-03-10 8:22 Zac Medico
2013-03-10 8:07 Zac Medico
2013-01-24 20:01 Zac Medico
2012-06-06 0:11 Zac Medico
2012-05-11 23:28 Zac Medico
2012-02-03 22:41 Zac Medico
2012-01-08 3:12 Arfrever Frehtes Taifersar Arahesis
2012-01-08 3:12 Arfrever Frehtes Taifersar Arahesis
2011-12-28 8:16 Zac Medico
2011-12-25 19:43 Arfrever Frehtes Taifersar Arahesis
2011-12-18 21:57 Arfrever Frehtes Taifersar Arahesis
2011-12-18 21:26 Arfrever Frehtes Taifersar Arahesis
2011-12-18 21:14 Arfrever Frehtes Taifersar Arahesis
2011-12-18 3:05 Arfrever Frehtes Taifersar Arahesis
2011-12-13 22:19 Zac Medico
2011-10-29 6:15 Zac Medico
2011-10-28 7:17 Zac Medico
2011-10-28 6:48 Zac Medico
2011-10-28 6:20 Zac Medico
2011-10-28 5:38 Zac Medico
2011-10-28 5:30 Zac Medico
2011-10-28 5:15 Zac Medico
2011-10-27 19:41 Zac Medico
2011-10-27 5:55 Zac Medico
2011-10-27 5:32 Zac Medico
2011-10-27 5:09 Zac Medico
2011-10-25 21:44 Zac Medico
2011-10-16 6:18 Zac Medico
2011-10-09 19:10 Zac Medico
2011-10-09 19:10 Zac Medico
2011-10-08 23:23 Zac Medico
2011-10-08 21:41 Arfrever Frehtes Taifersar Arahesis
2011-10-05 1:11 Arfrever Frehtes Taifersar Arahesis
2011-10-04 15:33 Zac Medico
2011-10-03 20:14 Zac Medico
2011-10-03 18:33 Zac Medico
2011-09-30 22:05 Zac Medico
2011-09-17 18:08 Zac Medico
2011-09-12 21:27 Zac Medico
2011-09-12 21:27 Zac Medico
2011-07-08 16:36 Zac Medico
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=0be173a54a5248cfd70a3543d7099d2dd3ee254b.zmedico@gentoo \
--to=zmedico@gentoo.org \
--cc=gentoo-commits@lists.gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox