aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2015-02-17 18:25:04 -0800
committerZac Medico <zmedico@gentoo.org>2015-03-04 13:32:07 -0800
commitbd9569342d1f6ca1c21cf34770bc403f8508c1ad (patch)
treefdffaa6a24736914e5b173a0257a8c47d0ce80fb /pym/portage/dbapi/bintree.py
parentbinpkg-multi-instance 5 of 7 (diff)
downloadportage-bd9569342d1f6ca1c21cf34770bc403f8508c1ad.tar.gz
portage-bd9569342d1f6ca1c21cf34770bc403f8508c1ad.tar.bz2
portage-bd9569342d1f6ca1c21cf34770bc403f8508c1ad.zip
binpkg-multi-instance 6 of 7
Remove unused binarytree _remove_symlink, _create_symlink, prevent_collision, _move_to_all, and _move_from_all methods. These are all related to the oldest PKGDIR layout, which put all of the tbz2 files in $PKGDIR/All, and created symlinks to them in the category directories. The $PKGDIR/All layout should be practically extinct by now. Now portage recognizes all existing layouts, or mixtures of them, and uses the old packages in place. It never puts new packages in $PKGDIR/All, so there's no need to move packages around to prevent file name collisions between packages from different categories. It also only uses regular files (any symlinks are ignored).
Diffstat (limited to 'pym/portage/dbapi/bintree.py')
-rw-r--r--pym/portage/dbapi/bintree.py117
1 files changed, 4 insertions, 113 deletions
diff --git a/pym/portage/dbapi/bintree.py b/pym/portage/dbapi/bintree.py
index f5e7303d4..2f0bc4705 100644
--- a/pym/portage/dbapi/bintree.py
+++ b/pym/portage/dbapi/bintree.py
@@ -471,89 +471,11 @@ class binarytree(object):
return moves
- def _remove_symlink(self, cpv):
- """Remove a ${PKGDIR}/${CATEGORY}/${PF}.tbz2 symlink and also remove
- the ${PKGDIR}/${CATEGORY} directory if empty. The file will not be
- removed if os.path.islink() returns False."""
- mycat, mypkg = catsplit(cpv)
- mylink = os.path.join(self.pkgdir, mycat, mypkg + ".tbz2")
- if os.path.islink(mylink):
- """Only remove it if it's really a link so that this method never
- removes a real package that was placed here to avoid a collision."""
- os.unlink(mylink)
- try:
- os.rmdir(os.path.join(self.pkgdir, mycat))
- except OSError as e:
- if e.errno not in (errno.ENOENT,
- errno.ENOTEMPTY, errno.EEXIST):
- raise
- del e
-
- def _create_symlink(self, cpv):
- """Create a ${PKGDIR}/${CATEGORY}/${PF}.tbz2 symlink (and
- ${PKGDIR}/${CATEGORY} directory, if necessary). Any file that may
- exist in the location of the symlink will first be removed."""
- mycat, mypkg = catsplit(cpv)
- full_path = os.path.join(self.pkgdir, mycat, mypkg + ".tbz2")
- self._ensure_dir(os.path.dirname(full_path))
- try:
- os.unlink(full_path)
- except OSError as e:
- if e.errno != errno.ENOENT:
- raise
- del e
- os.symlink(os.path.join("..", "All", mypkg + ".tbz2"), full_path)
-
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
- package from another category, the existing package will be bumped to
- ${PKGDIR}/${CATEGORY}/${PF}.tbz2 so that both can coexist."""
- if not self._all_directory:
- return
-
- # Copy group permissions for new directories that
- # may have been created.
- for path in ("All", catsplit(cpv)[0]):
- path = os.path.join(self.pkgdir, path)
- self._ensure_dir(path)
- if not os.access(path, os.W_OK):
- raise PermissionDenied("access('%s', W_OK)" % path)
-
- full_path = self.getname(cpv)
- if "All" == full_path.split(os.path.sep)[-2]:
- return
- """Move a colliding package if it exists. Code below this point only
- executes in rare cases."""
- mycat, mypkg = catsplit(cpv)
- myfile = mypkg + ".tbz2"
- mypath = os.path.join("All", myfile)
- dest_path = os.path.join(self.pkgdir, mypath)
-
- try:
- st = os.lstat(dest_path)
- except OSError:
- st = None
- else:
- if stat.S_ISLNK(st.st_mode):
- st = None
- try:
- os.unlink(dest_path)
- except OSError:
- if os.path.exists(dest_path):
- raise
-
- if st is not None:
- # For invalid packages, other_cat could be None.
- other_cat = portage.xpak.tbz2(dest_path).getfile(b"CATEGORY")
- if other_cat:
- other_cat = _unicode_decode(other_cat,
- encoding=_encodings['repo.content'], errors='replace')
- other_cat = other_cat.strip()
- other_cpv = other_cat + "/" + mypkg
- self._move_from_all(other_cpv)
- self.inject(other_cpv)
- self._move_to_all(cpv)
+ warnings.warn("The "
+ "portage.dbapi.bintree.binarytree.prevent_collision "
+ "method is deprecated.",
+ DeprecationWarning, stacklevel=2)
def _ensure_dir(self, path):
"""
@@ -589,37 +511,6 @@ class binarytree(object):
except PortageException:
pass
- def _move_to_all(self, cpv):
- """If the file exists, move it. Whether or not it exists, update state
- for future getname() calls."""
- mycat, mypkg = catsplit(cpv)
- myfile = mypkg + ".tbz2"
- self._pkg_paths[cpv] = os.path.join("All", myfile)
- src_path = os.path.join(self.pkgdir, mycat, myfile)
- try:
- mystat = os.lstat(src_path)
- except OSError as e:
- mystat = None
- if mystat and stat.S_ISREG(mystat.st_mode):
- self._ensure_dir(os.path.join(self.pkgdir, "All"))
- dest_path = os.path.join(self.pkgdir, "All", myfile)
- _movefile(src_path, dest_path, mysettings=self.settings)
- self._create_symlink(cpv)
- self.inject(cpv)
-
- def _move_from_all(self, cpv):
- """Move a package from ${PKGDIR}/All/${PF}.tbz2 to
- ${PKGDIR}/${CATEGORY}/${PF}.tbz2 and update state from getname calls."""
- self._remove_symlink(cpv)
- mycat, mypkg = catsplit(cpv)
- myfile = mypkg + ".tbz2"
- mypath = os.path.join(mycat, myfile)
- dest_path = os.path.join(self.pkgdir, mypath)
- self._ensure_dir(os.path.dirname(dest_path))
- src_path = os.path.join(self.pkgdir, "All", myfile)
- _movefile(src_path, dest_path, mysettings=self.settings)
- self._pkg_paths[cpv] = mypath
-
def populate(self, getbinpkgs=0):
"populates the binarytree"