summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xbin/emaint3
-rw-r--r--pym/portage/_global_updates.py17
-rw-r--r--pym/portage/dbapi/__init__.py27
3 files changed, 31 insertions, 16 deletions
diff --git a/bin/emaint b/bin/emaint
index 2bd17d9fd..52990f7df 100755
--- a/bin/emaint
+++ b/bin/emaint
@@ -323,8 +323,7 @@ class MoveHandler(object):
# Searching for updates in all the metadata is relatively slow, so this
# is where the progress bar comes out of indeterminate mode.
- for repo, updates in allupdates.items():
- self._tree.dbapi.update_ents(updates, onProgress=onProgress, repo=repo)
+ self._tree.dbapi.update_ents(allupdates, onProgress=onProgress)
return errors
class MoveInstalled(MoveHandler):
diff --git a/pym/portage/_global_updates.py b/pym/portage/_global_updates.py
index 214052daf..85c8d8ef4 100644
--- a/pym/portage/_global_updates.py
+++ b/pym/portage/_global_updates.py
@@ -54,6 +54,8 @@ def _global_updates(trees, prev_mtimes):
world_list = grabfile(world_file)
world_modified = False
world_warnings = set()
+ updpath_map = {}
+ repo_map = {}
for repo_name in portdb.getRepositories():
repo = portdb.getRepositoryPath(repo_name)
@@ -62,6 +64,10 @@ def _global_updates(trees, prev_mtimes):
# as a backwards-compatibility measure, fallback to PORTDIR
updpath = os.path.join(portdb.porttree_root, "profiles", "updates")
+ if updpath in updpath_map:
+ repo_map[repo_name] = updpath_map[updpath]
+ continue
+
try:
if mysettings.get("PORTAGE_CALLER") == "fixpackages":
update_data = grab_updates(updpath)
@@ -69,10 +75,11 @@ def _global_updates(trees, prev_mtimes):
update_data = grab_updates(updpath, prev_mtimes)
except DirectoryNotFound:
continue
- myupd = None
+ myupd = []
+ updpath_map[updpath] = myupd
+ repo_map[repo_name] = myupd
if len(update_data) > 0:
do_upgrade_packagesmessage = 0
- myupd = []
timestamps = {}
for mykey, mystat, mycontent in update_data:
writemsg_stdout("\n\n")
@@ -96,6 +103,7 @@ def _global_updates(trees, prev_mtimes):
writemsg("%s\n" % msg, noiselevel=-1)
retupd.extend(myupd)
+ for repo_name, myupd in repo_map.items():
def _world_repo_match(atoma, atomb):
"""
Check whether to perform a world change from atoma to atomb.
@@ -151,18 +159,19 @@ def _global_updates(trees, prev_mtimes):
for mykey, mtime in timestamps.items():
prev_mtimes[mykey] = mtime
+ if repo_map:
# We gotta do the brute force updates for these now.
if mysettings.get("PORTAGE_CALLER") == "fixpackages" or \
"fixpackages" in mysettings.features:
def onUpdate(maxval, curval):
if curval > 0:
writemsg_stdout("#")
- vardb.update_ents(myupd, onUpdate=onUpdate, repo=repo_name)
+ vardb.update_ents(repo_map, onUpdate=onUpdate)
if bindb:
def onUpdate(maxval, curval):
if curval > 0:
writemsg_stdout("*")
- bindb.update_ents(myupd, onUpdate=onUpdate, repo=repo_name)
+ bindb.update_ents(repo_map, onUpdate=onUpdate)
else:
do_upgrade_packagesmessage = 1
diff --git a/pym/portage/dbapi/__init__.py b/pym/portage/dbapi/__init__.py
index 88af46ba8..b6b9175c6 100644
--- a/pym/portage/dbapi/__init__.py
+++ b/pym/portage/dbapi/__init__.py
@@ -197,36 +197,43 @@ class dbapi(object):
else:
writemsg("!!! Invalid db entry: %s\n" % mypath, noiselevel=-1)
- def update_ents(self, updates, onProgress=None, onUpdate=None, repo=None):
+ def update_ents(self, updates, onProgress=None, onUpdate=None):
"""
Update metadata of all packages for package moves.
- @param updates: A list of move commands
- @type updates: List
+ @param updates: A list of move commands, or dict of {repo_name: list}
+ @type updates: list or dict
@param onProgress: A progress callback function
@type onProgress: a callable that takes 2 integer arguments: maxval and curval
@param onUpdate: A progress callback function called only
for packages that are modified by updates.
@type onUpdate: a callable that takes 2 integer arguments:
maxval and curval
- @param repo: Name of the repository which packages should be updated
- @type repo: string
"""
cpv_all = self.cpv_all()
cpv_all.sort()
maxval = len(cpv_all)
aux_get = self.aux_get
aux_update = self.aux_update
- update_keys = ["DEPEND", "RDEPEND", "PDEPEND", "PROVIDE"]
+ meta_keys = ["DEPEND", "RDEPEND", "PDEPEND", "PROVIDE", 'repository']
+ repo_dict = None
+ if isinstance(updates, dict):
+ repo_dict = updates
from portage.update import update_dbentries
if onUpdate:
onUpdate(maxval, 0)
if onProgress:
onProgress(maxval, 0)
for i, cpv in enumerate(cpv_all):
- if repo and aux_get(cpv, ['repository'])[0] != repo:
- continue
- metadata = dict(zip(update_keys, aux_get(cpv, update_keys)))
- metadata_updates = update_dbentries(updates, metadata)
+ metadata = dict(zip(meta_keys, aux_get(cpv, meta_keys)))
+ repo = metadata.pop('repository')
+ if repo_dict is None:
+ updates_list = updates
+ else:
+ updates_list = repo_dict.get(repo)
+ if updates_list is None:
+ continue
+
+ metadata_updates = update_dbentries(updates_list, metadata)
if metadata_updates:
aux_update(cpv, metadata_updates)
if onUpdate: