diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-09-13 05:53:18 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-09-13 05:53:18 +0000 |
commit | 3c59a39056452c2592478f41929e0bab493b68d4 (patch) | |
tree | 5014fd3e46905ce5a16f7c07a8a650bc3049b63e | |
parent | 08330cc73276d1cf3a75335995fe51fd636f39b1 (diff) | |
download | portage-3c59a39056452c2592478f41929e0bab493b68d4.tar.gz portage-3c59a39056452c2592478f41929e0bab493b68d4.tar.bz2 portage-3c59a39056452c2592478f41929e0bab493b68d4.zip |
Move the world file update code out of update_config_files() since it should
not be relative to PORTAGE_CONFIGROOT. Thanks to grobian for reporting.
svn path=/main/trunk/; revision=11508
-rw-r--r-- | pym/portage/__init__.py | 17 | ||||
-rw-r--r-- | pym/portage/update.py | 13 |
2 files changed, 16 insertions, 14 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 3bcb0b06c..199317c28 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -117,7 +117,7 @@ try: import portage.eclass_cache from portage.localization import _ from portage.update import dep_transform, fixdbentries, grab_updates, \ - parse_updates, update_config_files, update_dbentries + parse_updates, update_config_files, update_dbentries, update_dbentry # Need these functions directly in portage namespace to not break every external tool in existence from portage.versions import best, catpkgsplit, catsplit, pkgcmp, \ @@ -7069,6 +7069,7 @@ def _global_updates(trees, prev_mtimes): global secpass if secpass < 2 or "SANDBOX_ACTIVE" in os.environ: return + root = "/" mysettings = trees["/"]["vartree"].settings updpath = os.path.join(mysettings["PORTDIR"], "profiles", "updates") @@ -7102,6 +7103,20 @@ def _global_updates(trees, prev_mtimes): for msg in errors: writemsg("%s\n" % msg, noiselevel=-1) + world_file = os.path.join(root, WORLD_FILE) + world_list = grabfile(world_file) + world_modified = False + for update_cmd in myupd: + for pos, atom in enumerate(world_list): + new_atom = update_dbentry(update_cmd, atom) + if atom != new_atom: + world_list[pos] = new_atom + world_modified = True + if world_modified: + world_list.sort() + write_atomic(world_file, + "".join("%s\n" % (x,) for x in world_list)) + update_config_files("/", mysettings.get("CONFIG_PROTECT","").split(), mysettings.get("CONFIG_PROTECT_MASK","").split(), diff --git a/pym/portage/update.py b/pym/portage/update.py index 36108dd22..85d07f5a3 100644 --- a/pym/portage/update.py +++ b/pym/portage/update.py @@ -177,19 +177,6 @@ def update_config_files(config_root, protect, protect_mask, update_iter): del file_contents[x] continue - worldlist = grabfile(os.path.join(config_root, WORLD_FILE)) - modified = False - for update_cmd in update_iter: - for pos, atom in enumerate(worldlist): - new_atom = update_dbentry(update_cmd, atom) - if atom != new_atom: - worldlist[pos] = new_atom - modified = True - if modified: - worldlist.sort() - write_atomic(os.path.join(config_root, WORLD_FILE), - "\n".join(worldlist)+"\n") - # update /etc/portage/packages.* ignore_line_re = re.compile(r'^#|^\s*$') for update_cmd in update_iter: |