summaryrefslogtreecommitdiffstats
path: root/pym
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2007-05-28 09:31:26 +0000
committerZac Medico <zmedico@gentoo.org>2007-05-28 09:31:26 +0000
commit8fc7b6a4a3c745a376ec3fcd63aa8ca796a0b29f (patch)
tree4173b113d3ce8731d2389f837685cdb394b69cc7 /pym
parentf2a8756b2e5fd201582276fe45855dad237cd9aa (diff)
downloadportage-8fc7b6a4a3c745a376ec3fcd63aa8ca796a0b29f.tar.gz
portage-8fc7b6a4a3c745a376ec3fcd63aa8ca796a0b29f.tar.bz2
portage-8fc7b6a4a3c745a376ec3fcd63aa8ca796a0b29f.zip
Add new emaint targets called "moveinst" and "movebin" for applying package moves from $PORTDIR/profiles/updates/ on installed packages and binary packages.
svn path=/main/trunk/; revision=6652
Diffstat (limited to 'pym')
-rw-r--r--pym/portage/__init__.py18
-rw-r--r--pym/portage/dbapi/bintree.py17
-rw-r--r--pym/portage/dbapi/vartree.py13
3 files changed, 32 insertions, 16 deletions
diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py
index 0f90e2dd6..242bfb1b7 100644
--- a/pym/portage/__init__.py
+++ b/pym/portage/__init__.py
@@ -5058,13 +5058,23 @@ def global_updates(mysettings, trees, prev_mtimes):
trees["/"]["bintree"] = binarytree("/", mysettings["PKGDIR"],
settings=mysettings)
+ vardb = trees["/"]["vartree"].dbapi
+ bindb = trees["/"]["bintree"].dbapi
for update_cmd in myupd:
if update_cmd[0] == "move":
- trees["/"]["vartree"].dbapi.move_ent(update_cmd)
- trees["/"]["bintree"].move_ent(update_cmd)
+ moves = vardb.move_ent(update_cmd)
+ if moves:
+ writemsg_stdout(moves * "@")
+ moves = bindb.move_ent(update_cmd)
+ if moves:
+ writemsg_stdout(moves * "%")
elif update_cmd[0] == "slotmove":
- trees["/"]["vartree"].dbapi.move_slot_ent(update_cmd)
- trees["/"]["bintree"].move_slot_ent(update_cmd)
+ moves = vardb.move_slot_ent(update_cmd)
+ if moves:
+ writemsg_stdout(moves * "s")
+ moves = bindb.move_slot_ent(update_cmd)
+ if moves:
+ writemsg_stdout(moves * "S")
# The above global updates proceed quickly, so they
# are considered a single mtimedb transaction.
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index 8ef1ff23b..434480e48 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -15,6 +15,8 @@ import os, errno, stat
class bindbapi(fakedbapi):
def __init__(self, mybintree=None, settings=None):
self.bintree = mybintree
+ self.move_ent = mybintree.move_ent
+ self.move_slot_ent = mybintree.move_slot_ent
self.cpvdict={}
self.cpdict={}
if settings is None:
@@ -130,8 +132,9 @@ class binarytree(object):
origcat = origcp.split("/")[0]
mynewcat = newcp.split("/")[0]
origmatches=self.dbapi.cp_list(origcp)
+ moves = 0
if not origmatches:
- return
+ return moves
for mycpv in origmatches:
mycpsplit = catpkgsplit(mycpv)
@@ -153,8 +156,7 @@ class binarytree(object):
noiselevel=-1)
continue
- #print ">>> Updating data in:",mycpv
- writemsg_stdout("%")
+ moves += 1
mytbz2 = portage.xpak.tbz2(tbz2path)
mydata = mytbz2.get_data()
updated_items = update_dbentries([mylist], mydata)
@@ -184,7 +186,7 @@ class binarytree(object):
self._create_symlink(mynewcpv)
self.dbapi.cpv_inject(mynewcpv)
- return 1
+ return moves
def _remove_symlink(self, cpv):
"""Remove a ${PKGDIR}/${CATEGORY}/${PF}.tbz2 symlink and also remove
@@ -235,8 +237,9 @@ class binarytree(object):
raise InvalidAtom(pkg)
origmatches = self.dbapi.match(pkg)
+ moves = 0
if not origmatches:
- return
+ return moves
for mycpv in origmatches:
mycpsplit = catpkgsplit(mycpv)
myoldpkg = mycpv.split("/")[1]
@@ -257,10 +260,10 @@ class binarytree(object):
if (slot[0] != origslot):
continue
- writemsg_stdout("S")
+ moves += 1
mydata["SLOT"] = newslot+"\n"
mytbz2.recompose_mem(portage.xpak.xpak_mem(mydata))
- return 1
+ return moves
def update_ents(self, update_iter):
if len(update_iter) == 0:
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index f0be27eba..906c3c97f 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -276,8 +276,9 @@ class vardbapi(dbapi):
if not (isvalidatom(cp) and isjustname(cp)):
raise InvalidPackageName(cp)
origmatches = self.match(origcp, use_cache=0)
+ moves = 0
if not origmatches:
- return
+ return moves
for mycpv in origmatches:
mycpsplit = catpkgsplit(mycpv)
mynewcpv = newcp + "-" + mycpsplit[2]
@@ -288,7 +289,7 @@ class vardbapi(dbapi):
origpath = self.getpath(mycpv)
if not os.path.exists(origpath):
continue
- writemsg_stdout("@")
+ moves += 1
if not os.path.exists(self.getpath(mynewcat)):
#create the directory
os.makedirs(self.getpath(mynewcat))
@@ -313,6 +314,7 @@ class vardbapi(dbapi):
write_atomic(os.path.join(newpath, "CATEGORY"), mynewcat+"\n")
fixdbentries([mylist], newpath)
+ return moves
def update_ents(self, update_iter):
"""Run fixdbentries on all installed packages (time consuming). Like
@@ -336,9 +338,9 @@ class vardbapi(dbapi):
raise InvalidAtom(pkg)
origmatches = self.match(pkg, use_cache=0)
-
+ moves = 0
if not origmatches:
- return
+ return moves
for mycpv in origmatches:
origpath = self.getpath(mycpv)
if not os.path.exists(origpath):
@@ -351,8 +353,9 @@ class vardbapi(dbapi):
if (slot[0] != origslot):
continue
- writemsg_stdout("s")
+ moves += 1
write_atomic(os.path.join(origpath, "SLOT"), newslot+"\n")
+ return moves
def cp_list(self, mycp, use_cache=1):
mysplit=catsplit(mycp)