summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorSebastian Luther <SebastianLuther@gmx.de>2010-09-22 11:50:28 +0200
committerZac Medico <zmedico@gentoo.org>2010-09-26 23:50:14 -0700
commita6d9d67e3ff100bc07cc77d5e7702983fa6122e0 (patch)
tree0a7a047fc861a66dd4b43bd7b671d2f83bfb9fe5 /pym
parente5fb61a392ebd22b761e10f85e22243a52555b67 (diff)
downloadportage-a6d9d67e3ff100bc07cc77d5e7702983fa6122e0.tar.gz
portage-a6d9d67e3ff100bc07cc77d5e7702983fa6122e0.tar.bz2
portage-a6d9d67e3ff100bc07cc77d5e7702983fa6122e0.zip
reposyntax: Handle missing profiles/repo_name by setting repo_name to x-$(basename $path)
Diffstat (limited to 'pym')
-rw-r--r--pym/_emerge/main.py16
-rw-r--r--pym/portage/dbapi/porttree.py37
2 files changed, 32 insertions, 21 deletions
diff --git a/pym/_emerge/main.py b/pym/_emerge/main.py
index 17f83672c..48b0955d0 100644
--- a/pym/_emerge/main.py
+++ b/pym/_emerge/main.py
@@ -1172,13 +1172,11 @@ def expand_set_arguments(myfiles, myaction, root_config):
def repo_name_check(trees):
missing_repo_names = set()
- for root, root_trees in trees.items():
- if "porttree" in root_trees:
- portdb = root_trees["porttree"].dbapi
- missing_repo_names.update(portdb.porttrees)
- repos = portdb.getRepositories()
- for r in repos:
- missing_repo_names.discard(portdb.getRepositoryPath(r))
+ for root_trees in trees.values():
+ porttree = root_trees.get("porttree")
+ if porttree:
+ portdb = porttree.dbapi
+ missing_repo_names.update(portdb.getMissingRepoNames())
if portdb.porttree_root in missing_repo_names and \
not os.path.exists(os.path.join(
portdb.porttree_root, "profiles")):
@@ -1197,6 +1195,7 @@ def repo_name_check(trees):
msg.extend(textwrap.wrap("NOTE: Each repo_name entry " + \
"should be a plain text file containing a unique " + \
"name for the repository on the first line.", 70))
+ msg.append("\n")
writemsg_level("".join("%s\n" % l for l in msg),
level=logging.WARNING, noiselevel=-1)
@@ -1219,7 +1218,7 @@ def repo_name_duplicate_check(trees):
msg.append(' profiles/repo_name entries:')
msg.append('')
for k in sorted(ignored_repos):
- msg.append(' %s overrides' % (k,))
+ msg.append(' %s overrides' % ", ".join(k))
for path in ignored_repos[k]:
msg.append(' %s' % (path,))
msg.append('')
@@ -1228,6 +1227,7 @@ def repo_name_duplicate_check(trees):
"to avoid having duplicates ignored. " + \
"Set PORTAGE_REPO_DUPLICATE_WARN=\"0\" in " + \
"/etc/make.conf if you would like to disable this warning."))
+ msg.append("\n")
writemsg_level(''.join('%s\n' % l for l in msg),
level=logging.WARNING, noiselevel=-1)
diff --git a/pym/portage/dbapi/porttree.py b/pym/portage/dbapi/porttree.py
index 44dfa2503..065c57b42 100644
--- a/pym/portage/dbapi/porttree.py
+++ b/pym/portage/dbapi/porttree.py
@@ -114,6 +114,8 @@ class portdbapi(dbapi):
repository_map = {}
self.treemap = treemap
self._repository_map = repository_map
+ #Keep track of repos that lack profiles/repo_name
+ self._missing_repo_names = set()
identically_named_paths = {}
for path in porttrees:
if path in repository_map:
@@ -129,19 +131,22 @@ class portdbapi(dbapi):
# warn about missing repo_name at some other time, since we
# don't want to see a warning every time the portage module is
# imported.
- pass
- else:
- identically_named_path = treemap.get(repo_name)
- if identically_named_path is not None:
- # The earlier one is discarded.
- del repository_map[identically_named_path]
- identically_named_paths[identically_named_path] = repo_name
- if identically_named_path == porttrees[0]:
- # Found another repo with the same name as
- # $PORTDIR, so update porttrees[0] to match.
- porttrees[0] = path
- treemap[repo_name] = path
- repository_map[path] = repo_name
+ self._missing_repo_names.add(path)
+ repo_name = "x-" + os.path.basename(path)
+
+ identically_named_path = treemap.get(repo_name)
+ if identically_named_path is not None:
+ # The earlier one is discarded.
+ del repository_map[identically_named_path]
+ identically_named_paths[identically_named_path] = repo_name
+ if identically_named_path == porttrees[0]:
+ # Found another repo with the same name as
+ # $PORTDIR, so update porttrees[0] to match.
+ porttrees[0] = path
+ treemap[repo_name] = path
+ repository_map[path] = repo_name
+
+ self._missing_repo_names = frozenset(self._missing_repo_names)
# Ensure that each repo_name is unique. Later paths override
# earlier ones that correspond to the same name.
@@ -393,6 +398,12 @@ class portdbapi(dbapi):
"""
return self._ordered_repo_name_list
+ def getMissingRepoNames(self):
+ """
+ Returns a list of repository paths that lack profiles/repo_name.
+ """
+ return self._missing_repo_names
+
def findname2(self, mycpv, mytree=None, myrepo = None):
"""
Returns the location of the CPV, and what overlay it was in.