aux_update(cpv, metadata_updates)
if onProgress:
onProgress(maxval, i+1)
+
+ def move_slot_ent(self, mylist):
+ pkg = mylist[1]
+ origslot = mylist[2]
+ newslot = mylist[3]
+ origmatches = self.match(pkg)
+ moves = 0
+ if not origmatches:
+ return moves
+ from portage.versions import catsplit
+ for mycpv in origmatches:
+ slot = self.aux_get(mycpv, ["SLOT"])[0]
+ if slot != origslot:
+ continue
+ moves += 1
+ mydata = {"SLOT": newslot+"\n"}
+ self.aux_update(mycpv, mydata)
+ return moves
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:
self.bintree.populate()
return fakedbapi.cpv_all(self)
+ def move_slot_ent(self, mylist):
+ if not self.bintree.populated:
+ self.bintree.populate()
+ return fakedbapi.move_slot_ent(self, mylist)
class binarytree(object):
"this tree scans for a list of all packages available in PKGDIR"
self.pkgdir = normalize_path(pkgdir)
self.dbapi = bindbapi(self, settings=settings)
self.update_ents = self.dbapi.update_ents
+ self.move_slot_ent = self.dbapi.move_slot_ent
self.populated = 0
self.tree = {}
self.remotepkgs = {}
del e
os.symlink(os.path.join("..", "All", mypkg + ".tbz2"), full_path)
- def move_slot_ent(self, mylist):
- if not self.populated:
- self.populate()
- pkg = mylist[1]
- origslot = mylist[2]
- newslot = mylist[3]
-
- if not isvalidatom(pkg):
- raise InvalidAtom(pkg)
-
- origmatches = self.dbapi.match(pkg)
- moves = 0
- if not origmatches:
- return moves
- for mycpv in origmatches:
- mycpsplit = catpkgsplit(mycpv)
- myoldpkg = mycpv.split("/")[1]
- tbz2path = self.getname(mycpv)
- if os.path.exists(tbz2path) and not os.access(tbz2path,os.W_OK):
- writemsg("!!! Cannot update readonly binary: "+mycpv+"\n",
- noiselevel=-1)
- continue
-
- #print ">>> Updating data in:",mycpv
- mytbz2 = portage.xpak.tbz2(tbz2path)
- mydata = mytbz2.get_data()
-
- slot = mydata["SLOT"]
- if (not slot):
- continue
-
- if (slot[0] != origslot):
- continue
-
- moves += 1
- mydata["SLOT"] = newslot+"\n"
- mytbz2.recompose_mem(portage.xpak.xpak_mem(mydata))
- return moves
-
def prevent_collision(self, cpv):
"""Make sure that the file location ${PKGDIR}/All/${PF}.tbz2 is safe to
use for a given cpv. If a collision will occur with an existing
fixdbentries([mylist], newpath)
return moves
- def move_slot_ent(self, mylist):
- pkg = mylist[1]
- origslot = mylist[2]
- newslot = mylist[3]
-
- if not isvalidatom(pkg):
- raise InvalidAtom(pkg)
-
- origmatches = self.match(pkg, use_cache=0)
- moves = 0
- if not origmatches:
- return moves
- for mycpv in origmatches:
- origpath = self.getpath(mycpv)
- if not os.path.exists(origpath):
- continue
-
- slot = grabfile(os.path.join(origpath, "SLOT"));
- if (not slot):
- continue
-
- if (slot[0] != origslot):
- continue
-
- moves += 1
- write_atomic(os.path.join(origpath, "SLOT"), newslot+"\n")
- return moves
-
def cp_list(self, mycp, use_cache=1):
mysplit=catsplit(mycp)
if mysplit[0] == '*':