diff options
author | Zac Medico <zmedico@gentoo.org> | 2006-02-18 23:39:05 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2006-02-18 23:39:05 +0000 |
commit | f81515d2a66b9454ae4cae42c962b865db76f9e2 (patch) | |
tree | 61bf9031cecad80c5470f3b0c432c214e6510cfa | |
parent | a70e48884fec47655063d484dc606f5060fcc67f (diff) | |
download | portage-f81515d2a66b9454ae4cae42c962b865db76f9e2.tar.gz portage-f81515d2a66b9454ae4cae42c962b865db76f9e2.tar.bz2 portage-f81515d2a66b9454ae4cae42c962b865db76f9e2.zip |
Clean up do_upgrade() and add atom validation.
svn path=/main/trunk/; revision=2735
-rw-r--r-- | pym/portage.py | 38 |
1 files changed, 25 insertions, 13 deletions
diff --git a/pym/portage.py b/pym/portage.py index ea45dfaa6..0a0eadb74 100644 --- a/pym/portage.py +++ b/pym/portage.py @@ -6791,23 +6791,33 @@ def do_upgrade(mykey): db["/"]["bintree"]=binarytree("/",settings["PKGDIR"],virts) for myline in mylines: mysplit = myline.split() - if not len(mysplit): + if len(mysplit) == 0: continue - if mysplit[0]!="move" and mysplit[0]!="slotmove": + if mysplit[0] is not in ("move", "slotmove"): writemsg("portage: Update type \""+mysplit[0]+"\" not recognized.\n") processed=0 continue - if mysplit[0]=="move" and len(mysplit)!=3: - writemsg("portage: Update command \""+myline+"\" invalid; skipping.\n") - processed=0 - continue - if mysplit[0]=="slotmove" and len(mysplit)!=4: - writemsg("portage: Update command \""+myline+"\" invalid; skipping.\n") - processed=0 - continue - sys.stdout.write(".") - sys.stdout.flush() - + if mysplit[0]=="move": + if len(mysplit)!=3: + writemsg("portage: Update command \""+myline+"\" invalid; skipping.\n") + processed=0 + continue + orig_value, new_value = mysplit[1], mysplit[2] + for cp in (orig_value, new_value): + if not (isvalidatom(cp) and isjustname(cp)): + writemsg("\nERROR: Malformed update entry '%s'\n" % myline) + processed=0 + continue + if mysplit[0]=="slotmove": + if len(mysplit)!=4: + writemsg("portage: Update command \""+myline+"\" invalid; skipping.\n") + processed=0 + continue + pkg, origslot, newslot = mylist[1], mylist[2], mylist[3] + if not isvalidatom(pkg): + writemsg("\nERROR: Malformed update entry '%s'\n" % myline) + processed=0 + continue if mysplit[0]=="move": try: db["/"]["vartree"].dbapi.move_ent(mysplit) @@ -6825,6 +6835,8 @@ def do_upgrade(mykey): # The list of valid updates is filtered by continue statements above. myupd.append(mysplit) + sys.stdout.write(".") + sys.stdout.flush() if processed: #update our internal mtime since we processed all our directives. |