summaryrefslogtreecommitdiffstats
path: root/pym/portage_update.py
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-11-03 19:19:56 +0000
committerZac Medico <zmedico@gentoo.org>2007-11-03 19:19:56 +0000
commit3b8a10f77014cb1d67735aa172de7b6827ed9e6d (patch)
tree7e45955c0216204cf1edad484591d979f20d9f9b /pym/portage_update.py
parent53450656af965d040e399d4a29c330a6e6b85a3f (diff)
downloadportage-3b8a10f77014cb1d67735aa172de7b6827ed9e6d.tar.gz
portage-3b8a10f77014cb1d67735aa172de7b6827ed9e6d.tar.bz2
portage-3b8a10f77014cb1d67735aa172de7b6827ed9e6d.zip
Fix update_config_files() so that it uses update_dbentry()
to handle update commands since that already supports slotmove commands for SLOT atoms. (trunk r8397) svn path=/main/branches/2.1.2/; revision=8398
Diffstat (limited to 'pym/portage_update.py')
-rw-r--r--pym/portage_update.py60
1 files changed, 30 insertions, 30 deletions
diff --git a/pym/portage_update.py b/pym/portage_update.py
index bfbc90c6a..67bd61edc 100644
--- a/pym/portage_update.py
+++ b/pym/portage_update.py
@@ -176,39 +176,39 @@ def update_config_files(config_root, protect, protect_mask, update_iter):
if file_contents.has_key(x):
del file_contents[x]
continue
- worldlist = grabfile(os.path.join(config_root, WORLD_FILE))
+ worldlist = grabfile(os.path.join(config_root, WORLD_FILE))
+ modified = False
for update_cmd in update_iter:
- if update_cmd[0] == "move":
- old_value, new_value = update_cmd[1], update_cmd[2]
- #update world entries:
- for x in range(0,len(worldlist)):
- #update world entries, if any.
- worldlist[x] = \
- dep_transform(worldlist[x], old_value, new_value)
-
- #update /etc/portage/packages.*
- for x in file_contents:
- for mypos in range(0,len(file_contents[x])):
- line = file_contents[x][mypos]
- if line[0] == "#" or not line.strip():
- continue
- myatom = line.split()[0]
- if myatom.startswith("-"):
- # package.mask supports incrementals
- myatom = myatom[1:]
- if not isvalidatom(myatom):
- continue
- key = dep_getkey(myatom)
- if key == old_value:
- file_contents[x][mypos] = \
- line.replace(old_value, new_value)
- update_files[x] = 1
- sys.stdout.write("p")
- sys.stdout.flush()
+ 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")
- 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:
+ for x, contents in file_contents.iteritems():
+ for pos, line in enumerate(contents):
+ if ignore_line_re.match(line):
+ continue
+ atom = line.split()[0]
+ if atom.startswith("-"):
+ # package.mask supports incrementals
+ atom = atom[1:]
+ if not isvalidatom(atom):
+ 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()
protect_obj = ConfigProtect(
config_root, protect, protect_mask)