summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2006-06-28 22:24:07 +0000
committerZac Medico <zmedico@gentoo.org>2006-06-28 22:24:07 +0000
commit5f2a64fb4053d538bf086d6885824e3267b5cbaa (patch)
tree1f4b302d636b859b326373c60aaab406940795c4
parent2d7ef0838f59e03cc27ef0d8576538591704781e (diff)
downloadportage-5f2a64fb4053d538bf086d6885824e3267b5cbaa.tar.gz
portage-5f2a64fb4053d538bf086d6885824e3267b5cbaa.tar.bz2
portage-5f2a64fb4053d538bf086d6885824e3267b5cbaa.zip
Update symlinks in during package moves for bug #138394.
svn path=/main/trunk/; revision=3687
-rw-r--r--pym/portage.py26
1 files changed, 26 insertions, 0 deletions
diff --git a/pym/portage.py b/pym/portage.py
index 18aee7bd0..f391f0ba8 100644
--- a/pym/portage.py
+++ b/pym/portage.py
@@ -5450,6 +5450,7 @@ class binarytree(packagetree):
for cp in [origcp,newcp]:
if not (isvalidatom(cp) and isjustname(cp)):
raise portage_exception.InvalidPackageName(cp)
+ origcat = origcp.split("/")[0]
mynewcat=newcp.split("/")[0]
origmatches=self.dbapi.cp_list(origcp)
if not origmatches:
@@ -5492,6 +5493,31 @@ class binarytree(packagetree):
if (mynewpkg != myoldpkg):
os.rename(tbz2path,self.getname(mynewcpv))
self.dbapi.cpv_inject(mynewcpv)
+
+ # remove the old symlink and category directory, then create
+ # the new ones.
+ try:
+ os.unlink(os.path.join(self.pkgdir, origcat, myoldpkg) + ".tbz2")
+ except OSError, e:
+ if e.errno != errno.ENOENT:
+ raise
+ try:
+ os.rmdir(os.path.join(self.pkgdir, origcat))
+ except OSError, e:
+ if e.errno not in (errno.ENOENT, errno.ENOTEMPTY):
+ raise
+ try:
+ os.makedirs(os.path.join(self.pkgdir, mynewcat))
+ except OSError, e:
+ if e.errno != errno.EEXIST:
+ raise
+ try:
+ os.unlink(os.path.join(self.pkgdir, mynewcat, mynewpkg) + ".tbz2")
+ except OSError, e:
+ if e.errno != errno.ENOENT:
+ raise
+ os.symlink(os.path.join("..", "All", mynewpkg) + ".tbz2",
+ os.path.join(self.pkgdir, mynewcat, mynewpkg) + ".tbz2")
return 1
def move_slot_ent(self, mylist):