summaryrefslogtreecommitdiffstats
path: root/pym/portage/update.py
diff options
context:
space:
mode:
authorMichał Górny <gentoo@mgorny.alt.pl>2010-07-05 11:21:23 +0200
committerZac Medico <zmedico@gentoo.org>2010-07-27 16:13:16 -0700
commitad54ccc5c9dff04ffa47daf87f1364e6ec17a9ef (patch)
tree2fb42e2ee59ebb7c235738dd07950b28568e40fc /pym/portage/update.py
parent53f820a855cc9c817424c4705ca6f7b72b63e31e (diff)
downloadportage-ad54ccc5c9dff04ffa47daf87f1364e6ec17a9ef.tar.gz
portage-ad54ccc5c9dff04ffa47daf87f1364e6ec17a9ef.tar.bz2
portage-ad54ccc5c9dff04ffa47daf87f1364e6ec17a9ef.zip
Support repository-wide updates.
Support reading repository-wide update files. Apply them as long as the 'repository' for vardb entry matches the repository update is originating from. For world and configuration files, use the best vardb match.
Diffstat (limited to 'pym/portage/update.py')
-rw-r--r--pym/portage/update.py15
1 files changed, 9 insertions, 6 deletions
diff --git a/pym/portage/update.py b/pym/portage/update.py
index 7d48e1d17..b24c9cb0c 100644
--- a/pym/portage/update.py
+++ b/pym/portage/update.py
@@ -182,12 +182,14 @@ def parse_updates(mycontent):
myupd.append(mysplit)
return myupd, errors
-def update_config_files(config_root, protect, protect_mask, update_iter):
+def update_config_files(config_root, protect, protect_mask, update_iter, match_callback = None):
"""Perform global updates on /etc/portage/package.*.
config_root - location of files to update
protect - list of paths from CONFIG_PROTECT
protect_mask - list of paths from CONFIG_PROTECT_MASK
- update_iter - list of update commands as returned from parse_updates()"""
+ update_iter - list of update commands as returned from parse_updates()
+ match_callback - a callback which will be called with old and new atoms
+ and should return boolean value determining whether to perform the update"""
config_root = normalize_path(config_root)
update_files = {}
@@ -253,10 +255,11 @@ def update_config_files(config_root, protect, protect_mask, update_iter):
continue
new_atom = update_dbentry(update_cmd, atom)
if atom != new_atom:
- contents[pos] = line.replace(atom, new_atom)
- update_files[x] = 1
- sys.stdout.write("p")
- sys.stdout.flush()
+ if match_callback(atom, new_atom):
+ contents[pos] = line.replace(atom, new_atom)
+ update_files[x] = 1
+ sys.stdout.write("p")
+ sys.stdout.flush()
protect_obj = ConfigProtect(
config_root, protect, protect_mask)